2019-01-24 20:15:10 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
2018-12-12 21:24:08 +00:00
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package accounting
|
|
|
|
|
2019-01-17 18:34:13 +00:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2020-12-21 17:27:12 +00:00
|
|
|
"github.com/zeebo/errs"
|
|
|
|
|
2019-12-27 11:48:47 +00:00
|
|
|
"storj.io/common/storj"
|
2019-01-17 18:34:13 +00:00
|
|
|
)
|
2019-01-10 11:41:57 +00:00
|
|
|
|
2020-07-16 15:18:02 +01:00
|
|
|
// Constants for accounting_raw, accounting_rollup, and accounting_timestamps.
|
2018-12-12 21:24:08 +00:00
|
|
|
const (
|
2020-08-11 15:50:01 +01:00
|
|
|
// LastAtRestTally represents the accounting timestamp for the at-rest data calculation.
|
2018-12-18 17:18:42 +00:00
|
|
|
LastAtRestTally = "LastAtRestTally"
|
2020-08-11 15:50:01 +01:00
|
|
|
// LastBandwidthTally represents the accounting timestamp for the bandwidth allocation query.
|
2018-12-18 17:18:42 +00:00
|
|
|
LastBandwidthTally = "LastBandwidthTally"
|
2020-08-11 15:50:01 +01:00
|
|
|
// LastRollup represents the accounting timestamp for rollup calculations.
|
2019-01-16 19:30:33 +00:00
|
|
|
LastRollup = "LastRollup"
|
2018-12-12 21:24:08 +00:00
|
|
|
)
|
2019-01-17 18:34:13 +00:00
|
|
|
|
2020-12-21 17:27:12 +00:00
|
|
|
var (
|
|
|
|
// ErrInvalidArgument is returned when a function argument has an invalid
|
|
|
|
// business domain value.
|
|
|
|
ErrInvalidArgument = errs.Class("invalid argument")
|
|
|
|
// ErrSystemOrNetError is returned when the used storage backend returns an
|
|
|
|
// internal system or network error.
|
2021-04-28 09:06:17 +01:00
|
|
|
ErrSystemOrNetError = errs.Class("accounting backend")
|
2020-12-21 17:27:12 +00:00
|
|
|
// ErrKeyNotFound is returned when the key is not found in the cache.
|
|
|
|
ErrKeyNotFound = errs.Class("key not found")
|
|
|
|
// ErrUnexpectedValue is returned when an unexpected value according the
|
|
|
|
// business domain is in the cache.
|
|
|
|
ErrUnexpectedValue = errs.Class("unexpected value")
|
|
|
|
)
|
|
|
|
|
2020-07-16 15:18:02 +01:00
|
|
|
// CSVRow represents data from QueryPaymentInfo without exposing dbx.
|
2019-01-17 18:34:13 +00:00
|
|
|
type CSVRow struct {
|
2019-06-21 18:14:53 +01:00
|
|
|
NodeID storj.NodeID
|
|
|
|
NodeCreationDate time.Time
|
|
|
|
AtRestTotal float64
|
|
|
|
GetRepairTotal int64
|
|
|
|
PutRepairTotal int64
|
|
|
|
GetAuditTotal int64
|
|
|
|
PutTotal int64
|
|
|
|
GetTotal int64
|
|
|
|
Wallet string
|
|
|
|
Disqualified *time.Time
|
2019-01-17 18:34:13 +00:00
|
|
|
}
|