Forum OpenACS Q&A: locking files that are currently edited

I need a file storage that locks files that are edited. I want to suggest a parameter either in file-storage or content repository where you can enter an interval in seconds how long a file should be locked in case of an edit. if the number is set to 0 it is not locked otherwise it is locked for the given interval.

Currently there is link called "Download" that will serve the file. I want to suggest another link "Edit" for files which will also serve the file but save to database user_id and timestamp when it was served. Files that are locked will be displayed a little bit different to others. when a second user tries to upload a new version of a locked file a complaint is given with details on who is blocking the file and when the lock will be released.

there can be a sweeper that removes locks every lets say two minutes if the interval has passed.

does this approach sound reasonable to you? Shall I implement the core if this feature in cr or file storage?

Collapse
Posted by Claudio Pasolini on
This matter has already been discussed years ago and someone suggested to add a check-out/check-in feature to file-storage. I think that this feature would generally be very useful, mainly for certain business such as engineering.

I suggest:

  • to use the timeout parameter also to specify if the check-out/check-in feature is enabled or disabled, leaving things unmodified in the latter case;
  • to rename 'Check-Out' and 'Check-In' the links and /or buttons, if the feature is enabled;
  • to allow an admin to clear a lock even if the timeout interval is not passed.
Collapse
Posted by mervyn colton on
The check in check out idea is more useful in many situations. If the timeout was wanted, then how about 2 parameters?

check_inout which says if you lock files or not, as per post number 2,
check_out_timeout which is a number of minutes after which the file is un-checked out automatically on a sweeper. If this second parameter is zero, it is never automatically checked back in.

if using check out and check in, an option to "cancel" the checkout is useful for both the person that did the checking out and for admin staff.

Merv.

Collapse
Posted by Nima Mazloumi on
not sure if two is necessary. what if there is the timeout parameter. if set to 0 (default) then a check in/out mechanism is not wanted. If the timeout is greater 0 then it is.
Collapse
Posted by gustaf neumann on
be aware that locking via HTTP is part of the webdav specification (rfc2518). There are recently a couple of new rfcs (and canididate RFCs) in this area such as rfc3253 (Versioning Extensions to WebDAV), rfc4709 (Mounting Web Distributed Authoring and Versioning (WebDAV) Servers), rfc4331 (Quota and Size Properties for Distributed Authoring and Versioning (DAV) Collections), and rfc4316 (Datatypes for Web Distributed Authoring and Versioning (WebDAV) Properties).
The goal should be to safely edit files in place. Here, WebDAV is certainly an important player, which is supported by more and more operating systems. Even, if you don't want to for some reason to use webdav in your requirements, whatever is done should be conceptually compatible.
Collapse
Posted by Michael Steigman on
There are cases where you may not want to unlock the file via the sweeper process (ever). I think the two parameters suggested by Mervyn would enable a flexible configuration of this feature.

I also agree with his point that the checkout feature is a generally useful feature. It's something I've talked with DaveB about on several occasions. I really think it should be part of the CR and not specific to FS.