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

Function FindSmallestBoundaryFile

src/leveldb/db/version_set.cc:1321–1339  ·  view source on GitHub ↗

Finds minimum file b2=(l2, u2) in level file for which l2 > u1 and user_key(l2) = user_key(u1)

Source from the content-addressed store, hash-verified

1319// Finds minimum file b2=(l2, u2) in level file for which l2 > u1 and
1320// user_key(l2) = user_key(u1)
1321FileMetaData* FindSmallestBoundaryFile(
1322 const InternalKeyComparator& icmp,
1323 const std::vector<FileMetaData*>& level_files,
1324 const InternalKey& largest_key) {
1325 const Comparator* user_cmp = icmp.user_comparator();
1326 FileMetaData* smallest_boundary_file = nullptr;
1327 for (size_t i = 0; i < level_files.size(); ++i) {
1328 FileMetaData* f = level_files[i];
1329 if (icmp.Compare(f->smallest, largest_key) > 0 &&
1330 user_cmp->Compare(f->smallest.user_key(), largest_key.user_key()) ==
1331 0) {
1332 if (smallest_boundary_file == nullptr ||
1333 icmp.Compare(f->smallest, smallest_boundary_file->smallest) < 0) {
1334 smallest_boundary_file = f;
1335 }
1336 }
1337 }
1338 return smallest_boundary_file;
1339}
1340
1341// Extracts the largest file b1 from |compaction_files| and then searches for a
1342// b2 in |level_files| for which user_key(u1) = user_key(l2). If it finds such a

Callers 1

AddBoundaryInputsFunction · 0.85

Calls 4

user_comparatorMethod · 0.45
sizeMethod · 0.45
CompareMethod · 0.45
user_keyMethod · 0.45

Tested by

no test coverage detected