Class StoragePersonaRepository


  • public class StoragePersonaRepository
    extends java.lang.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 Detail

      • StoragePersonaRepository

        public StoragePersonaRepository​(java.lang.String clusterName,
                                        ReadOnlyStoreRepository repository,
                                        HelixAdapterSerializer compositeSerializer,
                                        org.apache.helix.zookeeper.impl.client.ZkClient zkClient)
    • Method Detail

      • getPersona

        public StoragePersona getPersona​(java.lang.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 java.util.List<StoragePersona> getAllPersonas()
      • hasPersona

        public boolean hasPersona​(java.lang.String name)
      • refresh

        public final void refresh()
        Clears the cache and re-loads the cache data from Zookeeper.
      • addPersona

        public void addPersona​(java.lang.String name,
                               long quotaNumber,
                               java.util.Set<java.lang.String> storesToEnforce,
                               java.util.Set<java.lang.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​(java.lang.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​(java.lang.String personaName)
        Deletes the persona with the given name. If no persona is found, this method does nothing.
      • getPersonaContainingStore

        public StoragePersona getPersonaContainingStore​(java.lang.String storeName)
      • validatePersona

        public void validatePersona​(java.lang.String personaName,
                                    long quota,
                                    java.util.Set<java.lang.String> storesToEnforce,
                                    java.util.Set<java.lang.String> owners)
      • validatePersona

        public void validatePersona​(StoragePersona persona)
      • validateAddUpdatedStore

        public void validateAddUpdatedStore​(StoragePersona persona,
                                            java.util.Optional<Store> store)
      • addStoresToPersona

        public void addStoresToPersona​(java.lang.String personaName,
                                       java.util.List<java.lang.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​(java.lang.String personaName,
                                            java.lang.String storeName)