Class RouterBasedStoreSchemaFetcher
- java.lang.Object
-
- com.linkedin.venice.client.schema.RouterBasedStoreSchemaFetcher
-
- All Implemented Interfaces:
StoreSchemaFetcher,java.io.Closeable,java.lang.AutoCloseable
public class RouterBasedStoreSchemaFetcher extends java.lang.Object implements StoreSchemaFetcher
Router based implementation ofStoreSchemaFetcher. 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
Fields Modifier and Type Field Description static java.lang.StringTYPE_GET_UPDATE_SCHEMAstatic java.lang.StringTYPE_KEY_SCHEMAstatic java.lang.StringTYPE_LATEST_VALUE_SCHEMAstatic java.lang.StringTYPE_VALUE_SCHEMA
-
Constructor Summary
Constructors Constructor Description RouterBasedStoreSchemaFetcher(AbstractAvroStoreClient client)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.util.Map<java.lang.Integer,org.apache.avro.Schema>getAllValueSchemasWithId()Returns all value schemas of the store as a map with schema id as the key.org.apache.avro.SchemagetKeySchema()Returns Key schema of the store.org.apache.avro.SchemagetLatestValueSchema()Returns the latest available Value schema of the store.SchemaEntrygetLatestValueSchemaEntry()java.lang.StringgetStoreName()Returns the Venice store name this class is associated with.org.apache.avro.SchemagetUpdateSchema(org.apache.avro.Schema valueSchema)Returns the Update (Write Compute) schema of the provided Value schema.DerivedSchemaEntrygetUpdateSchemaEntry(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 Detail
-
TYPE_KEY_SCHEMA
public static final java.lang.String TYPE_KEY_SCHEMA
- See Also:
- Constant Field Values
-
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
-
-
Constructor Detail
-
RouterBasedStoreSchemaFetcher
public RouterBasedStoreSchemaFetcher(AbstractAvroStoreClient client)
-
-
Method Detail
-
getKeySchema
public org.apache.avro.Schema getKeySchema()
Description copied from interface:StoreSchemaFetcherReturns Key schema of the store.- Specified by:
getKeySchemain interfaceStoreSchemaFetcher
-
getLatestValueSchema
public org.apache.avro.Schema getLatestValueSchema()
Description copied from interface:StoreSchemaFetcherReturns 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:
getLatestValueSchemain interfaceStoreSchemaFetcher
-
getLatestValueSchemaEntry
public SchemaEntry getLatestValueSchemaEntry()
- Specified by:
getLatestValueSchemaEntryin interfaceStoreSchemaFetcher
-
getAllValueSchemasWithId
public java.util.Map<java.lang.Integer,org.apache.avro.Schema> getAllValueSchemasWithId()
Description copied from interface:StoreSchemaFetcherReturns all value schemas of the store as a map with schema id as the key.- Specified by:
getAllValueSchemasWithIdin interfaceStoreSchemaFetcher
-
getUpdateSchemaEntry
public DerivedSchemaEntry getUpdateSchemaEntry(int valueSchemaId)
Description copied from interface:StoreSchemaFetcherGet the latest derived schema of a value schema. Return the derived schema inDerivedSchemaEntryformat, which contains Schema and protocol ID.- Specified by:
getUpdateSchemaEntryin interfaceStoreSchemaFetcher
-
getUpdateSchema
public org.apache.avro.Schema getUpdateSchema(org.apache.avro.Schema valueSchema) throws VeniceExceptionDescription copied from interface:StoreSchemaFetcherReturns the Update (Write Compute) schema of the provided Value schema. The returned schema is used to construct aGenericRecordthat partially updates a record value that is associated with this value schema. This method is expected to throwInvalidVeniceSchemaExceptionwhen 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 generalVeniceExceptionwith corresponding error message.- Specified by:
getUpdateSchemain interfaceStoreSchemaFetcher- Throws:
VeniceException
-
getStoreName
public java.lang.String getStoreName()
Description copied from interface:StoreSchemaFetcherReturns the Venice store name this class is associated with.- Specified by:
getStoreNamein interfaceStoreSchemaFetcher
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
-