CkOperationsClient
Namespace: Meshmakers.Octo.Sdk.ServiceClient.AssetRepositoryServices.Tenants.Methods
Reads and waits for the operations of asynchronous CK methods through the asset repository's
runtime.operations query. A generated method client of an asynchronous method returns a
CkOperationHandle; this client turns the handle into the result:
CkOperationsClient.GetOperationAsync(String, CancellationToken) reads one operation (state, progress, result or error),
CkOperationsClient.ListOperationsAsync(CkOperationListFilter, CancellationToken) lists the caller's operations (or every caller's, for tenant administrators),
CkOperationsClient.WaitForOperationAsync<TResult>(CkOperationHandle<TResult>, IProgress<CkOperation>, CkOperationWaitOptions, CancellationToken) polls until the operation is final and returns the typed result.
The client is separate from the generated method clients so that a CK method name can never collide with these members. Operations cannot be cancelled (decision): the cancellation token of a wait only ends the wait.
public class CkOperationsClient
Inheritance Object → CkOperationsClient
Fields
OperationNotFound
The extensions.code of an unknown, expired or foreign operation id.
public static string OperationNotFound;
OperationQueryRefused
The extensions.code of a list query the caller may not run (allOwners without administrator rights).
public static string OperationQueryRefused;
OperationFailedMessage
CkMethodError.Message of an operation error: the operation carries no message text (code and parameters only, language-neutral).
public static string OperationFailedMessage;
GetOperationDocument
The document of CkOperationsClient.GetOperationAsync(String, CancellationToken).
public static string GetOperationDocument;
ListOperationsDocument
The document of CkOperationsClient.ListOperationsAsync(CkOperationListFilter, CancellationToken).
public static string ListOperationsDocument;
Constructors
CkOperationsClient(ITenantClient)
Creates the client.
public CkOperationsClient(ITenantClient tenantClient)
Parameters
tenantClient ITenantClient
The tenant client of the tenant the operations belong to
Methods
GetOperationAsync(String, CancellationToken)
Reads one operation. Readable by the caller who started it and by tenant administrators.
public Task<CkOperation> GetOperationAsync(string operationId, CancellationToken cancellationToken)
Parameters
operationId String
The operation id (CkOperationHandle.OperationId)
cancellationToken CancellationToken
Cancels the request
Returns
Task<CkOperation>
The operation
Exceptions
CkOperationQueryException
OPERATION_NOT_FOUND: the id is unknown, expired (retention) or belongs to another caller.
ListOperationsAsync(CkOperationListFilter, CancellationToken)
Lists operations, newest accepted first: by default the caller's own operations.
public Task<CkOperationPage> ListOperationsAsync(CkOperationListFilter filter, CancellationToken cancellationToken)
Parameters
filter CkOperationListFilter
Method, state, time and paging filter; null for the first page of all own operations
cancellationToken CancellationToken
Cancels the request
Returns
Task<CkOperationPage>
The page and the total count
Exceptions
CkOperationQueryException
OPERATION_QUERY_REFUSED for CkOperationListFilter.AllOwners without administrator rights.
WaitForOperationAsync<TResult>(CkOperationHandle<TResult>, IProgress<CkOperation>, CkOperationWaitOptions, CancellationToken)
Waits until the operation of handle is final and returns its result: the typed value on
SUCCEEDED; a declared error of the method as CkMethodResult.Error on FAILED.
public Task<CkMethodResult<TResult>> WaitForOperationAsync<TResult>(CkOperationHandle<TResult> handle, IProgress<CkOperation> progress, CkOperationWaitOptions options, CancellationToken cancellationToken)
Type Parameters
TResult
The C# type of the declared result
Parameters
handle CkOperationHandle<TResult>
The handle the generated method client returned
progress IProgress<CkOperation>
Called with the operation at the start and whenever its state or progress changes
options CkOperationWaitOptions
Poll interval and hooks; null for the defaults
cancellationToken CancellationToken
Ends the wait (throws OperationCanceledException); the operation itself keeps running
Returns
Task<CkMethodResult<TResult>>
The result of the operation
Exceptions
CkMethodCallException
The operation failed with a code the method does not declare, e.g. METHOD_OUTCOME_UNKNOWN (reason``handler-lost: the handler stopped, the operation is not started again) or METHOD_HANDLER_FAILED.
CkOperationQueryException
OPERATION_NOT_FOUND: the operation expired or is not readable by the caller.
WaitForOperationAsync(CkOperationHandle, IProgress<CkOperation>, CkOperationWaitOptions, CancellationToken)
Waits until the operation of handle (a method without result) is final, see
CkOperationsClient.WaitForOperationAsync<TResult>(CkOperationHandle<TResult>, IProgress<CkOperation>, CkOperationWaitOptions, CancellationToken).
public Task<CkMethodResult> WaitForOperationAsync(CkOperationHandle handle, IProgress<CkOperation> progress, CkOperationWaitOptions options, CancellationToken cancellationToken)
Parameters
handle CkOperationHandle
The handle the generated method client returned
progress IProgress<CkOperation>
Called with the operation at the start and whenever its state or progress changes
options CkOperationWaitOptions
Poll interval and hooks; null for the defaults
cancellationToken CancellationToken
Ends the wait; the operation itself keeps running
Returns
Task<CkMethodResult>
Success, or the declared error of the method
Exceptions
CkMethodCallException
The operation failed with a code the method does not declare.
CkOperationQueryException
OPERATION_NOT_FOUND.
WaitForCompletionAsync(CkOperationHandle, IProgress<CkOperation>, CkOperationWaitOptions, CancellationToken)
Polls the operation until it is final and returns it as read, without judging the error (the building block of CkOperationsClient.WaitForOperationAsync<TResult>(CkOperationHandle<TResult>, IProgress<CkOperation>, CkOperationWaitOptions, CancellationToken); also for a caller that only knows the operation id). Between two reads it waits CkOperationHandle.RetryAfterSeconds (at least CkOperationWaitOptions.MinPollInterval, at most CkOperationWaitOptions.MaxPollInterval).
public Task<CkOperation> WaitForCompletionAsync(CkOperationHandle handle, IProgress<CkOperation> progress, CkOperationWaitOptions options, CancellationToken cancellationToken)
Parameters
handle CkOperationHandle
The handle; new CkOperationHandle(operationId) for a stored id
progress IProgress<CkOperation>
Called with the operation at the start and whenever its state or progress changes
options CkOperationWaitOptions
Poll interval and hooks; null for the defaults
cancellationToken CancellationToken
Ends the wait; the operation itself keeps running
Returns
Task<CkOperation>
The final operation (SUCCEEDED or FAILED)
Exceptions
CkOperationQueryException
OPERATION_NOT_FOUND.
PollInterval(Nullable<Int32>, CkOperationWaitOptions)
The delay between two reads: retryAfterSeconds within the bounds of the options,
CkOperationWaitOptions.DefaultPollInterval when the service suggested none.
internal static TimeSpan PollInterval(Nullable<int> retryAfterSeconds, CkOperationWaitOptions options)
Parameters
retryAfterSeconds Nullable<Int32>
options CkOperationWaitOptions
Returns
AsUtc(DateTime)
An unspecified kind is UTC (the SDK convention, as for RawPointDto); local times are converted.
internal static DateTime AsUtc(DateTime value)
Parameters
value DateTime
Returns
FromWire(String)
internal static CkOperationState FromWire(string state)
Parameters
state String
Returns
ToWire(CkOperationState)
internal static string ToWire(CkOperationState state)
Parameters
state CkOperationState