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

Function traverseRevTree

lib/index.es.js:834–848  ·  view source on GitHub ↗
(revs, callback)

Source from the content-addressed store, hash-verified

832// The return value from the callback will be passed as context to all
833// children of that node
834function traverseRevTree(revs, callback) {
835 var toVisit = revs.slice();
836
837 var node;
838 while ((node = toVisit.pop())) {
839 var pos = node.pos;
840 var tree = node.ids;
841 var branches = tree[2];
842 var newCtx =
843 callback(branches.length === 0, pos, tree[0], node.ctx, tree[1]);
844 for (var i = 0, len = branches.length; i < len; i++) {
845 toVisit.push({pos: pos + 1, ids: branches[i], ctx: newCtx});
846 }
847 }
848}
849
850function sortByPos(a, b) {
851 return a.pos - b.pos;

Callers 7

collectLeavesFunction · 0.70
compactTreeFunction · 0.70
stemFunction · 0.70
computeHeightFunction · 0.70
processDocMethod · 0.70
_setupMethod · 0.70
LevelPouchFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…