storj/satellite/accounting/bucketstats.go
Michał Niewrzał 27a714e8b0 satellite/accounting/tally: use objects iterator instead metaloop
Bucket tally calculation will be removed from metaloop and will
use metabase objects iterator directly.

At the moment only bucket tally needs objects so it make no sense
to implement separate objects loop.

Change-Id: Iee60059fc8b9a1bf64d01cafe9659b69b0e27eb1
2021-07-20 15:52:18 +00:00

40 lines
759 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
TotalSegments int64
TotalBytes int64
MetadataSize int64
}
// Combine aggregates all the tallies.
func (s *BucketTally) Combine(o *BucketTally) {
s.ObjectCount += o.ObjectCount
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
}