Modelling Checkin-Checkout using locks
Monday, 23 February 2015 · 6 messages · last reply 25 Feb 2015
AJ
Andreas Jung23 Feb 2015 16:52 #
Hi there,
I am currently thinking about ways how to model a reliable
checkout-checkin scenario with XML documents.
In an older SGML CMS system that we build, we implemented the procedure roughly like that:
- user chooses a document in the CMS and clicks on CHECKOUT
- CHECKOUT copy the document to a private area of the user
- CHECKOUT will lock the original file (reads allowed,
write forbidden)
- user edits the the copied content
- user performs either a CHECKIN which will copy
the private copy of the file into its original location
and release the lock
- or user will cancel the checkout (removing the
copy and releasing the lock)
I see that exist-db has support for read and exclusive
locks (inside the util: module).
Can they be used to implement such a scenario?
Is it possible to associate (arbitrary metadata) with locks
like lock time, user who created the lock, app specific data?
Is it possible to introspect all current locks on the database?
Is there something like a lock token (in WebDAV) does one needs to release a lock?
Andreas
AJ
Andreas Jung23 Feb 2015 16:53 #
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
oops, this was intended for the exist-db guys...but the question are similar...anyone used BaseX with a checkout-checkin scenario?
Andreas
Quoted text · Andreas Jung · 31 lines
Andreas Jung wrote: > Hi there, > > I am currently thinking about ways how to model a reliable > checkout-checkin scenario with XML documents. > > In an older SGML CMS system that we build, we implemented the > procedure roughly like that: > > - user chooses a document in the CMS and clicks on CHECKOUT - > CHECKOUT copy the document to a private area of the user - CHECKOUT > will lock the original file (reads allowed, write forbidden) - user > edits the the copied content - user performs either a CHECKIN which > will copy the private copy of the file into its original location and > release the lock - or user will cancel the checkout (removing the > copy and releasing the lock) > > I see that exist-db has support for read and exclusive locks (inside > the util: module). > > Can they be used to implement such a scenario? > > Is it possible to associate (arbitrary metadata) with locks like lock > time, user who created the lock, app specific data? > > Is it possible to introspect all current locks on the database? > > Is there something like a lock token (in WebDAV) does one needs to > release a lock? > > Andreas
- --
Regards
Andreas Jung
andreas at andreas-jung.com
about.me/andreasjung
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQGUBAEBAgAGBQJU60znAAoJEADcfz7u4AZj1lQLwKUdviDiZ8+coRTOSfh+W+Iw 6GMSIAL3VrmnpiTTkipwJS+8VlKqUTlb7V/tQPuG1kUVgILAtN6LaUrnJgvYlbbn edNkJzxcbrfr0Yme2a/f3DhHkSp3f4csb6nCd0OOIOP5n2y9+/judrnffoaOFlyq 8tJM3/KU732M222YrWzah8l51i56FDYQohL3H0fkUWh3e6SKZQrTQyGhgFBC2ER7 XbfFpf976vzevLtMiF1anEt+tM86DQukRqIKIrC9sgO0VRz2LT3sNv2rO7bEDdok TZZsx+VbXCbp3hNWc8L/pH4UEz9A2xbvxms/nRt0aQmA2C8F0HS2QX/5fTyRW860 ValDn9/9ctyANjYGQkrrH3BeQ2AW2sjflUDQt29vpmpWC1JivOu7fAgCN3mHyT3F dBdCjoQpryQ4baaq4kKl1ecQMIDfmKJ1Bl3St4qrkkfk7fIyhUIofB+zwM+wcLXp t46CiTTxVPKbFjsce3ZyClW76mlUEek=
=gISO
-----END PGP SIGNATURE-----
CG
Christian Grün23 Feb 2015 18:15 #
Quoted text · Andreas Jung · 2 lines
> oops, this was intended for the exist-db guys...but the question > are similar...anyone used BaseX with a checkout-checkin scenario?
First of all: I'm also interested to hear more about this from our users..
Talking about locking functions, we plan to generalize our WebDAV locking feature to a general database locking mechanism. The WebDAV locks already contain information on the user who created the lock, a timeout, the scope (shared vs. exclusive), the lock id, etc., and this info could be extended by the lock time and other (maybe even application specific) info. Do you have some examples for data that could be specific to an application?
Christian
AJ
Andreas Jung23 Feb 2015 18:23 #
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted text · Christian Grün · 14 lines
Christian Grün wrote: >> oops, this was intended for the exist-db guys...but the question >> are similar...anyone used BaseX with a checkout-checkin scenario? > > First of all: I'm also interested to hear more about this from our > users.. > > Talking about locking functions, we plan to generalize our WebDAV > locking feature to a general database locking mechanism. The WebDAV > locks already contain information on the user who created the lock, > a timeout, the scope (shared vs. exclusive), the lock id, etc., and > this info could be extended by the lock time and other (maybe even > application specific) info. Do you have some examples for data that > could be specific to an application?
In our SGML CMS you were able to checkout parts of a bigger document for example a chapter. In this case we needed additional information inside the checked-out document - perhaps not on the lock itself - we used processing instructions for that as far as I recall.
Being able to store arbitrary key-value pairs on a lock would be sufficient. Otherweise I would store such application specific data as an additional XML file containing these informations.
Andreas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQGUBAEBAgAGBQJU62IaAAoJEADcfz7u4AZjNZALv0Io/kz/HrL2w/1AjXrYs2n4 bMpW+qqxRj91WlLJxDZrjfHXOaaB3km+aHBlatEWQOnZSeLtaHBYYzsSToXHvj5L O29kxgRaMXLw30YtsfeRIVLeefGY6Y34F44N+EZmrdqb1Mfr2HCl9/B/LTBhv34z +9H22XMroPEgM40sBWkUzl6pr+FHwDH5NovByFuwu2Bw+gvhOWlWRvwZ5i5xRmvY OET2uhqVeAqeHaEyyH7Ox+m95deqsVU9t/JrA71xtkXfaNpIDNtgxnqaej2pLSDc XiaklMmaqnNMZUahd+StoCtvqPnAGloWxjbb4WUnEU+6z+lOB+u/vbxNXBQkyeSb 2lRbDcvVbiitupC3tackuNxLjOBbvPMNYsQ010297VkALKTp2ZBX8azPei/SgvaQ cQJxegRpSMi+ThOam5U2V4i0+CSkRrUV6EgtYYEyPuGa6mDEmNi80V6yELF328H6 CI/dcovjtTp/6VDZB3g8u02oXVmu7s4=
=HJMw
-----END PGP SIGNATURE-----
CG
Christian Grün24 Feb 2015 15:31 #
I have added a GitHub issue on your locking request [1]. In the meanwhile, it's probably best to use RESTXQ (XQuery) and check if a resource is locked before returning it to a user.
[1] https://github.com/BaseXdb/basex/issues/1083
Quoted text · Andreas Jung · 29 lines
On Mon, Feb 23, 2015 at 6:28 PM, <zopyxfilter at gmail.com> wrote: > Andreas Jung wrote: >> Christian Grün wrote: >>>> oops, this was intended for the exist-db guys...but the question >>>> are similar...anyone used BaseX with a checkout-checkin scenario? >>> First of all: I'm also interested to hear more about this from our >>> users.. >> >>> Talking about locking functions, we plan to generalize our WebDAV >>> locking feature to a general database locking mechanism. The WebDAV >>> locks already contain information on the user who created the lock, >>> a timeout, the scope (shared vs. exclusive), the lock id, etc., and >>> this info could be extended by the lock time and other (maybe even >>> application specific) info. Do you have some examples for data that >>> could be specific to an application? >> >> In our SGML CMS you were able to checkout parts of a bigger document >> for example a chapter. In this case we needed additional information >> inside the checked-out document - perhaps not on the lock itself - >> we used processing instructions for that as far as I recall. >> >> Being able to store arbitrary key-value pairs on a lock would be >> sufficient. Otherweise I would store such application specific >> data as an additional XML file containing these informations. > > At least needs to be some support for lock token in order detect > lock/unlock conflicts. > > Andreas
AJ
Andreas Jung25 Feb 2015 04:58 #
Quoted text · Christian Grün · 6 lines
Christian Grün wrote: > I have added a GitHub issue on your locking request [1]. In the > meanwhile, it's probably best to use RESTXQ (XQuery) and check if a > resource is locked before returning it to a user. > > [1] https://github.com/BaseXdb/basex/issues/1083
Thanks.
Meanwhile I started working on my own locking abstraction layer in my app - based on traditional lock files for now. I will see how can I use the more specific lock implementations of eXist or BaseX later on.
Andreas
Written for BaseX 8.0. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery