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

Method insert

fdbserver/VersionedBTree.actor.cpp:5488–5516  ·  view source on GitHub ↗

Find or create a mutation buffer boundary for bound and return an iterator to it

Source from the content-addressed store, hash-verified

5486
5487 // Find or create a mutation buffer boundary for bound and return an iterator to it
5488 iterator insert(KeyRef boundary) {
5489 // Find the first split point in buffer that is >= key
5490 // Since the initial state of the mutation buffer contains the range '' through
5491 // the maximum possible key, our search had to have found something so we
5492 // can assume the iterator is valid.
5493 iterator ib = mutations.lower_bound(boundary);
5494
5495 // If we found the boundary we are looking for, return its iterator
5496 if (ib.key() == boundary) {
5497 return ib;
5498 }
5499
5500 // ib is our insert hint. Copy boundary into arena and insert boundary into buffer
5501 boundary = KeyRef(arena, boundary);
5502 ib = mutations.insert(ib, { boundary, RangeMutation() });
5503
5504 // ib is certainly > begin() because it is guaranteed that the empty string
5505 // boundary exists and the only way to have found that is to look explicitly
5506 // for it in which case we would have returned above.
5507 iterator iPrevious = ib;
5508 --iPrevious;
5509 // If the range we just divided was being cleared, then the dividing boundary key and range after it must
5510 // also be cleared
5511 if (iPrevious.mutation().clearAfterBoundary) {
5512 ib.mutation().clearAll();
5513 }
5514
5515 return ib;
5516 }
5517 };
5518#define USE_ART_MUTATION_BUFFER 1
5519

Callers 6

removeRemapEntryFunction · 0.45
setFunction · 0.45
clearFunction · 0.45
insertMethod · 0.45

Calls 5

KeyRefClass · 0.85
RangeMutationClass · 0.85
clearAllMethod · 0.80
lower_boundMethod · 0.45
keyMethod · 0.45

Tested by

no test coverage detected