func (r *clientRPC) Get(conn io.Writer, req *clientRequest) { var res api.Response kv, err := r.s.Get(req.Key) if err != nil { setError(&res, err) api.Encode(&res, conn) return } res.KV = libkvToKV(kv) api.Encode(&res, conn) }
func (r *clientRPC) AtomicPut(conn io.Writer, req *clientRequest) { var res api.Response ok, kv, err := r.s.AtomicPut(req.Key, req.Value, kvToLibKV(req.Previous), &libkvstore.WriteOptions{TTL: req.TTL}) if err != nil { setError(&res, err) } else { res.Completed = ok res.KV = libkvToKV(kv) } api.NewEncoder(conn).Encode(&res) }