Class DiskUsage

    • Field Detail

      • TC_PROPERTY_HUGE_LOG_SIZE_ALERT_LEVEL

        public static final String TC_PROPERTY_HUGE_LOG_SIZE_ALERT_LEVEL
        See Also:
        Constant Field Values
      • FREE_SPACE_CALCULATOR_INCLUDE_EXTERNAL_STORAGES_PROPERTY

        public static final String FREE_SPACE_CALCULATOR_INCLUDE_EXTERNAL_STORAGES_PROPERTY
        See Also:
        Constant Field Values
    • Method Detail

      • isBuildLogSizeHuge

        public static boolean isBuildLogSizeHuge​(long estimateSize)
      • getSizeThreshold

        public static long getSizeThreshold()
      • isDiskUsageEnabled

        public static boolean isDiskUsageEnabled()
      • peekRows

        @NotNull
        public Map<SProject,​DiskUsageProjectRow> peekRows​(@NotNull
                                                                Collection<SProject> project)
        Description copied from interface: DiskUsageViewer

        This method peeks collected data for a number of projects wrapping data objects to DiskUsageProjectRow instances. As peek method it doesn't recalculate missing data.

        Specified by:
        peekRows in interface DiskUsageViewer
        Parameters:
        project - projects to collect rows
        Returns:
        map of packed rows.
      • isProjectDiskUsageUsed

        public static boolean isProjectDiskUsageUsed()
      • recalculateAllData

        public void recalculateAllData​(@NotNull
                                       UpdateAllProgress progress)

        Recalculates all data recursively going to each artifact directory

        Specified by:
        recalculateAllData in interface DiskUsagePersister
        Parameters:
        progress - UpdateAllProgress instance that can be used to watch the progress.
      • getData

        @NotNull
        public CompositeDiskUsageData getData​(@NotNull
                                              SBuildType bt)

        Disk usage data is stored in cache so it could be outdated. Use recalculateData or DiskUsageTaskExecutor to update values. Disk usage data will be calculated in this method if data was not collected yet. Use peekData to avoid blocking.

        Parameters:
        bt - Build type to collect disk usage data for
        Returns:
        disk usage data over one BuildType
      • getData

        @NotNull
        public List<CompositeDiskUsageData> getData​(@NotNull
                                                    SProject project)

        Disk usage data is stored in cache so it could be outdated. Use recalculateData or DiskUsageTaskExecutor to update values. Disk usage data will be calculated in this method if data was not collected yet. Use peekData to avoid blocking.

        Parameters:
        project - Project to collect usage data in
        Returns:
        disk usage data over all configurations in specified project
      • peekData

        @NotNull
        public CompositeDiskUsageData peekData​(@NotNull
                                               SBuildType bt)
        Description copied from interface: DiskUsageViewer

        Disk usage data is stored in cache so it could be outdated. Use recalculateData or DiskUsageTaskExecutor to update values.

        This method doesn't calculate data when it's not available

        Specified by:
        peekData in interface DiskUsageViewer
        Parameters:
        bt - Build type to collect disk usage data for
        Returns:
        disk usage data over one BuildType
      • hasData

        public boolean hasData​(@NotNull
                               SBuildType bt)
        Specified by:
        hasData in interface DiskUsagePersister
        Returns:
        true if there is any saved data over provided buildType
      • peekData

        @NotNull
        public List<CompositeDiskUsageData> peekData​(@NotNull
                                                     SProject project)
        Description copied from interface: DiskUsageViewer

        Disk usage data is stored in cache so it could be outdated. Use recalculateData or DiskUsageTaskExecutor to update values.

        This method doesn't calculate data when it's not available

        Specified by:
        peekData in interface DiskUsageViewer
        Parameters:
        project - Project to collect usage data in
        Returns:
        disk usage data over all configurations in specified project
      • peekRows

        @NotNull
        public List<DiskUsageRow> peekRows​(@NotNull
                                           SProject project)
        Description copied from interface: DiskUsageViewer

        This method peeks collected data for a project wrapping data objects to DiskUsageRow instances. As peek method it doesn't recalculate missing data.

        Specified by:
        peekRows in interface DiskUsageViewer
        Parameters:
        project - project to collect rows
        Returns:
        list of packed rows.
      • peekRow

        @Nullable
        public DiskUsageRow peekRow​(@NotNull
                                    SBuildType bt)
        Description copied from interface: DiskUsageViewer

        This method peeks collected data for a build type wrapping data objects to DiskUsageRow instances. As peek method it doesn't recalculate missing data.

        Specified by:
        peekRow in interface DiskUsageViewer
        Parameters:
        bt - build configuration to collect rows
        Returns:
        packed row
      • getDataWithSubprojects

        @NotNull
        public List<CompositeDiskUsageData> getDataWithSubprojects​(@Nullable
                                                                   SProject project)

        The method calculates disk usage data for all subproject of a given SProject including itself.

        Disk usage data is stored in cache so it could be outdated. Use recalculateData or DiskUsageTaskExecutor to update values.

        Parameters:
        project - Project to collect disk usage data from. Root project will be used if null.
        Returns:
        CompositeDiskUsageData instances including the ones for project and for all in't ancestors
      • buildArtifactsCleaned

        public void buildArtifactsCleaned​(@NotNull
                                          SBuildType buildType,
                                          long buildId,
                                          boolean wasPinned,
                                          boolean noArtifactsLeft,
                                          boolean allRemoved,
                                          long removedArtifacts,
                                          long removedInternalArtifacts,
                                          long removedLogs)
        Description copied from interface: DiskUsagePersister
        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.
        Specified by:
        buildArtifactsCleaned in interface DiskUsagePersister
        noArtifactsLeft - should be true if build is removed completely (the whole build artifacts directory is removed)
        allRemoved - should be true if no artifacts left (internal artifacts don't matter)
      • buildArtifactsCleaned

        public void buildArtifactsCleaned​(@NotNull
                                          SBuildType buildType,
                                          long buildId,
                                          boolean wasPinned,
                                          boolean noArtifactsLeft,
                                          boolean allRemoved,
                                          long removedArtifacts,
                                          long removedInternalArtifacts,
                                          long removedLogs,
                                          @NotNull
                                          String storageId)
        Specified by:
        buildArtifactsCleaned in interface DiskUsagePersister
      • beforeBuildsDeletedFromHistory

        public void beforeBuildsDeletedFromHistory​(List<SFinishedBuild> builds)
        Description copied from interface: DiskUsagePersister

        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'.

        Specified by:
        beforeBuildsDeletedFromHistory in interface DiskUsagePersister
        Parameters:
        builds - Cleaned builds
      • junkDeleted

        public void junkDeleted​(@NotNull
                                SBuildType buildType,
                                long totalDeleted,
                                @NotNull
                                String storageId)
        Description copied from interface: DiskUsagePersister

        Decreases 'non-builds data' for buildType

        Specified by:
        junkDeleted in interface DiskUsagePersister
        Parameters:
        buildType - Build type where junk was cleaned
        totalDeleted - Size of cleaned junk
      • getPinnedArtifactsSize

        public long getPinnedArtifactsSize()
        Specified by:
        getPinnedArtifactsSize in interface DiskUsageViewer
        Returns:
        size of all artifacts in found pinned builds
      • getPinnedLogsSize

        public long getPinnedLogsSize()
        Specified by:
        getPinnedLogsSize in interface DiskUsageViewer
        Returns:
        size of all logs in found pinned builds
      • getPinnedBuildsSize

        public long getPinnedBuildsSize​(@NotNull
                                        SBuildType buildType)
        Specified by:
        getPinnedBuildsSize in interface DiskUsageViewer
        Returns:
        total size of artifacts and logs in found pinned builds of specified BuildType
      • getPinnedBuildsLogsSize

        public long getPinnedBuildsLogsSize​(@NotNull
                                            SBuildType buildType)
        Specified by:
        getPinnedBuildsLogsSize in interface DiskUsageViewer
        Returns:
        total size of logs in found pinned builds of specified BuildType