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-14 14:27:21 +00:00
|
|
|
"go.uber.org/zap"
|
2018-12-07 14:46:42 +00:00
|
|
|
)
|
2018-12-05 14:03:23 +00:00
|
|
|
|
2018-12-14 14:27:21 +00:00
|
|
|
//DB is an interface for interacting with accounting stuff
|
|
|
|
type DB interface {
|
|
|
|
// LastGranularTime records the greatest last tallied bandwidth agreement time
|
|
|
|
LastGranularTime(ctx context.Context) (time.Time, bool, error)
|
|
|
|
// SaveGranulars records granular tallies (sums of bw agreement values) to the database
|
|
|
|
// and updates the LastGranularTime
|
|
|
|
SaveGranulars(ctx context.Context, logger *zap.Logger, latestBwa time.Time, bwTotals map[string]int64) error
|
2018-11-26 21:49:55 +00:00
|
|
|
}
|