raft

package module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

README

raft

GoDoc

a utility wrapper around hashicorp/raft used by graphikDB

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opt

type Opt func(o *Options)

func WithAdvertiseAddr added in v0.0.5

func WithAdvertiseAddr(addr net.Addr) Opt

func WithElectionTimeout added in v0.0.7

func WithElectionTimeout(timeout time.Duration) Opt

func WithHeartbeatTimeout added in v0.0.7

func WithHeartbeatTimeout(timeout time.Duration) Opt

func WithIsLeader

func WithIsLeader(isLeader bool) Opt

func WithMaxPool

func WithMaxPool(max int) Opt

func WithPeerID

func WithPeerID(peerID string) Opt

func WithRaftDir

func WithRaftDir(dir string) Opt

func WithRestoreSnapshotOnRestart

func WithRestoreSnapshotOnRestart(restore bool) Opt

func WithSnapshotRetention

func WithSnapshotRetention(retention int) Opt

func WithTimeout

func WithTimeout(timeout time.Duration) Opt

type Options

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

type Raft

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

func NewRaft

func NewRaft(fsm *fsm.FSM, lis net.Listener, opts ...Opt) (*Raft, error)

func (*Raft) Apply

func (s *Raft) Apply(bits []byte) (interface{}, error)

func (*Raft) Close

func (r *Raft) Close() error

func (*Raft) Join

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

func (*Raft) LeaderAddr

func (s *Raft) LeaderAddr() string

func (*Raft) PeerID

func (r *Raft) PeerID() string

func (*Raft) Servers

func (s *Raft) Servers() ([]raft.Server, error)

func (*Raft) State

func (r *Raft) State() raft.RaftState

func (*Raft) Stats

func (s *Raft) Stats() map[string]string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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