func (server *gobbyserver) CheckMaster(args *gobbyrpc.CheckArgs, reply *gobbyrpc.GobbyReply) error { if server.leasenode.CheckMaster() { reply.Status = gobbyrpc.OK } else { reply.Status = gobbyrpc.FAIL } return nil }
func (server *gobbyserver) Get(args *gobbyrpc.GetArgs, reply *gobbyrpc.GobbyReply) error { server.lock.Lock() c := &command.Command{ Key: args.Key, Type: command.Get, ID: server.nextCID, } replyCh := make(chan *gobbyrpc.GobbyReply) server.nextCID++ server.replyChs[c.ID] = replyCh server.lock.Unlock() //go server.paxosnode.Replicate(c) server.pending.Enqueue(c) // blocking for reply r := <-replyCh reply.Status = r.Status reply.Value = r.Value return nil }