replicator

package
v0.0.0-...-0d89867 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotLeader = fmt.Errorf("not leader")

ErrNotLeader represents this node is not leader

Functions

This section is empty.

Types

type Replicator

type Replicator interface {
	Join(nodeID, addr string) error
	Propose(command *models.Command) error
	GetSnapshot() (store.Snapshot, error)
	IsLeader() bool
	Leader() string
	LeaderCh() <-chan bool
	Start(string, bool) error
}

Replicator is storage engine replicated by raft algorithm

func NewReplicator

func NewReplicator(
	store store.Store,
	snapshotStore snapshotstore.SnapshotStore,
	transport transport.Transport,
	logStore logstore.LogStore,
	stableStore stablestore.StableStore,
	serializer serializer.Serializer,
	snapshotter snapshotter.Snapshotter,
	handler handler.Handler,
	logger logger.Logger,
) (Replicator, error)

NewReplicator returns replicator implementation

Jump to

Keyboard shortcuts

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