replicator

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

replicator is a package managing the replication of data among peers

replicator the replication logic for an OrbitDB store

Index

Constants

This section is empty.

Variables

View Source
var Events = []interface{}{
	new(EventLoadEnd),
	new(EventLoadAdded),
	new(EventLoadProgress),
}

Functions

This section is empty.

Types

type EventLoadAdded

type EventLoadAdded struct {
	Entry ipfslog.Entry
	Hash  cid.Cid
}

EventLoadAdded An event triggered when entries have been added

func NewEventLoadAdded

func NewEventLoadAdded(h cid.Cid, entry ipfslog.Entry) EventLoadAdded

NewEventLoadAdded Creates a new EventLoadAdded event

type EventLoadEnd

type EventLoadEnd struct {
	Logs []ipfslog.Log
}

EventLoadEnd An event triggered when load ended

func NewEventLoadEnd

func NewEventLoadEnd(logs []ipfslog.Log) EventLoadEnd

NewEventLoadEnd Creates a new EventLoadEnd event

type EventLoadProgress

type EventLoadProgress struct {
	Entry ipfslog.Entry
}

EventLoadProgress An event triggered when entries have been loaded

func NewEventLoadProgress

func NewEventLoadProgress(entry ipfslog.Entry) EventLoadProgress

NewEventLoadProgress Creates a new EventLoadProgress event

type Options added in v1.4.0

type Options struct {
	Logger   *zap.Logger
	Tracer   trace.Tracer
	EventBus event.Bus
}

type ReplicationInfo

type ReplicationInfo interface {
	// GetProgress Get the value of progress
	GetProgress() int

	// GetProgress Get the value of progress
	SetProgress(i int)

	// GetMax Get the value of max
	GetMax() int

	// SetMax Sets the value of max
	SetMax(i int)

	// Reset Resets all values to 0
	Reset()
}

ReplicationInfo Holds information about the current replication state

func NewReplicationInfo

func NewReplicationInfo() ReplicationInfo

NewReplicationInfo Creates a new ReplicationInfo instance

type Replicator

type Replicator interface {
	// Stop Stops the replication
	Stop()

	// Load Loads new data to replicate
	Load(ctx context.Context, heads []ipfslog.Entry)

	// GetQueue Returns the list of CID in the queue
	GetQueue() []cid.Cid

	EventBus() event.Bus
}

Replicator Replicates stores information among peers

func NewReplicator

func NewReplicator(store storeInterface, concurrency uint, opts *Options) (Replicator, error)

NewReplicator Creates a new Replicator instance

Jump to

Keyboard shortcuts

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