Package jetbrains.buildServer.vcs.impl
Class VcsBranchNameCache
- java.lang.Object
-
- jetbrains.buildServer.vcs.impl.VcsBranchNameCache
-
public class VcsBranchNameCache extends Object
A cache that stores a mapping logical -> physical branch for a (build configuration, vcs root) pair. Stores this mapping only for build configuration for which logical branches were requested.
If the information is requested for the new configuration and vcs root, the mapping will be computed from the latest RepositoryState and stored in cache.
If thegetVcsBranchNamesByLogicalBranch(BuildTypeEx, String, List)
is going to be called for multiple logical branches, it makes sense to precalculate the mapping withprecalculateVcsBranches(BuildTypeEx)
, because even to determine if the information in cache needs updating, we need to get the state and calculate a hash from all its branches, which might be a long operation for big repositories- Since:
- 2024.3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
VcsBranchNameCache.CacheEntry
-
Constructor Summary
Constructors Constructor Description VcsBranchNameCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<VcsInstanceBranchPair>
getVcsBranchNamesByLogicalBranch(BuildTypeEx buildType, String logicalBranchName, List<VcsBranchNameCache.CacheEntry> precalculatedEntries)
List<VcsBranchNameCache.CacheEntry>
precalculateVcsBranches(BuildTypeEx buildType)
The values returned from this method are short-lived and should be used only if vcs branch names are to be calculated for multiple branches in short period of time
-
-
-
Method Detail
-
precalculateVcsBranches
public List<VcsBranchNameCache.CacheEntry> precalculateVcsBranches(@NotNull BuildTypeEx buildType)
The values returned from this method are short-lived and should be used only if vcs branch names are to be calculated for multiple branches in short period of time- Returns:
- a list of CacheEntries that can speed up calculation of
getVcsBranchNamesByLogicalBranch(BuildTypeEx, String, List)
if it will be called for multiple branches
-
getVcsBranchNamesByLogicalBranch
@NotNull public List<VcsInstanceBranchPair> getVcsBranchNamesByLogicalBranch(@NotNull BuildTypeEx buildType, @NotNull String logicalBranchName, @Nullable List<VcsBranchNameCache.CacheEntry> precalculatedEntries)
- Parameters:
precalculatedEntries
- shoulde be calculated withprecalculateVcsBranches(BuildTypeEx)
if needed- Returns:
- a list of pairs (VcsRootInstance, corresponding vcs branch name for the given logicalBranchName)
-
-