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 runtime_build;
17mod scheduler;
18mod store;
19mod worker;
20
21pub use context::WorkflowContext;
22pub use engine::{FlowEngine, FlowEngineBuilder};
23pub use error::{FlowError, Result};
24pub use model::{
25    ActiveHookSnapshot, CancellationRequest, CancellationRequestSnapshot, ChildOperationReference,
26    FlowEvent, FlowEventEnvelope, HookCallbackRoute, HookMetadata, HookSnapshot, HookStatus,
27    JsonValue, RetryPolicy, RuntimeCommand, RuntimeKind, RuntimeSpec, ScheduledWakeup,
28    ScheduledWakeupKind, StepCommand, StepFailureAction, StepSnapshot, StepStatus, WaitSnapshot,
29    WaitStatus, WorkflowProgress, WorkflowRunSnapshot, WorkflowRunStatus, WorkflowRunSummary,
30    WorkflowRunSuspension, WorkflowSpec, WorkflowTerminalOutcome,
31};
32#[cfg(feature = "a3s-event")]
33pub use observe::A3sEventBusFlowEventSink;
34pub use observe::{
35    A3sFlowEvent, A3sFlowEventBridge, A3sFlowEventSink, A3sFlowEventSubject,
36    FanoutFlowEventObserver, FlowEventObserver, FlowWorkflowIdentity, InMemoryA3sFlowEventSink,
37    InMemoryFlowEventObserver, LocalFileA3sFlowEventSink, NoopFlowEventObserver,
38};
39pub use protocol::{
40    NativeRuntimeKind, NativeRuntimeRequest, NativeRuntimeResponse, NATIVE_RUNTIME_PROTOCOL,
41};
42pub use runtime::{
43    FlowRuntime, NativeTsRuntime, NativeTsRuntimeConfig, NativeTsRuntimePreflight, StepInvocation,
44    WorkflowInvocation,
45};
46pub use runtime_build::{RuntimeBuildCompatibility, RuntimeBuildId};
47pub use scheduler::{FlowScheduler, FlowSchedulerTick};
48#[cfg(feature = "postgres")]
49pub use store::PostgresEventStore;
50#[cfg(feature = "sqlite")]
51pub use store::SqliteEventStore;
52pub use store::{FlowEventStore, InMemoryEventStore, LocalFileEventStore};
53#[cfg(any(feature = "postgres", feature = "sqlite"))]
54pub use store::{
55    FlowHistoryHold, FlowHistoryRetentionPolicy, FlowHistoryRetentionReport, FlowHistoryTombstone,
56};
57#[cfg(feature = "boot")]
58pub use worker::{BootFlowTaskDeduplication, BootFlowTaskManager, BootFlowTaskPolicy};
59pub use worker::{
60    FlowTask, FlowTaskDispatcher, FlowTaskLease, FlowTaskOutcome, FlowTaskQueue, FlowWorker,
61    InMemoryFlowTaskQueue, LocalFileDeadLetteredTask, LocalFileFlowTaskQueue,
62    RuntimeBuildTaskRouter,
63};
64#[cfg(feature = "postgres")]
65pub use worker::{PostgresDeadLetteredTask, PostgresFlowTaskQueue};