2 ms·
That's a great way of phrasing it. A boolean can be a FSM in hiding. Tracking FSM transitions is the change history/transaction log, isn't it? It would be: {
by jpollock 4y ago
That's a great way of phrasing it. A boolean can be a FSM in hiding.
Tracking FSM transitions is the change history/transaction log, isn't it?
It would be:
{timestamp, old_state, event, new_state}
If we convert booleans to timestamps for the FSM, I end up with:
timestamp not_configured;
timestamp being_provisioned;
timestamp active;
timestamp disabled;
timestamp deleted;
Which would cause confusion when there are multiple FSMs in the same database record.
We could isolate each FSM into its own column.
It still makes it kind-of hard to decide what's the current state. The set of timestamps needs to be considered and sorted, going from field to {field_name, timestamp} and then sorting by timestamp and extracting the max. It would make "select count(*) from customers where current_state = 'active'" brittle - the addition of a new state would require all existing queries to change.