StreamConnection

managedwriter. StreamConnection

StreamConnection is responsible for writing requests to a bidirecional GRPC connection against the Storage Write API appendRows method.

All the requests are sent without flow control, and writes are sent in receiving order. It's user's responsibility to do the flow control and maintain the lifetime of the requests.

Constructor

new StreamConnection()

Extends

  • EventEmitter

Methods

close()

Close the bi-directional stream connection.

(async) finalize() → {Promise.<(FinalizeWriteStreamResponse|null)>}

Finalize a write stream so that no new data can be appended to the stream. Finalize is not supported on the DefaultStream stream.

Returns:
Type Description
Promise.<(FinalizeWriteStreamResponse|null)>

(async) flushRows() → {Promise.<(FlushRowsResponse|null)>}

Flushes rows to a BUFFERED stream. If users are appending rows to BUFFERED stream, flush operation is required in order for the rows to become available for reading. A Flush operation flushes up to any previously flushed offset in a BUFFERED stream, to the offset specified in the request.

Flush is not supported on the DefaultStream stream, since it is not BUFFERED.

Parameters:
Name Type Description
request.offset number | Long | string | null
Returns:
Type Description
Promise.<(FlushRowsResponse|null)>

getPendingWrites()

Access in-flight write requests.

getStreamId()

Get the name of the write stream associated with this connection. When the connection is created withouth a write stream, this method can be used to retrieve the automatically created write stream name.

isOpen()

Check if connection is open and ready to send requests.

onConnectionError()

Callback is invoked when an error is received from the server.

onSchemaUpdated()

Callback is invoked when a the server notifies the stream connection of a new Table Schema change.

reconnect()

Reconnect and re send inflight requests.

write(request) → {managedwriter.PendingWrite}

Write a request to the bi-directional stream connection.

Parameters:
Name Type Description
request AppendRowRequest

request to send.

Returns:
Type Description
managedwriter.PendingWrite