replicator

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2019 License: Apache-2.0 Imports: 13 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

This section is empty.

Functions

This section is empty.

Types

type EventLoadAdded

type EventLoadAdded struct {
	Hash cid.Cid
}

EventLoadAdded An event triggered when entries have been added

func NewEventLoadAdded

func NewEventLoadAdded(h cid.Cid) *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 {
	ID            string
	Hash          cid.Cid
	Latest        ipfslog.Entry
	UnknownField4 interface{}
	BufferLength  int
}

EventLoadProgress An event triggered when entries have been loaded

func NewEventLoadProgress

func NewEventLoadProgress(id string, h cid.Cid, latest ipfslog.Entry, unknownField4 interface{}, bufferLength int) *EventLoadProgress

NewEventLoadProgress Creates a new EventLoadProgress event

type ReplicationInfo

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

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

	// GetBuffered Get the value of buffered
	GetBuffered() int

	// GetQueued Get the value of queued
	GetQueued() int

	// IncQueued Increments the value of queued
	IncQueued()

	// Reset Resets all values to 0
	Reset()

	// SetProgress Sets the value of progress
	SetProgress(i int)

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

	// DecreaseQueued Decrements the value of queued of i
	DecreaseQueued(i int)

	// SetBuffered Sets the value of buffered
	SetBuffered(i int)
}

ReplicationInfo Holds information about the current replication state

func NewReplicationInfo

func NewReplicationInfo() ReplicationInfo

NewReplicationInfo Creates a new ReplicationInfo instance

type Replicator

type Replicator interface {
	events.EmitterInterface

	// Stop Stops the replication
	Stop()

	// Load Loads new data to replicate
	Load(ctx context.Context, cids []cid.Cid)

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

	// GetBufferLen Gets the length of the buffer
	GetBufferLen() int
}

Replicator Replicates stores information among peers

func NewReplicator

func NewReplicator(ctx context.Context, store storeInterface, concurrency uint) Replicator

NewReplicator Creates a new Replicator instance

Jump to

Keyboard shortcuts

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