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