Documentation
¶
Index ¶
Constants ¶
const ( OK = "OK" ErrNoKey = "ErrNoKey" )
const ( GET = "Get" PUT = "Put" APPEND = "Append" )
const ClerkTimeout = 1 * time.Second
const Debug = 0
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Clerk ¶
type Clerk struct {
// contains filtered or unexported fields
}
func (*Clerk) PutAppend ¶
shared by Put and Append.
you can send an RPC with code like this: ok := ck.servers[i].Call("KVServer.PutAppend", &args, &reply)
the types of args and reply (including whether they are pointers) must match the declared types of the RPC handler function's arguments. and reply must be passed as a pointer.
type ClerkTrackAction ¶
type ClerkTrackAction int
const ( ClerkOK ClerkTrackAction ClerkIgnore ClerkRetry )
type KVRPCCommitItem ¶
type KVRPCCommitItem struct {
// contains filtered or unexported fields
}
type KVRPCIssueItem ¶
type KVRPCIssueItem struct {
// contains filtered or unexported fields
}
type KVServer ¶
type KVServer struct { DB map[string]string ClerkTrack map[int64]int // contains filtered or unexported fields }
func StartKVServer ¶
func StartKVServer(servers []*labrpc.ClientEnd, me int, persister *raft.Persister, maxraftstate int) *KVServer
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 through the underlying Raft implementation, which should call persister.SaveStateAndSnapshot() to atomically save the Raft state along with the snapshot. 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 (*KVServer) Kill ¶
func (kv *KVServer) Kill()
the tester calls Kill() when a KVServer 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 (*KVServer) PutAppend ¶
func (kv *KVServer) PutAppend(args *PutAppendArgs, reply *PutAppendReply)