raft

package
v0.0.0-...-77adb20 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSM

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

FSM wraps a state object and implements the Raft FSM interface

func NewFSM

func NewFSM(state *state.State, logger *logrus.Entry) *FSM

NewFSM returns a new FSM

func (*FSM) Apply

func (f *FSM) Apply(log *_raft.Log) interface{}

Apply is invoked once a log entry is committed. It applies the log data to the state as a transaction.

func (*FSM) Restore

func (f *FSM) Restore(io.ReadCloser) error

Restore is not implemented yet

func (*FSM) Snapshot

func (f *FSM) Snapshot() (_raft.FSMSnapshot, error)

Snapshot is not implemented yet

type Raft

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

Raft implements the Consensus interface. It uses Hashicorp Raft

func NewRaft

func NewRaft(config config.RaftConfig, logger *logrus.Logger) *Raft

NewRaft returns a new Raft object

func (*Raft) Info

func (r *Raft) Info() (map[string]string, error)

Info returns Raft stats

func (*Raft) Init

func (r *Raft) Init(state *state.State, service *service.Service) error

Init instantiates a Raft

func (*Raft) Run

func (r *Raft) Run() error

Run starts the Raft node and service

Jump to

Keyboard shortcuts

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