Strategies for "checkout" or explicit file locking
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.
Dear Alister,
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") write.xq: declare option query:write-lock "config"; file:write-text("config.xml", 'blablabla') Hope this helps, Christian [1] http://docs.basex.org/wiki/Transaction_Management#XQuery_Locking_Options
participants (2)
-
Alister Pillow -
Christian Grün