replicator

package
v0.0.0-...-79ba347 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 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 {
	// contains filtered or unexported fields
}

Task represents group of Replicator task parameters.

func (*Task) SetCopiesNumber

func (t *Task) SetCopiesNumber(v uint32)

SetCopiesNumber sets number of copies to replicate.

func (*Task) SetNodes

func (t *Task) SetNodes(v []netmap.NodeInfo)

SetNodes sets a list of potential object holders.

func (*Task) SetObject

func (t *Task) SetObject(obj *objectSDK.Object)

SetObject sets object to avoid fetching it from the local storage.

func (*Task) SetObjectAddress

func (t *Task) SetObjectAddress(v oid.Address)

SetObjectAddress sets address of local object.

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