garbageCollect scans for stored keys that this node doesn't own or should not be replicated to it and removes them.
()
| 304 | // garbageCollect scans for stored keys that this node doesn't own or should not |
| 305 | // be replicated to it and removes them. |
| 306 | func (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. |