func (r *clientRPC) AtomicDelete(conn io.Writer, req *clientRequest) { var res api.Response ok, err := r.s.AtomicDelete(req.Key, kvToLibKV(req.Previous)) if err != nil { setError(&res, err) } res.Completed = ok api.NewEncoder(conn).Encode(&res) }
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) }