MCPcopy Create free account
hub / github.com/dadgar/onecache / Replace

Method Replace

onecache/onecache_rpc.go:192–205  ·  view source on GitHub ↗

Replace sets the content of a key only if it exists.

(args StorageArgs, resp *struct{})

Source from the content-addressed store, hash-verified

190
191// Replace sets the content of a key only if it exists.
192func (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.
208func (r *rpcServer) Append(args StorageArgs, resp *struct{}) error {

Callers 1

runMethod · 0.45

Calls 4

targetNodeMethod · 0.95
forwardMethod · 0.95
markClientVersionMethod · 0.95
MarkDirtyMethod · 0.65

Tested by

no test coverage detected