One of the challenges that I am struggling with in Firebase is that because the client (untrusted) is in control, how can I assure that I maintain referential integrity across changes that require multiple operations, e.g., delete a node and THEN update another node, e.g., updating an index in another node.
Since this is two updates; I cannot see how I can use the validation rules to ensure this. My current solution is to use the onDisconnect mechanism to back out changes if something were to fail, e.g.,
1) Setup a onDisconnect to restore the index.
2) Delete from index.
3) Setup a onDisconnect to restore the node
3) Delete the node
4) Cancel the onDisconnects across the entire Firebase (would cancel both onDisconnects in one fell swoop).
note: This could get pretty ugly if I had to do a bunch of operations.
Any other tricks?
I some other posts about queues and priv-workers (presumably on my application server); but I am trying to get away from having my server.
Like the queue, I could simply have the client work through my my application server (which then updates Firebase). Again, I do not want my server.
John