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.
Implements
IDisposableNamespace
GoogleGoogle.CloudGoogle.Cloud.SpannerV1Assembly
Google.Cloud.Spanner.V1.dll
Properties
IsClosed
public bool IsClosed { get; }
Indicates whether the reader is closed or not.
Property Value | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
cancellationToken | CancellationToken A cancellation token for the asynchronous operation. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
cancellationToken | CancellationToken A cancellation token for the asynchronous operation. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
cancellationToken | CancellationToken A cancellation token for the asynchronous operation. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
cancellationToken | CancellationToken A cancellation token for the asynchronous operation. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
EventHandlerStreamClosedEventArgs |