Class StoragePersonaRepository

java.lang.Object
com.linkedin.venice.helix.StoragePersonaRepository

public class StoragePersonaRepository extends Object
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.
  • Constructor Details

  • Method Details

    • getPersona

      public StoragePersona getPersona(String name)
      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

      public List<StoragePersona> getAllPersonas()
    • hasPersona

      public boolean hasPersona(String name)
    • 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

      public void updatePersona(String personaName, UpdateStoragePersonaQueryParams params)
      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.
      On failure, the given persona, if it exists, will remain unchanged.
    • deletePersona

      public void deletePersona(String personaName)
      Deletes the persona with the given name. If no persona is found, this method does nothing.
    • getPersonaContainingStore

      public StoragePersona getPersonaContainingStore(String storeName)
    • validatePersona

      public void validatePersona(String personaName, long quota, Set<String> storesToEnforce, Set<String> owners)
    • validatePersonaUpdate

      public void validatePersonaUpdate(String personaName, UpdateStoragePersonaQueryParams params)
    • validatePersona

      public void validatePersona(StoragePersona persona)
    • validateAddUpdatedStore

      public void validateAddUpdatedStore(StoragePersona persona, Optional<Store> store)
    • addStoresToPersona

      public 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.
    • personaContainsStore

      public boolean personaContainsStore(String personaName, String storeName)