Class AccountUtils


  • public class AccountUtils
    extends java.lang.Object
    Utils for Account-related operations.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  AccountUtils.AccountUpdateInfo
      Holds information updated for an Account
    • Constructor Summary

      Constructors 
      Constructor Description
      AccountUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int compareAccounts​(java.util.Collection<com.github.ambry.account.Account> accountsInPrimary, java.util.Collection<com.github.ambry.account.Account> accountsInSecondary)
      Compares and logs differences (if any) in Accounts.
      static java.util.Set<com.github.ambry.account.Container> getDeprecatedContainers​(com.github.ambry.account.AccountService accountService, long containerDeletionRetentionDays)
      Returns Set of deprecated Containers ready for deletion from AccountService.
      static void searchNonEmptyContainers​(java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> nonEmptyContainersByAccount, com.github.ambry.server.StatsSnapshot statsSnapshot, java.lang.String keyName)
      Gets valid data size Containers.
      static java.util.Set<com.github.ambry.account.Container> selectInactiveContainerCandidates​(com.github.ambry.server.StatsSnapshot statsSnapshot, java.util.Set<com.github.ambry.account.Container> deleteInProgressContainerSet)
      Selects Containers to be marked as INACTIVE.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AccountUtils

        public AccountUtils()
    • Method Detail

      • getDeprecatedContainers

        public static java.util.Set<com.github.ambry.account.Container> getDeprecatedContainers​(com.github.ambry.account.AccountService accountService,
                                                                                                long containerDeletionRetentionDays)
        Returns Set of deprecated Containers ready for deletion from AccountService.
        Parameters:
        accountService - AccountService object.
        containerDeletionRetentionDays - Number of days upto which deprecated containers can be marked as ACTIVE.
        Returns:
        Set of deprecated Containers.
      • compareAccounts

        public static int compareAccounts​(java.util.Collection<com.github.ambry.account.Account> accountsInPrimary,
                                          java.util.Collection<com.github.ambry.account.Account> accountsInSecondary)
        Compares and logs differences (if any) in Accounts.
        Parameters:
        accountsInPrimary - accounts in primary collection.
        accountsInSecondary - accounts in secondary collection.
        Returns:
        count of accounts mismatching.
      • selectInactiveContainerCandidates

        public static java.util.Set<com.github.ambry.account.Container> selectInactiveContainerCandidates​(com.github.ambry.server.StatsSnapshot statsSnapshot,
                                                                                                          java.util.Set<com.github.ambry.account.Container> deleteInProgressContainerSet)
        Selects Containers to be marked as INACTIVE. Check the valid data size of each DELETE_IN_PROGRESS container from StatsSnapshot and select the ones with zero data size to be marked as INACTIVE.
        Returns:
        Set of inactive Container candidates.
      • searchNonEmptyContainers

        public static void searchNonEmptyContainers​(java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> nonEmptyContainersByAccount,
                                                    com.github.ambry.server.StatsSnapshot statsSnapshot,
                                                    java.lang.String keyName)
        Gets valid data size Containers. The qualified Containers' raw valid data size should be larger than zero.
        Parameters:
        nonEmptyContainersByAccount - it holds a mapping of Accounts to Containers which raw valid data size larger than zero.
        statsSnapshot - the StatsSnapshot generated from cluster wide aggregation.
        keyName - the key of subMap for each level of StatsSnapshot.