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 classXdsResourceType.Args(package private) static classXdsResourceType.ParsedResource<T extends XdsClient.ResourceUpdate>static classXdsResourceType.ResourceInvalidExceptionstatic classXdsResourceType.StructOrError<T>(package private) static classXdsResourceType.ValidatedResourceUpdate<T extends XdsClient.ResourceUpdate>
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringHASH_POLICY_FILTER_STATE_KEYprotected static java.lang.StringTRANSPORT_SOCKET_NAME_TLSprotected static java.lang.StringTYPE_URL_CLUSTER_CONFIG(package private) static java.lang.StringTYPE_URL_RESOURCEprotected static java.lang.StringTYPE_URL_TYPED_STRUCTprotected static java.lang.StringTYPE_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 TdoParse(XdsResourceType.Args args, com.google.protobuf.Message unpackedMessage)protected java.lang.StringextractResourceName(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 booleanisFullStateOfTheWorld()(package private) XdsResourceType.ValidatedResourceUpdate<T>parse(XdsResourceType.Args args, java.util.List<com.google.protobuf.Any> resources)abstract booleanshouldRetrieveResourceKeysForArgs()abstract java.lang.StringtypeName()abstract java.lang.StringtypeUrl()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 serializedAnymessage, while replacing Type URLcompatibleTypeUrlwithtypeUrl.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.Resourcewhich then provides the name. This method is only called for the old approach.- Returns:
- the resource's name, or
nullif 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.InvalidProtocolBufferExceptionHelper method to unpack serializedAnymessage, while replacing Type URLcompatibleTypeUrlwithtypeUrl.- 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
-
-