Class CDSFirstBranchRevisionTracker
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.CDSFirstBranchRevisionTracker
-
- All Implemented Interfaces:
FirstBranchRevisionTracker
public class CDSFirstBranchRevisionTracker extends Object implements FirstBranchRevisionTracker
FirstBranchRevisionTracker on top of custom data storage. Uses 3 storages: root storage, rev storage, and settings change storage. Root storage: parentRootId -> settingsHash v:parentRootId -> version (parentRootId is a long, so no clash is possible) Rev storage (id computed from parentRootId, settingsHash) branch -> first seen revision in the branch Settings change storage (id computed from parentRootId, settingsHash): branch -> first seen in the branch after settings change Rev storage and settings change storage can contain different revisions for the same branch (e.g. after force push to the branch). In version=1 the version was omitted and there were no settings change storage. If version is outdated the storage is converted to current version during updateRevisions(). Keeps only one rev & settings change storage for given parentRootId.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jetbrains.buildServer.serverSide.impl.FirstBranchRevisionTracker
FirstBranchRevisionTracker.RevisionOrigin
-
-
Field Summary
Fields Modifier and Type Field Description static StringCURRENT_VERSIONstatic StringROOT_STORAGEstatic StringSETTINGS_VCS_ROOT_SUFFIXstatic StringVERSION_KEY_PREFIX
-
Constructor Summary
Constructors Constructor Description CDSFirstBranchRevisionTracker(VcsModificationHistoryEx vcsHistory, MultiNodesEvents nodesEvents, TeamCityNodes teamCityNodes, CustomDataStorageManager customDataStorageManager)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteRevisions(SBuildType buildType)Removes all revisions stored for the specified build typevoiddeleteRevisions(SBuildType buildType, long parentVcsRootId, boolean implicitSettingsRoot)voiddeleteRevisions(SBuildType buildType, SVcsRoot root, boolean implicitSettingsRoot)Removes all revisions for the specified buildType and VCS rootStringgetFirstRevision(SBuildType buildType, VcsRootInstanceEntry entry, String vcsBranch)Returns a first revision detected in branch for the given buildType, VCS root entry and the vcs branch.CustomDataStoragegetRevStorage(SBuildType buildType, VcsRootInstance root, String settingsHash, boolean refresh)Map<String,String>getSettingsChangeRevisions(SBuildType buildType, VcsRootInstanceEntry entry)Returns branch revisions detected after settings changeCustomDataStoragegetSettingsChangeStorage(SBuildType buildType, VcsRootInstance root, String settingsHash, boolean refresh)Set<Long>getVcsRootsWithBranchRevisions(SBuildType buildType, boolean implicitSettingsRoot)Set of ids of VCS roots which have first branch revisions remembered for the specified build configurationstatic StringgetVersionKey(long parentRootId)StringserializeRevision(String revision, FirstBranchRevisionTracker.RevisionOrigin revisionOrigin)StringsettingsHash(VcsRootInstanceEntry entry)booleanshouldFlushModifiedStoragesImmediately()voidupdateRevisions(VcsRootInstance root, Map<SBuildType,CheckoutRules> usages, boolean implicitSettingsRootUsages, RepositoryState fromState, RepositoryState toState, Set<SBuildType> forceRevisionUpdateBuildTypes)Updates first detected revision for specified root and its usages after collecting changes from the fromSate to the toState.
-
-
-
Field Detail
-
ROOT_STORAGE
public static final String ROOT_STORAGE
- See Also:
- Constant Field Values
-
CURRENT_VERSION
public static final String CURRENT_VERSION
- See Also:
- Constant Field Values
-
VERSION_KEY_PREFIX
public static final String VERSION_KEY_PREFIX
- See Also:
- Constant Field Values
-
SETTINGS_VCS_ROOT_SUFFIX
public static final String SETTINGS_VCS_ROOT_SUFFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CDSFirstBranchRevisionTracker
public CDSFirstBranchRevisionTracker(@NotNull VcsModificationHistoryEx vcsHistory, @NotNull MultiNodesEvents nodesEvents, @NotNull TeamCityNodes teamCityNodes, @NotNull CustomDataStorageManager customDataStorageManager)
-
-
Method Detail
-
deleteRevisions
public void deleteRevisions(@NotNull SBuildType buildType, @NotNull SVcsRoot root, boolean implicitSettingsRoot)Description copied from interface:FirstBranchRevisionTrackerRemoves all revisions for the specified buildType and VCS root- Specified by:
deleteRevisionsin interfaceFirstBranchRevisionTracker- Parameters:
buildType- buildType of interestroot- VCS root of interest
-
deleteRevisions
public void deleteRevisions(@NotNull SBuildType buildType, long parentVcsRootId, boolean implicitSettingsRoot)- Specified by:
deleteRevisionsin interfaceFirstBranchRevisionTracker
-
deleteRevisions
public void deleteRevisions(@NotNull SBuildType buildType)Description copied from interface:FirstBranchRevisionTrackerRemoves all revisions stored for the specified build type- Specified by:
deleteRevisionsin interfaceFirstBranchRevisionTracker
-
updateRevisions
public void updateRevisions(@NotNull VcsRootInstance root, @NotNull Map<SBuildType,CheckoutRules> usages, boolean implicitSettingsRootUsages, @NotNull RepositoryState fromState, @NotNull RepositoryState toState, @NotNull Set<SBuildType> forceRevisionUpdateBuildTypes)Description copied from interface:FirstBranchRevisionTrackerUpdates first detected revision for specified root and its usages after collecting changes from the fromSate to the toState. Detects the case when currently stored first revision is not reachable from the new branch head and updates the first revision with the branch head- Specified by:
updateRevisionsin interfaceFirstBranchRevisionTracker
-
serializeRevision
@NotNull public String serializeRevision(@NotNull String revision, @NotNull FirstBranchRevisionTracker.RevisionOrigin revisionOrigin)
-
getFirstRevision
@Nullable public String getFirstRevision(@NotNull SBuildType buildType, @NotNull VcsRootInstanceEntry entry, @NotNull String vcsBranch)
Description copied from interface:FirstBranchRevisionTrackerReturns a first revision detected in branch for the given buildType, VCS root entry and the vcs branch. Returns null if no revision is found.- Specified by:
getFirstRevisionin interfaceFirstBranchRevisionTracker- Parameters:
buildType- buildType of interestentry- root entry of interestvcsBranch- vcs branch name- Returns:
- see above
-
getSettingsChangeRevisions
@NotNull public Map<String,String> getSettingsChangeRevisions(@NotNull SBuildType buildType, @NotNull VcsRootInstanceEntry entry)
Description copied from interface:FirstBranchRevisionTrackerReturns branch revisions detected after settings change- Specified by:
getSettingsChangeRevisionsin interfaceFirstBranchRevisionTracker
-
getVcsRootsWithBranchRevisions
@NotNull public Set<Long> getVcsRootsWithBranchRevisions(@NotNull SBuildType buildType, boolean implicitSettingsRoot)
Description copied from interface:FirstBranchRevisionTrackerSet of ids of VCS roots which have first branch revisions remembered for the specified build configuration- Specified by:
getVcsRootsWithBranchRevisionsin interfaceFirstBranchRevisionTrackerimplicitSettingsRoot- if true then only ids of settings VCS roots will be returned, if false, then only ids of regular VCS roots will be returned- Returns:
-
getSettingsChangeStorage
@NotNull public CustomDataStorage getSettingsChangeStorage(@NotNull SBuildType buildType, @NotNull VcsRootInstance root, @NotNull String settingsHash, boolean refresh)
-
getRevStorage
@NotNull public CustomDataStorage getRevStorage(@NotNull SBuildType buildType, @NotNull VcsRootInstance root, @NotNull String settingsHash, boolean refresh)
-
settingsHash
@NotNull public String settingsHash(@NotNull VcsRootInstanceEntry entry)
-
getVersionKey
@NotNull public static String getVersionKey(long parentRootId)
-
shouldFlushModifiedStoragesImmediately
public boolean shouldFlushModifiedStoragesImmediately()
-
-