Methods
(async) batchCommitWriteStream(request) → {Promise}
Atomically commits a group of PENDING
streams that belong to the same
parent
table.
Streams must be finalized before commit and cannot be committed multiple times. Once a stream is committed, data in the stream becomes available for read operations.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
Returns:
Type | Description |
---|---|
Promise |
|
(async) createStreamConnection(requestopt, optionsopt) → {StreamConnection}
Open StreamConnection in which data can be appended to the given stream.
If a stream is created beforehand with createWriteStream
, the streamId can be passed here.
Or destinationTable + streamType can be passed so the WriteStreamStream is created under the hood.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
object |
<optional> |
Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
StreamConnection |
|
(async) createWriteStream(request) → {Promise.<string>}
Creates a write stream to the given table and return just the streamId.
Additionally, every table has a special stream named DefaultStream to which data can be written. This stream doesn't need to be created using createWriteStream. It is a stream that can be used simultaneously by any number of clients. Data written to this stream is considered committed as soon as an acknowledgement is received.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
Returns:
Type | Description |
---|---|
Promise.<string> |
} - The promise which resolves to the streamId. |
(async) createWriteStreamFullResponse(request) → {Promise.<WriteStream>}
Creates a write stream to the given table and return all information about it.
Additionally, every table has a special stream named DefaultStream to which data can be written. This stream doesn't need to be created using createWriteStream. It is a stream that can be used simultaneously by any number of clients. Data written to this stream is considered committed as soon as an acknowledgement is received.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
Returns:
Type | Description |
---|---|
Promise.<WriteStream> |
} - The promise which resolves to the WriteStream. |
enableWriteRetries()
Enables StreamConnections to automatically retry failed appends.
Enabling retries is best suited for cases where users want to achieve at-least-once append semantics. Use of automatic retries may complicate patterns where the user is designing for exactly-once append semantics.
(async) finalizeWriteStream(request) → {Promise.<FinalizeWriteStreamResponse>}
Finalize a write stream so that no new data can be appended to the stream. Finalize is not supported on the DefaultStream.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
Returns:
Type | Description |
---|---|
Promise.<FinalizeWriteStreamResponse> |
|
(async) flushRows(request) → {Promise}
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 DEFAULT stream, since it is not BUFFERED.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
Returns:
Type | Description |
---|---|
Promise |
|
(async) getWriteStream(request, optionsopt) → {Promise.<WriteStream>}
Gets information about a write stream.
Parameters:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Promise.<WriteStream> |
} - The promise which resolves to the WriteStream. |
initialize() → {Promise}
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Returns:
Type | Description |
---|---|
Promise |
A promise that resolves when auth is complete. |
isOpen()
Check if client is open and ready to send requests.
setMaxRetryAttempts()
Change max retries attempts on child StreamConnections.
The default valuen is to retry 4 times.
Only valid right now when write retries are enabled.
- See:
-
- enableWriteRetries.