Package com.linkedin.davinci.repository
Class NativeMetadataRepositoryViewAdapter
java.lang.Object
com.linkedin.davinci.repository.NativeMetadataRepositoryViewAdapter
- All Implemented Interfaces:
SubscribedViewStoreProvider
,ClusterInfoProvider
,ReadOnlySchemaRepository
,ReadOnlyStoreRepository
,SubscriptionBasedReadOnlyStoreRepository
,VeniceResource
public class NativeMetadataRepositoryViewAdapter
extends Object
implements SubscriptionBasedReadOnlyStoreRepository, ReadOnlySchemaRepository, ClusterInfoProvider, SubscribedViewStoreProvider
Adapter that provides read only interface to access store, schema and cluster info using the underlying
NativeMetadataRepository
for both regular Venice stores and Venice view stores. Intended for client
libraries like DaVinci and CC clients which need to consume and materialize store views.-
Constructor Summary
ConstructorsConstructorDescriptionNativeMetadataRepositoryViewAdapter
(NativeMetadataRepository nativeMetadataRepository) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
This method will only return all the subscribed Venice stores and not include the view stores for the following reasons: 1.int
getBatchGetLimit
(String storeName) Get batch-get limit for the specified storegetDerivedSchema
(String storeName, int valueSchemaId, int writeComputeSchemaId) 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) Get one store by given name from repository.getStoreOrThrow
(String storeName) getSubscribedViewStores
(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.long
Get total read quota of all stores.getValueSchema
(String storeName, int id) Get value schema for the given store and value schema id.int
getValueSchemaId
(String storeName, String valueSchemaStr) Return the schema ID of any schema for the store that has the same parsing canonical form as the schema provided.getValueSchemas
(String storeName) Get all the value schemas for the given store.getVeniceCluster
(String storeName) Get the associated Venice cluster name given a Venice store name.boolean
Whether the store exists or not.boolean
hasValueSchema
(String storeName, int id) Check whether the specified schema id is valid or notboolean
isReadComputationEnabled
(String storeName) Whether computation is enabled for the specified store.void
refresh()
refreshOneStore
(String storeName) Selective refresh operation which fetches one store from ZKvoid
Register store data change listener.void
void
Unregister store data change listener.void
unsubscribe
(String storeName) 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.meta.ReadOnlySchemaRepository
getLatestDerivedSchema
Methods inherited from interface com.linkedin.venice.meta.ReadOnlyStoreRepository
waitVersion, waitVersion
-
Constructor Details
-
NativeMetadataRepositoryViewAdapter
-
-
Method Details
-
refresh
public void refresh()- Specified by:
refresh
in interfaceVeniceResource
-
clear
public void clear()- Specified by:
clear
in interfaceVeniceResource
-
getVeniceCluster
Description copied from interface:ClusterInfoProvider
Get the associated Venice cluster name given a Venice store name.- Specified by:
getVeniceCluster
in interfaceClusterInfoProvider
- Returns:
- the cluster name that the store belongs to or null if such information cannot be provided.
-
getKeySchema
Description copied from interface:ReadOnlySchemaRepository
Get key schema for the given store.- Specified by:
getKeySchema
in interfaceReadOnlySchemaRepository
-
getValueSchema
Description copied from interface:ReadOnlySchemaRepository
Get value schema for the given store and value schema id.- Specified by:
getValueSchema
in interfaceReadOnlySchemaRepository
-
hasValueSchema
Description copied from interface:ReadOnlySchemaRepository
Check whether the specified schema id is valid or not- Specified by:
hasValueSchema
in interfaceReadOnlySchemaRepository
-
getValueSchemaId
Description copied from interface:ReadOnlySchemaRepository
Return the schema ID of any schema for the store that has the same parsing canonical form as the schema provided.- Specified by:
getValueSchemaId
in interfaceReadOnlySchemaRepository
-
getValueSchemas
Description copied from interface:ReadOnlySchemaRepository
Get all the value schemas for the given store.- Specified by:
getValueSchemas
in interfaceReadOnlySchemaRepository
-
getSupersetOrLatestValueSchema
Description copied from interface:ReadOnlySchemaRepository
Get the most recent value schema or superset value schema if one exists.- Specified by:
getSupersetOrLatestValueSchema
in interfaceReadOnlySchemaRepository
-
getSupersetSchema
Description copied from interface:ReadOnlySchemaRepository
Get 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:
getSupersetSchema
in interfaceReadOnlySchemaRepository
- Returns:
- Superset value schema or
null
if store does not have any superset value schema.
-
getDerivedSchemaId
Description copied from interface:ReadOnlySchemaRepository
Look 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:
getDerivedSchemaId
in 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 writeComputeSchemaId) - Specified by:
getDerivedSchema
in interfaceReadOnlySchemaRepository
-
getDerivedSchemas
- Specified by:
getDerivedSchemas
in interfaceReadOnlySchemaRepository
-
getLatestDerivedSchema
Description copied from interface:ReadOnlySchemaRepository
Get the most recent derived schema added to the given store and value schema id- Specified by:
getLatestDerivedSchema
in interfaceReadOnlySchemaRepository
-
getReplicationMetadataSchema
public RmdSchemaEntry getReplicationMetadataSchema(String storeName, int valueSchemaId, int replicationMetadataVersionId) - Specified by:
getReplicationMetadataSchema
in interfaceReadOnlySchemaRepository
-
getReplicationMetadataSchemas
- Specified by:
getReplicationMetadataSchemas
in interfaceReadOnlySchemaRepository
-
getStore
Description copied from interface:ReadOnlyStoreRepository
Get one store by given name from repository.- Specified by:
getStore
in interfaceReadOnlyStoreRepository
- Parameters:
storeName
- name of wanted store.- Returns:
- Store for given name.
-
getStoreOrThrow
- Specified by:
getStoreOrThrow
in interfaceReadOnlyStoreRepository
- Throws:
VeniceNoStoreException
-
hasStore
Description copied from interface:ReadOnlyStoreRepository
Whether the store exists or not.- Specified by:
hasStore
in interfaceReadOnlyStoreRepository
- Parameters:
storeName
- store name- Returns:
-
refreshOneStore
Description copied from interface:ReadOnlyStoreRepository
Selective refresh operation which fetches one store from ZK- Specified by:
refreshOneStore
in interfaceReadOnlyStoreRepository
- Parameters:
storeName
- store name- Returns:
- the newly refreshed store
-
getAllStores
This method will only return all the subscribed Venice stores and not include the view stores for the following reasons: 1. Currently, there is no usage of get all view stores. 2. The purpose of this adapter is to allow consumers to work with view stores without having to leak view store specific logic everywhere. If the repository included view stores in getAllStores() then callers will need to understand and differentiate view stores in order to avoid unexpected behaviors.- Specified by:
getAllStores
in interfaceReadOnlyStoreRepository
- Returns:
-
getTotalStoreReadQuota
public long getTotalStoreReadQuota()Description copied from interface:ReadOnlyStoreRepository
Get total read quota of all stores.- Specified by:
getTotalStoreReadQuota
in interfaceReadOnlyStoreRepository
-
registerStoreDataChangedListener
Description copied from interface:ReadOnlyStoreRepository
Register store data change listener.- Specified by:
registerStoreDataChangedListener
in interfaceReadOnlyStoreRepository
-
unregisterStoreDataChangedListener
Description copied from interface:ReadOnlyStoreRepository
Unregister store data change listener.- Specified by:
unregisterStoreDataChangedListener
in interfaceReadOnlyStoreRepository
-
getBatchGetLimit
Description copied from interface:ReadOnlyStoreRepository
Get batch-get limit for the specified store- Specified by:
getBatchGetLimit
in interfaceReadOnlyStoreRepository
- Returns:
-
isReadComputationEnabled
Description copied from interface:ReadOnlyStoreRepository
Whether computation is enabled for the specified store.- Specified by:
isReadComputationEnabled
in interfaceReadOnlyStoreRepository
- Parameters:
storeName
- store name- Returns:
-
subscribe
- Specified by:
subscribe
in interfaceSubscriptionBasedReadOnlyStoreRepository
- Throws:
InterruptedException
-
unsubscribe
- Specified by:
unsubscribe
in interfaceSubscriptionBasedReadOnlyStoreRepository
-
getSubscribedViewStores
- Specified by:
getSubscribedViewStores
in interfaceSubscribedViewStoreProvider
- Parameters:
storeName
- of the Venice store.- Returns:
- a set of subscribed view store names associated with the provided Venice store.
-