Background operations (IRPCBackgroundOperationsAdmin)
Monitors the vault's background work: refreshes of external object types and external locations, and the queue of asynchronous tasks.
Use this interface to start, stop and query background operations.
| gRPC service | MFiles.IRPCBackgroundOperationsAdmin |
|---|---|
| Book and level | Administration API, specialized |
| Methods | 9 |
| Proto file | mfiles/IRPCBackgroundOperationsAdmin.proto |
Overview
M-Files Admin uses this service to show and start background refreshes and to list the vault's
asynchronous tasks. Every method needs a vault session and the vault right
change_metadata_structure (part of full control); a normal user gets "Access denied.". The exception is
CheckAndRegisterMultiServerResponsibility,
which is for an M-Files component.
Background operations are identified by a
BackgroundOperationID: type and id. M-Files Admin uses
BACKGROUND_OPERATION_TYPE_REFRESH_EXTERNAL_OBJECT_TYPE with the object type ID and
BACKGROUND_OPERATION_TYPE_REFRESH_EXTERNAL_LOCATION with the external location ID. Start one with
StartBackgroundOperation,
then follow it with
GetBackgroundOperationStatus
or block with
WaitForBackgroundOperationCompletion.
Asynchronous tasks (AsyncTask) are work items that the vault queues
and runs later, for example permission updates after a change (ACLPseudoUserPropagation,
RefreshObjectsACL) or preview file generation (GenerateViewerFiles). Task IDs grow over
time. Read them with
GetAsyncTasksRange or
GetAsyncTask, and wait for them with
WaitForAsyncTaskCompletion.
To wait until the vault has finished all background work queued so far (for example in a test, after a change that triggers permission updates):
- QueueAndGetLatestAsyncTask;
stop if
is_availableis false. - WaitForAsyncTaskCompletion
with
async_tasks= [that task's ID] andtasks_request= {async_task_start: the same ID,max_count: 50,latest: true,filters: 3 (queued or running) }. - Repeat step 2 with the IDs in
tasks_response.async_tasksuntil it is empty.
Methods
| Method | Summary | Facts |
|---|---|---|
| CheckAndRegisterMultiServerResponsibility | Tells whether this server is the one in a multi-server vault that runs the reporting data exports, and claims that role if no server has it. | internal: not for applications admin session idempotent |
| GetAsyncTask | Gets one asynchronous task by ID. | admin session idempotent |
| GetAsyncTasks | Gets the vault's asynchronous tasks, newest first. | admin session idempotent |
| GetAsyncTasksRange | Gets a page of asynchronous tasks, oldest or newest first, optionally only tasks in given states. | admin session idempotent |
| GetBackgroundOperationStatus | Gets the run state of a background operation, such as an external object type refresh. | admin session idempotent |
| QueueAndGetLatestAsyncTask | Gets the newest asynchronous task of the vault and asks the server to queue pending tasks for running now. | admin session idempotent |
| StartBackgroundOperation | Starts a background operation now, such as a full refresh of an external object type from its external database. | admin session idempotent |
| WaitForAsyncTaskCompletion | Waits until the given asynchronous tasks have finished, then optionally returns a list of tasks. | admin session idempotent |
| WaitForBackgroundOperationCompletion | Waits until a background operation has finished, or stops it. | admin session idempotent |