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 Object
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
(package private) static final class
static final class
static final class
(package private) static final class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract T
doParse
(XdsResourceType.Args args, com.google.protobuf.Message unpackedMessage) protected 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
(package private) XdsResourceType.ValidatedResourceUpdate
<T> parse
(XdsResourceType.Args args, List<com.google.protobuf.Any> resources) abstract boolean
abstract String
typeName()
abstract String
typeUrl()
protected static <T extends com.google.protobuf.Message>
TunpackCompatibleType
(com.google.protobuf.Any any, Class<T> clazz, String typeUrl, String compatibleTypeUrl) Helper method to unpack serializedAny
message, while replacing Type URLcompatibleTypeUrl
withtypeUrl
.protected abstract Class
<? extends com.google.protobuf.Message>
-
Field Details
-
TYPE_URL_RESOURCE
- See Also:
-
TRANSPORT_SOCKET_NAME_TLS
- See Also:
-
HASH_POLICY_FILTER_STATE_KEY
- See Also:
-
TYPE_URL_CLUSTER_CONFIG
- See Also:
-
TYPE_URL_TYPED_STRUCT_UDPA
- See Also:
-
TYPE_URL_TYPED_STRUCT
- See Also:
-
-
Constructor Details
-
XdsResourceType
public XdsResourceType()
-
-
Method Details
-
extractResourceName
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
-
typeName
-
typeUrl
-
shouldRetrieveResourceKeysForArgs
public abstract boolean shouldRetrieveResourceKeysForArgs() -
isFullStateOfTheWorld
protected abstract boolean isFullStateOfTheWorld() -
parse
XdsResourceType.ValidatedResourceUpdate<T> parse(XdsResourceType.Args args, 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, Class<T> clazz, String typeUrl, 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
-