Background operations (IRPCBackgroundOperationsAdmin)

View as Markdown

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 serviceMFiles.IRPCBackgroundOperationsAdmin
Book and levelAdministration API, specialized
Methods9
Proto filemfiles/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):

  1. QueueAndGetLatestAsyncTask; stop if is_available is false.
  2. WaitForAsyncTaskCompletion with async_tasks = [that task's ID] and tasks_request = { async_task_start: the same ID, max_count: 50, latest: true, filters: 3 (queued or running) }.
  3. Repeat step 2 with the IDs in tasks_response.async_tasks until it is empty.

Methods

MethodSummaryFacts
CheckAndRegisterMultiServerResponsibilityTells 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
GetAsyncTaskGets one asynchronous task by ID.admin session idempotent
GetAsyncTasksGets the vault's asynchronous tasks, newest first.admin session idempotent
GetAsyncTasksRangeGets a page of asynchronous tasks, oldest or newest first, optionally only tasks in given states.admin session idempotent
GetBackgroundOperationStatusGets the run state of a background operation, such as an external object type refresh.admin session idempotent
QueueAndGetLatestAsyncTaskGets the newest asynchronous task of the vault and asks the server to queue pending tasks for running now.admin session idempotent
StartBackgroundOperationStarts a background operation now, such as a full refresh of an external object type from its external database.admin session idempotent
WaitForAsyncTaskCompletionWaits until the given asynchronous tasks have finished, then optionally returns a list of tasks.admin session idempotent
WaitForBackgroundOperationCompletionWaits until a background operation has finished, or stops it.admin session idempotent