Package com.google.gerrit.server.project
Class NullProjectCache
- java.lang.Object
-
- com.google.gerrit.server.project.NullProjectCache
-
- All Implemented Interfaces:
ProjectCache
public class NullProjectCache extends Object implements ProjectCache
An implementation ofProjectCache
with no operations implemented.
-
-
Constructor Summary
Constructors Constructor Description NullProjectCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.common.collect.ImmutableSortedSet<Project.NameKey>
all()
Returns sorted iteration of projects.com.google.common.collect.ImmutableSortedSet<Project.NameKey>
byName(String prefix)
Filter the set of registered project names by common prefix.void
evict(Project.NameKey p)
Invalidate the cached information about the given project.void
evictAndReindex(Project p)
Invalidate the cached information about the given project, and triggers reindexing for itvoid
evictAndReindex(Project.NameKey p)
Invalidate the cached information about the given project, and triggers reindexing for itOptional<ProjectState>
get(Project.NameKey projectName)
Get the cached data for a project by its unique name.ProjectState
getAllProjects()
Returns the parent state for all projects on this server.ProjectState
getAllUsers()
Returns the project state of the project storing meta data for all users.Set<AccountGroup.UUID>
guessRelevantGroupUUIDs()
Returns estimated set of relevant groups extracted from hot project access rules.void
onCreateProject(Project.NameKey newProjectName)
Notify the cache that a new project was constructed.void
remove(Project p)
Remove information about the given project from the cache.void
remove(Project.NameKey name)
Remove information about the given project from the cache.
-
-
-
Method Detail
-
getAllProjects
public ProjectState getAllProjects()
Description copied from interface:ProjectCache
Returns the parent state for all projects on this server.- Specified by:
getAllProjects
in interfaceProjectCache
-
getAllUsers
public ProjectState getAllUsers()
Description copied from interface:ProjectCache
Returns the project state of the project storing meta data for all users.- Specified by:
getAllUsers
in interfaceProjectCache
-
get
public Optional<ProjectState> get(Project.NameKey projectName) throws com.google.gerrit.exceptions.StorageException
Description copied from interface:ProjectCache
Get the cached data for a project by its unique name.- Specified by:
get
in interfaceProjectCache
- Parameters:
projectName
- name of the project.- Returns:
- an
Optional
wrapping the cached data;absent
if no such project exists or the projectName is null - Throws:
com.google.gerrit.exceptions.StorageException
- when there was an error.
-
evict
public void evict(Project.NameKey p)
Description copied from interface:ProjectCache
Invalidate the cached information about the given project.- Specified by:
evict
in interfaceProjectCache
- Parameters:
p
- the NameKey of the project that is being evicted
-
remove
public void remove(Project p)
Description copied from interface:ProjectCache
Remove information about the given project from the cache. It will no longer be returned fromProjectCache.all()
.- Specified by:
remove
in interfaceProjectCache
-
remove
public void remove(Project.NameKey name)
Description copied from interface:ProjectCache
Remove information about the given project from the cache. It will no longer be returned fromProjectCache.all()
.- Specified by:
remove
in interfaceProjectCache
-
all
public com.google.common.collect.ImmutableSortedSet<Project.NameKey> all()
Description copied from interface:ProjectCache
Returns sorted iteration of projects.- Specified by:
all
in interfaceProjectCache
-
guessRelevantGroupUUIDs
public Set<AccountGroup.UUID> guessRelevantGroupUUIDs()
Description copied from interface:ProjectCache
Returns estimated set of relevant groups extracted from hot project access rules. If the cache is cold or too small for the entire project set of the server, this set may be incomplete.- Specified by:
guessRelevantGroupUUIDs
in interfaceProjectCache
-
byName
public com.google.common.collect.ImmutableSortedSet<Project.NameKey> byName(String prefix)
Description copied from interface:ProjectCache
Filter the set of registered project names by common prefix.- Specified by:
byName
in interfaceProjectCache
- Parameters:
prefix
- common prefix.- Returns:
- sorted iteration of projects sharing the same prefix.
-
onCreateProject
public void onCreateProject(Project.NameKey newProjectName) throws IOException
Description copied from interface:ProjectCache
Notify the cache that a new project was constructed.- Specified by:
onCreateProject
in interfaceProjectCache
- Throws:
IOException
-
evictAndReindex
public void evictAndReindex(Project p)
Description copied from interface:ProjectCache
Invalidate the cached information about the given project, and triggers reindexing for it- Specified by:
evictAndReindex
in interfaceProjectCache
- Parameters:
p
- project that is being evicted
-
evictAndReindex
public void evictAndReindex(Project.NameKey p)
Description copied from interface:ProjectCache
Invalidate the cached information about the given project, and triggers reindexing for it- Specified by:
evictAndReindex
in interfaceProjectCache
- Parameters:
p
- the NameKey of the project that is being evicted
-
-