Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddServerReq ¶
type AddServerReq struct {
Endpoint string
}
type KV ¶
KV structure that holds Raft instance
func StartKVServer ¶
func StartKVServer(servers []*rpc.Client, me int, persister *raft.Persister, maxraftstate int, e *echo.Echo) *KV
StartKVServer return a RaftKV servers[] contains the ports of the set of servers that will cooperate via Raft to form the fault-tolerant key/value service. me is the index of the current server in servers[]. the k/v server should store snapshots with persister.SaveSnapshot(), and Raft should save its state (including log) with persister.SaveRaftState(). the k/v server should snapshot when Raft's saved state exceeds maxraftstate bytes, in order to allow Raft to garbage-collect its log. if maxraftstate is -1, you don't need to snapshot. StartKVServer() must return quickly, so it should start goroutines for any long-running work.
func (*KV) AddPeer ¶
func (kv *KV) AddPeer(args *AddPeerArgs, reply *AddPeerReply) error
func (*KV) AppendEntry ¶
AppendEntry appends an entry Op and returns a boolean
func (*KV) Kill ¶
func (kv *KV) Kill()
Kill is called by the tester when a RaftKV instance won't be needed again. you are not required to do anything in Kill, but it might be convenient to (for example) turn off debug output from this instance.
func (*KV) PutAppend ¶
func (kv *KV) PutAppend(args *PutAppendArgs, reply *PutAppendReply) error
PutAppend RPC
type PutAppendArgs ¶
PutAppendArgs structure for Put or Append Argument
type PutAppendReply ¶
PutAppendReply structure for Put or Append Reply