MCPcopy Create free account
hub / github.com/bytedance/terarkdb / InitFirstLevelIter

Method InitFirstLevelIter

table/two_level_iterator.cc:242–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240 };
241
242 bool InitFirstLevelIter() {
243 min_heap_.clear();
244 if (!first_level_iter_->Valid()) {
245 return false;
246 }
247 // Manual inline MapSstElement::Decode
248 const char* err_msg = "Invalid MapSstElement";
249 first_level_value_ = first_level_iter_->value();
250 status_ = first_level_value_.fetch();
251 if (!status_.ok()) {
252 return false;
253 }
254 Slice map_input = first_level_value_.slice();
255 link_.clear();
256 largest_key_ = first_level_iter_->key();
257 uint64_t flags;
258 uint64_t link_count;
259 if (!GetVarint64(&map_input, &flags) ||
260 !GetVarint64(&map_input, &link_count) ||
261 !GetLengthPrefixedSlice(&map_input, &smallest_key_)) {
262 status_ = Status::Corruption(err_msg);
263 return false;
264 }
265 include_smallest_ = (flags & MapSstElement::kIncludeSmallest) != 0;
266 include_largest_ = (flags & MapSstElement::kIncludeLargest) != 0;
267 link_.resize(link_count);
268 for (uint64_t i = 0; i < link_count; ++i) {
269 if (!GetVarint64(&map_input, &link_[i])) {
270 status_ = Status::Corruption(err_msg);
271 return false;
272 }
273 assert(file_meta_ == nullptr ||
274 std::binary_search(file_meta_->prop.dependence.begin(),
275 file_meta_->prop.dependence.end(),
276 Dependence{link_[i], 0},
277 TERARK_CMP(file_number, <)));
278 }
279 return true;
280 }
281
282 void InitSecondLevelMinHeap(const Slice& target, bool include) {
283 InitSecondLevelMinHeapImpl(target, include);

Callers

nothing calls this directly

Calls 13

GetVarint64Function · 0.85
GetLengthPrefixedSliceFunction · 0.85
CorruptionFunction · 0.85
fetchMethod · 0.80
sliceMethod · 0.80
clearMethod · 0.65
ValidMethod · 0.45
valueMethod · 0.45
okMethod · 0.45
keyMethod · 0.45
resizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected