It seems to me that it's possible to implement atomic exclusive locking by slightly abusing the ACL features of Parse. Also, given the ability to lock like this, a queue should also be possible.
You'll see that a lock is held by a user, so we assume that each client has a different user. To claim the lock, you simply alter the ACLs in such a way that no other user can write. To release it, you revert the ACLs.
My class handles a collection of locks, where you can fetch locks using normal queries, and then claim and release them.
A subclass of this handles a queue, which is basically just an ordered collection of locks.
Any interest in including something like this in ParsePy?
It seems to me that it's possible to implement atomic exclusive locking by slightly abusing the ACL features of Parse. Also, given the ability to lock like this, a queue should also be possible.
Here's a first pass at an implementation: https://gist.github.com/dankrause/a58161d3f4a7db904b57
You'll see that a lock is held by a user, so we assume that each client has a different user. To claim the lock, you simply alter the ACLs in such a way that no other user can write. To release it, you revert the ACLs.
My class handles a collection of locks, where you can fetch locks using normal queries, and then claim and release them.
A subclass of this handles a queue, which is basically just an ordered collection of locks.
Any interest in including something like this in ParsePy?