piecetracker

package
v1.84.0-rc Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Error is a standard error class for this package.
	Error = errs.Class("piecetracker")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	UseRangedLoop bool `help:"whether to enable piece tracker observer with ranged loop" default:"true"`
}

Config is the configuration for the piecetracker.

type Observer

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

Observer implements piecetraker ranged loop observer.

The piecetracker counts the number of pieces currently expected to reside on each node, then passes the counts to the overlay with UpdatePieceCounts().

func NewObserver

func NewObserver(log *zap.Logger, metabaseDB *metabase.DB, overlay overlay.DB, config Config) *Observer

NewObserver creates new piecetracker ranged loop observer.

func (*Observer) Finish

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

Finish updates piece counts in the DB.

func (*Observer) Fork

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

Fork implements ranged loop observer fork method.

func (*Observer) Join

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

Join joins piecetracker ranged loop partial to main observer updating piece counts map.

func (*Observer) Start

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

Start implements ranged loop observer start method.

Jump to

Keyboard shortcuts

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