Skip to content
Meshline
SDK 1.1.0 · TypeView source on GitHub

Developer guide · API index

Members on this page

Meshline.Sdk

Meshline.Storage

QueryReader<T> Class

Reads successive batches from a fixed snapshot of a local SQLite query.

public sealed class QueryReader<T> : System.IAsyncDisposable

Type parameters

T

The type of item returned by the reader.

Inheritance System.Object → QueryReader<T>

Implements System.IAsyncDisposable

Remarks

The snapshot is fixed when the reader is opened, so later database changes do not reorder or extend its batches. An empty batch marks completion. Open a new reader to refresh and dispose this reader promptly to release its transaction.

Methods

QueryReader<T>.DisposeAsync() Method

Releases the snapshot transaction and its database connection.

public System.Threading.Tasks.ValueTask DisposeAsync();

Implements DisposeAsync()

Returns

System.Threading.Tasks.ValueTask
A value task that completes when owned resources and active work have been released.

Exceptions

Microsoft.Data.Sqlite.SqliteException
Releasing the SQLite snapshot transaction fails.

QueryReader<T>.ReadNextAsync(int, CancellationToken) Method

Reads the next batch from the reader's fixed SQLite snapshot.

public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<T>> ReadNextAsync(int count, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

Parameters

count System.Int32

The positive maximum number of items to read in this batch.

cancellationToken System.Threading.CancellationToken

A token that can cancel the operation.

Returns

System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<T>>
Up to count items in query order, or an empty list when the snapshot is exhausted.

Exceptions

System.ArgumentOutOfRangeException
count is not positive. A stored sequence or Unix timestamp is outside the range supported by the result model.

System.ObjectDisposedException
The reader has been disposed.

System.OperationCanceledException
The operation observes cancellation of cancellationToken.

Microsoft.Data.Sqlite.SqliteException
The SQLite database cannot be opened or a database command fails, for example because the schema is not migrated or the file is locked.

System.Text.Json.JsonException
A stored or received protocol document cannot be serialized or deserialized.

System.OverflowException
Advancing the reader offset exceeds the maximum signed 32-bit item count.

System.ArgumentException
A stored account, group, channel, or message identifier is invalid when a result is materialized.

System.NotSupportedException
A stored account identifier uses an unsupported namespace when the result is materialized.