Interface DiskUsagePersister
-
- All Known Implementing Classes:
DiskUsage
public interface DiskUsagePersister
Created by Andrey Titov on 01.02.16.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
beforeBuildsDeletedFromHistory(List<SFinishedBuild> builds)
This method should be called for builds deleted from history before their cleanup.void
buildArtifactsCleaned(SBuildType buildType, long buildId, boolean wasPinned, boolean allRemoved, boolean noArtifactsLeft, long removedArtifacts, long removedInternalArtifacts, long removedLogs)
Updates data over a build type after partial or full build cleanup.void
buildArtifactsCleaned(SBuildType buildType, long buildId, boolean wasPinned, boolean allRemoved, boolean noArtifactsLeft, long removedArtifacts, long removedInternalArtifacts, long removedLogs, String storageId)
long
getVersion(SBuildType buildType)
Disk usage data is stored versioned.boolean
hasData(SBuildType buildType)
void
junkDeleted(SBuildType buildType, long totalDeleted, String storageId)
Decreases 'non-builds data' for buildTypevoid
recalculateAllData(UpdateAllProgress progress)
Recalculates all data recursively going to each artifact directoryvoid
recalculateBuild(SBuild build)
Recalculates a single buildCompositeDiskUsageData
recalculateData(SBuildType bt)
Recalculates a single build typevoid
recalculateProject(SProject project)
void
setLastUpdateDuration(long lastUpdateDurationMs)
Sets the duration of last full scanvoid
setLastUpdateTime(Date lastUpdateTime)
Sets the date of last full scanvoid
updateBuildPinned(SBuild build)
Save disk usage data over the pinned buildvoid
updateBuildUnpinned(SBuild build)
Save disk usage data over the unpinned build
-
-
-
Method Detail
-
recalculateAllData
void recalculateAllData(@NotNull UpdateAllProgress progress)
Recalculates all data recursively going to each artifact directory
- Parameters:
progress
- UpdateAllProgress instance that can be used to watch the progress.
-
recalculateData
@NotNull CompositeDiskUsageData recalculateData(@NotNull SBuildType bt)
Recalculates a single build type
- Parameters:
bt
-- Returns:
-
buildArtifactsCleaned
void buildArtifactsCleaned(@NotNull SBuildType buildType, long buildId, boolean wasPinned, boolean allRemoved, boolean noArtifactsLeft, long removedArtifacts, long removedInternalArtifacts, long removedLogs)
Updates data over a build type after partial or full build cleanup. If allRemoved is true (build is completely removed)CompositeDiskUsageData#getBuildsNumber()
will be decreased. If at the same time removedArtifacts is 0 (no own artifacts removed) -CompositeDiskUsageData#getCleanedBuildsNumber()
will be decreased as well. If allRemoved is false while noArtifactsLeft is true and removedArtifacts is positive (any own artifacts removed) -CompositeDiskUsageData#getCleanedBuildsNumber()
will be increased. If wasPinned is true - pinned sizes will be decreased. If allRemoved is true at the same time - the build will be removed from pinned builds list.- Parameters:
buildType
-buildId
-wasPinned
-allRemoved
- should be true if build is removed completely (the whole build artifacts directory is removed)noArtifactsLeft
- should be true if no artifacts left (internal artifacts don't matter)removedArtifacts
-removedInternalArtifacts
-removedLogs
-
-
buildArtifactsCleaned
void buildArtifactsCleaned(@NotNull SBuildType buildType, long buildId, boolean wasPinned, boolean allRemoved, boolean noArtifactsLeft, long removedArtifacts, long removedInternalArtifacts, long removedLogs, @NotNull String storageId)
-
beforeBuildsDeletedFromHistory
void beforeBuildsDeletedFromHistory(List<SFinishedBuild> builds)
This method should be called for builds deleted from history before their cleanup. Pinned builds will be marked as unpinned, builds will be removed from top builds list, total log size and artifacts size would be moved to 'non-builds data'.
- Parameters:
builds
- Cleaned builds
-
junkDeleted
void junkDeleted(@NotNull SBuildType buildType, long totalDeleted, @NotNull String storageId)
Decreases 'non-builds data' for buildType
- Parameters:
buildType
- Build type where junk was cleanedtotalDeleted
- Size of cleaned junkstorageId
-
-
recalculateBuild
void recalculateBuild(@NotNull SBuild build)
Recalculates a single build
- Parameters:
build
-
-
setLastUpdateTime
void setLastUpdateTime(@Nullable Date lastUpdateTime)
Sets the date of last full scan
- Parameters:
lastUpdateTime
-
-
setLastUpdateDuration
void setLastUpdateDuration(long lastUpdateDurationMs)
Sets the duration of last full scan
- Parameters:
lastUpdateTime
-
-
updateBuildPinned
void updateBuildPinned(@NotNull SBuild build)
Save disk usage data over the pinned build
- Parameters:
build
-
-
updateBuildUnpinned
void updateBuildUnpinned(@NotNull SBuild build)
Save disk usage data over the unpinned build
- Parameters:
build
-
-
getVersion
long getVersion(@Nullable SBuildType buildType)
Disk usage data is stored versioned. 0 means data was not collected yet.
- Parameters:
buildType
-- Returns:
- version
-
hasData
boolean hasData(@NotNull SBuildType buildType)
- Parameters:
buildType
-- Returns:
- true if there is any saved data over provided buildType
-
recalculateProject
void recalculateProject(@NotNull SProject project)
-
-