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

Method getGCKeys

onecache/onecache.go:320–339  ·  view source on GitHub ↗

getGCKeys returns keys that should be GC'd and whether there should be a follow up GC because keys are being replicated.

()

Source from the content-addressed store, hash-verified

318// getGCKeys returns keys that should be GC'd and whether there should be a
319// follow up GC because keys are being replicated.
320func (n *Node) getGCKeys() ([]string, bool) {
321 keys := n.data.List()
322 var gc []string
323 var replicating bool
324 for _, key := range keys {
325 replicas := n.ring.replicaPeers(key)
326 for _, replica := range replicas {
327 if replica == n.name {
328 if n.replicator.IsReplicating(key) {
329 replicating = true
330 continue
331 }
332 gc = append(gc, key)
333 break
334 }
335 }
336 }
337
338 return gc, replicating
339}

Callers 2

garbageCollectMethod · 0.95

Calls 3

ListMethod · 0.80
replicaPeersMethod · 0.65
IsReplicatingMethod · 0.65

Tested by 1