2018-11-26 21:49:55 +00:00
|
|
|
// Copyright (C) 2018 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package accounting
|
|
|
|
|
|
|
|
import (
|
2018-12-12 21:24:08 +00:00
|
|
|
"context"
|
2018-12-14 14:27:21 +00:00
|
|
|
"time"
|
2018-12-12 21:24:08 +00:00
|
|
|
|
2018-12-18 17:18:42 +00:00
|
|
|
"storj.io/storj/pkg/storj"
|
2018-12-07 14:46:42 +00:00
|
|
|
)
|
2018-12-05 14:03:23 +00:00
|
|
|
|
2019-01-02 17:53:27 +00:00
|
|
|
// DB stores information about bandwidth usage
|
2018-12-14 14:27:21 +00:00
|
|
|
type DB interface {
|
2019-01-02 17:53:27 +00:00
|
|
|
// LastRawTime records the latest last tallied time.
|
2018-12-18 17:18:42 +00:00
|
|
|
LastRawTime(ctx context.Context, timestampType string) (time.Time, bool, error)
|
2019-01-02 17:53:27 +00:00
|
|
|
// SaveBWRaw records raw sums of agreement values to the database and updates the LastRawTime.
|
2018-12-18 17:18:42 +00:00
|
|
|
SaveBWRaw(ctx context.Context, latestBwa time.Time, bwTotals map[string]int64) error
|
2019-01-02 17:53:27 +00:00
|
|
|
// SaveAtRestRaw records raw tallies of at-rest-data.
|
2018-12-18 17:18:42 +00:00
|
|
|
SaveAtRestRaw(ctx context.Context, latestTally time.Time, nodeData map[storj.NodeID]int64) error
|
2018-11-26 21:49:55 +00:00
|
|
|
}
|