deltaflow/lib.rs
1//! # Deltaflow
2//!
3//! The embeddable workflow engine.
4//!
5//! 
6//!
7//! Type-safe, Elixir-inspired pipelines that run in your process. No infrastructure required.
8//!
9//! ## Why Deltaflow?
10//!
11//! - **Type-safe composition** - Compiler enforces step output matches next step's input
12//! - **Elixir-inspired** - Declarative pipelines via method chaining, not scattered callbacks
13//! - **Observable by default** - Every run and step recorded for debugging
14//! - **Embeddable** - A library, not a service. Runs in your process.
15//!
16//! ## Quick Start
17//!
18//! ```rust,ignore
19//! use deltaflow::{Pipeline, Step, StepError, RetryPolicy, NoopRecorder};
20//!
21//! let pipeline = Pipeline::new("my_workflow")
22//! .start_with(ParseInput)
23//! .then(ProcessData)
24//! .then(FormatOutput)
25//! .with_retry(RetryPolicy::exponential(3))
26//! .with_recorder(NoopRecorder)
27//! .build();
28//!
29//! let result = pipeline.run(input).await?;
30//! ```
31//!
32//! ## Forking and Fan-out
33//!
34//! Route output to multiple downstream pipelines:
35//!
36//! ```rust,ignore
37//! let pipeline = Pipeline::new("router")
38//! .start_with(ValidateStep)
39//! .fork_when(|data| data.priority == "high", "fast_track")
40//! .fork_when(|data| data.needs_review, "review").desc("needs_review")
41//! .fan_out(&["analytics", "archival"])
42//! .emit("notifications", |data| vec![Notification::from(data)])
43//! .build();
44//! ```
45//!
46//! ## Web Visualizer
47//!
48//! Use `deltaflow-harness` for interactive pipeline visualization:
49//!
50//! ```rust,ignore
51//! use deltaflow_harness::RunnerHarnessExt;
52//!
53//! let runner = RunnerBuilder::new(store)
54//! .pipeline(my_pipeline)
55//! .with_visualizer(3000)
56//! .build();
57//! ```
58//!
59//! ## Feature Flags
60//!
61//! - `sqlite` - Enable SQLite-backed recording and task storage
62
63pub mod pipeline;
64pub mod recorder;
65pub mod retry;
66pub mod step;
67
68pub use pipeline::{
69 BuiltPipeline, EmitNode, FanOutNode, ForkNode, HasEntityId, Metadata, Pipeline,
70 PipelineError, PipelineGraph, SpawnRule, StepNode,
71};
72pub use recorder::{NoopRecorder, Recorder, RunId, RunStatus, StepId, StepStatus};
73pub use retry::RetryPolicy;
74pub use step::{Step, StepError};
75
76#[cfg(feature = "sqlite")]
77pub mod sqlite;
78
79#[cfg(feature = "sqlite")]
80pub mod runner;
81
82#[cfg(feature = "sqlite")]
83pub mod scheduler;
84
85#[cfg(feature = "sqlite")]
86pub use sqlite::SqliteRecorder;
87
88#[cfg(feature = "sqlite")]
89pub use runner::{
90 ErasedPipeline, Runner, RunnerBuilder, SpawnedTask, SqliteTaskStore, StoredTask, TaskError,
91 TaskId, TaskStore,
92};
93
94#[cfg(feature = "sqlite")]
95pub use scheduler::{PeriodicScheduler, SchedulerBuilder};