public sealed class ReliableStreamReader : IDisposable
Provides streaming access to a Spanner SQL query that automatically retries, handles chunking and recoverable errors.
Implements
IDisposableNamespace
Google.Cloud.Spanner.V1Assembly
Google.Cloud.Spanner.V1.dll
Properties
IsClosed
public bool IsClosed { get; }
Indicates whether the reader is closed or not.
Property Value | |
---|---|
Type | Description |
Boolean |
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()
Finalize()
protected void Finalize()
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 |
Task<ResultSetMetadata> | 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 |
Task<Boolean> | 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 |
Task<Value> | 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 |
EventHandler<StreamClosedEventArgs> |