Skip to content

Design a Reactive Database (Live Queries), stage 4 of 9: decide

Twelve tasks, eleven cards

The board and the count are separate subscriptions. Each is re-run and pushed as soon as its own run finishes.

System so far· 5 parts
123456CLIENTWeb andmobile appsSERVICESync serversSERVICEFunction runnersDATABASEVersioned storeSERVICESubscriptiontracker

Select a component to see what it is responsible for and which state it owns.

  1. 1Web and mobile apps → Sync servers: Subscribe and mutate
  2. 2Sync servers → Function runners: Run a function
  3. 3Function runners → Versioned store: Read at a snapshot
  4. 4Versioned store → Subscription tracker: Committed writes, in order
  5. 5Subscription tracker → Sync servers: These subscriptions changed
  6. 6Sync servers → Web and mobile apps: New results
  • Request / response
  • Asynchronous
  • Server push

What you need to know

0 of 2 checks done
  1. When a screen shows several queries, each one is true at some moment. If they're re-run and pushed independently, the screen can show the board at one moment and the count at another: twelve tasks counted, eleven shown.

    A multiversion store keeps recent versions of data, so it can answer "as of timestamp T". That makes the moment explicit.

  2. Check

    Every result is tagged with the timestamp it was computed at. What rule should the client follow?