Skip to main content

a3s_flow/
lib.rs

1//! Durable workflow engine core for A3S.
2//!
3//! `a3s-flow` models the Workflow SDK style of durable execution as a Rust
4//! core: workflow runs are event-sourced, step results are persisted, waits and
5//! hooks suspend without burning compute, and the actual workflow interpreter is
6//! a pluggable runtime. The native TypeScript runtime boundary compiles source
7//! once, then invokes the compiled executable through a small JSON protocol.
8
9mod context;
10mod engine;
11mod error;
12mod model;
13mod observe;
14mod protocol;
15mod runtime;
16mod scheduler;
17mod store;
18mod worker;
19
20pub use context::WorkflowContext;
21pub use engine::{FlowEngine, FlowEngineBuilder};
22pub use error::{FlowError, Result};
23pub use model::{
24    ActiveHookSnapshot, FlowEvent, FlowEventEnvelope, HookCallbackRoute, HookMetadata,
25    HookSnapshot, HookStatus, JsonValue, RetryPolicy, RuntimeCommand, RuntimeKind, RuntimeSpec,
26    StepCommand, StepFailureAction, StepSnapshot, StepStatus, WaitSnapshot, WaitStatus,
27    WorkflowRunSnapshot, WorkflowRunStatus, WorkflowRunSummary, WorkflowRunSuspension,
28    WorkflowSpec,
29};
30pub use observe::{
31    A3sFlowEvent, A3sFlowEventBridge, A3sFlowEventSink, A3sFlowEventSubject,
32    FanoutFlowEventObserver, FlowEventObserver, FlowWorkflowIdentity, InMemoryA3sFlowEventSink,
33    InMemoryFlowEventObserver, LocalFileA3sFlowEventSink, NoopFlowEventObserver,
34};
35pub use protocol::{
36    NativeRuntimeKind, NativeRuntimeRequest, NativeRuntimeResponse, NATIVE_RUNTIME_PROTOCOL,
37};
38pub use runtime::{
39    FlowRuntime, NativeTsRuntime, NativeTsRuntimeConfig, NativeTsRuntimePreflight, StepInvocation,
40    WorkflowInvocation,
41};
42pub use scheduler::{FlowScheduler, FlowSchedulerTick};
43#[cfg(feature = "postgres")]
44pub use store::PostgresEventStore;
45#[cfg(feature = "sqlite")]
46pub use store::SqliteEventStore;
47pub use store::{FlowEventStore, InMemoryEventStore, LocalFileEventStore};
48pub use worker::{
49    FlowTask, FlowTaskLease, FlowTaskOutcome, FlowTaskQueue, FlowWorker, InMemoryFlowTaskQueue,
50    LocalFileDeadLetteredTask, LocalFileFlowTaskQueue,
51};
52#[cfg(feature = "postgres")]
53pub use worker::{PostgresDeadLetteredTask, PostgresFlowTaskQueue};