I would wrap the lock-granting in a transaction: 1. read. 2. ensure not locked. 3. set locked. 4. write.
If the entity is locked in step 2 or the transaction fails, then bail out -- you didn't get the lock. See: http://code.google.com/appengine/docs/datastore/transactions.html On Jan 14, 3:23 pm, jay <j...@jaykyburz.com> wrote: > Hi All, > > I have a quick question which seems to be a common topic here but I > cant find a clear answer. Hope you can help. > > My application allows users to download a blob of data and edit it. > The blob cannot be merged so while the data is in use I need to "lock" > the data allowing others read only access. > > I concerned that there is no guaranteed way to grant a user this > lock. > > Is this possible? Is there preferable strategy? > > I was thinking something like this > > write --> attempt to take ownership of file by appending my email to a > list > read <-- check that lock was granted to me and only me. Only my email > in the list. > > read <-- grab the blob > do my work > write --> save the blob and clear the owner list > > I can make this work if the read is guaranteed to happen _after_ the > write of ownership info. > > Are read write operations guaranteed to occur in the order I call them > in the script. ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---