Method GetTableUsageAsyncEnumerable
GetTableUsageAsyncEnumerable(String, GetTableUsageOptions, CancellationToken)
Declaration
public IAsyncEnumerable<TableUsageResult> GetTableUsageAsyncEnumerable(string tableName, GetTableUsageOptions options, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | tableName | Name of the table. |
GetTableUsageOptions | options | (Optional) Options for this operation, which allow specify a time range for usage records, limit on the number usage records returned and other parameters. To retrieve multiple table usage records, the options must specify a time range. |
CancellationToken | cancellationToken | (Optional) Cancellation token. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TableUsageResult> | Async enumerable to iterate over TableUsageResult objects. |
Remarks
Use this API when you need to retrieve a large number of table usage records and you wish to page the results rather than returning the whole list at once.
This API is similar to
GetTableUsageAsync(String, GetTableUsageOptions, CancellationToken)
but creates IAsyncEnumerable<T> that allows you to
iterate over the results using await foreach
construct. Each of the results is TableUsageResult
containing partial list of table usage records.
Note that you must specify a time range (at least one of StartTime and EndTime) for which to return table usage records, otherwise only one (the most recent) table usage record will be returned.
You may optionally specify a limit on the number of table usage records returned in each partial result using Limit. If not specified, a default system limit will be used.
Note that this method may only throw ArgumentException. Other exceptions listed can only be thrown during the iteration process as per deferred execution semantics of enumerables.
Examples
Asynchronously paging table usage records.var currentTime = DateTime.UtcNow;
var options = new TableUsageOptions
{
StartTime = currentTime - TimeSpan.FromDays(1),
EndTime = currentTime,
Limit = 120
};
await foreach(var result in client.GetTableUsageAsyncEnumerable(options))
{
foreach(var usageRecord in result.UsageRecords)
{
Console.WriteLine(usageRecord);
}
}
Exceptions
Type | Condition |
---|---|
ArgumentException | If
tableName is null or invalid
or options contains invalid values. |
TimeoutException | Operation has timed out. |
InvalidOperationException | The table or service is not in a valid state to perform this operation. |
NotSupportedException | If this operation is invoked on on-premise NoSQL database (see KVStore). |
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. |
See Also
GetTableUsageAsyncEnumerable(String, Nullable<DateTime>, Nullable<DateTime>, Nullable<Int32>, CancellationToken)
Declaration
public IAsyncEnumerable<TableUsageResult> GetTableUsageAsyncEnumerable(string tableName, Nullable<DateTime> startTime, Nullable<DateTime> endTime = null, Nullable<int> limit = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | tableName | Name of the table. |
Nullable<DateTime> | startTime | Start time for the time period from which to return table usage records. |
Nullable<DateTime> | endTime | (Optional) End time for the time period from which to return table usage records. |
Nullable<Int32> | limit | (Optional) Limit on the number of table usage records returned in each partial result of the iteration. |
CancellationToken | cancellationToken | (Optional) Cancellation token. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TableUsageResult> | Async enumerable to iterate over TableUsageResult objects. |
Remarks
Exceptions
Type | Condition |
---|---|
ArgumentException | If
tableName is null or invalid
or startTime , endTime or
limit contain invalid values. |
TimeoutException | Operation has timed out. |
InvalidOperationException | The table or service is not in a valid state to perform this operation. |
NotSupportedException | If this operation is invoked on on-premise NoSQL database (see KVStore). |
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. |