ReplPageSource
Convenience factories for result-flow page sources.
- Kind:
Class - Namespace: Repl
- Assembly:
Repl.Core - Source: src/Repl.Core/ResultFlow/ReplPageSource.cs
Signature
Section titled “Signature”public static class ReplPageSourceInheritance
Section titled “Inheritance”Methods
Section titled “Methods”Create<T>(Func<ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>>)
Section titled “Create<T>(Func<ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>>)”Creates a page source from a fetch delegate.
public static IReplPageSource<T> Create<T>(Func<ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>> fetch)Type Parameters
Section titled “Type Parameters”T: Item type.
Parameters
Section titled “Parameters”fetch(Func<ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>>): Delegate that fetches one page for each request.
Returns
Section titled “Returns”IReplPageSource<T> - A page source consumable by Repl renderers.
Create<T, TState>(TState, Func<TState, ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>>)
Section titled “Create<T, TState>(TState, Func<TState, ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>>)”Creates a page source from a fetch delegate and explicit state.
public static IReplPageSource<T> Create<T, TState>(TState state, Func<TState, ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>> fetch)Type Parameters
Section titled “Type Parameters”T: Item type.TState: State type.
Parameters
Section titled “Parameters”state(TState): State passed to the fetch delegate.fetch(Func<TState, ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>>): Delegate that fetches one page for each request.
Returns
Section titled “Returns”IReplPageSource<T> - A page source consumable by Repl renderers.
FromAsyncEnumerable<T>(Func<CancellationToken, IAsyncEnumerable<T>>, Func<T, bool>?, int?)
Section titled “FromAsyncEnumerable<T>(Func<CancellationToken, IAsyncEnumerable<T>>, Func<T, bool>?, int?)”Creates an offset-cursor page source over an async stream factory.
public static IReplPageSource<T> FromAsyncEnumerable<T>(Func<CancellationToken, IAsyncEnumerable<T>> createItems, Func<T, bool>? filter = null, int? maxSourceItemsToScan = null)Type Parameters
Section titled “Type Parameters”T: Item type.
Parameters
Section titled “Parameters”createItems(Func<CancellationToken, IAsyncEnumerable<T>>): Factory that creates the async stream for each page request.filter(Func<T, bool>): Optional client-side filter applied before final paging.maxSourceItemsToScan(int?): Maximum source rows to scan while filling one filtered page.
Returns
Section titled “Returns”IReplPageSource<T> - A page source consumable by Repl renderers.
FromAsyncEnumerable<T, TState>(TState, Func<TState, CancellationToken, IAsyncEnumerable<T>>, Func<TState, T, bool>?, int?)
Section titled “FromAsyncEnumerable<T, TState>(TState, Func<TState, CancellationToken, IAsyncEnumerable<T>>, Func<TState, T, bool>?, int?)”Creates an offset-cursor page source over an async stream factory, with explicit state.
public static IReplPageSource<T> FromAsyncEnumerable<T, TState>(TState state, Func<TState, CancellationToken, IAsyncEnumerable<T>> createItems, Func<TState, T, bool>? filter = null, int? maxSourceItemsToScan = null)Type Parameters
Section titled “Type Parameters”T: Item type.TState: State type.
Parameters
Section titled “Parameters”state(TState): State passed to the stream factory and filter delegate.createItems(Func<TState, CancellationToken, IAsyncEnumerable<T>>): Factory that creates the async stream for each page request.filter(Func<TState, T, bool>): Optional client-side filter applied before final paging.maxSourceItemsToScan(int?): Maximum source rows to scan while filling one filtered page.
Returns
Section titled “Returns”IReplPageSource<T> - A page source consumable by Repl renderers.
FromItems<T>(IReadOnlyList<T>, Func<T, bool>?)
Section titled “FromItems<T>(IReadOnlyList<T>, Func<T, bool>?)”Creates an offset-cursor page source over an in-memory list.
public static IReplPageSource<T> FromItems<T>(IReadOnlyList<T> items, Func<T, bool>? filter = null)Type Parameters
Section titled “Type Parameters”T: Item type.
Parameters
Section titled “Parameters”items(IReadOnlyList<T>): Items to expose as pages.filter(Func<T, bool>): Optional client-side filter applied before final paging.
Returns
Section titled “Returns”IReplPageSource<T> - A page source consumable by Repl renderers.
FromItems<T, TState>(IReadOnlyList<T>, TState, Func<TState, T, bool>?)
Section titled “FromItems<T, TState>(IReadOnlyList<T>, TState, Func<TState, T, bool>?)”Creates an offset-cursor page source over an in-memory list and explicit state.
public static IReplPageSource<T> FromItems<T, TState>(IReadOnlyList<T> items, TState state, Func<TState, T, bool>? filter = null)Type Parameters
Section titled “Type Parameters”T: Item type.TState: State type.
Parameters
Section titled “Parameters”items(IReadOnlyList<T>): Items to expose as pages.state(TState): State passed to the filter delegate.filter(Func<TState, T, bool>): Optional client-side filter applied before final paging.
Returns
Section titled “Returns”IReplPageSource<T> - A page source consumable by Repl renderers.
FromOffset<T>(Func<int, int, CancellationToken, ValueTask<IReadOnlyList<T>>>, long?, Func<T, bool>?, int?)
Section titled “FromOffset<T>(Func<int, int, CancellationToken, ValueTask<IReadOnlyList<T>>>, long?, Func<T, bool>?, int?)”Creates an offset-cursor page source over a store that can fetch by offset and take.
public static IReplPageSource<T> FromOffset<T>(Func<int, int, CancellationToken, ValueTask<IReadOnlyList<T>>> fetch, long? totalCount = null, Func<T, bool>? filter = null, int? maxSourceItemsToScan = null)Type Parameters
Section titled “Type Parameters”T: Item type.
Parameters
Section titled “Parameters”fetch(Func<int, int, CancellationToken, ValueTask<IReadOnlyList<T>>>): Delegate called with offset, take, and cancellation token.totalCount(long?): Total item count, when known without expensive enumeration.filter(Func<T, bool>): Optional client-side filter applied after source fetches and before final paging.maxSourceItemsToScan(int?): Maximum source rows to scan while filling one filtered page.
Returns
Section titled “Returns”IReplPageSource<T> - A page source consumable by Repl renderers.
FromOffset<T, TState>(TState, Func<TState, int, int, CancellationToken, ValueTask<IReadOnlyList<T>>>, long?, Func<TState, T, bool>?, int?)
Section titled “FromOffset<T, TState>(TState, Func<TState, int, int, CancellationToken, ValueTask<IReadOnlyList<T>>>, long?, Func<TState, T, bool>?, int?)”Creates an offset-cursor page source over a store that can fetch by offset and take, with explicit state.
public static IReplPageSource<T> FromOffset<T, TState>(TState state, Func<TState, int, int, CancellationToken, ValueTask<IReadOnlyList<T>>> fetch, long? totalCount = null, Func<TState, T, bool>? filter = null, int? maxSourceItemsToScan = null)Type Parameters
Section titled “Type Parameters”T: Item type.TState: State type.
Parameters
Section titled “Parameters”state(TState): State passed to the fetch and filter delegates.fetch(Func<TState, int, int, CancellationToken, ValueTask<IReadOnlyList<T>>>): Delegate called with state, offset, take, and cancellation token.totalCount(long?): Total item count, when known without expensive enumeration.filter(Func<TState, T, bool>): Optional client-side filter applied after source fetches and before final paging.maxSourceItemsToScan(int?): Maximum source rows to scan while filling one filtered page.
Returns
Section titled “Returns”IReplPageSource<T> - A page source consumable by Repl renderers.