storj/satellite/accounting/bucketstats.go
Jeremy Wharton d8f64326f5 satellite/accounting/tally: remove objects loop
This change removes the use of the objects loop for calculating bucket
tallies. It has been superseded by a custom query.

Change-Id: I9ea4633006c9af3ea14d7de40871639e7b687c22
2023-05-22 15:18:03 -05:00

37 lines
758 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
}