storagenode/console: API /dashboard disk-space data separated for UsedForPieces, Trash, Available

Change-Id: I7411da2c92c72a24af98e007efe476d8a023db82
This commit is contained in:
Qweder93 2020-05-02 20:52:29 +03:00 committed by Nikolai Siedov
parent 16081f53d2
commit 7a83473f00
2 changed files with 8 additions and 1 deletions

View File

@ -7,4 +7,5 @@ package console
type DiskSpaceInfo struct {
Used int64 `json:"used"`
Available int64 `json:"available"`
Trash int64 `json:"trash"`
}

View File

@ -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{