MCPcopy
hub / github.com/apache/pouchdb / compactTree

Function compactTree

lib/index.es.js:886–896  ·  view source on GitHub ↗
(metadata)

Source from the content-addressed store, hash-verified

884// compact a tree by marking its non-leafs as missing,
885// and return a list of revs to delete
886function compactTree(metadata) {
887 var revs = [];
888 traverseRevTree(metadata.rev_tree, function (isLeaf, pos,
889 revHash, ctx, opts) {
890 if (opts.status === 'available' && !isLeaf) {
891 revs.push(pos + '-' + revHash);
892 opts.status = 'missing';
893 }
894 });
895 return revs;
896}
897
898// `findPathToLeaf()` returns an array of revs that goes from the specified
899// leaf rev to the root of that leaf’s branch.

Callers 1

autoCompactFunction · 0.70

Calls 1

traverseRevTreeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…