Package com.linkedin.venice.helix
Class HelixReadWriteSchemaRepositoryAdapter
java.lang.Object
com.linkedin.venice.helix.HelixReadWriteSchemaRepositoryAdapter
- All Implemented Interfaces:
ReadOnlySchemaRepository,ReadWriteSchemaRepository,VeniceResource
public class HelixReadWriteSchemaRepositoryAdapter
extends Object
implements ReadWriteSchemaRepository
This repository supports the following operations:
1. For the regular stores, read/write operations are supported as
HelixReadWriteSchemaRepository.
2. For system stores, only read operations are supported via HelixReadOnlyZKSharedSchemaRepository,
and if you want to update the schemas for system stores, you will need to update the corresponding
zk shared store instead.-
Constructor Summary
ConstructorsConstructorDescriptionHelixReadWriteSchemaRepositoryAdapter(HelixReadOnlyZKSharedSchemaRepository readOnlyZKSharedSchemaRepository, ReadWriteSchemaRepository readWriteRegularStoreSchemaRepository) -
Method Summary
Modifier and TypeMethodDescriptionaddDerivedSchema(String storeName, String schemaStr, int valueSchemaId) Add a new derived schema for the given store and value schema idaddDerivedSchema(String storeName, String schemaStr, int valueSchemaId, int derivedSchemaId) Add a new derived schema for the given store by specifying derived schema id.addReplicationMetadataSchema(String storeName, int valueSchemaId, String replicationMetadataSchemaStr, int replicationMetadataVersionId) addValueSchema(String storeName, String schemaStr, int schemaId) Add a new value schema for the given store by specifying schema id.addValueSchema(String storeName, String schemaStr, DirectionalSchemaCompatibilityType expectedCompatibilityType) Add a new value schema for the given storevoidclear()getDerivedSchema(String storeName, int valueSchemaId, int derivedSchemaId) getDerivedSchemaId(String storeName, String derivedSchemaStr) Look up derived schema id and its corresponding value schema id by given store name and derived schema.getDerivedSchemas(String storeName) getKeySchema(String storeName) Get key schema for the given store.getLatestDerivedSchema(String storeName, int valueSchemaId) Get the most recent derived schema added to the given store and value schema idgetReplicationMetadataSchema(String storeName, int valueSchemaId, int replicationMetadataVersionId) getReplicationMetadataSchemas(String storeName) getSupersetOrLatestValueSchema(String storeName) Get the most recent value schema or superset value schema if one exists.getSupersetSchema(String storeName) Get the superset value schema for a given store.getValueSchema(String storeName, int id) Get value schema for the given store and value schema id.intgetValueSchemaId(String storeName, String valueSchemaStr) Return the schema ID of any schema that has the same parsing canonical form as the schema provided.getValueSchemas(String storeName) Get all the value schemas for the given store.booleanhasValueSchema(String storeName, int id) Check whether the specified schema id is valid or notinitKeySchema(String storeName, String schemaStr) Set up key schema for the given storeintpreCheckDerivedSchemaAndGetNextAvailableId(String storeName, int valueSchemaId, String derivedSchemaStr) intpreCheckValueSchemaAndGetNextAvailableId(String storeName, String valueSchemaStr, DirectionalSchemaCompatibilityType expectedCompatibilityType) voidrefresh()removeDerivedSchema(String storeName, int valueSchemaId, int derivedSchemaId) Remove an existing derived schemavoidremoveValueSchema(String storeName, int schemaID) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.linkedin.venice.meta.ReadOnlySchemaRepository
getLatestDerivedSchemaMethods inherited from interface com.linkedin.venice.meta.ReadWriteSchemaRepository
addValueSchema
-
Constructor Details
-
Method Details
-
initKeySchema
Description copied from interface:ReadWriteSchemaRepositorySet up key schema for the given store- Specified by:
initKeySchemain interfaceReadWriteSchemaRepository
-
addValueSchema
public SchemaEntry addValueSchema(String storeName, String schemaStr, DirectionalSchemaCompatibilityType expectedCompatibilityType) Description copied from interface:ReadWriteSchemaRepositoryAdd a new value schema for the given store- Specified by:
addValueSchemain interfaceReadWriteSchemaRepository
-
addValueSchema
Description copied from interface:ReadWriteSchemaRepositoryAdd a new value schema for the given store by specifying schema id. This API is mostly intended to be used in cross-colo mode. When there are multiple colos, we'd like to have consistent value id across colos, so that deserializer can work properly while reading records. Caller should figure out the schema id number by themselves. TODO: Might want to remove it from the interface and make it invisible from the outside- Specified by:
addValueSchemain interfaceReadWriteSchemaRepository
-
addDerivedSchema
Description copied from interface:ReadWriteSchemaRepositoryAdd a new derived schema for the given store and value schema id- Specified by:
addDerivedSchemain interfaceReadWriteSchemaRepository
-
addDerivedSchema
public DerivedSchemaEntry addDerivedSchema(String storeName, String schemaStr, int valueSchemaId, int derivedSchemaId) Description copied from interface:ReadWriteSchemaRepositoryAdd a new derived schema for the given store by specifying derived schema id. Mostly used in cross-colo mode.- Specified by:
addDerivedSchemain interfaceReadWriteSchemaRepository
-
removeDerivedSchema
public DerivedSchemaEntry removeDerivedSchema(String storeName, int valueSchemaId, int derivedSchemaId) Description copied from interface:ReadWriteSchemaRepositoryRemove an existing derived schema- Specified by:
removeDerivedSchemain interfaceReadWriteSchemaRepository- Returns:
- the derived schema that is deleted or null if the schema doesn't exist
-
preCheckValueSchemaAndGetNextAvailableId
public int preCheckValueSchemaAndGetNextAvailableId(String storeName, String valueSchemaStr, DirectionalSchemaCompatibilityType expectedCompatibilityType) - Specified by:
preCheckValueSchemaAndGetNextAvailableIdin interfaceReadWriteSchemaRepository
-
preCheckDerivedSchemaAndGetNextAvailableId
public int preCheckDerivedSchemaAndGetNextAvailableId(String storeName, int valueSchemaId, String derivedSchemaStr) - Specified by:
preCheckDerivedSchemaAndGetNextAvailableIdin interfaceReadWriteSchemaRepository
-
getKeySchema
Description copied from interface:ReadOnlySchemaRepositoryGet key schema for the given store.- Specified by:
getKeySchemain interfaceReadOnlySchemaRepository
-
getValueSchema
Description copied from interface:ReadOnlySchemaRepositoryGet value schema for the given store and value schema id.- Specified by:
getValueSchemain interfaceReadOnlySchemaRepository
-
hasValueSchema
Description copied from interface:ReadOnlySchemaRepositoryCheck whether the specified schema id is valid or not- Specified by:
hasValueSchemain interfaceReadOnlySchemaRepository
-
getValueSchemaId
Description copied from interface:ReadOnlySchemaRepositoryReturn the schema ID of any schema that has the same parsing canonical form as the schema provided. If multiple schemas have the same parsing canonical form, return the one with the largest ID.- Specified by:
getValueSchemaIdin interfaceReadOnlySchemaRepository
-
getValueSchemas
Description copied from interface:ReadOnlySchemaRepositoryGet all the value schemas for the given store.- Specified by:
getValueSchemasin interfaceReadOnlySchemaRepository
-
removeValueSchema
- Specified by:
removeValueSchemain interfaceReadWriteSchemaRepository
-
getSupersetOrLatestValueSchema
Description copied from interface:ReadOnlySchemaRepositoryGet the most recent value schema or superset value schema if one exists.- Specified by:
getSupersetOrLatestValueSchemain interfaceReadOnlySchemaRepository
-
getSupersetSchema
Description copied from interface:ReadOnlySchemaRepositoryGet the superset value schema for a given store. Each store has at most one active superset schema. Specifically a store must have some features enabled (e.g. read compute, write compute) to have a superset value schema which evolves as new value schemas are added.- Specified by:
getSupersetSchemain interfaceReadOnlySchemaRepository- Returns:
- Superset value schema or
nullif store does not have any superset value schema.
-
getDerivedSchemaId
Description copied from interface:ReadOnlySchemaRepositoryLook up derived schema id and its corresponding value schema id by given store name and derived schema. This is likely used by clients that write to Venice- Specified by:
getDerivedSchemaIdin interfaceReadOnlySchemaRepository- Returns:
- a pair where the first value is value schema id and the second value is derived schema id
-
getDerivedSchema
public DerivedSchemaEntry getDerivedSchema(String storeName, int valueSchemaId, int derivedSchemaId) - Specified by:
getDerivedSchemain interfaceReadOnlySchemaRepository
-
getDerivedSchemas
- Specified by:
getDerivedSchemasin interfaceReadOnlySchemaRepository
-
getLatestDerivedSchema
Description copied from interface:ReadOnlySchemaRepositoryGet the most recent derived schema added to the given store and value schema id- Specified by:
getLatestDerivedSchemain interfaceReadOnlySchemaRepository
-
addReplicationMetadataSchema
public RmdSchemaEntry addReplicationMetadataSchema(String storeName, int valueSchemaId, String replicationMetadataSchemaStr, int replicationMetadataVersionId) - Specified by:
addReplicationMetadataSchemain interfaceReadWriteSchemaRepository
-
getReplicationMetadataSchema
public RmdSchemaEntry getReplicationMetadataSchema(String storeName, int valueSchemaId, int replicationMetadataVersionId) - Specified by:
getReplicationMetadataSchemain interfaceReadOnlySchemaRepository
-
getReplicationMetadataSchemas
- Specified by:
getReplicationMetadataSchemasin interfaceReadOnlySchemaRepository
-
refresh
public void refresh()- Specified by:
refreshin interfaceVeniceResource
-
clear
public void clear()- Specified by:
clearin interfaceVeniceResource
-
getReadWriteRegularStoreSchemaRepository
-