tally

package
v0.8.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2019 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Error = errs.Class("tally error")
)

Error is a standard error class for this package.

Functions

This section is empty.

Types

type Config

type Config struct {
	Interval time.Duration `help:"how frequently tally should run" default:"1h" devDefault:"30s"`
}

Config contains configurable values for tally

type Tally

type Tally struct {
	// contains filtered or unexported fields
}

Tally is the service for accounting for data stored on each storage node

func New

func New(logger *zap.Logger, accountingDB accounting.DB, bwAgreementDB bwagreement.DB, pointerdb *pointerdb.Service, overlay *overlay.Cache, limit int, interval time.Duration) *Tally

New creates a new Tally

func (*Tally) QueryBW

func (t *Tally) QueryBW(ctx context.Context) (time.Time, map[storj.NodeID][]int64, error)

QueryBW queries bandwidth allocation database, selecting all new contracts since the last collection run time. Grouping by action type, storage node ID and adding total of bandwidth to granular data table.

func (*Tally) Run

func (t *Tally) Run(ctx context.Context) (err error)

Run the Tally loop

func (*Tally) SaveAtRestRaw

func (t *Tally) SaveAtRestRaw(ctx context.Context, latestTally time.Time, created time.Time, nodeData map[storj.NodeID]float64) error

SaveAtRestRaw records raw tallies of at-rest-data and updates the LastTimestamp

func (*Tally) SaveBWRaw

func (t *Tally) SaveBWRaw(ctx context.Context, tallyEnd time.Time, created time.Time, bwTotals map[storj.NodeID][]int64) error

SaveBWRaw records granular tallies (sums of bw agreement values) to the database and updates the LastTimestamp

func (*Tally) Tally

func (t *Tally) Tally(ctx context.Context) error

Tally calculates data-at-rest and bandwidth usage once

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL