piecemigrate

package
v1.125.3 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2025 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend added in v1.120.1

type Backend interface {
	Writer(context.Context, storj.NodeID, storj.PieceID, pb.PieceHashAlgorithm) (*pieces.Writer, error)
	Reader(context.Context, storj.NodeID, storj.PieceID) (*pieces.Reader, error)
	WalkSatellitePieces(context.Context, storj.NodeID, func(pieces.StoredPieceAccess) error) error
	Delete(context.Context, storj.NodeID, storj.PieceID) error
}

Backend is the minimal interface that the old piece backend needs to implement for the migration to work.

TODO(artur): make at least OldPieceBackend implement this interface, or give up and just put the pieces' type for the old backend.

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, store *satstore.SatelliteStore, old Backend, 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 runs the chore.

func (*Chore) SetMigrate

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

SetMigrate enables or disables migration for the given satellite. If migrate is true, adds the satellite with its migration status to the active set; otherwise, removes it.

func (*Chore) Stats added in v1.120.1

func (chore *Chore) Stats(cb func(key monkit.SeriesKey, field string, val float64))

Stats implements monkit.StatSource.

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 {
	BufferSize        int           `help:"how many pieces to buffer" default:"1"`
	Delay             time.Duration `help:"constant delay between migration of two pieces. 0 means no delay" default:"0"`
	Jitter            bool          `help:"whether to add jitter to the delay; has no effect if delay is 0" default:"true"`
	Interval          time.Duration `help:"how long to wait between pooling satellites for active migration" default:"10m"`
	MigrateRegardless bool          `help:"whether to also migrate pieces for satellites outside currently set" default:"false"`
	MigrateExpired    bool          `help:"whether to also migrate expired pieces" default:"true"`
	DeleteExpired     bool          `help:"whether to also delete expired pieces; has no effect if expired are migrated" default:"true"`
}

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
JackTT - Gopher 🇻🇳