consensus

package
v0.0.0-...-b631e0d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

func Config(num int)

Config creates num in-memory raft nodes and connects them

func Handler

func Handler(w http.ResponseWriter, r *http.Request)

Handler grabs the get param ?next= and tries to transition to the state contained there

Types

type FSM

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

FSM implements the raft FSM interface and holds a state

func NewFSM

func NewFSM() *FSM

NewFSM creates a new FSM with start state of "first"

func (*FSM) Apply

func (f *FSM) Apply(r *raft.Log) interface{}

Apply updates our FSM

func (*FSM) Restore

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

Restore needed to satisfy the raft FSM interface

func (*FSM) Snapshot

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

Snapshot needed to satisfy the raft FSM interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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