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

Method push

fdbserver/DiskQueue.actor.cpp:894–913  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

892 nextReadLocation(-1), readBufPage(nullptr), readBufPos(0) {}
893
894 location push(StringRef contents) override {
895 ASSERT(recovered);
896 uint8_t const* begin = contents.begin();
897 uint8_t const* end = contents.end();
898 CODE_PROBE(contents.size() && pushedPageCount(), "More than one push between commits");
899
900 bool pushAtEndOfPage = contents.size() >= 4 && pushedPageCount() && backPage().remainingCapacity() < 4;
901 CODE_PROBE(pushAtEndOfPage, "Push right at the end of a page, possibly splitting size");
902 while (begin != end) {
903 if (!pushedPageCount() || !backPage().remainingCapacity())
904 addEmptyPage();
905
906 auto& p = backPage();
907 int s = std::min<int>(p.remainingCapacity(), end - begin);
908 memcpy(p.payload + p.payloadSize, begin, s);
909 p.payloadSize += s;
910 begin += s;
911 }
912 return endLocation();
913 }
914
915 void pop(location upTo) override {
916 ASSERT(!upTo.hi);

Callers 1

pushMethod · 0.45

Calls 6

pushedPageCountFunction · 0.85
memcpyFunction · 0.85
remainingCapacityMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected