piecemigrate

package
v1.119.4 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chore

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

Chore migrates pieces.

architecture: Chore

func NewChore

func NewChore(log *zap.Logger, config Config, old, new piecestore.PieceBackend) *Chore

NewChore initializes and returns a new Chore instance.

func (*Chore) Close

func (chore *Chore) Close() (err error)

Close shuts down the chore's loop and releases associated resources. Always returns nil.

func (*Chore) Run

func (chore *Chore) Run(ctx context.Context) (err error)

Run starts the chore loop to migrate pieces based on the configuration.

func (*Chore) RunOnce

func (chore *Chore) RunOnce(ctx context.Context) (err error)

RunOnce executes a single iteration of the chore to migrate pieces based on the configuration.

func (*Chore) SetMigrate

func (chore *Chore) SetMigrate(sat storj.NodeID, migrate bool)

SetMigrate enables or disables migration for the given satellite. Adds the satellite to the active set if migrate is true; otherwise, removes it.

func (*Chore) TryMigrateOne

func (chore *Chore) TryMigrateOne(sat storj.NodeID, piece storj.PieceID)

TryMigrateOne enqueues a migration item for the given satellite and piece if the queue has capacity. Fails silently if the queue is full.

type Config

type Config struct {
	BatchSize int           `help:"how many pieces to migrate at once" default:"10000"`
	Interval  time.Duration `help:"how long to wait between the batches" default:"10m"`
}

Config defines the configuration for the chore.

Jump to

Keyboard shortcuts

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