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

Method next

bolt/exec/SpillFile.cpp:49–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47} // namespace
48
49void SpillInputStream::next(bool /*throwIfPastEnd*/) {
50 MicrosecondTimer timer(&spillReadIOTimeUs_);
51 if (spillUringEnabled_ && file_->uringEnabled()) {
52 int curIdx = idx_ % bufferNum_;
53 auto ret = file_->waitForComplete();
54 BOLT_CHECK(
55 ret, "Error occurred when waiting for io_uring read to complete");
56 size_t compeletedSize = bufferSizes_[curIdx];
57 setRange(
58 {readBuffers_[curIdx]->asMutable<uint8_t>(),
59 (int32_t)compeletedSize,
60 0});
61 completed_ += compeletedSize;
62 idx_++;
63 prefetch(true);
64 } else { // blocking pread
65 const size_t readBytes =
66 std::min(size_ - offset_, readBuffers_[0]->capacity());
67 BOLT_CHECK_LT(0, readBytes, "Reading past end of spill file");
68 setRange({readBuffers_[0]->asMutable<uint8_t>(), (int32_t)readBytes, 0});
69 file_->pread(offset_, readBytes, readBuffers_[0]->asMutable<char>());
70 offset_ += readBytes;
71 completed_ += readBytes;
72 }
73}
74
75void SpillInputStream::init(bool /*throwIfPastEnd*/) {
76 MicrosecondTimer timer(&spillReadIOTimeUs_);

Callers

nothing calls this directly

Calls 5

minFunction · 0.50
uringEnabledMethod · 0.45
waitForCompleteMethod · 0.45
capacityMethod · 0.45
preadMethod · 0.45

Tested by

no test coverage detected