Builds a typed graph. The builder issues every handle - nodes, joins - and validates the whole graph in compile, reporting every problem at once.
Nodes that route to each other in a cycle are declared first and implemented afterwards:
val b = GraphBuilder("counter", "v1")
val count = StateKey.replace[Int]("count", 0)
val tick = b.declare[Unit]("tick")
b.implement(tick, writes = Set(count)) { (_, state, _) =>
NodeResult.fromResult(state.get(count).map { n =>
val next = Command.empty.update(count, n + 1)
if n + 1 < 3 then next.goto(tick) else next
})
}
val graph = b.compile(tick)(_.get(count))
The builder is mutable and meant to be used from one thread while the graph is assembled; the CompiledGraph it produces is immutable.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Value members
Concrete methods
Validates the graph and compiles it. output projects the final committed state when the run goes quiescent.
Validates the graph and compiles it. output projects the final committed state when the run goes quiescent.
Attributes
Issues a handle for a node consuming I; implement it before compiling. inputVersion is the version of I's JSON shape in checkpoints, with migrations from earlier versions.
Issues a handle for a node consuming I; implement it before compiling. inputVersion is the version of I's JSON shape in checkpoints, with migrations from earlier versions.
Attributes
Issues a handle for a node that continues suspended work, consuming Resumed[Q, A]; implement ref.node like any other node. questionVersion versions the question's JSON in checkpoints; inputVersion versions the Resumed payload of a scheduled continuation.
Issues a handle for a node that continues suspended work, consuming Resumed[Q, A]; implement ref.node like any other node. questionVersion versions the question's JSON in checkpoints; inputVersion versions the Resumed payload of a scheduled continuation.
Attributes
A barrier released when every child of a fan-out has completed; see DynamicJoin.
A static edge: every completed task of from also schedules to, before the routes in its command. Edges from one node are scheduled in declaration order.
A static edge: every completed task of from also schedules to, before the routes in its command. Edges from one node are scheduled in declaration order.
Attributes
Gives a declared node its behaviour and the state keys it may update or remove. retry runs the node again after its own failure (RetryPolicy); cache answers a repeated input from memory for a node that depends only on its input (CachePolicy). Neither changes the graph's structural fingerprint.
Gives a declared node its behaviour and the state keys it may update or remove. retry runs the node again after its own failure (RetryPolicy); cache answers a repeated input from memory for a node that depends only on its input (CachePolicy). Neither changes the graph's structural fingerprint.
Attributes
Declares and implements a node in one step.
Declares and implements a node in one step.
Attributes
Declares and implements a resume node in one step.
Declares and implements a resume node in one step.
Attributes
Registers a key that nodes read but none writes, such as one seeded by a restored snapshot.
Registers a key that nodes read but none writes, such as one seeded by a restored snapshot.
Attributes
A barrier that runs target after every node in sources has completed; see StaticJoin.