piecetracker

package
v1.113.2 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: AGPL-3.0 Imports: 10 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"`
	UpdateBatchSize int  `help:"batch size for updating nodes with number of pieces" default:"1000"`
}

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