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

Method garbageCollect

onecache/onecache.go:306–316  ·  view source on GitHub ↗

garbageCollect scans for stored keys that this node doesn't own or should not be replicated to it and removes them.

()

Source from the content-addressed store, hash-verified

304// garbageCollect scans for stored keys that this node doesn't own or should not
305// be replicated to it and removes them.
306func (n *Node) garbageCollect() {
307 keys, replicating := n.getGCKeys()
308 for _, key := range keys {
309 n.data.Delete(key)
310 }
311
312 // Queue another round of GC since we were replicating unowned keys.
313 if replicating {
314 n.gc.Reset(10 * time.Minute)
315 }
316}
317
318// getGCKeys returns keys that should be GC'd and whether there should be a
319// follow up GC because keys are being replicated.

Callers

nothing calls this directly

Calls 2

getGCKeysMethod · 0.95
DeleteMethod · 0.80

Tested by

no test coverage detected