GroupIncludeCache: Return Collection instead of Set

All callers of these methods simply iterate over the elements, they
don't perform any set lookups. Returning Collection instead of Set
allows us to store ImmutableLists internally, which have much less
memory overhead on servers with lots of groups.

Change-Id: I12e6ef0d03d9b06c112e4d1203603b23cafaf903
This commit is contained in:
Dave Borowitz
2016-12-06 09:24:26 -05:00
parent e3f7c69059
commit 6564b5a6f5
3 changed files with 43 additions and 29 deletions

View File

@@ -16,18 +16,18 @@ package com.google.gerrit.server.account;
import com.google.gerrit.reviewdb.client.AccountGroup;
import java.util.Set;
import java.util.Collection;
/** Tracks group inclusions in memory for efficient access. */
public interface GroupIncludeCache {
/** @return groups directly a member of the passed group. */
Set<AccountGroup.UUID> subgroupsOf(AccountGroup.UUID group);
Collection<AccountGroup.UUID> subgroupsOf(AccountGroup.UUID group);
/** @return any groups the passed group belongs to. */
Set<AccountGroup.UUID> parentGroupsOf(AccountGroup.UUID groupId);
Collection<AccountGroup.UUID> parentGroupsOf(AccountGroup.UUID groupId);
/** @return set of any UUIDs that are not internal groups. */
Set<AccountGroup.UUID> allExternalMembers();
Collection<AccountGroup.UUID> allExternalMembers();
void evictSubgroupsOf(AccountGroup.UUID groupId);
void evictParentGroupsOf(AccountGroup.UUID groupId);