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

Method InternalGet

src/leveldb/table/table.cc:216–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216Status Table::InternalGet(const ReadOptions& options, const Slice& k, void* arg,
217 void (*handle_result)(void*, const Slice&,
218 const Slice&)) {
219 Status s;
220 Iterator* iiter = rep_->index_block->NewIterator(rep_->options.comparator);
221 iiter->Seek(k);
222 if (iiter->Valid()) {
223 Slice handle_value = iiter->value();
224 FilterBlockReader* filter = rep_->filter;
225 BlockHandle handle;
226 if (filter != nullptr && handle.DecodeFrom(&handle_value).ok() &&
227 !filter->KeyMayMatch(handle.offset(), k)) {
228 // Not found
229 } else {
230 Iterator* block_iter = BlockReader(this, options, iiter->value());
231 block_iter->Seek(k);
232 if (block_iter->Valid()) {
233 (*handle_result)(arg, block_iter->key(), block_iter->value());
234 }
235 s = block_iter->status();
236 delete block_iter;
237 }
238 }
239 if (s.ok()) {
240 s = iiter->status();
241 }
242 delete iiter;
243 return s;
244}
245
246uint64_t Table::ApproximateOffsetOf(const Slice& key) const {
247 Iterator* index_iter =

Callers 1

GetMethod · 0.80

Calls 9

offsetMethod · 0.80
NewIteratorMethod · 0.45
SeekMethod · 0.45
ValidMethod · 0.45
valueMethod · 0.45
DecodeFromMethod · 0.45
KeyMayMatchMethod · 0.45
keyMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected