nodetally

package
v1.74.1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Error is a standard error class for this package.

Functions

This section is empty.

Types

type Observer

type Observer struct {
	Node map[storj.NodeID]float64
	// contains filtered or unexported fields
}

Observer observes metainfo and adds up tallies for nodes and buckets.

func NewObserver

func NewObserver(log *zap.Logger, now time.Time) *Observer

NewObserver returns an segment loop observer that adds up totals for nodes.

func (*Observer) InlineSegment

func (observer *Observer) InlineSegment(ctx context.Context, segment *segmentloop.Segment) (err error)

InlineSegment is called for each inline segment.

func (*Observer) LoopStarted

func (observer *Observer) LoopStarted(context.Context, segmentloop.LoopInfo) (err error)

LoopStarted is called at each start of a loop.

func (*Observer) RemoteSegment

func (observer *Observer) RemoteSegment(ctx context.Context, segment *segmentloop.Segment) error

RemoteSegment is called for each remote segment.

type RangedLoopObserver added in v1.71.1

type RangedLoopObserver struct {
	Node map[storj.NodeID]float64
	// contains filtered or unexported fields
}

RangedLoopObserver implements node tally ranged loop observer.

func NewRangedLoopObserver added in v1.71.1

func NewRangedLoopObserver(log *zap.Logger, accounting accounting.StoragenodeAccounting) *RangedLoopObserver

NewRangedLoopObserver creates new RangedLoopObserver.

func (*RangedLoopObserver) Finish added in v1.71.1

func (observer *RangedLoopObserver) Finish(ctx context.Context) (err error)

Finish calculates byte*hours from per node storage usage and save tallies to DB.

func (*RangedLoopObserver) Fork added in v1.71.1

func (observer *RangedLoopObserver) Fork(ctx context.Context) (_ rangedloop.Partial, err error)

Fork forks new node tally ranged loop partial.

func (*RangedLoopObserver) Join added in v1.71.1

func (observer *RangedLoopObserver) Join(ctx context.Context, partial rangedloop.Partial) (err error)

Join joins node tally ranged loop partial to main observer updating main per node usage map.

func (*RangedLoopObserver) SetNow added in v1.71.1

func (observer *RangedLoopObserver) SetNow(nowFn func() time.Time)

SetNow overrides the timestamp used to store the result.

func (*RangedLoopObserver) Start added in v1.71.1

func (observer *RangedLoopObserver) Start(ctx context.Context, time time.Time) (err error)

Start implements ranged loop observer start method.

type RangedLoopPartial added in v1.71.1

type RangedLoopPartial struct {
	Node map[storj.NodeID]float64
	// contains filtered or unexported fields
}

RangedLoopPartial implements node tally ranged loop partial.

func NewRangedLoopPartial added in v1.71.1

func NewRangedLoopPartial(log *zap.Logger, nowFn func() time.Time) *RangedLoopPartial

NewRangedLoopPartial creates new node tally ranged loop partial.

func (*RangedLoopPartial) Process added in v1.71.1

func (partial *RangedLoopPartial) Process(ctx context.Context, segments []segmentloop.Segment) error

Process iterates over segment range updating partial node usage map.

type Service

type Service struct {
	Loop *sync2.Cycle
	// contains filtered or unexported fields
}

Service is the tally service for data stored on each storage node.

architecture: Chore

func New

New creates a new node tally Service.

func (*Service) Close

func (service *Service) Close() error

Close stops the service and releases any resources.

func (*Service) Run

func (service *Service) Run(ctx context.Context) (err error)

Run the node tally service loop.

func (*Service) SetNow

func (service *Service) SetNow(now func() time.Time)

SetNow allows tests to have the Service act as if the current time is whatever they want. This avoids races and sleeping, making tests more reliable and efficient.

func (*Service) Tally

func (service *Service) Tally(ctx context.Context) (err error)

Tally calculates data-at-rest usage once.

Jump to

Keyboard shortcuts

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