| 141 | : ::arrow::io::BufferReader(buffer) {} |
| 142 | |
| 143 | ::arrow::Future<std::shared_ptr<Buffer>> ReadAsync( |
| 144 | const ::arrow::io::IOContext& io_context, int64_t position, |
| 145 | int64_t nbytes) override { |
| 146 | read_async_count.fetch_add(1); |
| 147 | auto self = std::dynamic_pointer_cast<DelayedBufferReader>(shared_from_this()); |
| 148 | return DeferNotOk(::arrow::io::internal::SubmitIO( |
| 149 | io_context, [self, position, nbytes]() -> Result<std::shared_ptr<Buffer>> { |
| 150 | std::this_thread::sleep_for(std::chrono::seconds(1)); |
| 151 | return self->DoReadAt(position, nbytes); |
| 152 | })); |
| 153 | } |
| 154 | |
| 155 | std::atomic<int> read_async_count{0}; |
| 156 | }; |
no test coverage detected