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
  • Field Details

  • Constructor Details

    • XdsResourceType

      public XdsResourceType()
  • Method Details

    • extractResourceName

      @Nullable 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. The newer approach has resources wrapped with envoy.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 Class<? extends com.google.protobuf.Message> unpackedClassName()
    • typeName

      public abstract String typeName()
    • typeUrl

      public abstract String 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
      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 serialized Any message, while replacing Type URL compatibleTypeUrl with typeUrl.
      Type Parameters:
      T - The type of unpacked message
      Parameters:
      any - serialized message to unpack
      clazz - the class to unpack the message to
      typeUrl - type URL to replace message Type URL, when it's compatible
      compatibleTypeUrl - compatible Type URL to be replaced with typeUrl
      Returns:
      Unpacked message
      Throws:
      com.google.protobuf.InvalidProtocolBufferException - if the message couldn't be unpacked