Package com.github.ambry.account
Class AccountUtils
- java.lang.Object
-
- com.github.ambry.account.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)
ReturnsSet
of deprecatedContainer
s ready for deletion fromAccountService
.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 sizeContainer
s.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)
SelectsContainer
s to be marked as INACTIVE.
-
-
-
Method Detail
-
getDeprecatedContainers
public static java.util.Set<com.github.ambry.account.Container> getDeprecatedContainers(com.github.ambry.account.AccountService accountService, long containerDeletionRetentionDays)
ReturnsSet
of deprecatedContainer
s ready for deletion fromAccountService
.- Parameters:
accountService
-AccountService
object.containerDeletionRetentionDays
- Number of days upto which deprecated containers can be marked as ACTIVE.- Returns:
Set
of deprecatedContainer
s.
-
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)
SelectsContainer
s to be marked as INACTIVE. Check the valid data size of each DELETE_IN_PROGRESS container fromStatsSnapshot
and select the ones with zero data size to be marked as INACTIVE.- Returns:
Set
of inactiveContainer
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 sizeContainer
s. The qualifiedContainer
s' raw valid data size should be larger than zero.- Parameters:
nonEmptyContainersByAccount
- it holds a mapping ofAccount
s toContainer
s which raw valid data size larger than zero.statsSnapshot
- theStatsSnapshot
generated from cluster wide aggregation.keyName
- the key of subMap for each level ofStatsSnapshot
.
-
-