You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then the initialise action can't neatly change states with transition_state because the target state isn't static, it depends on the resource being initialised.
Describe the solution you'd like
A custom change action could be written to pick the state to transition to, eg.
Based on this, I think it should be possible to add another change function like transition_state but called something like next_state.
next_state could introspect the defined transitions for a resource and find one that:
matches the current action
has the current state in the from list
has a single state in the to list (that isn't :*)
and then transition to that state.
An error could be raised (similar to NoValidTransition, maybe NoValidNextState) if there is no single state that can be determined to transition to.
Express the feature either with a change to resource syntax, or with a change to the resource interface
update:initialisedochangenext_state()# new function!end
Additional context
My initial attempt at starting to implement this that doesn't even compile and is probably pretty dodgy (based on copypasting and tweaking the code for transition_state) -
Is your feature request related to a problem? Please describe.
If a state machine has two transition definitions, eg:
Then the
initialise
action can't neatly change states withtransition_state
because the target state isn't static, it depends on the resource being initialised.Describe the solution you'd like
A custom change action could be written to pick the state to transition to, eg.
Based on this, I think it should be possible to add another change function like
transition_state
but called something likenext_state
.next_state
could introspect the defined transitions for a resource and find one that:from
listto
list (that isn't:*
)and then transition to that state.
An error could be raised (similar to NoValidTransition, maybe NoValidNextState) if there is no single state that can be determined to transition to.
Express the feature either with a change to resource syntax, or with a change to the resource interface
Additional context
My initial attempt at starting to implement this that doesn't even compile and is probably pretty dodgy (based on copypasting and tweaking the code for
transition_state
) -The text was updated successfully, but these errors were encountered: