Class GitFileDiffCacheImpl
- java.lang.Object
-
- com.google.gerrit.server.patch.gitfilediff.GitFileDiffCacheImpl
-
- All Implemented Interfaces:
GitFileDiffCache
public class GitFileDiffCacheImpl extends Object implements GitFileDiffCache
Implementation of theGitFileDiffCache
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GitFileDiffCacheImpl.DiffAlgorithm
Enum for the supported diff algorithms for the file diff computation.static class
GitFileDiffCacheImpl.DiffAlgorithmFactory
Creates a new JGit diff algorithm instance using the Gerrit'sGitFileDiffCacheImpl.DiffAlgorithm
enum.
-
Constructor Summary
Constructors Constructor Description GitFileDiffCacheImpl(com.google.common.cache.LoadingCache<GitFileDiffCacheKey,GitFileDiff> cache)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GitFileDiff
get(GitFileDiffCacheKey key)
Returns the git file diff for a single file path identified by its key.com.google.common.collect.ImmutableMap<GitFileDiffCacheKey,GitFileDiff>
getAll(Iterable<GitFileDiffCacheKey> keys)
Returns the file diff for a collection of file paths identified by their keys.static com.google.inject.Module
module()
-
-
-
Constructor Detail
-
GitFileDiffCacheImpl
@Inject public GitFileDiffCacheImpl(com.google.common.cache.LoadingCache<GitFileDiffCacheKey,GitFileDiff> cache)
-
-
Method Detail
-
module
public static com.google.inject.Module module()
-
get
public GitFileDiff get(GitFileDiffCacheKey key) throws DiffNotAvailableException
Description copied from interface:GitFileDiffCache
Returns the git file diff for a single file path identified by its key.- Specified by:
get
in interfaceGitFileDiffCache
- Parameters:
key
- identifies two git trees, a specific file path and other diff parameters.- Returns:
- the file diff for a single file path identified by its key.
- Throws:
DiffNotAvailableException
- if the tree IDs of the key are invalid for this project or if file contents could not be read.
-
getAll
public com.google.common.collect.ImmutableMap<GitFileDiffCacheKey,GitFileDiff> getAll(Iterable<GitFileDiffCacheKey> keys) throws DiffNotAvailableException
Description copied from interface:GitFileDiffCache
Returns the file diff for a collection of file paths identified by their keys.- Specified by:
getAll
in interfaceGitFileDiffCache
- Parameters:
keys
- identifying different file paths of different projects.- Returns:
- a map of the input keys to their corresponding git file diffs.
- Throws:
DiffNotAvailableException
- if the diff failed to be evaluated for one or more of the input keys due to invalid tree IDs or if file contents could not be read.
-
-