Operation Manager
Introduction
The KreaTV OperationManager is a framework used to handle jobs that are
executed asynchronously in platform services. The OperationManager is not
a service itself, the interface is instead implemented by each service that
has need for asynchronous operations.
Using the Service

Sequence diagram for usage of asynchronous operation.
- The application requests a handle to the operation manager for a given
service.
- The application gets a new operation identifier from the operation manager
by calling IToiOperationManager::CreateOperation(). It also register itself
as listener to operation events.
- The application starts the asynchronous operation in the service and
provides the operation identifier as argument to the call. An exception
will be raised if there is already an ongoing operation connected to this
identifier.
- During the asynchronous execution the service will inform the operation
manager and the application will be notified with operation result events
during execution. Depending on the nature of the operation the service may
provide several events during execution or one single event when the
operation is either complete or has failed. The event provides information
about the operation such as the current state, progress and error code.
- Once the operation is complete, the operation state is set to
OPERATION_COMPLETED. If there are any result values that can be fetched from
the service, this will be indicated by the result argument in the event.
The possible result types are defined by the service. If there are no result
values the result argument is set to IToiOperationManager::OP_RESULT_NONE.
- If there are result values the application fetch these from the service
using the appropriate method. When the application is done, the operation
identifier can either be released by calling ReleaseOperation() or reused
in another asynchronous operation.