Class GetTableUsageOptions
Cloud Service/Cloud Simulator only. Represents options passed to
GetTableUsageAsync(String, GetTableUsageOptions, CancellationToken) API.
Namespace: Oracle.NoSQL.SDK
Assembly: Oracle.NoSQL.SDK.dll
Syntax
public class GetTableUsageOptions : Object
Remarks
For properties not specified or
null
,
appropriate defaults will be used as indicated below.
- If neither StartTime nor EndTime is specified, only a single most recent table usage record is returned.
- For both StartTime and EndTime the System.DateTime.Kind must be either Utc or Local and cannot be Unspecified. It is preferred to use Utc to avoid time zone ambiguities.
- If both StartTime and EndTime are specified, they must be of the same System.DateTime.Kind, preferred kind being Utc.
- If StartTime is specified, but not EndTime, EndTime defaults to the current time.
- If EndTime is specified, but not StartTime, up to Limit usage records will be returned ending at EndTime. E.g. if EndTime is 10pm today and Limit is 60, 60 1-minute usage records will be returned between 9pm and 10pm today. If Limit is not specified, a large system limit will be used which may result in large number of table usage records returned.
- You may not specify Limit unless you specify at least one of StartTime and EndTime. Without the time period only one most recent usage record is returned.
- If Limit is not specified, a large system defined limit will be used which may result in large number of table usage records returned unless the time period is appropriately restricted.
Because the number of table usage records can be very large, you may page the results over multiple calls to GetTableUsageAsync(String, GetTableUsageOptions, CancellationToken) using FromIndex and Limit properties as shown in the example below. However, the recommended way is to call GetTableUsageAsyncEnumerable and iterate over its result.
Examples
Executing GetTableUsage operation with provided GetTableUsageOptions.var result = await client.GetTableUsageAsync("MyTable",
new GetTableUsageOptions
{
Compartment = "my_compartment",
Timeout = TimeSpan.FromSeconds(10),
StartTime = DateTime.Now - TimeSpan.FromHours(1)
});
Paging over table usage records using
GetTableUsageAsync(String, GetTableUsageOptions, CancellationToken)
and FromIndex and Limit properties. We
iterate until the number of returned table usage records becomes less
than the limit (and possibly 0), which means that the last partial
result has been received.
var currentTime = DateTime.UtcNow;
var options = new GetTableUsageOptions
{
StartTime = currentTime - TimeSpan.FromDays(2),
EndTime = currentTime - TimeSpan.FromDays(1)
Limit = 100
};
do
{
var result = await client.GetTableUsageAsync("MyTable", options);
foreach(var usageRecord in result.UsageRecords)
{
Console.WriteLine(usageRecord);
}
options.FromIndex = result.NextIndex;
} while(result.UsageRecords.Count == options.Limit);
Constructors
Name | Description |
---|---|
GetTableUsageOptions() |
Properties
Name | Description |
---|---|
Compartment | Cloud service only. Gets or sets the compartment id or name for the operation. |
EndTime | Gets or sets the end time for the time period from which to return table usage records. |
FromIndex | Gets or sets the index at which to start returning table usage records. |
Limit | Gets or sets the limit on the number of table usage records returned. |
StartTime | Gets or sets the start time for the time period from which to return table usage records. |
Timeout | Gets or sets the timeout for the request. |