stateless
stateless copied to clipboard
Allow setting a state machine to some intermediate state
In scenarios where state machine entities are persisted and outlive a host's memory, and then are later retrieved to act upon, it would be helpful to be able to efficiently load the state machine logic for its current state, to know what it can do and fire off tasks and potentially transition to the next state.
So something like func (sm *StateMachine[S, T]) SetState(state S)
, to immediately put the StateMachine
into the state the entity is in, and act on it from there.
Is there appetite for something like this, and are there any concerns or limitations preventing it from being added?