async
This service transforms a source of Go function(method) into a state-machine by:
- Creating a struct where all function local variables become struct fields
- Rewriting control flow into a struct tree, so that we can jump to any statement we want
This allows us to write statemachines in Go with
- Ease of writing and reading Go code
- Ability to save, dump, modify & resume it's state
- Type-safety of the code before & after transformation
See test folder for more info on how it works and how to use it.
The idea for this service is to leverage https://gitlab.com/albert_einstein/slct service to build asyncronous Go statemachine runtime.
Limitations:
- Only pure structs are currently supported
- You have to put '// :' comment after select statement and calls to other async functions. Theese serve as resume label for engine to know where to resume the process. For example "order.update" tells engine that the process should be resumed at function iwth "order" label and inside the function at label "update"
- The generation is pretty brittle - lots of features are not supported, so see test folder on what you can currently do.