Documentation ¶
Index ¶
- Constants
- func CheckGet(where string, db *leveldb.DB, roptions *leveldb.ReadOptions, ...) bool
- func Close(rserver *rServer)
- func Exists(pid int, debug bool) bool
- func New(id int, config string, debug bool) *rServer
- func Restart(id int, config string, rserver *rServer, debug bool) *rServer
- type AppendEntries
- type AppendEntriesStatus
- type ElectionStatusMessage
- type KVCommand
- type LogEntry
- type RaftServer
- type ReadRequest
- type RequestVote
Constants ¶
View Source
const ( DEFAULT_TERM = 0 FOLLOWER = 1 LEADER = 2 CANDIDATE = 3 EXIT = 4 INVALID_INDEX = 0 // Command GET = 0 PUT = 1 DEL = 2 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AppendEntries ¶
type AppendEntriesStatus ¶
type ElectionStatusMessage ¶
type LogEntry ¶
type LogEntry struct { // An index into an abstract 2^64 size array Index int64 // The data that was supplied to raft's inbox Command interface{} }
Identifies an entry in the log
type RaftServer ¶
type RaftServer interface { Term() int IsLeader() bool // Mailbox for state machine layer above to send commands of any // kind, and to have them replicated by raft. If the server is not // the leader, the message will be silently dropped. Outbox() chan<- interface{} // Mailbox for state machine layer above to receive commands. These // are guaranteed to have been replicated on a majority Inbox() <-chan *LogEntry // Remove items from 0 .. index (inclusive), and reclaim disk // space. This is a hint, and there's no guarantee of immediacy since // there may be some servers that are lagging behind). DiscardUpto(index int64) // get the state machine of the server Store() map[string]interface{} }
Click to show internal directories.
Click to hide internal directories.