Package com.linkedin.venice.helix
Class CachedReadOnlyStoreRepository
- java.lang.Object
-
- com.linkedin.venice.helix.CachedReadOnlyStoreRepository
-
- All Implemented Interfaces:
ReadOnlyStoreRepository
,VeniceResource
- Direct Known Subclasses:
HelixReadOnlyStoreRepository
,HelixReadWriteStoreRepository
public class CachedReadOnlyStoreRepository extends java.lang.Object implements ReadOnlyStoreRepository
-
-
Field Summary
Fields Modifier and Type Field Description protected ClusterLockManager
clusterLockManager
protected java.lang.String
clusterName
protected java.lang.String
clusterStoreRepositoryPath
static java.lang.String
STORE_REPOSITORY_PATH
protected java.util.Map<java.lang.String,Store>
storeMap
protected org.apache.helix.zookeeper.impl.client.ZkClient
zkClient
protected org.apache.helix.manager.zk.ZkBaseDataAccessor<Store>
zkDataAccessor
-
Constructor Summary
Constructors Constructor Description CachedReadOnlyStoreRepository(org.apache.helix.zookeeper.impl.client.ZkClient zkClient, java.lang.String clusterName, HelixAdapterSerializer compositeSerializer, ClusterLockManager clusterLockManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
java.util.List<Store>
getAllStores()
Get all stores in the current repositoryint
getBatchGetLimit(java.lang.String storeName)
Get batch-get limit for the specified storeStore
getStore(java.lang.String storeName)
Get one store by given name from repository.protected Store
getStoreFromZk(java.lang.String storeName)
Store
getStoreOrThrow(java.lang.String storeName)
protected java.util.List<Store>
getStoresFromZk()
HelixReadOnlyZKSharedSystemStoreRepository
is overriding this function to filter out stores, which are not necessary to put a watch against duringrefresh()
, and if this logic to refresh the zk store repository gets changed in the future, we need to updateHelixReadOnlyZKSharedSystemStoreRepository
accordingly.protected java.util.List<Store>
getStoresFromZk(java.util.Collection<java.lang.String> storeNames)
protected java.lang.String
getStoreZkPath(java.lang.String storeName)
long
getTotalStoreReadQuota()
Get total read quota of all stores.boolean
hasStore(java.lang.String storeName)
Whether the store exists or not.boolean
isReadComputationEnabled(java.lang.String storeName)
Whether computation is enabled for the specified store.protected void
notifyStoreChanged(Store store)
protected void
notifyStoreCreated(Store store)
protected void
notifyStoreDeleted(Store store)
protected Store
putStore(Store newStore)
void
refresh()
Store
refreshOneStore(java.lang.String storeName)
Selective refresh operation which fetches one store from ZKvoid
registerStoreDataChangedListener(StoreDataChangedListener listener)
Register store data change listener.protected Store
removeStore(java.lang.String storeName)
void
unregisterStoreDataChangedListener(StoreDataChangedListener listener)
Unregister store data change listener.-
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.ReadOnlyStoreRepository
waitVersion, waitVersion
-
-
-
-
Field Detail
-
STORE_REPOSITORY_PATH
public static final java.lang.String STORE_REPOSITORY_PATH
- See Also:
- Constant Field Values
-
clusterName
protected final java.lang.String clusterName
-
clusterStoreRepositoryPath
protected final java.lang.String clusterStoreRepositoryPath
-
zkClient
protected final org.apache.helix.zookeeper.impl.client.ZkClient zkClient
-
zkDataAccessor
protected final org.apache.helix.manager.zk.ZkBaseDataAccessor<Store> zkDataAccessor
-
clusterLockManager
protected final ClusterLockManager clusterLockManager
-
storeMap
protected final java.util.Map<java.lang.String,Store> storeMap
-
-
Constructor Detail
-
CachedReadOnlyStoreRepository
public CachedReadOnlyStoreRepository(org.apache.helix.zookeeper.impl.client.ZkClient zkClient, java.lang.String clusterName, HelixAdapterSerializer compositeSerializer, ClusterLockManager clusterLockManager)
-
-
Method Detail
-
getStore
public Store getStore(java.lang.String storeName)
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
public Store getStoreOrThrow(java.lang.String storeName) throws VeniceNoStoreException
- Specified by:
getStoreOrThrow
in interfaceReadOnlyStoreRepository
- Throws:
VeniceNoStoreException
-
hasStore
public boolean hasStore(java.lang.String storeName)
Description copied from interface:ReadOnlyStoreRepository
Whether the store exists or not.- Specified by:
hasStore
in interfaceReadOnlyStoreRepository
- Parameters:
storeName
- store name- Returns:
-
getAllStores
public java.util.List<Store> getAllStores()
Description copied from interface:ReadOnlyStoreRepository
Get all stores in the current repository- 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
-
getBatchGetLimit
public int getBatchGetLimit(java.lang.String storeName)
Description copied from interface:ReadOnlyStoreRepository
Get batch-get limit for the specified store- Specified by:
getBatchGetLimit
in interfaceReadOnlyStoreRepository
- Returns:
-
isReadComputationEnabled
public boolean isReadComputationEnabled(java.lang.String storeName)
Description copied from interface:ReadOnlyStoreRepository
Whether computation is enabled for the specified store.- Specified by:
isReadComputationEnabled
in interfaceReadOnlyStoreRepository
- Parameters:
storeName
- store name- Returns:
-
refresh
public void refresh()
- Specified by:
refresh
in interfaceVeniceResource
-
refreshOneStore
public Store refreshOneStore(java.lang.String storeName)
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
-
clear
public void clear()
- Specified by:
clear
in interfaceVeniceResource
-
registerStoreDataChangedListener
public void registerStoreDataChangedListener(StoreDataChangedListener listener)
Description copied from interface:ReadOnlyStoreRepository
Register store data change listener.- Specified by:
registerStoreDataChangedListener
in interfaceReadOnlyStoreRepository
-
unregisterStoreDataChangedListener
public void unregisterStoreDataChangedListener(StoreDataChangedListener listener)
Description copied from interface:ReadOnlyStoreRepository
Unregister store data change listener.- Specified by:
unregisterStoreDataChangedListener
in interfaceReadOnlyStoreRepository
-
removeStore
protected Store removeStore(java.lang.String storeName)
-
getStoreZkPath
protected final java.lang.String getStoreZkPath(java.lang.String storeName)
-
getStoreFromZk
protected Store getStoreFromZk(java.lang.String storeName)
-
getStoresFromZk
protected java.util.List<Store> getStoresFromZk()
HelixReadOnlyZKSharedSystemStoreRepository
is overriding this function to filter out stores, which are not necessary to put a watch against duringrefresh()
, and if this logic to refresh the zk store repository gets changed in the future, we need to updateHelixReadOnlyZKSharedSystemStoreRepository
accordingly.
-
getStoresFromZk
protected java.util.List<Store> getStoresFromZk(java.util.Collection<java.lang.String> storeNames)
-
notifyStoreCreated
protected void notifyStoreCreated(Store store)
-
notifyStoreDeleted
protected void notifyStoreDeleted(Store store)
-
notifyStoreChanged
protected void notifyStoreChanged(Store store)
-
-