storj/pkg/accounting/db.go
Bill Thorp fb4a11ebb0
Differentiate GET and PUT operations in the tally service (#965)
* draft of new bandwidth agreement types
* updated storagenode report for new types
* use correct pba types
2019-01-10 06:41:57 -05:00

26 lines
821 B
Go

// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
package accounting
import (
"context"
"time"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/storj"
)
//BWTally is a convience alias
type BWTally [pb.PayerBandwidthAllocation_PUT_REPAIR + 1]map[string]int64
// DB stores information about bandwidth usage
type DB interface {
// LastRawTime records the latest last tallied time.
LastRawTime(ctx context.Context, timestampType string) (time.Time, bool, error)
// SaveBWRaw records raw sums of agreement values to the database and updates the LastRawTime.
SaveBWRaw(ctx context.Context, latestBwa time.Time, bwTotals BWTally) error
// SaveAtRestRaw records raw tallies of at-rest-data.
SaveAtRestRaw(ctx context.Context, latestTally time.Time, nodeData map[storj.NodeID]int64) error
}