Interface StoreSchemaFetcher
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
- All Known Implementing Classes:
RouterBasedStoreSchemaFetcher
public interface StoreSchemaFetcher extends java.io.Closeable
This class is the public interface for Venice store user to fetch store schemas. It is intended to replace the old schema fetching APIs inAvroGenericStoreClient
. It is expected that each instance of this class is associated with a single Venice store and user can use it to fetch the Venice store schemas for their logics.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.util.Set<org.apache.avro.Schema>
getAllValueSchemas()
Returns all value schemas of the store.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.Schema
getKeySchema()
Returns Key schema of the store.org.apache.avro.Schema
getLatestValueSchema()
Returns the latest available Value schema of the store.SchemaEntry
getLatestValueSchemaEntry()
java.lang.String
getStoreName()
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.DerivedSchemaEntry
getUpdateSchemaEntry(int valueSchemaId)
Get the latest derived schema of a value schema.
-
-
-
Method Detail
-
getKeySchema
org.apache.avro.Schema getKeySchema()
Returns Key schema of the store.
-
getLatestValueSchema
org.apache.avro.Schema getLatestValueSchema()
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
-
getAllValueSchemas
default java.util.Set<org.apache.avro.Schema> getAllValueSchemas()
Returns all value schemas of the store.
-
getAllValueSchemasWithId
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.
-
getUpdateSchema
org.apache.avro.Schema getUpdateSchema(org.apache.avro.Schema valueSchema) throws VeniceException
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.- Throws:
VeniceException
-
getStoreName
java.lang.String getStoreName()
Returns the Venice store name this class is associated with.
-
getLatestValueSchemaEntry
SchemaEntry getLatestValueSchemaEntry()
-
getUpdateSchemaEntry
DerivedSchemaEntry getUpdateSchemaEntry(int valueSchemaId)
Get the latest derived schema of a value schema. Return the derived schema inDerivedSchemaEntry
format, which contains Schema and protocol ID.
-
-