Documentation ¶
Index ¶
- Constants
- func DPrintf(format string, a ...interface{}) (n int, err error)
- type AppendEntriesArgs
- type AppendEntriesReply
- type ApplyMsg
- type CommandState
- type LogEntry
- type Persister
- func (ps *Persister) Copy() *Persister
- func (ps *Persister) RaftStateSize() int
- func (ps *Persister) ReadRaftState() []byte
- func (ps *Persister) ReadSnapshot() []byte
- func (ps *Persister) SaveRaftState(state []byte)
- func (ps *Persister) SaveStateAndSnapshot(state []byte, snapshot []byte)
- func (ps *Persister) SnapshotSize() int
- type Raft
- type RequestVoteArgs
- type RequestVoteReply
Constants ¶
View Source
const ( FOLLOWER = 0 CANDIDATE = 1 LEADER = 2 CopyEntries = 3 HeartBeat = 4 )
View Source
const Debug = 0
Debugging
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AppendEntriesArgs ¶
type AppendEntriesReply ¶
type CommandState ¶
type Persister ¶
type Persister struct {
// contains filtered or unexported fields
}
func MakePersister ¶
func MakePersister() *Persister
func (*Persister) RaftStateSize ¶
func (*Persister) ReadRaftState ¶
func (*Persister) ReadSnapshot ¶
func (*Persister) SaveRaftState ¶
func (*Persister) SaveStateAndSnapshot ¶
Save both Raft state and K/V snapshot as a single atomic action, to help avoid them getting out of sync.
func (*Persister) SnapshotSize ¶
type Raft ¶
type Raft struct {
// contains filtered or unexported fields
}
A Go object implementing a single Raft peer.
func (*Raft) AppendEntries ¶
func (rf *Raft) AppendEntries(args *AppendEntriesArgs, reply *AppendEntriesReply) error
func (*Raft) RequestVote ¶
func (rf *Raft) RequestVote(args *RequestVoteArgs, reply *RequestVoteReply) error
type RequestVoteArgs ¶
type RequestVoteReply ¶
Click to show internal directories.
Click to hide internal directories.