raft

package
v0.0.0-...-d1cd037 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSMSnapshot

type FSMSnapshot struct {
}

func (*FSMSnapshot) Persist

func (f *FSMSnapshot) Persist(sink raft.SnapshotSink) error

func (*FSMSnapshot) Release

func (f *FSMSnapshot) Release()

type OptionFn

type OptionFn func(b *Raft)

func Addr

func Addr(addr string) OptionFn

func Config

func Config(raft *raft.Config) OptionFn

func DataDir

func DataDir(dataDir string) OptionFn

func Logger

func Logger(logger *simplelog.Logger) OptionFn

type Raft

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

Raft manages consensus on Jocko cluster using Hashicorp Raft

func New

func New(opts ...OptionFn) (*Raft, error)

New Raft object

func (*Raft) Addr

func (b *Raft) Addr() string

Addr of raft node

func (*Raft) Apply

func (b *Raft) Apply(cmd jocko.RaftCommand) error

Apply command to all raft nodes

func (*Raft) Bootstrap

func (b *Raft) Bootstrap(serf jocko.Serf, serfEventCh <-chan *jocko.ClusterMember, commandCh chan<- jocko.RaftCommand) (err error)

Bootstrap is used to bootstrap the raft instance. Commands received by raft are sent on commandCh channel.

func (*Raft) IsLeader

func (b *Raft) IsLeader() bool

IsLeader checks if this broker is the cluster controller

func (*Raft) LeaderID

func (b *Raft) LeaderID() string

LeaderID is ID of the controller node

func (*Raft) Shutdown

func (b *Raft) Shutdown() error

Shutdown raft agent

Jump to

Keyboard shortcuts

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