Strategies for "checkout" or explicit file locking
APAlister Pillow15 Jun 2014 12:13 # Hi all,
BaseX doesn’t appear to have explicit document-level access control (ownership and permissions). I understand that Write and Read locks are applied during queries - but these are not explicit and only apply during the course of the query.
I wonder what strategies other people use to lock a file for “editing”, or “checkout” a file so that only a single user has access (in a multi-user environment).
Does anyone manage more than a few users within one instance of BaseX? (e.g. more than 10)
Thanks,
Alister.
CGChristian Grün16 Jun 2014 13:08 # Quoted text · Alister Pillow · 1 line
> I wonder what strategies other people use to lock a file for “editing”, or “checkout” a file so that only a single user has access (in a multi-user environment).
We usually apply the XQuery locking options [1]: From all XQuery expressions that reference the same lock string, only one writing process will be run one at the same time. This can e. g. look as follows:
read.xq:
declare option query:read-lock "config";
file:read-text("config.xml")
declare option query:write-lock "config";
file:write-text("config.xml", 'blablabla')
⚡Generated with XQuery