MCPcopy Create free account
hub / github.com/bytedance/bolt / getPages

Method getPages

bolt/exec/OutputBuffer.cpp:52–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52std::vector<std::shared_ptr<SerializedPage>> ArbitraryBuffer::getPages(
53 uint64_t maxBytes) {
54 BOLT_CHECK_GT(maxBytes, 0, "maxBytes can't be zero");
55
56 std::vector<std::shared_ptr<SerializedPage>> pages;
57 uint64_t bytesRemoved{0};
58 while (bytesRemoved < maxBytes && !pages_.empty()) {
59 if (pages_.front() == nullptr) {
60 // NOTE: keep the end marker in arbitrary buffer to signal all the
61 // destination buffers after the buffers have all been consumed.
62 BOLT_CHECK_EQ(pages_.size(), 1);
63 pages.push_back(nullptr);
64 break;
65 }
66 bytesRemoved += pages_.front()->size();
67 pages.push_back(std::move(pages_.front()));
68 pages_.pop_front();
69 }
70 return pages;
71}
72
73std::string ArbitraryBuffer::toString() const {
74 return fmt::format(

Callers 2

loadDataMethod · 0.80
TEST_FFunction · 0.80

Calls 3

emptyMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by 1

TEST_FFunction · 0.64