Knowledgebase: Installation and Configuration
Setup file callbacks
Posted by Sven Koester, Last modified by Andre Kuehnemund on 22 July 2011 12:01
To allow some degree of customization of file handling in PresSTORE, there is an option to assign several user-defined callbacks in the form of scripts (or application programs) at some predefined points in the PresSTORE filesystem abstraction driver. |
As of the V2, PresSTORE supports following file callbacks: touch delete version.
The touch callback is invoked after an new file is created or existing file is written to. The callback is called with one single argument which is the absolute path of the file created (or written):
The delete callback is invoked before a file will be deleted. The callback is called with at least one or more arguments where each argument represents absolute path of the file to be deleted:
delete_callback filepath1 filepath2 ...
If you declare the delete callback, it is your responsibility to delete the file(s). PresSTORE will assume the file(s) has/have been deleted after calling your program, regardless of what you do in the callback (and wether the file(s) is/are ultimately deleted or not).
The version callback is invoked before a new version of a file needs to be created. The callback is created with the following arguments:
version_callback time numvers rootdir filepath
time - unix time_t stamp in number of seconds since the Epoch
numvers - number of versions to keep, as set by the user
rootdir - absolute path of the target directory
filepath - absolute path of the file for which to make a version
To declare any of the callbacks you need to setup server-wide options like this:
ns_param versionCallback path
ns_param touchCallback path
ns_param deleteCallback path