MCPcopy Create free account
hub / github.com/apple/foundationdb / decodeKV

Function decodeKV

fdbserver/KeyValueStoreSQLite.actor.cpp:556–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

554}
555
556KeyValueRef decodeKV(StringRef encoded) {
557 uint8_t const* d = encoded.begin();
558 uint64_t h, len1, len2;
559 d += sqlite3GetVarint(d, (u64*)&h);
560 d += sqlite3GetVarint(d, (u64*)&len1);
561 d += sqlite3GetVarint(d, (u64*)&len2);
562 ASSERT(d == encoded.begin() + h);
563 ASSERT(len1 >= 12 && !(len1 & 1));
564 ASSERT(len2 >= 12 && !(len2 & 1));
565 len1 = (len1 - 12) / 2;
566 len2 = (len2 - 12) / 2;
567 ASSERT(d + len1 + len2 == encoded.end());
568 return KeyValueRef(KeyRef(d, len1), KeyRef(d + len1, len2));
569}
570
571// Given a key size and value prefix size, get the minimum bytes that must be read from the underlying
572// btree tuple to safely read the prefix length from the value bytes (if the value is long enough)

Callers 5

clearOneMethod · 0.85
clearMethod · 0.85
fastClearMethod · 0.85
getMethod · 0.85
getRangeMethod · 0.85

Calls 4

KeyRefClass · 0.85
KeyValueRefClass · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected