Class RouterBasedStoreSchemaFetcher

  • All Implemented Interfaces:
    StoreSchemaFetcher, java.io.Closeable, java.lang.AutoCloseable

    public class RouterBasedStoreSchemaFetcher
    extends java.lang.Object
    implements StoreSchemaFetcher
    Router based implementation of StoreSchemaFetcher. It supports schema look up for key schema, the latest value schema and latest update schema of a provided value schema version. Notice that this class does not contain any caching of schema so each API invocation will send a new request to Venice Router to fetch the desired store schema.
    • Field Detail

      • TYPE_VALUE_SCHEMA

        public static final java.lang.String TYPE_VALUE_SCHEMA
        See Also:
        Constant Field Values
      • TYPE_GET_UPDATE_SCHEMA

        public static final java.lang.String TYPE_GET_UPDATE_SCHEMA
        See Also:
        Constant Field Values
      • TYPE_LATEST_VALUE_SCHEMA

        public static final java.lang.String TYPE_LATEST_VALUE_SCHEMA
        See Also:
        Constant Field Values
    • Method Detail

      • getLatestValueSchema

        public org.apache.avro.Schema getLatestValueSchema()
        Description copied from interface: StoreSchemaFetcher
        Returns the latest available Value schema of the store. The latest superset schema is: 1. If a superset schema exists for the store, return the superset schema 2. If no superset schema exists for the store, return the value schema with the largest schema id
        Specified by:
        getLatestValueSchema in interface StoreSchemaFetcher
      • getAllValueSchemasWithId

        public java.util.Map<java.lang.Integer,​org.apache.avro.Schema> getAllValueSchemasWithId()
        Description copied from interface: StoreSchemaFetcher
        Returns all value schemas of the store as a map with schema id as the key.
        Specified by:
        getAllValueSchemasWithId in interface StoreSchemaFetcher
      • getUpdateSchema

        public org.apache.avro.Schema getUpdateSchema​(org.apache.avro.Schema valueSchema)
                                               throws VeniceException
        Description copied from interface: StoreSchemaFetcher
        Returns the Update (Write Compute) schema of the provided Value schema. The returned schema is used to construct a GenericRecord that partially updates a record value that is associated with this value schema. This method is expected to throw InvalidVeniceSchemaException when the provided value schema could not be found in the Venice backend. For other unexpected errors like store is not write-compute enabled or corresponding update schema is not found in the Venice backend, this method will throw general VeniceException with corresponding error message.
        Specified by:
        getUpdateSchema in interface StoreSchemaFetcher
        Throws:
        VeniceException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException