Google Cloud Spanner v1 API - Class ReliableStreamReader (5.0.0-beta03)

public sealed class ReliableStreamReader : IDisposable

Reference documentation and code samples for the Google Cloud Spanner v1 API class ReliableStreamReader.

Provides streaming access to a Spanner SQL query that automatically retries, handles chunking and recoverable errors.

Inheritance

object > ReliableStreamReader

Implements

IDisposable

Namespace

Google.Cloud.Spanner.V1

Assembly

Google.Cloud.Spanner.V1.dll

Properties

IsClosed

public bool IsClosed { get; }

Indicates whether the reader is closed or not.

Property Value
TypeDescription
bool

Stats

public ResultSetStats Stats { get; }

The statistics for the results, if present. These are only present on the last RPC response from the server. They can be observed while that final response is being consumed, or afterwards.

Property Value
TypeDescription
ResultSetStats

Methods

Close()

public void Close()

Closes the stream reader.

Dispose()

public void Dispose()

EnsureInitializedAsync(CancellationToken)

public Task EnsureInitializedAsync(CancellationToken cancellationToken)

Ensures the stream reader is initialized, i.e. that the request has been executed and we've received appropriate metadata.

Parameter
NameDescription
cancellationTokenCancellationToken

A cancellation token for the asynchronous operation.

Returns
TypeDescription
Task

A task indicating the result of initialization.

~ReliableStreamReader()

protected ~ReliableStreamReader()

GetMetadataAsync(CancellationToken)

public Task<ResultSetMetadata> GetMetadataAsync(CancellationToken cancellationToken)

Asynchronously retrieves the metadata associated with this stream.

Parameter
NameDescription
cancellationTokenCancellationToken

A cancellation token for the asynchronous operation.

Returns
TypeDescription
TaskResultSetMetadata

A task which, when completed, will contain the metadata for the stream.

HasDataAsync(CancellationToken)

public Task<bool> HasDataAsync(CancellationToken cancellationToken)

Determines whether this stream has any more data or not. This is equivalent to calling NextAsync(CancellationToken) to see whether the return value is null, but without consuming the value from the stream.

Parameter
NameDescription
cancellationTokenCancellationToken

A cancellation token for the asynchronous operation.

Returns
TypeDescription
Taskbool

A task which, when completed, will indicate whether the stream contains data.

NextAsync(CancellationToken)

public Task<Value> NextAsync(CancellationToken cancellationToken)

Asynchronously reads the next value from the stream. A null value indicates the end of the stream.

Parameter
NameDescription
cancellationTokenCancellationToken

A cancellation token for the asynchronous operation.

Returns
TypeDescription
TaskValue

A task which, when completed, will provide the next value read from the stream.

Events

StreamClosed

public event EventHandler<StreamClosedEventArgs> StreamClosed

Event invoked when the stream is closed.

Event Type
TypeDescription
EventHandlerStreamClosedEventArgs