Class ProjectCacheImpl

  • All Implemented Interfaces:
    ProjectCache

    public class ProjectCacheImpl
    extends Object
    implements ProjectCache
    Cache of project information, including access rights.

    The data of a project is the project's project.config in refs/meta/config parsed out as an immutable value. It's keyed purely by the refs/meta/config SHA-1. We also cache the same value keyed by name. The latter mapping can become outdated, so data must be evicted explicitly.

    • Method Detail

      • module

        public static com.google.inject.Module module()
      • get

        public Optional<ProjectState> get​(Project.NameKey projectName)
        Description copied from interface: ProjectCache
        Get the cached data for a project by its unique name.
        Specified by:
        get in interface ProjectCache
        Parameters:
        projectName - name of the project.
        Returns:
        an Optional wrapping the cached data; absent if no such project exists or the projectName is null
      • evict

        public void evict​(Project.NameKey p)
        Description copied from interface: ProjectCache
        Invalidate the cached information about the given project.
        Specified by:
        evict in interface ProjectCache
        Parameters:
        p - the NameKey of the project that is being evicted
      • 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 interface ProjectCache
        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 interface ProjectCache
        Parameters:
        p - the NameKey of the project that is being evicted
      • all

        public com.google.common.collect.ImmutableSortedSet<Project.NameKey> all()
        Description copied from interface: ProjectCache
        Returns sorted iteration of projects.
        Specified by:
        all in interface ProjectCache
      • 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 interface ProjectCache
      • byName

        public com.google.common.collect.ImmutableSortedSet<Project.NameKey> byName​(String pfx)
        Description copied from interface: ProjectCache
        Filter the set of registered project names by common prefix.
        Specified by:
        byName in interface ProjectCache
        Parameters:
        pfx - common prefix.
        Returns:
        sorted iteration of projects sharing the same prefix.
      • allProjectsFileProjectConfigHash

        public static byte[] allProjectsFileProjectConfigHash​(Optional<org.eclipse.jgit.lib.StoredConfig> allProjectsConfig)
        Returns a MurMur128 hash of the contents of etc/All-Projects-project.config.
      • evictAllByName

        public void evictAllByName()
      • sizeAllByName

        public long sizeAllByName()