Class DiskUsageStoreProviderImpl.DiskUsageStoreImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.statistics.diskusage.DiskUsageStoreProviderImpl.DiskUsageStoreImpl
-
- All Implemented Interfaces:
DiskUsageReader,DiskUsageStore
- Enclosing class:
- DiskUsageStoreProviderImpl
public static class DiskUsageStoreProviderImpl.DiskUsageStoreImpl extends Object implements DiskUsageStore
-
-
Field Summary
Fields Modifier and Type Field Description static StringDATAstatic StringPINNED_ARTIFACTS_SIZEstatic StringPINNED_BUILD_IDSstatic StringPINNED_LOGS_SIZEstatic StringUPDATING
-
Constructor Summary
Constructors Constructor Description DiskUsageStoreImpl(CustomDataStorage customDataStorage, String id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DiskUsageDataclear()Removes all dataPair<DiskUsageData,DiskUsageData>compute(Function<DiskUsageData,DiskUsageData> dataConverter)Calls the function and passes current DiskUsageData or null if nothing is stored yet.Pair<DiskUsageData,DiskUsageData>computeIfExists(Function<DiskUsageData,DiskUsageData> dataConverter)Calls the function and passes current DiskUsageData there if data is currently stored.DiskUsageDatagetCurrentDiskUsage()DiskUsageDatagetCurrentOrStoreEmptyDiskUsage()Creates and stores empty disk usageDiskUsageDatagetOrCreateCurrentDiskUsage()longgetPinnedBuildsArtifactsSize()longgetPinnedBuildsLogsSize()intgetPinnedBuildsNumber()booleanhasData()booleanisUpdating()booleanremovePinnedBuildIfExists(long buildId, long totalArtifactsDelta, long logsDelta)Applies deltas to currently stored pinned builds data and removes the build from pinned - only if the build is currently storedDiskUsageDatasetCurrentDiskUsage(DiskUsageData currentDiskUsageData)Sets the current DiskUsageData regardless of currently stored datavoidsetIsUpdating(boolean isUpdating)Marks that this data is currently updatedbooleanupdatePinnedBuildIfNotExists(long buildId, long totalArtifactsDelta, long logsDelta)Applies deltas to currently stored pinned builds data and adds the build to pinned - only if the build wasn't stored yet
-
-
-
Field Detail
-
DATA
@NotNull public static final String DATA
- See Also:
- Constant Field Values
-
UPDATING
@NotNull public static final String UPDATING
- See Also:
- Constant Field Values
-
PINNED_BUILD_IDS
@NotNull public static final String PINNED_BUILD_IDS
- See Also:
- Constant Field Values
-
PINNED_ARTIFACTS_SIZE
@NotNull public static final String PINNED_ARTIFACTS_SIZE
- See Also:
- Constant Field Values
-
PINNED_LOGS_SIZE
@NotNull public static final String PINNED_LOGS_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DiskUsageStoreImpl
public DiskUsageStoreImpl(@NotNull CustomDataStorage customDataStorage, @NotNull String id)
-
-
Method Detail
-
getCurrentDiskUsage
@Nullable public DiskUsageData getCurrentDiskUsage()
- Specified by:
getCurrentDiskUsagein interfaceDiskUsageReader- Returns:
- current disk usage for current holder or null if no data stored
-
hasData
public boolean hasData()
- Specified by:
hasDatain interfaceDiskUsageReader- Returns:
- true if any data is stored (data could be not validated)
-
isUpdating
public boolean isUpdating()
- Specified by:
isUpdatingin interfaceDiskUsageStore- Returns:
- true if data is currently updated
-
setIsUpdating
public void setIsUpdating(boolean isUpdating)
Description copied from interface:DiskUsageStoreMarks that this data is currently updated- Specified by:
setIsUpdatingin interfaceDiskUsageStore
-
getOrCreateCurrentDiskUsage
@NotNull public DiskUsageData getOrCreateCurrentDiskUsage()
- Specified by:
getOrCreateCurrentDiskUsagein interfaceDiskUsageStore- Returns:
- current disk usage for current holder or new empty DiskUsageData
-
getCurrentOrStoreEmptyDiskUsage
@Nullable public DiskUsageData getCurrentOrStoreEmptyDiskUsage()
Description copied from interface:DiskUsageStoreCreates and stores empty disk usage- Specified by:
getCurrentOrStoreEmptyDiskUsagein interfaceDiskUsageStore- Returns:
- previously associated value
-
clear
@Nullable public DiskUsageData clear()
Description copied from interface:DiskUsageStoreRemoves all data- Specified by:
clearin interfaceDiskUsageStore
-
computeIfExists
@NotNull public Pair<DiskUsageData,DiskUsageData> computeIfExists(@NotNull Function<DiskUsageData,DiskUsageData> dataConverter)
Description copied from interface:DiskUsageStoreCalls the function and passes current DiskUsageData there if data is currently stored. Function is not called if no data is currently stored. Object returned from the function will be stored back, data won't be changed otherwise. Update status is set during function call.- Specified by:
computeIfExistsin interfaceDiskUsageStore
-
compute
@NotNull public Pair<DiskUsageData,DiskUsageData> compute(@NotNull Function<DiskUsageData,DiskUsageData> dataConverter)
Description copied from interface:DiskUsageStoreCalls the function and passes current DiskUsageData or null if nothing is stored yet. Object returned from the function will be stored back, data won't be changed otherwise. Update status is set during function call.- Specified by:
computein interfaceDiskUsageStore
-
setCurrentDiskUsage
@Nullable public DiskUsageData setCurrentDiskUsage(@NotNull DiskUsageData currentDiskUsageData)
Description copied from interface:DiskUsageStoreSets the current DiskUsageData regardless of currently stored data- Specified by:
setCurrentDiskUsagein interfaceDiskUsageStore- Returns:
- previously associated value
-
updatePinnedBuildIfNotExists
public boolean updatePinnedBuildIfNotExists(long buildId, long totalArtifactsDelta, long logsDelta)Description copied from interface:DiskUsageStoreApplies deltas to currently stored pinned builds data and adds the build to pinned - only if the build wasn't stored yet- Specified by:
updatePinnedBuildIfNotExistsin interfaceDiskUsageStore
-
removePinnedBuildIfExists
public boolean removePinnedBuildIfExists(long buildId, long totalArtifactsDelta, long logsDelta)Description copied from interface:DiskUsageStoreApplies deltas to currently stored pinned builds data and removes the build from pinned - only if the build is currently stored- Specified by:
removePinnedBuildIfExistsin interfaceDiskUsageStore
-
getPinnedBuildsNumber
public int getPinnedBuildsNumber()
- Specified by:
getPinnedBuildsNumberin interfaceDiskUsageStore- Returns:
- the number of stored pinned builds
-
getPinnedBuildsArtifactsSize
public long getPinnedBuildsArtifactsSize()
- Specified by:
getPinnedBuildsArtifactsSizein interfaceDiskUsageReader- Returns:
- sum of artifacts size in pinned builds (both internal and external)
-
getPinnedBuildsLogsSize
public long getPinnedBuildsLogsSize()
- Specified by:
getPinnedBuildsLogsSizein interfaceDiskUsageReader- Returns:
- sum of logs size in pinned builds
-
-