Class RouterBasedStoreSchemaFetcher
java.lang.Object
com.linkedin.venice.client.schema.RouterBasedStoreSchemaFetcher
- All Implemented Interfaces:
StoreSchemaFetcher
,Closeable
,AutoCloseable
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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Returns all value schemas of the store as a map with schema id as the key.org.apache.avro.Schema
Returns Key schema of the store.org.apache.avro.Schema
Returns the latest available Value schema of the store.Returns the Venice store name this class is associated with.org.apache.avro.Schema
getUpdateSchema
(org.apache.avro.Schema valueSchema) Returns the Update (Write Compute) schema of the provided Value schema.getUpdateSchemaEntry
(int valueSchemaId) Get the latest derived schema of a value schema.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.linkedin.venice.client.schema.StoreSchemaFetcher
getAllValueSchemas
-
Field Details
-
TYPE_KEY_SCHEMA
- See Also:
-
TYPE_VALUE_SCHEMA
- See Also:
-
TYPE_GET_UPDATE_SCHEMA
- See Also:
-
TYPE_LATEST_VALUE_SCHEMA
- See Also:
-
-
Constructor Details
-
RouterBasedStoreSchemaFetcher
-
-
Method Details
-
getKeySchema
public org.apache.avro.Schema getKeySchema()Description copied from interface:StoreSchemaFetcher
Returns Key schema of the store.- Specified by:
getKeySchema
in interfaceStoreSchemaFetcher
-
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 interfaceStoreSchemaFetcher
-
getLatestValueSchemaEntry
- Specified by:
getLatestValueSchemaEntry
in interfaceStoreSchemaFetcher
-
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 interfaceStoreSchemaFetcher
-
getUpdateSchemaEntry
Description copied from interface:StoreSchemaFetcher
Get the latest derived schema of a value schema. Return the derived schema inDerivedSchemaEntry
format, which contains Schema and protocol ID.- Specified by:
getUpdateSchemaEntry
in interfaceStoreSchemaFetcher
-
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 aGenericRecord
that partially updates a record value that is associated with this value schema. This method is expected to throwInvalidVeniceSchemaException
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 generalVeniceException
with corresponding error message.- Specified by:
getUpdateSchema
in interfaceStoreSchemaFetcher
- Throws:
VeniceException
-
getStoreName
Description copied from interface:StoreSchemaFetcher
Returns the Venice store name this class is associated with.- Specified by:
getStoreName
in interfaceStoreSchemaFetcher
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-