| 47 | } // namespace |
| 48 | |
| 49 | void 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 | |
| 75 | void SpillInputStream::init(bool /*throwIfPastEnd*/) { |
| 76 | MicrosecondTimer timer(&spillReadIOTimeUs_); |
nothing calls this directly
no test coverage detected