Package com.linkedin.venice.helix
Class StoragePersonaRepository
java.lang.Object
com.linkedin.venice.helix.StoragePersonaRepository
Cached wrapper for the
StoragePersonaAccessor
class, which keeps a map of store names to personas that
contain them, as well as caches Zookeeper personas.
Class Invariants:
- Each method is thread-safe.
- The state of the repository (including the cache) will not be affected by object mutations until update methods from the repository are called.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Helper class which listens to changes from aReadOnlyStoreRepository
and updates the caches and ZK of the StoragePersonaRepository accordingly. -
Constructor Summary
ConstructorDescriptionStoragePersonaRepository
(String clusterName, ReadOnlyStoreRepository repository, HelixAdapterSerializer compositeSerializer, org.apache.helix.zookeeper.impl.client.ZkClient zkClient) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Creates a new persona with the given parameters.void
addStoresToPersona
(String personaName, List<String> storeNames) This operation assumes that stores which are added to the persona are not contained within any store, but does not do any validity checks.void
deletePersona
(String personaName) Deletes the persona with the given name.getPersona
(String name) Returns a persona with the given name within the cluster that the repository is located.getPersonaContainingStore
(String storeName) boolean
hasPersona
(String name) boolean
personaContainsStore
(String personaName, String storeName) final void
refresh()
Clears the cache and re-loads the cache data from Zookeeper.void
updatePersona
(String personaName, UpdateStoragePersonaQueryParams params) Updates a persona with the given parameters.void
validateAddUpdatedStore
(StoragePersona persona, Optional<Store> store) void
validatePersona
(StoragePersona persona) void
void
validatePersonaUpdate
(String personaName, UpdateStoragePersonaQueryParams params)
-
Constructor Details
-
StoragePersonaRepository
public StoragePersonaRepository(String clusterName, ReadOnlyStoreRepository repository, HelixAdapterSerializer compositeSerializer, org.apache.helix.zookeeper.impl.client.ZkClient zkClient)
-
-
Method Details
-
getPersona
Returns a persona with the given name within the cluster that the repository is located. In the case that no persona with this name exists, this method returns null. -
getAllPersonas
-
hasPersona
-
refresh
public final void refresh()Clears the cache and re-loads the cache data from Zookeeper. -
addPersona
public void addPersona(String name, long quotaNumber, Set<String> storesToEnforce, Set<String> owners) Creates a new persona with the given parameters. This method will throw an error if:- A persona with the given name already exists in the cluster.
- One of the stores in storesToEnforce does not exist in the cluster.
- The total quota of the stores exceeds the given persona budget.
-
updatePersona
Updates a persona with the given parameters. This method will throw an error if:- There is no persona with this name in the cluster.
- One of the stores in storesToEnforce does not exist in the cluster.
- The total quota of the stores exceeds the given persona budget.
-
deletePersona
Deletes the persona with the given name. If no persona is found, this method does nothing. -
getPersonaContainingStore
-
validatePersona
-
validatePersonaUpdate
-
validatePersona
-
validateAddUpdatedStore
-
addStoresToPersona
This operation assumes that stores which are added to the persona are not contained within any store, but does not do any validity checks. -
personaContainsStore
-