From 7a83473f00f3169d810ec0a22852c256102bf91e Mon Sep 17 00:00:00 2001 From: Qweder93 Date: Sat, 2 May 2020 20:52:29 +0300 Subject: [PATCH] storagenode/console: API /dashboard disk-space data separated for UsedForPieces, Trash, Available Change-Id: I7411da2c92c72a24af98e007efe476d8a023db82 --- storagenode/console/diskspace.go | 1 + storagenode/console/service.go | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/storagenode/console/diskspace.go b/storagenode/console/diskspace.go index 50fadecf1..577ffc917 100644 --- a/storagenode/console/diskspace.go +++ b/storagenode/console/diskspace.go @@ -7,4 +7,5 @@ package console type DiskSpaceInfo struct { Used int64 `json:"used"` Available int64 `json:"available"` + Trash int64 `json:"trash"` } diff --git a/storagenode/console/service.go b/storagenode/console/service.go index 077aa04ee..cf28d4f36 100644 --- a/storagenode/console/service.go +++ b/storagenode/console/service.go @@ -167,7 +167,12 @@ func (s *Service) GetDashboardData(ctx context.Context) (_ *Dashboard, err error ) } - piecesContentSize, err := s.pieceStore.SpaceUsedForPiecesAndTrash(ctx) + _, piecesContentSize, err := s.pieceStore.SpaceUsedForPieces(ctx) + if err != nil { + return nil, SNOServiceErr.Wrap(err) + } + + trash, err := s.pieceStore.SpaceUsedForTrash(ctx) if err != nil { return nil, SNOServiceErr.Wrap(err) } @@ -180,6 +185,7 @@ func (s *Service) GetDashboardData(ctx context.Context) (_ *Dashboard, err error data.DiskSpace = DiskSpaceInfo{ Used: piecesContentSize, Available: s.allocatedDiskSpace.Int64(), + Trash: trash, } data.Bandwidth = BandwidthInfo{