Method WaitForTableStateAsync
WaitForTableStateAsync(String, TableState, TableCompletionOptions, CancellationToken)
Declaration
public Task<TableResult> WaitForTableStateAsync(string tableName, TableState tableState, TableCompletionOptions options = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | tableName | Name of the table. |
TableState | tableState | Desired table state, usually Active or Dropped |
TableCompletionOptions | options | (Optional) Options for this operation.
If not specified or null , defaults will be used.
See TableCompletionOptions. |
CancellationToken | cancellationToken | (Optional) Cancellation token. |
Returns
Type | Description |
---|---|
Task<TableResult> | Task returning TableResult. |
Remarks
This is achieved by polling the table at specified interval. You can use this API to ensure that the table is ready for data operations after it has been created or altered.
Note: the preferred way of ensuring that the table is ready for data operations after table DDL has been performed is to call WaitForCompletionAsync(Nullable<TimeSpan>, Nullable<TimeSpan>, CancellationToken) on a TableResult object returned by ExecuteTableDDLAsync representing ongoing table DDL operation. Use this API only in a rare use case where DDL operation is performed outside your control and you don't have its TableResult.
This API waits until the table has transitioned from an
intermediate state like Creating or
Updating to a stable state like
Active, at which point it can be used.
The result of this operation, if successful, is a
TableResult that shows the table state from the
last poll. If tableState
is
Dropped this method will return
successfully once the table no longer exists and the resulting
TableResult will contain only the table name and
state (dropped), with other properties being
null
.
Note that unlike other methods that return
TableResult this method will not fail if the table
doesn't exist and even if the target tableState
is Active. Instead, it will keep polling
until the table is created or the timeout is reached, which allows
you to asynchronously wait for table creation done outside your
control. Caution need to be exercised using this method to avoid
excessive poll times.
Exceptions
Type | Condition |
---|---|
ArgumentException | If
tableName is null or invalid
or tableState is invalid or
or options contains invalid values. |
TimeoutException | Operation has timed out. |
InvalidOperationException | The service is not in a valid state to perform this operation. |
NoSQLException | NoSQLException or one of its subclasses is thrown if operation cannot be performed for any other reason. See documentation for corresponding subclass of NoSQLException. |