storj/satellite/accounting/bucketstats.go
Egon Elbre 267506bb20 satellite/metabase: move package one level higher
metabase has become a central concept and it's more suitable for it to
be directly nested under satellite rather than being part of metainfo.

metainfo is going to be the "endpoint" logic for handling requests.

Change-Id: I53770d6761ac1e9a1283b5aa68f471b21e784198
2021-04-21 15:54:22 +03:00

45 lines
911 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
InlineSegments int64
RemoteSegments int64
InlineBytes int64
RemoteBytes int64
MetadataSize int64
}
// Combine aggregates all the tallies.
func (s *BucketTally) Combine(o *BucketTally) {
s.ObjectCount += o.ObjectCount
s.InlineSegments += o.InlineSegments
s.RemoteSegments += o.RemoteSegments
s.InlineBytes += o.InlineBytes
s.RemoteBytes += o.RemoteBytes
}
// Segments returns total number of segments.
func (s *BucketTally) Segments() int64 {
return s.InlineSegments + s.RemoteSegments
}
// Bytes returns total bytes.
func (s *BucketTally) Bytes() int64 {
return s.InlineBytes + s.RemoteBytes
}