Method ReadAllPipelinedAsync
- Namespace
- AvroSharp.Containers
- Assembly
- AvroSharp.dll
ReadAllPipelinedAsync(int, CancellationToken)
Reads the remaining objects with I/O and decompression running ahead of decoding: a background task reads and
decompresses up to blocksAhead blocks while the caller decodes the current one. This helps
most with the slower codecs (xz, bzip2) and slow streams; with the null codec on a fast stream it adds only
overhead.
public IAsyncEnumerable<T> ReadAllPipelinedAsync(int blocksAhead = 2, CancellationToken cancellationToken = default)
Parameters
blocksAheadintHow many decompressed blocks may wait for the caller, from 1.
cancellationTokenCancellationTokenCancels reading.
Returns
Remarks
While the enumeration runs, the reader belongs to it: do not call other members. Memory is bounded by about
blocksAhead + 2 blocks. Errors from reading or decompressing a block are reported when the
caller reaches that block. Stopping the enumeration early stops the background task.
Exceptions
- AvroDataException
A block is malformed or truncated.