Package io.grpc.xds.client
Class XdsResourceType<T extends XdsClient.ResourceUpdate>
- java.lang.Object
-
- io.grpc.xds.client.XdsResourceType<T>
-
- Direct Known Subclasses:
XdsClusterResource
,XdsEndpointResource
,XdsListenerResource
,XdsRouteConfigureResource
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/10847") public abstract class XdsResourceType<T extends XdsClient.ResourceUpdate> extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XdsResourceType.Args
(package private) static class
XdsResourceType.ParsedResource<T extends XdsClient.ResourceUpdate>
static class
XdsResourceType.ResourceInvalidException
static class
XdsResourceType.StructOrError<T>
(package private) static class
XdsResourceType.ValidatedResourceUpdate<T extends XdsClient.ResourceUpdate>
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
HASH_POLICY_FILTER_STATE_KEY
protected static java.lang.String
TRANSPORT_SOCKET_NAME_TLS
protected static java.lang.String
TYPE_URL_CLUSTER_CONFIG
(package private) static java.lang.String
TYPE_URL_RESOURCE
protected static java.lang.String
TYPE_URL_TYPED_STRUCT
protected static java.lang.String
TYPE_URL_TYPED_STRUCT_UDPA
-
Constructor Summary
Constructors Constructor Description XdsResourceType()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract T
doParse(XdsResourceType.Args args, com.google.protobuf.Message unpackedMessage)
protected java.lang.String
extractResourceName(com.google.protobuf.Message unpackedResource)
Extract the resource name from an older resource type that included the name within the resource contents itself.protected abstract boolean
isFullStateOfTheWorld()
(package private) XdsResourceType.ValidatedResourceUpdate<T>
parse(XdsResourceType.Args args, java.util.List<com.google.protobuf.Any> resources)
abstract boolean
shouldRetrieveResourceKeysForArgs()
abstract java.lang.String
typeName()
abstract java.lang.String
typeUrl()
protected static <T extends com.google.protobuf.Message>
TunpackCompatibleType(com.google.protobuf.Any any, java.lang.Class<T> clazz, java.lang.String typeUrl, java.lang.String compatibleTypeUrl)
Helper method to unpack serializedAny
message, while replacing Type URLcompatibleTypeUrl
withtypeUrl
.protected abstract java.lang.Class<? extends com.google.protobuf.Message>
unpackedClassName()
-
-
-
Field Detail
-
TYPE_URL_RESOURCE
static final java.lang.String TYPE_URL_RESOURCE
- See Also:
- Constant Field Values
-
TRANSPORT_SOCKET_NAME_TLS
protected static final java.lang.String TRANSPORT_SOCKET_NAME_TLS
- See Also:
- Constant Field Values
-
HASH_POLICY_FILTER_STATE_KEY
public static final java.lang.String HASH_POLICY_FILTER_STATE_KEY
- See Also:
- Constant Field Values
-
TYPE_URL_CLUSTER_CONFIG
protected static final java.lang.String TYPE_URL_CLUSTER_CONFIG
- See Also:
- Constant Field Values
-
TYPE_URL_TYPED_STRUCT_UDPA
protected static final java.lang.String TYPE_URL_TYPED_STRUCT_UDPA
- See Also:
- Constant Field Values
-
TYPE_URL_TYPED_STRUCT
protected static final java.lang.String TYPE_URL_TYPED_STRUCT
- See Also:
- Constant Field Values
-
-
Method Detail
-
extractResourceName
@Nullable protected java.lang.String extractResourceName(com.google.protobuf.Message unpackedResource)
Extract the resource name from an older resource type that included the name within the resource contents itself. The newer approach has resources wrapped withenvoy.service.discovery.v3.Resource
which then provides the name. This method is only called for the old approach.- Returns:
- the resource's name, or
null
if name is not stored within the resource contents
-
unpackedClassName
protected abstract java.lang.Class<? extends com.google.protobuf.Message> unpackedClassName()
-
typeName
public abstract java.lang.String typeName()
-
typeUrl
public abstract java.lang.String typeUrl()
-
shouldRetrieveResourceKeysForArgs
public abstract boolean shouldRetrieveResourceKeysForArgs()
-
isFullStateOfTheWorld
protected abstract boolean isFullStateOfTheWorld()
-
parse
XdsResourceType.ValidatedResourceUpdate<T> parse(XdsResourceType.Args args, java.util.List<com.google.protobuf.Any> resources)
-
doParse
protected abstract T doParse(XdsResourceType.Args args, com.google.protobuf.Message unpackedMessage) throws XdsResourceType.ResourceInvalidException
-
unpackCompatibleType
protected static <T extends com.google.protobuf.Message> T unpackCompatibleType(com.google.protobuf.Any any, java.lang.Class<T> clazz, java.lang.String typeUrl, java.lang.String compatibleTypeUrl) throws com.google.protobuf.InvalidProtocolBufferException
Helper method to unpack serializedAny
message, while replacing Type URLcompatibleTypeUrl
withtypeUrl
.- Type Parameters:
T
- The type of unpacked message- Parameters:
any
- serialized message to unpackclazz
- the class to unpack the message totypeUrl
- type URL to replace message Type URL, when it's compatiblecompatibleTypeUrl
- compatible Type URL to be replaced withtypeUrl
- Returns:
- Unpacked message
- Throws:
com.google.protobuf.InvalidProtocolBufferException
- if the message couldn't be unpacked
-
-