Runtime API
Core classes
Section titled “Core classes”AsyncGraph::Graph
Section titled “AsyncGraph::Graph”Builds and executes the workflow graph.
Methods:
node(name, &block): define a node block under a symbolic name.edge(from, to, branch: nil): add a normal edge or a barrier join edge.set_entry_point(name): mark the first node.set_finish_point(name): route a node toAsyncGraph::FINISH.step(state:, node:, resolved: {}, resolve_request: nil): execute one logical step.edges_from(node): inspect configured destinations.join?(node): check whether a node is a barrier join.join_for(node): return the source nodes expected by a join.process_join(token:, joins:): park or release join tokens for custom runners.validate!: validate the graph before execution-facing operations.
AsyncGraph::Await
Section titled “AsyncGraph::Await”Used inside node blocks to suspend on external work.
Methods:
call(key, kind, payload = {})all(definitions)
AsyncGraph::Command
Section titled “AsyncGraph::Command”Explicit control signal returned from a node.
Helpers:
goto(node)update(delta)update_and_goto(delta, node)
AsyncGraph::Runner
Section titled “AsyncGraph::Runner”Optional helper for applications that want the gem to manage persisted execution state between passes while still keeping persistence and job execution outside the gem.
Methods:
start_run(state:, token_uid: "t1"): build a persisted run snapshot with runner-managedtokensandjoins.advance_run(run:, resolved: nil, resolve_request: nil) { |request| ... }: advance one persisted run by one pass.start(state:, token_uid: "t1"): build an entry token for persisted execution.step(token:, joins:, resolved: {}, resolve_request: nil) { |request| ... }: low-level token step for custom runners.
Result objects
Section titled “Result objects”AsyncGraph::Suspended
Section titled “AsyncGraph::Suspended”Fields:
statenoderequests
AsyncGraph::Advanced
Section titled “AsyncGraph::Advanced”Fields:
statedestinations
AsyncGraph::Finished
Section titled “AsyncGraph::Finished”Fields:
state
AsyncGraph::Runner::Result
Section titled “AsyncGraph::Runner::Result”Fields:
statustokensjoinsstaterequestsrequest_refs
AsyncGraph::Runner::Run
Section titled “AsyncGraph::Runner::Run”Fields:
statustokensjoinsresult
AsyncGraph::JoinParked
Section titled “AsyncGraph::JoinParked”Fields:
joins
AsyncGraph::JoinReleased
Section titled “AsyncGraph::JoinReleased”Fields:
tokenjoins
Errors
Section titled “Errors”AsyncGraph::ValidationErrorAsyncGraph::JoinConflictError
Constants and structs
Section titled “Constants and structs”AsyncGraph::FINISHAsyncGraph::DEFERAsyncGraph::RequestAsyncGraph::EdgeAsyncGraph::AwaitSignal