Package com.google.gerrit.server.git
Class LocalDiskRepositoryManager
- java.lang.Object
-
- com.google.gerrit.server.git.LocalDiskRepositoryManager
-
- All Implemented Interfaces:
GitRepositoryManager
- Direct Known Subclasses:
MultiBaseLocalDiskRepositoryManager
public class LocalDiskRepositoryManager extends Object implements GitRepositoryManager
Manages Git repositories stored on the local filesystem.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LocalDiskRepositoryManager.Lifecycle
static class
LocalDiskRepositoryManager.Module
protected class
LocalDiskRepositoryManager.ProjectVisitor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Boolean
canPerformGC()
Check if garbage collection can be performed by the repository manager.org.eclipse.jgit.lib.Repository
createRepository(Project.NameKey name)
Create (and open) a repository by name.Path
getBasePath(Project.NameKey name)
Return the basePath under which the specified project is stored.SortedSet<Project.NameKey>
list()
org.eclipse.jgit.lib.Repository
openRepository(Project.NameKey name)
Get (or open) a repository by name.protected void
scanProjects(LocalDiskRepositoryManager.ProjectVisitor visitor)
-
-
-
Method Detail
-
getBasePath
public Path getBasePath(Project.NameKey name)
Return the basePath under which the specified project is stored.- Parameters:
name
- the name of the project- Returns:
- base directory
-
openRepository
public org.eclipse.jgit.lib.Repository openRepository(Project.NameKey name) throws org.eclipse.jgit.errors.RepositoryNotFoundException
Description copied from interface:GitRepositoryManager
Get (or open) a repository by name.- Specified by:
openRepository
in interfaceGitRepositoryManager
- Parameters:
name
- the repository name, relative to the base directory.- Returns:
- the cached Repository instance. Caller must call
close()
when done to decrement the resource handle. - Throws:
org.eclipse.jgit.errors.RepositoryNotFoundException
- the name does not denote an existing repository.
-
createRepository
public org.eclipse.jgit.lib.Repository createRepository(Project.NameKey name) throws org.eclipse.jgit.errors.RepositoryNotFoundException, RepositoryCaseMismatchException, IOException
Description copied from interface:GitRepositoryManager
Create (and open) a repository by name.- Specified by:
createRepository
in interfaceGitRepositoryManager
- Parameters:
name
- the repository name, relative to the base directory.- Returns:
- the cached Repository instance. Caller must call
close()
when done to decrement the resource handle. - Throws:
RepositoryCaseMismatchException
- the name collides with an existing repository name, but only in case of a character within the name.org.eclipse.jgit.errors.RepositoryNotFoundException
- the name is invalid.IOException
- the repository cannot be created.
-
canPerformGC
public Boolean canPerformGC()
Description copied from interface:GitRepositoryManager
Check if garbage collection can be performed by the repository manager.- Specified by:
canPerformGC
in interfaceGitRepositoryManager
- Returns:
- true if repository can perform garbage collection.
-
list
public SortedSet<Project.NameKey> list()
- Specified by:
list
in interfaceGitRepositoryManager
- Returns:
- set of all known projects, sorted by natural NameKey order.
-
scanProjects
protected void scanProjects(LocalDiskRepositoryManager.ProjectVisitor visitor)
-
-