Firebase: How do I update multiple resources atomically?

前端 未结 2 1437
忘了有多久
忘了有多久 2020-11-27 14:59

Firebase allows for a resource to be updated transactionally. As I understand it, the client does this buy sending requests to the server saying \"If the old value is X, ma

2条回答
  •  [愿得一人]
    2020-11-27 15:42

    there is another way.... very tedious... and not really transactions...

    As Firebase allows atomically changes on a value, you could create a lock or semaphore with the meaning of "started a transaction on the resources x, y and z"... of course, it is not a real transaction as it doesn't block resources, a part from the lock. We could call it transaction by convention. The clients needs to know that when the lock is occupied, they should not change x, y and z resources....

提交回复
热议问题