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

Method ParseNextKey

src/leveldb/table/block.cc:225–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223 }
224
225 bool ParseNextKey() {
226 current_ = NextEntryOffset();
227 const char* p = data_ + current_;
228 const char* limit = data_ + restarts_; // Restarts come right after data
229 if (p >= limit) {
230 // No more entries to return. Mark as invalid.
231 current_ = restarts_;
232 restart_index_ = num_restarts_;
233 return false;
234 }
235
236 // Decode next entry
237 uint32_t shared, non_shared, value_length;
238 p = DecodeEntry(p, limit, &shared, &non_shared, &value_length);
239 if (p == nullptr || key_.size() < shared) {
240 CorruptionError();
241 return false;
242 } else {
243 key_.resize(shared);
244 key_.append(p, non_shared);
245 value_ = Slice(p + non_shared, value_length);
246 while (restart_index_ + 1 < num_restarts_ &&
247 GetRestartPoint(restart_index_ + 1) < current_) {
248 ++restart_index_;
249 }
250 return true;
251 }
252 }
253};
254
255Iterator* Block::NewIterator(const Comparator* comparator) {

Callers

nothing calls this directly

Calls 4

DecodeEntryFunction · 0.85
SliceClass · 0.50
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected