Multiple Users Updating a Single Stack

Howard Bornstein bornstein at designeq.com
Wed Jan 29 14:07:01 EST 2003


>If multiple users were to update a single stack (over a network, for
>instance), would RR handle everything nicely or could the stack become
>corrupted over time?

I can't speak to whether simply opening and closing the stack from a 
server would corrupt it. I suspect Rev will keep the integrity of the 
stack as well as if it were local on a hard drive. 

However, there is another problem of "data integrity" since when a user 
runs the stack off a server, he is opening a local copy on his computer 
in RAM. Changes made to the stack are made to the RAM copy and only when 
the file is saved are the changes written back to the server.

Imagine if two users are running the stack simultaneously. User A runs 
the stack locally and makes changes, then writes the stack back to the 
server. User B does the same thing but writes the stack back after User 
A. User B's version of the stack becomes the one residing on the server 
and all of User A's changes are lost (overwritten) because of User B's 
version.

I've implemented a simple lock-out procedure to handle this. This works 
in my situation because it's a stack that doesn't get a lot of activity 
and isn't hit by a lot of users at the same time. In such a situation, 
this wouldn't be an appropriate strategy.

on openstack
   -- check a custom property to see if the stack is locked
  if the cLock of this stack is true then
    Answer "Another user is currently using this program. You can read 
the information but won't be able to make any changes." titled "Program 
is in use."
  -- Since it's locked, don't allow changes to this field
  set the locktext of fld "thenotes" to true -- prevent any changes
  else
    -- lock out this stack so someone else can use it at the same time
    set the cLock of this stack to true
    save this stack
  end if
end openstack

on closestack
  --unlock the stack for a new user to use
  set the cLock of this stack to false
  set the locktext of fld "theNotes" to false
  save this stack
end closestack

Regards,

Howard Bornstein
____________________
D E S I G N  E Q
www.designeq.com



More information about the use-livecode mailing list