// Send all commited information to new node func (pn *paxosNode) RecvReplaceCatchup(args *paxosrpc.ReplaceCatchupArgs, reply *paxosrpc.ReplaceCatchupReply) error { pn.storage.storageLock.Lock() defer pn.storage.storageLock.Unlock() jsonMap, _ := json.Marshal(pn.storage.storage) reply.Data = jsonMap return nil }
func (pn *paxosNode) RecvReplaceCatchup(args *paxosrpc.ReplaceCatchupArgs, reply *paxosrpc.ReplaceCatchupReply) error { data, err := json.Marshal(pn.keyValue) if err == nil { reply.Data = data } return nil }
// Request the value that was agreed upon for a particular round. A node // receiving this message should reply with the data (as an array of bytes) // needed to make the replacement server aware of the keys and values // committed so far. func (pn *paxosNode) RecvReplaceCatchup(args *paxosrpc.ReplaceCatchupArgs, reply *paxosrpc.ReplaceCatchupReply) error { var network bytes.Buffer // Stand-in for the network. // Create an encoder and send a value. enc := gob.NewEncoder(&network) err := enc.Encode(pn.instances) if err != nil { } reply.Data = network.Bytes() return nil }
func (pn *paxosNode) RecvReplaceCatchup(args *paxosrpc.ReplaceCatchupArgs, reply *paxosrpc.ReplaceCatchupReply) error { var network bytes.Buffer enc := gob.NewEncoder(&network) err := enc.Encode(pn.storage) if err != nil { return err } reply.Data = network.Bytes() return nil }
// receive replace cat chup request func (pn *paxosNode) RecvReplaceCatchup(args *paxosrpc.ReplaceCatchupArgs, reply *paxosrpc.ReplaceCatchupReply) error { value, _ := json.Marshal(pn.valueMap) reply.Data = value return nil }