Question
This question will be for developers I wanted to know how twiki solves problem of simultaneous editing of topics by multiple users. And also was intrested to know on what basis new versions are prepared.
Environment
--
KunalShah - 26 Feb 2005
Answer
It currently creates a lock file. New versions are created if a different user edits the topic or if the same user re-edits more than 60 minutes after their previous edit.
--
CrawfordCurrie - 27 Feb 2005
Here the module for topic locking see if it is fesible. Appriciate anybodys suggestion on this
Note: - As we r using Asp.Net we have application object and application variables where we can store few things which can be assessed by the complete application. We r thinking to use this application object to keep track of all files which are currently edited.
Module for Topic Locking;-
To be used when user clicks edit,
1. Check weather the user is a authenticated user to edit a particular page. (This is because along with registration we r providing users facility to fix users who can edit the page. i.e we provide read permission to all but write permission to selected)
2. Lock the topic so that multiple accesses is avoided.
3. Versioning module starts next.
Algorithm for Topic Locking
1. Make a Application object entry which contains following
- Topic Name b. UsageCounter (indicating no of users are currently editing the page.)
2. on edit search the file in the application object
3. If file present (Topic already locked.)
- Prompt user accordingly (Send him a warning message as in Twiki) b. If he clicks edit anyway c. Increase Counter value by one. d. Call to Create New version module. (if its new session) e. Provide user with code of <TopicName.aspx> to edit it.
4. Else If files not present (Topic not locked yet)
- Lock the topic and Increase the counter variable.(from zero to one) b. Call to create new Version module. (if its new session) c. Provide user with the code of <TopicName.aspx> to edit it.
Save Module
- On click to save access application variable again and remove TopicName from the application variable if the counter field is 1. b. Else just decrement the counter by one and continue. c. The user who saves last his topic will be the latest topic now onwards.
what i want to know is what happens when user clicks "Edit it anyway link". Now what happens according to me is two different versions are created for two diff users, but the problem is whose version is considered as latest version?
Here there an be a little inconsistence or ambiguity on whose version remains latest and also on what code to be provided to the second user when he clicks edit
Please suggest me some idea if u think this algo is not a proper solution to simultaneous editing of topics.
--
KunalShah - 28 Feb 2005
The
DevelopBranch has obviated the need for locks; see
ReleaseLocksOnSave and
AvoidConsecutiveRevisionsBySameUser
--
WillNorris - 01 Mar 2005
Actually it hasn't, not completely anyway. Locks are still used to make certain operations, such as topic rename, atomic. However this should be totally internal to the store implementation.
--
CrawfordCurrie - 01 Mar 2005