Documentation ¶
Index ¶
- Constants
- func DPrintf(format string, a ...interface{}) (n int, err error)
- type AppendEntriesArgs
- type AppendEntriesReply
- type ApplyMsg
- type InstallSnapshotArgs
- type InstallSnapshotReply
- 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
- func (rf *Raft) AppendEntries(args AppendEntriesArgs, reply *AppendEntriesReply)
- func (rf *Raft) GetPerisistSize() int
- func (rf *Raft) GetState() (int, bool)
- func (rf *Raft) GetState2() int
- func (rf *Raft) InstallSnapshot(args InstallSnapshotArgs, reply *InstallSnapshotReply)
- func (rf *Raft) Kill()
- func (rf *Raft) RequestVote(args RequestVoteArgs, reply *RequestVoteReply)
- func (rf *Raft) Start(command interface{}) (int, int, bool)
- func (rf *Raft) StartSnapshot(snapshot []byte, index int)
- type RequestVoteArgs
- type RequestVoteReply
Constants ¶
View Source
const ( Leader = iota Candidate Follower HBINTERVAL = 50 * time.Millisecond // 50ms )
View Source
const Debug = 0
Debugging
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AppendEntriesArgs ¶
type AppendEntriesReply ¶
type InstallSnapshotArgs ¶
type InstallSnapshotReply ¶
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
}
func (*Raft) AppendEntries ¶
func (rf *Raft) AppendEntries(args AppendEntriesArgs, reply *AppendEntriesReply)
func (*Raft) GetPerisistSize ¶
func (*Raft) InstallSnapshot ¶
func (rf *Raft) InstallSnapshot(args InstallSnapshotArgs, reply *InstallSnapshotReply)
func (*Raft) RequestVote ¶
func (rf *Raft) RequestVote(args RequestVoteArgs, reply *RequestVoteReply)
func (*Raft) StartSnapshot ¶
type RequestVoteArgs ¶
type RequestVoteReply ¶
Click to show internal directories.
Click to hide internal directories.