A write goes to Zanzibar and not straight to Spanner because a write here is specific to the application.
Spanner is a database. It can manage writes and order them. It has no idea of auth, ACLs or groups, just as it has no idea of orders in an e-commerce system. Zanzibar has the idea.
When Abhishek leaves a team, his access is removed in steps:
- The groups Abhishek is in are found.
- The documents which belong to those groups are found. These are read operations, an expand and a check.
- If the reads succeed, the write is done.
This is a conditional write, like a mini transaction. If the balance was sufficient, then deduct the balance. The database is too generic for it, so the logic belongs to the server.
Logic on the server brings back an old problem. One server deducts a balance and another adds to it, on the same DB. In Zanzibar, one person removes someone from a group and another makes them its chairman. Both cannot be accepted. One has to fail.