store

package
v0.0.0-...-02d37c3 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRaftTCPTransport

func NewRaftTCPTransport(raftBindAddr string, log io.Writer) (*raft.NetworkTransport, error)

Types

type NodeFSM

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

Node State Machine

func NewNodeFSM

func NewNodeFSM() *NodeFSM

func (*NodeFSM) Apply

func (fsm *NodeFSM) Apply(l *raft.Log) interface{}

Apply applies a Raft log entry to the key-value store.

func (*NodeFSM) Restore

func (f *NodeFSM) Restore(rc io.ReadCloser) error

Restore stores the key-value store to a previous state.

func (*NodeFSM) Snapshot

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

Snapshot returns a snapshot of the key-value store.

type Store

type Store struct {
	RaftDir  string
	RaftAddr string
	// contains filtered or unexported fields
}

func NewStore

func NewStore(nodeConfig *config.NodeConfig) (*Store, error)

TODO: rename func NewStore(raftDir, raftBindAddr string) (*Store, error) {

func (*Store) Join

func (s *Store) Join(nodeID, addr string) error

Join joins a node, identified by nodeID and located at addr, to this store. The node must be ready to respond to Raft communications at that address.

func (*Store) Open

func (store *Store) Open(bootstrap bool, localNodeID string) error

Jump to

Keyboard shortcuts

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