Documentation
¶
Overview ¶
Package helpers provides experimental and unstable helpers.
Index ¶
- func ErrFromCtxs(ctxs ...context.Context) error
- func FanOutIn(mach *am.Machine, name string, total, concurrency int, fn FanFn) (any, error)
- func NestedState(e *am.Event, strIDField string, machGetter func(id string) *am.Machine) (am.Result, <-chan struct{}, error)
- func RaceCtx[T *any](ctx context.Context, ch chan T) (T, error)
- func RelationsMatrix(mach *am.Machine) ([][]int, error)
- func TimeMatrix(machines []*am.Machine) ([]am.Time, error)
- func TransitionMatrix(tx, prevTx *am.Transition, index am.S) ([][]int, error)
- type FanFn
- type FanHandlers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrFromCtxs ¶
ErrFromCtxs returns the first non-nil error from a list of contexts.
func FanOutIn ¶ added in v0.12.0
FanOutIn creates [total] number of state pairs of "Name1" and "Name1Done", as well as init and merge states ("Name", "NameDone"). [name] is treated as a namespace and can't have other states within. Retry can be achieved by adding the init state repetively. FanOutIn can be chained, but it should be called before any mutations or telemetry (as it changes the state struct). The returned handlers struct can be used to adjust the concurrency level.
func NestedState ¶
func NestedState( e *am.Event, strIDField string, machGetter func(id string) *am.Machine, ) (am.Result, <-chan struct{}, error)
NestedState forwards the mutation to one of the composed submachines. Parent state should be a Multi state and only called directly (not from a relation). TODO test case, solve locking by passing the event to the submachine
func TimeMatrix ¶
TimeMatrix returns a matrix of state clocks for the given machines.