| 283 | |
| 284 | |
| 285 | void AsynchronousReadBufferFromFileDescriptor::rewind() |
| 286 | { |
| 287 | if (prefetch_future.valid()) |
| 288 | { |
| 289 | prefetch_future.wait(); |
| 290 | prefetch_future = {}; |
| 291 | } |
| 292 | |
| 293 | /// Clearing the buffer with existing data. New data will be read on subsequent call to 'next'. |
| 294 | working_buffer.resize(0); |
| 295 | pos = working_buffer.begin(); |
| 296 | file_offset_of_buffer_end = 0; |
| 297 | bytes_to_ignore = 0; |
| 298 | |
| 299 | /// A previous read cycle may have failed, leaving the buffer in a canceled state. |
| 300 | /// Reset so the next read cycle can proceed normally after rewind. |
| 301 | canceled = false; |
| 302 | } |
| 303 | |
| 304 | std::optional<size_t> AsynchronousReadBufferFromFileDescriptor::tryGetFileSize() |
| 305 | { |