Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotLeader is returned when a node attempts to execute a leader-only // operation. ErrNotLeader = errors.New("not leader") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Bind string `json:"bind"` DataDir string `json:"data_dir"` Peers string `json:"peers"` }
Config ?
type Election ¶
type Election struct { NodeStatCh chan NodeState OperationCh chan OperationType // contains filtered or unexported fields }
Election leader election with raft
func New ¶
func New(raftBindAddr utils.NetAddr, raftDataDir string, raftPeers utils.NetAddrList, enableSingle bool) *Election
New return an Election instance
func (*Election) RecvOperation ¶
func (p *Election) RecvOperation(op OperationType) error
func (*Election) RemovePeer ¶
func (*Election) TransferLeaderShip ¶
type OperationType ¶
type OperationType int
OperationType for raft peers
const ( // Remove remove raft peer Remove OperationType = iota )
Click to show internal directories.
Click to hide internal directories.