DeluxeOwl / ssm

I'm not the dev. Mirror of https://git.sr.ht/~mariusor/ssm

Home Page:https://git.sr.ht/~mariusor/ssm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple State Machine

Build Status

This is a very basic API for creating State Machines.

A state is represented by any function which accepts a context as a parameter and returns another state function.

The states are run iteratively until the End state is reached, when the state machine stops.

Error handling is provided through two Error states:

  • The simple Error state which stops the execution
  • The RestartError state which restarts the execution from the first received state.
type Fn func(ctx context.Context) Fn

To start the state machine you can pass a state to one of the Run or RunParallel functions. The later runs the received states in parallel and the former does so sequentially.

About

I'm not the dev. Mirror of https://git.sr.ht/~mariusor/ssm

https://git.sr.ht/~mariusor/ssm

License:MIT License


Languages

Language:Go 100.0%