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

Method indexForKey

fdbserver/tester.actor.cpp:103–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103int64_t KVWorkload::indexForKey(const KeyRef& key, bool absent) const {
104 int idx = 0;
105 if (nodePrefix > 0) {
106 ASSERT(keyBytes >= 32);
107 idx += 16;
108 }
109 ASSERT(keyBytes >= 16);
110 // extract int64_t index, the reverse process of emplaceIndex()
111 auto end = key.size() - idx - (absent ? 1 : 0);
112 std::string str((char*)key.begin() + idx, end);
113 int64_t res = std::stoll(str, nullptr, 16);
114 return res;
115}
116
117Key KVWorkload::keyForIndex(uint64_t index, bool absent) const {
118 int adjustedKeyBytes = (absent) ? (keyBytes + 1) : keyBytes;

Callers 2

Calls 2

sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected