replicator

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricsRegister added in v0.37.0

type MetricsRegister interface {
	IncInFlightRequest()
	DecInFlightRequest()
	IncProcessedObjects()
	AddPayloadSize(size int64)
}

type Option

type Option func(*cfg)

Option is an option for Policer constructor.

func WithLocalStorage

func WithLocalStorage(v *engine.StorageEngine) Option

WithLocalStorage returns option to set local object storage of Replicator.

func WithLogger

func WithLogger(v *logger.Logger) Option

WithLogger returns option to set Logger of Replicator.

func WithMetrics added in v0.37.0

func WithMetrics(v MetricsRegister) Option

func WithPutTimeout

func WithPutTimeout(v time.Duration) Option

WithPutTimeout returns option to set Put timeout of Replicator.

func WithRemoteSender

func WithRemoteSender(v *putsvc.RemoteSender) Option

WithRemoteSender returns option to set remote object sender of Replicator.

type Replicator

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

Replicator represents the utility that replicates local objects to remote nodes.

func New

func New(opts ...Option) *Replicator

New creates, initializes and returns Replicator instance.

func (*Replicator) HandleTask

func (p *Replicator) HandleTask(ctx context.Context, task Task, res TaskResult)

HandleTask executes replication task inside invoking goroutine. Passes all the nodes that accepted the replication to the TaskResult.

type Task

type Task struct {
	// NumCopies is the number of copies to replicate.
	NumCopies uint32
	// Addr is the address of the local object.
	Addr oid.Address
	// Obj is the object to avoid fetching it from the local storage.
	Obj *objectSDK.Object
	// Nodes is a list of potential object holders.
	Nodes []netmap.NodeInfo
}

Task represents group of Replicator task parameters.

type TaskResult

type TaskResult interface {
	// SubmitSuccessfulReplication submits the successful object replication
	// to the given node.
	SubmitSuccessfulReplication(netmap.NodeInfo)
}

TaskResult is a replication result interface.

Jump to

Keyboard shortcuts

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