Interface Csv.IParallelReadBuilder<T>
- Namespace
- FlameCsv
- Assembly
- FlameCsv.Core.dll
Builder to create a parallel CSV reading pipeline from.
public interface Csv.IParallelReadBuilder<T> : Csv.IReadBuilderBase<T, Csv.IParallelReadBuilder<T>> where T : unmanaged, IBinaryInteger<T>
Type Parameters
T
- Inherited Members
Properties
ParallelOptions
Options to use for parallel reading; chunk size, degree of parallelism, and cancellation token.
CsvParallelOptions ParallelOptions { get; }
Property Value
Methods
ForEachAsync<TValue>(CsvTypeMap<T, TValue>, Func<ArraySegment<TValue>, CancellationToken, ValueTask>, CsvOptions<T>?)
Reads CSV records in parallel, binding them using the given type map, and invokes the given action for each batch.
Task ForEachAsync<TValue>(CsvTypeMap<T, TValue> typeMap, Func<ArraySegment<TValue>, CancellationToken, ValueTask> action, CsvOptions<T>? options = null)
Parameters
typeMapCsvTypeMap<T, TValue>Type map to use for binding
actionFunc<ArraySegment<TValue>, CancellationToken, ValueTask>Action to invoke
optionsCsvOptions<T>Options to use, Default used by default
Returns
- Task
A task that completes when all values have been written to the channel
Type Parameters
TValue
Remarks
The callback will be invoked concurrently from multiple threads.
ForEachAsync<TValue>(Func<ArraySegment<TValue>, CancellationToken, ValueTask>, CsvOptions<T>?)
Reads CSV records in parallel, binding them using reflection, and invokes the given action for each batch.
[RequiresUnreferencedCode("This code path uses reflection. Use the overloads accepting source generated CsvTypeMap for AOT/trimming compatible code.")]
[RequiresDynamicCode("This code path uses compiled expressions. Use the overloads accepting source generated CsvTypeMap for AOT/trimming compatible code.")]
Task ForEachAsync<TValue>(Func<ArraySegment<TValue>, CancellationToken, ValueTask> action, CsvOptions<T>? options = null)
Parameters
actionFunc<ArraySegment<TValue>, CancellationToken, ValueTask>Action to invoke
optionsCsvOptions<T>Options to use, Default used by default
Returns
Type Parameters
TValue
Remarks
The callback will be invoked concurrently from multiple threads.
ForEach<TValue>(CsvTypeMap<T, TValue>, Action<ArraySegment<TValue>>, CsvOptions<T>?)
Reads CSV records in parallel, binding them using the given type map, and invokes the given action for each batch.
void ForEach<TValue>(CsvTypeMap<T, TValue> typeMap, Action<ArraySegment<TValue>> action, CsvOptions<T>? options = null)
Parameters
typeMapCsvTypeMap<T, TValue>Type map to use for binding
actionAction<ArraySegment<TValue>>Action to invoke
optionsCsvOptions<T>Options to use, Default used by default
Type Parameters
TValue
Remarks
The callback will be invoked concurrently from multiple threads.
ForEach<TValue>(Action<ArraySegment<TValue>>, CsvOptions<T>?)
Reads CSV records in parallel, binding them using reflection, and invokes the given action for each batch.
[RequiresUnreferencedCode("This code path uses reflection. Use the overloads accepting source generated CsvTypeMap for AOT/trimming compatible code.")]
[RequiresDynamicCode("This code path uses compiled expressions. Use the overloads accepting source generated CsvTypeMap for AOT/trimming compatible code.")]
void ForEach<TValue>(Action<ArraySegment<TValue>> action, CsvOptions<T>? options = null)
Parameters
actionAction<ArraySegment<TValue>>Action to invoke
optionsCsvOptions<T>Options to use, Default used by default
Type Parameters
TValue
Remarks
The callback will be invoked concurrently from multiple threads.
ReadAsync<TValue>(CsvTypeMap<T, TValue>, CsvOptions<T>?)
Reads CSV records in parallel and returns them as batches, binding them using the given type map.
IAsyncEnumerable<ArraySegment<TValue>> ReadAsync<TValue>(CsvTypeMap<T, TValue> typeMap, CsvOptions<T>? options = null)
Parameters
typeMapCsvTypeMap<T, TValue>Type map used to bind the CSV data
optionsCsvOptions<T>Options to use, Default used by default
Returns
- IAsyncEnumerable<ArraySegment<TValue>>
An enumerable to read CSV records in parallel
Type Parameters
TValue
Remarks
The batches returned by the enumerator must not be held onto after the next iteration, or after the enumerator is disposed. Process the data in-place, or copy it to another buffer.
ReadAsync<TValue>(CsvOptions<T>?)
Reads CSV records in parallel and returns them as batches, binding them using reflection.
[RequiresUnreferencedCode("This code path uses reflection. Use the overloads accepting source generated CsvTypeMap for AOT/trimming compatible code.")]
[RequiresDynamicCode("This code path uses compiled expressions. Use the overloads accepting source generated CsvTypeMap for AOT/trimming compatible code.")]
IAsyncEnumerable<ArraySegment<TValue>> ReadAsync<TValue>(CsvOptions<T>? options = null)
Parameters
optionsCsvOptions<T>Options to use, Default used by default
Returns
- IAsyncEnumerable<ArraySegment<TValue>>
An enumerable to read CSV records in parallel
Type Parameters
TValue
Remarks
The batches returned by the enumerator must not be held onto after the next iteration, or after the enumerator is disposed. Process the data in-place, or copy it to another buffer.
Read<TValue>(CsvTypeMap<T, TValue>, CsvOptions<T>?)
Reads CSV records in parallel and returns them as batches,, binding them using the given type map.
IEnumerable<ArraySegment<TValue>> Read<TValue>(CsvTypeMap<T, TValue> typeMap, CsvOptions<T>? options = null)
Parameters
typeMapCsvTypeMap<T, TValue>Type map used to bind the CSV data
optionsCsvOptions<T>Options to use, Default used by default
Returns
- IEnumerable<ArraySegment<TValue>>
An enumerable to read CSV records in parallel
Type Parameters
TValue
Remarks
The batches returned by the enumerator must not be held onto after the next iteration, or after the enumerator is disposed. Process the data in-place, or copy it to another buffer.
Read<TValue>(CsvOptions<T>?)
Reads CSV records in parallel and returns them as batches, binding them using reflection.
[RequiresUnreferencedCode("This code path uses reflection. Use the overloads accepting source generated CsvTypeMap for AOT/trimming compatible code.")]
[RequiresDynamicCode("This code path uses compiled expressions. Use the overloads accepting source generated CsvTypeMap for AOT/trimming compatible code.")]
IEnumerable<ArraySegment<TValue>> Read<TValue>(CsvOptions<T>? options = null)
Parameters
optionsCsvOptions<T>Options to use, Default used by default
Returns
- IEnumerable<ArraySegment<TValue>>
An enumerable to read CSV records in parallel
Type Parameters
TValue
Remarks
The batches returned by the enumerator must not be held onto after the next iteration, or after the enumerator is disposed. Process the data in-place, or copy it to another buffer.
ToChannelAsync<TValue>(ChannelWriter<TValue>, CsvTypeMap<T, TValue>, CsvOptions<T>?)
Reads CSV records in parallel, binding them using the given type map, and writes them to the given channel. Does not support ordered processing.
Task ToChannelAsync<TValue>(ChannelWriter<TValue> channelWriter, CsvTypeMap<T, TValue> typeMap, CsvOptions<T>? options = null)
Parameters
channelWriterChannelWriter<TValue>Channel to write the values to
typeMapCsvTypeMap<T, TValue>Type map to use for binding
optionsCsvOptions<T>Options to use, Default used by default
Returns
Type Parameters
TValue
Remarks
Cancellation token can be passed to AsParallel().
Exceptions
ToChannelAsync<TValue>(ChannelWriter<TValue>, CsvOptions<T>?)
Reads CSV records in parallel, binding them using reflection, and writes them to the given channel. Does not support ordered processing.
[RequiresUnreferencedCode("This code path uses reflection. Use the overloads accepting source generated CsvTypeMap for AOT/trimming compatible code.")]
[RequiresDynamicCode("This code path uses compiled expressions. Use the overloads accepting source generated CsvTypeMap for AOT/trimming compatible code.")]
Task ToChannelAsync<TValue>(ChannelWriter<TValue> channelWriter, CsvOptions<T>? options = null)
Parameters
channelWriterChannelWriter<TValue>Channel to write the values to
optionsCsvOptions<T>Options to use, Default used by default
Returns
- Task
A task that completes when all values have been written to the channel
Type Parameters
TValue
Remarks
Cancellation token can be passed to AsParallel().
Exceptions
WithParallelOptions(in CsvParallelOptions)
Configures the builder to use the given parallel options.
Csv.IParallelReadBuilder<T> WithParallelOptions(in CsvParallelOptions parallelOptions)
Parameters
parallelOptionsCsvParallelOptionsOptions to use for parallel reading