Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorNotALeader = errors.New("not a leader")
ErrorNotALeader error returned where no server leader
Functions ¶
This section is empty.
Types ¶
type Args ¶
type Args struct {
IsTestMode bool
Logger *logrus.Logger
PstLog wal.Wal
RPCServer rpc.Server
Server *pb.Peer
EventHandler *events.Events
StorageMgr store.Manager
}
Args argument structure for Raft Instance
type CommitEntry ¶
type CommitEntry struct {
// Command is the client command being committed.
Command interface{}
// Index is the log index at which the client command is committed.
Index int64
// Term is the Raft term at which the client command is committed.
Term int64
}
CommitEntry is the data reported by Raft to the commit channel. Each commit entry notifies the client that consensus was reached on a command and it can be applied to the client's state machine.
type Raft ¶
type Raft interface {
Peers() map[string]*pb.Peer
AddPeer(peer *pb.Peer)
State() State
RequestVotes(ctx context.Context, request *pb.VoteRequest) (*pb.VoteReply, error)
RemovePeer(*pb.RemovePeerRequest) error
Start()
Stop()
AppendEntries(ctx context.Context, request *pb.AppendEntryRequest) (*pb.AppendEntryReply, error)
Log() []*pb.WalEntry
SubmitAndWait(interface{}, string, pb.CommandType) error
AddCommandListener(string) error
WaitForCommandCompletion(string) error
Server() *pb.Peer
StorageManager() store.Manager
IsTestMode() bool
EventHandler() *events.Events
//IsRunning for tests
IsRunning() bool
}
Raft raft interface
Click to show internal directories.
Click to hide internal directories.