4 ms·
There is something wrong with the terminology here. State machine = push based working? I've found bitemporal databases a good way of thinking about most cru
by hyperman1 2y ago
There is something wrong with the terminology here. State machine = push based working?
I've found bitemporal databases a good way of thinking about most crud-style applications, including payment systems. Basically, you keep 2 timestamps: When something supposedly happened, and when you learned about it. This means you leave a logbook of every action around. By replaying the logbook ordered on happened timestamp, you arrive at the correct current state. You can only append to the logbook, never modify an existing field. You use a state machine to gather the state from the logbook, and probably cache it in another table
So e.g. on day 1 you do a payment. happened=learned=day 1, paid. On day 2 you find out this was an error: happened=day1, learned=day2, undo payment.