Major rewrite of the SHAMap code. This code performs much better

than the original version, particularly for smaller maps.
This commit is contained in:
JoelKatz
2012-02-05 06:54:44 -08:00
parent 41ce5fa7f9
commit 30c9bf0ed2
7 changed files with 753 additions and 912 deletions

View File

@@ -20,11 +20,15 @@ class SHAMapDiffNode
mNodeID(id), mOurHash(ourHash), mOtherHash(otherHash) { ; }
};
bool SHAMap::compare(SHAMap::pointer otherMap, SHAMapDiff& differences, int maxCount)
{ // compare two hash trees, add up to maxCount differences to the difference table
// return value: true=complete table of differences given, false=too many differences
// throws on corrupt tables or missing nodes
#if 0
// FIXME: Temporarily disabled
std::stack<SHAMapDiffNode> nodeStack; // track nodes we've pushed
nodeStack.push(SHAMapDiffNode(SHAMapNode(), getHash(), otherMap->getHash()));
@@ -143,5 +147,8 @@ bool SHAMap::compare(SHAMap::pointer otherMap, SHAMapDiff& differences, int maxC
}
}
}
#endif
return true;
}