Reads from a source iterator, completes the subsequent decode task on the calling thread. This is only really used for compatibility with the async pipeline when CPU threading is disabled
| 331 | // thread. This is only really used for compatibility with the async pipeline when CPU |
| 332 | // threading is disabled |
| 333 | AsyncGenerator<DecodedBlock> MakeDecodingGenerator( |
| 334 | Iterator<ChunkedBlock> source, |
| 335 | std::function<Result<DecodedBlock>(const ChunkedBlock&)> decoder) { |
| 336 | struct State { |
| 337 | Iterator<ChunkedBlock> source; |
| 338 | std::function<Result<DecodedBlock>(const ChunkedBlock&)> decoder; |
| 339 | } state{std::move(source), std::move(decoder)}; |
| 340 | return [state = std::make_shared<State>(std::move(state))] { |
| 341 | auto maybe_block = state->source.Next(); |
| 342 | if (!maybe_block.ok()) { |
| 343 | return Future<DecodedBlock>::MakeFinished(maybe_block.status()); |
| 344 | } |
| 345 | const auto& block = maybe_block.ValueUnsafe(); |
| 346 | if (IsIterationEnd(block)) { |
| 347 | return ToFuture(IterationEnd<DecodedBlock>()); |
| 348 | } |
| 349 | return ToFuture(state->decoder(block)); |
| 350 | }; |
| 351 | } |
| 352 | |
| 353 | class StreamingReaderImpl : public StreamingReader { |
| 354 | public: |
no test coverage detected