MCPcopy Create free account
hub / github.com/ElementsProject/elements / Compare

Method Compare

src/leveldb/db/dbformat.cc:48–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48int InternalKeyComparator::Compare(const Slice& akey, const Slice& bkey) const {
49 // Order by:
50 // increasing user key (according to user-supplied comparator)
51 // decreasing sequence number
52 // decreasing type (though sequence# should be enough to disambiguate)
53 int r = user_comparator_->Compare(ExtractUserKey(akey), ExtractUserKey(bkey));
54 if (r == 0) {
55 const uint64_t anum = DecodeFixed64(akey.data() + akey.size() - 8);
56 const uint64_t bnum = DecodeFixed64(bkey.data() + bkey.size() - 8);
57 if (anum > bnum) {
58 r = -1;
59 } else if (anum < bnum) {
60 r = +1;
61 }
62 }
63 return r;
64}
65
66void InternalKeyComparator::FindShortestSeparator(std::string* start,
67 const Slice& limit) const {

Callers 2

FindShortestSeparatorMethod · 0.95
FindShortSuccessorMethod · 0.95

Calls 4

ExtractUserKeyFunction · 0.85
DecodeFixed64Function · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected