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

Method replicateBackfill

onecache/replicator.go:359–382  ·  view source on GitHub ↗

replicateBackfill replicates a key due to leadership changes where a backfill is necessary.

(key, peer string)

Source from the content-addressed store, hash-verified

357// replicateBackfill replicates a key due to leadership changes where a backfill
358// is necessary.
359func (p *peerSync) replicateBackfill(key, peer string) error {
360
361 // Get the data to transmit.
362 data, err := p.r.n.data.Get(key)
363 if err != nil {
364 return err
365 }
366
367 var resp struct{}
368 args := StorageArgs{
369 Key: key,
370 Value: data.Data,
371 Flags: data.Flags,
372 Exp: data.Exp,
373 Cas: data.Cas,
374 ExplicitPeer: peer,
375 }
376
377 if err := p.r.n.server.Add(args, &resp); err != nil {
378 return err
379 }
380
381 return nil
382}
383
384// replicateTouch replicates a key due to it being touched.
385func (p *peerSync) replicateTouch(key, peer string) error {

Callers 1

replicateMethod · 0.95

Calls 2

GetMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected