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 String
DATA
static String
PINNED_ARTIFACTS_SIZE
static String
PINNED_BUILD_IDS
static String
PINNED_LOGS_SIZE
static String
UPDATING
-
Constructor Summary
Constructors Constructor Description DiskUsageStoreImpl(CustomDataStorage customDataStorage, String id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DiskUsageData
clear()
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.DiskUsageData
getCurrentDiskUsage()
DiskUsageData
getCurrentOrStoreEmptyDiskUsage()
Creates and stores empty disk usageDiskUsageData
getOrCreateCurrentDiskUsage()
long
getPinnedBuildsArtifactsSize()
long
getPinnedBuildsLogsSize()
int
getPinnedBuildsNumber()
boolean
hasData()
boolean
isUpdating()
boolean
removePinnedBuildIfExists(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 storedDiskUsageData
setCurrentDiskUsage(DiskUsageData currentDiskUsageData)
Sets the current DiskUsageData regardless of currently stored datavoid
setIsUpdating(boolean isUpdating)
Marks that this data is currently updatedboolean
updatePinnedBuildIfNotExists(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:
getCurrentDiskUsage
in interfaceDiskUsageReader
- Returns:
- current disk usage for current holder or null if no data stored
-
hasData
public boolean hasData()
- Specified by:
hasData
in interfaceDiskUsageReader
- Returns:
- true if any data is stored (data could be not validated)
-
isUpdating
public boolean isUpdating()
- Specified by:
isUpdating
in interfaceDiskUsageStore
- Returns:
- true if data is currently updated
-
setIsUpdating
public void setIsUpdating(boolean isUpdating)
Description copied from interface:DiskUsageStore
Marks that this data is currently updated- Specified by:
setIsUpdating
in interfaceDiskUsageStore
-
getOrCreateCurrentDiskUsage
@NotNull public DiskUsageData getOrCreateCurrentDiskUsage()
- Specified by:
getOrCreateCurrentDiskUsage
in interfaceDiskUsageStore
- Returns:
- current disk usage for current holder or new empty DiskUsageData
-
getCurrentOrStoreEmptyDiskUsage
@Nullable public DiskUsageData getCurrentOrStoreEmptyDiskUsage()
Description copied from interface:DiskUsageStore
Creates and stores empty disk usage- Specified by:
getCurrentOrStoreEmptyDiskUsage
in interfaceDiskUsageStore
- Returns:
- previously associated value
-
clear
@Nullable public DiskUsageData clear()
Description copied from interface:DiskUsageStore
Removes all data- Specified by:
clear
in interfaceDiskUsageStore
-
computeIfExists
@NotNull public Pair<DiskUsageData,DiskUsageData> computeIfExists(@NotNull Function<DiskUsageData,DiskUsageData> dataConverter)
Description copied from interface:DiskUsageStore
Calls 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:
computeIfExists
in interfaceDiskUsageStore
-
compute
@NotNull public Pair<DiskUsageData,DiskUsageData> compute(@NotNull Function<DiskUsageData,DiskUsageData> dataConverter)
Description copied from interface:DiskUsageStore
Calls 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:
compute
in interfaceDiskUsageStore
-
setCurrentDiskUsage
@Nullable public DiskUsageData setCurrentDiskUsage(@NotNull DiskUsageData currentDiskUsageData)
Description copied from interface:DiskUsageStore
Sets the current DiskUsageData regardless of currently stored data- Specified by:
setCurrentDiskUsage
in interfaceDiskUsageStore
- Returns:
- previously associated value
-
updatePinnedBuildIfNotExists
public boolean updatePinnedBuildIfNotExists(long buildId, long totalArtifactsDelta, long logsDelta)
Description copied from interface:DiskUsageStore
Applies deltas to currently stored pinned builds data and adds the build to pinned - only if the build wasn't stored yet- Specified by:
updatePinnedBuildIfNotExists
in interfaceDiskUsageStore
-
removePinnedBuildIfExists
public boolean removePinnedBuildIfExists(long buildId, long totalArtifactsDelta, long logsDelta)
Description copied from interface:DiskUsageStore
Applies deltas to currently stored pinned builds data and removes the build from pinned - only if the build is currently stored- Specified by:
removePinnedBuildIfExists
in interfaceDiskUsageStore
-
getPinnedBuildsNumber
public int getPinnedBuildsNumber()
- Specified by:
getPinnedBuildsNumber
in interfaceDiskUsageStore
- Returns:
- the number of stored pinned builds
-
getPinnedBuildsArtifactsSize
public long getPinnedBuildsArtifactsSize()
- Specified by:
getPinnedBuildsArtifactsSize
in interfaceDiskUsageReader
- Returns:
- sum of artifacts size in pinned builds (both internal and external)
-
getPinnedBuildsLogsSize
public long getPinnedBuildsLogsSize()
- Specified by:
getPinnedBuildsLogsSize
in interfaceDiskUsageReader
- Returns:
- sum of logs size in pinned builds
-
-