Replace sets the content of a key only if it exists.
(args StorageArgs, resp *struct{})
| 190 | |
| 191 | // Replace sets the content of a key only if it exists. |
| 192 | func (r *rpcServer) Replace(args StorageArgs, resp *struct{}) error { |
| 193 | target := r.targetNode(args.Key, args.ExplicitPeer) |
| 194 | if target != r.n.name { |
| 195 | return r.forward(target, "Node.Replace", args, resp) |
| 196 | } |
| 197 | |
| 198 | if err := r.n.data.Replace(args.Key, args.Value, args.Exp, args.Flags); err != nil { |
| 199 | return err |
| 200 | } |
| 201 | |
| 202 | r.n.replicator.MarkDirty(args.Key) |
| 203 | r.markClientVersion(args.Key) |
| 204 | return nil |
| 205 | } |
| 206 | |
| 207 | // Append appends to the contents of a key. |
| 208 | func (r *rpcServer) Append(args StorageArgs, resp *struct{}) error { |
no test coverage detected