Interface DiskUsagePersister

  • All Known Implementing Classes:
    DiskUsage

    public interface DiskUsagePersister
    Created by Andrey Titov on 01.02.16.
    • 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.
      • 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 cleaned
        totalDeleted - Size of cleaned junk
        storageId -
      • 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)