storj/satellite/accounting/bucketstats.go
Michal Niewrzal aea3baf6a9 satellite/accounting/tally: calculate pending object count
Change-Id: I4ee6072f4c60fafd809e8184ada9c1abf7edd8aa
2023-06-09 10:15:27 +00:00

39 lines
845 B
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package accounting
import (
"storj.io/storj/satellite/metabase"
)
// BucketTally contains information about aggregate data stored in a bucket.
type BucketTally struct {
metabase.BucketLocation
ObjectCount int64
PendingObjectCount int64
TotalSegments int64
TotalBytes int64
MetadataSize int64
}
// Combine aggregates all the tallies.
func (s *BucketTally) Combine(o *BucketTally) {
s.ObjectCount += o.ObjectCount
s.PendingObjectCount += o.PendingObjectCount
s.TotalSegments += o.TotalSegments
s.TotalBytes += o.TotalBytes
}
// Segments returns total number of segments.
func (s *BucketTally) Segments() int64 {
return s.TotalSegments
}
// Bytes returns total bytes.
func (s *BucketTally) Bytes() int64 {
return s.TotalBytes
}