view Sphinx/source/plugins/delayed-deletion-plugin.rst @ 1126:28dfd8d2d082 default tip

documenting wsi 3.0
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 27 Dec 2024 20:29:59 +0100
parents b9fe60571a3e
children
line wrap: on
line source

.. _delayed-deletion-plugin:


Delayed deletion plugin
=======================

.. contents::

This page describes the **official sample plugin** that performs
delayed deletions of storage files. This plugin was **introduced in
Orthanc 1.11.1** as part of its official distribution.

On some file systems, the deletion of files can be quite long and therefore,
a ``DELETE`` request on a study with thousands of instances can last minutes.

The Delayed deletion plugin handles file deletion asynchronously by pushing
the files to delete into a queue that is handled asynchronously.
This queue is stored in a SQLite DB stored on disk which allows the plugin
to resume deletions if Orthanc is stopped/restarted while deleting files.


Configuration
-------------

.. highlight:: json

Here's a sample configuration section for this plugin with its default values::

  {
    "DelayedDeletion": {

      // Enables/disables the plugin
      "Enable": false,

      // Delay (in milliseconds) between deletion of 2 files
      // This avoids overloading Orthanc disk with the deletion
      // of files and leaves room for other operations.
      // '0' means no throttling.
      "ThrottleDelayMs": 0,

      // Force the path of the SQLite DB
      // By default, this value is generated by the plugin base on
      // the "StorageDirectory" and "DatabaseServerIdentifier"
      // configurations.
      // If running multiple Orthanc on the same storage, make
      // sure that they use different "Path" for the DelayedDeletion DB
      // "Path": "/my/path/delayed-deletion.db"
    }
  }

Working with multiple Orthanc instances
---------------------------------------

When running multiple instance on the same DB (e.g a PostgreSQL DB), each
Delayed Deletion plugin will maintain its own list of files to delete and
store it in its own SQLite DB.  To make sure each instance has its own
DB, the plugin uses the ``DatabaseServerIdentifier`` configuration to 
generate the name of the SQLite DB.



Status
------

You can get a progress status of the plugin by calling the ``/plugins/delayed-deletion/status`` API route.


Compilation
-----------

This plugin is part of the Orthanc core repository and is included in the Orthanc makefile.  
It is compiled with Orthanc itself and is distributed together with Orthanc binaries.