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
Nested ClassesModifier and TypeClassDescriptionstatic classHelper class which listens to changes from aReadOnlyStoreRepositoryand updates the caches and ZK of the StoragePersonaRepository accordingly. -
Constructor Summary
ConstructorsConstructorDescriptionStoragePersonaRepository(String clusterName, ReadOnlyStoreRepository repository, HelixAdapterSerializer compositeSerializer, org.apache.helix.zookeeper.impl.client.ZkClient zkClient) -
Method Summary
Modifier and TypeMethodDescriptionvoidCreates a new persona with the given parameters.voidaddStoresToPersona(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.voiddeletePersona(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) booleanhasPersona(String name) booleanpersonaContainsStore(String personaName, String storeName) final voidrefresh()Clears the cache and re-loads the cache data from Zookeeper.voidupdatePersona(String personaName, UpdateStoragePersonaQueryParams params) Updates a persona with the given parameters.voidvalidateAddUpdatedStore(StoragePersona persona, Optional<Store> store) voidvalidatePersona(StoragePersona persona) voidvoidvalidatePersonaUpdate(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
-