state_dependency¶
Intro¶
There are states and recipes for reaching that state.
This is a similar way how states are "bootstrapped" in other tools, for example:
There is no domain-specific lang used by protoprime to define those states (everything is defined via python code).
Identification¶
Each state is identified by a string (state name).
proto_code defines states only for "proto" phase (see primer_runtime).
Client code may use that framework to implement client-specific states.
Dependency: static and dynamic¶
States can depend on other states. These dependencies form a DAG.
When child state (statically) depends on parent state, parent state may or may not be (dynamically) bootstrapped before its child.
The dependencies are declared statically (before execution), but executed dynamically (conditionally):
NOTE: state implementation is free not to bootstrap any parent state (based on dynamic evaluation of conditions)
BUT: state implementation must not bootstrap any other state beyond statically declared as parent
Declaring dependencies statically allows ensuring there are no cycles (which break DAG).