Class GitFileDiffCacheImpl
java.lang.Object
com.google.gerrit.server.patch.gitfilediff.GitFileDiffCacheImpl
- All Implemented Interfaces:
GitFileDiffCache
Implementation of the
GitFileDiffCache
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum for the supported diff algorithms for the file diff computation.static class
Creates a new JGit diff algorithm instance using the Gerrit'sGitFileDiffCacheImpl.DiffAlgorithm
enum. -
Constructor Summary
ConstructorsConstructorDescriptionGitFileDiffCacheImpl
(com.google.common.cache.LoadingCache<GitFileDiffCacheKey, GitFileDiff> cache) -
Method Summary
Modifier and TypeMethodDescriptionget
(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 Details
-
GitFileDiffCacheImpl
@Inject public GitFileDiffCacheImpl(com.google.common.cache.LoadingCache<GitFileDiffCacheKey, GitFileDiff> cache)
-
-
Method Details
-
module
public static com.google.inject.Module module() -
get
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.
-