Class RouterBackedSchemaReader
- java.lang.Object
-
- com.linkedin.venice.client.schema.RouterBackedSchemaReader
-
- All Implemented Interfaces:
SchemaReader
,java.io.Closeable
,java.lang.AutoCloseable
public class RouterBackedSchemaReader extends java.lang.Object implements SchemaReader
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
TYPE_ALL_VALUE_SCHEMA_IDS
static java.lang.String
TYPE_KEY_SCHEMA
static java.lang.String
TYPE_UPDATE_SCHEMA
static java.lang.String
TYPE_VALUE_SCHEMA
-
Constructor Summary
Constructors Constructor Description RouterBackedSchemaReader(InternalAvroStoreClient storeClient, java.util.Optional<org.apache.avro.Schema> readerSchema, java.util.Optional<java.util.function.Predicate<org.apache.avro.Schema>> preferredSchemaFilter, java.time.Duration valueSchemaRefreshPeriod, ICProvider icProvider)
RouterBackedSchemaReader(java.util.function.Supplier<InternalAvroStoreClient> clientSupplier, java.util.Optional<org.apache.avro.Schema> readerSchema, java.util.Optional<java.util.function.Predicate<org.apache.avro.Schema>> preferredSchemaFilter)
RouterBackedSchemaReader(java.util.function.Supplier<InternalAvroStoreClient> clientSupplier, java.util.Optional<org.apache.avro.Schema> readerSchema, java.util.Optional<java.util.function.Predicate<org.apache.avro.Schema>> preferredSchemaFilter, ICProvider icProvider)
RouterBackedSchemaReader(java.util.function.Supplier<InternalAvroStoreClient> clientSupplier, java.util.Optional<org.apache.avro.Schema> readerSchema, java.util.Optional<java.util.function.Predicate<org.apache.avro.Schema>> preferredSchemaFilter, java.time.Duration valueSchemaRefreshPeriod)
RouterBackedSchemaReader(java.util.function.Supplier<InternalAvroStoreClient> clientSupplier, java.util.Optional<org.apache.avro.Schema> readerSchema, java.util.Optional<java.util.function.Predicate<org.apache.avro.Schema>> preferredSchemaFilter, java.time.Duration valueSchemaRefreshPeriod, ICProvider icProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
org.apache.avro.Schema
getKeySchema()
DerivedSchemaEntry
getLatestUpdateSchema()
org.apache.avro.Schema
getLatestValueSchema()
java.lang.Integer
getLatestValueSchemaId()
Get the latest value schema id.org.apache.avro.Schema
getUpdateSchema(int valueSchemaId)
org.apache.avro.Schema
getValueSchema(int id)
int
getValueSchemaId(org.apache.avro.Schema schema)
Return the schema ID of any schema that has the same parsing canonical form as the schema provided.
-
-
-
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_ALL_VALUE_SCHEMA_IDS
public static final java.lang.String TYPE_ALL_VALUE_SCHEMA_IDS
- See Also:
- Constant Field Values
-
TYPE_UPDATE_SCHEMA
public static final java.lang.String TYPE_UPDATE_SCHEMA
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RouterBackedSchemaReader
public RouterBackedSchemaReader(java.util.function.Supplier<InternalAvroStoreClient> clientSupplier, java.util.Optional<org.apache.avro.Schema> readerSchema, java.util.Optional<java.util.function.Predicate<org.apache.avro.Schema>> preferredSchemaFilter)
-
RouterBackedSchemaReader
public RouterBackedSchemaReader(java.util.function.Supplier<InternalAvroStoreClient> clientSupplier, java.util.Optional<org.apache.avro.Schema> readerSchema, java.util.Optional<java.util.function.Predicate<org.apache.avro.Schema>> preferredSchemaFilter, ICProvider icProvider)
-
RouterBackedSchemaReader
public RouterBackedSchemaReader(java.util.function.Supplier<InternalAvroStoreClient> clientSupplier, java.util.Optional<org.apache.avro.Schema> readerSchema, java.util.Optional<java.util.function.Predicate<org.apache.avro.Schema>> preferredSchemaFilter, java.time.Duration valueSchemaRefreshPeriod)
-
RouterBackedSchemaReader
public RouterBackedSchemaReader(java.util.function.Supplier<InternalAvroStoreClient> clientSupplier, java.util.Optional<org.apache.avro.Schema> readerSchema, java.util.Optional<java.util.function.Predicate<org.apache.avro.Schema>> preferredSchemaFilter, java.time.Duration valueSchemaRefreshPeriod, ICProvider icProvider)
-
RouterBackedSchemaReader
public RouterBackedSchemaReader(InternalAvroStoreClient storeClient, java.util.Optional<org.apache.avro.Schema> readerSchema, java.util.Optional<java.util.function.Predicate<org.apache.avro.Schema>> preferredSchemaFilter, java.time.Duration valueSchemaRefreshPeriod, ICProvider icProvider)
-
-
Method Detail
-
getKeySchema
public org.apache.avro.Schema getKeySchema()
- Specified by:
getKeySchema
in interfaceSchemaReader
-
getValueSchema
public org.apache.avro.Schema getValueSchema(int id)
- Specified by:
getValueSchema
in interfaceSchemaReader
-
getLatestValueSchema
public org.apache.avro.Schema getLatestValueSchema() throws VeniceClientException
- Specified by:
getLatestValueSchema
in interfaceSchemaReader
- Throws:
VeniceClientException
-
getLatestValueSchemaId
public java.lang.Integer getLatestValueSchemaId() throws VeniceClientException
Description copied from interface:SchemaReader
Get the latest value schema id. This may be different from the value schema with the largest id if the superset schema is not the value schema with the largest id- Specified by:
getLatestValueSchemaId
in interfaceSchemaReader
- Throws:
VeniceClientException
-
getValueSchemaId
public int getValueSchemaId(org.apache.avro.Schema schema)
Description copied from interface:SchemaReader
Return the schema ID of any schema that has the same parsing canonical form as the schema provided.- Specified by:
getValueSchemaId
in interfaceSchemaReader
- Parameters:
schema
- The schema for which the schema ID is needed- Returns:
- The ID of the schema that has the same parsing canonical form as the schema provided
-
getUpdateSchema
public org.apache.avro.Schema getUpdateSchema(int valueSchemaId)
- Specified by:
getUpdateSchema
in interfaceSchemaReader
-
getLatestUpdateSchema
public DerivedSchemaEntry getLatestUpdateSchema()
- Specified by:
getLatestUpdateSchema
in interfaceSchemaReader
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-