Deleting Files From Storage
Cerebro Support avatar
Written by Cerebro Support
Updated over a week ago

Cerebro users can delete files that were previously uploaded to the storage. On deletion, first, the database entry is being erased, and after that, the file should be removed from the storage.

The trick is that one file can be referred to from several messages (possibly from different users as well), and in this case deleting one link should not affect file accessibility. On the other side, Cerebro may be configured to work with several storages, and that file may not exist on every storage.

Taking this issue into consideration, Cerebro uses the following file deletion procedure:

  • a Python script for file deletion is launched on every file storage periodically (on schedule);

  • a database query made from under a special account gets a list of all files marked for deletion by Cerebro users;

  • if a file from the list is found in a Cargador catalogue, it is physically deleted.

Note

You need to have Python (http://www.python.org) version 3.х or higher installed in your system to launch this script. Make sure that Python directory has been added to system path. This information, as well as the current Python version number, can be obtained by running the following command in the command line:

python3 --version


The file deletion script parameters can be configured by cron_conf.py script, its sample is located in service-tools.zip package. The set of parameters for file deletion procedure is described below:

DB_HOST=""
DB_PORT=45432
DB_SCHEMA="memoria"

CARGADOR_HOST=""
CARGADOR_RPC_PORT=4040

CARGADOR_DEL_PASSWORD='' # password for sweeping deleted files.
#    Must match with cargador.conf/config/catalog/del_password

Parameter values:

  • DB_HOST — database application server IP address (or DNS name) in the LAN or Internet (depends on Cerebro installation type, see “Deployment Options”);

  • DB_PORT — network port used by PostgreSQL on the database application server (default port is 5432);

  • DB_SCHEMA — database name (default name is memoria);

  • CARGADOR_HOSTCargador server IP address (or DNS name) in the LAN (e.g., localhost);

  • CARGADOR_RPC_PORT — port used to connect to Cargador via XML-RPC protocol, used by the file deletion script (4040 by default);

  • CARGADOR_DEL_PASSWORD — password for file deletion from a storage (see the explanation below).

The CARGADOR_DEL_PASSWORD parameter must match with password in the cargador.<linux|mac|win>.conf configuration file, the sample of which you unpacked from the service-tools.zip archive into the Cargador launch directory.

During standard Cargador installation procedure, the only value you must set in this file is the password - the del_password parameter in the config/catalog section. You may specify any value here, the only requirement is that it must be equal to CARGADOR_DEL_PASSWORD value in cron_conf.py.

Did this answer your question?