sayiir_runtime/lib.rs
1#![deny(clippy::pedantic)]
2#![forbid(unsafe_code)]
3#![deny(
4 clippy::unwrap_used,
5 clippy::expect_used,
6 clippy::panic,
7 clippy::indexing_slicing,
8 clippy::todo,
9 clippy::unimplemented,
10 clippy::dbg_macro,
11 clippy::print_stdout,
12 clippy::print_stderr
13)]
14
15//! Workflow runtime for executing durable workflows.
16//!
17//! This crate provides the execution engine that drives [`sayiir_core`] workflows
18//! to completion. It re-exports the core crate, persistence layer, and proc-macros
19//! so most users only need a single dependency:
20//!
21//! ```toml
22//! [dependencies]
23//! sayiir-runtime = "0.1"
24//! ```
25//!
26//! # Execution Strategies
27//!
28//! | Scenario | Use |
29//! |----------|-----|
30//! | Single server, crash recovery needed | [`CheckpointingRunner`] |
31//! | Multiple workers, horizontal scaling | [`PooledWorker`] |
32//! | Simple in-memory execution | [`InProcessRunner`] |
33//!
34//! # Quick Example
35//!
36//! ```rust,no_run
37//! use sayiir_runtime::{CheckpointingRunner, WorkflowRunner, workflow, task};
38//! use sayiir_runtime::persistence::InMemoryBackend;
39//!
40//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
41//! let backend = InMemoryBackend::new();
42//! let runner = CheckpointingRunner::new(backend);
43//!
44//! // Run a workflow with automatic checkpointing
45//! // let status = runner.run(&workflow, "instance-123", input).await?;
46//! # Ok(())
47//! # }
48//! ```
49//!
50//! # Re-exports
51//!
52//! This crate re-exports key items for convenience:
53//!
54//! - [`sayiir_core`] — via `sayiir_runtime::persistence` (through `sayiir_persistence`)
55//! - [`sayiir_persistence`] — as [`persistence`]
56//! - [`task`] and [`workflow!`] — from `sayiir-macros`
57//! - [`sayiir_ctx!`] — context macro from `sayiir-core`
58//!
59//! For the full README with architecture diagrams and detailed configuration,
60//! see the [crate README](https://crates.io/crates/sayiir-runtime).
61
62pub mod error;
63pub mod execution;
64pub mod prelude;
65mod runner;
66pub mod serialization;
67pub mod worker;
68
69// Re-exports
70pub use error::RuntimeError;
71pub use execution::{
72 ResumeOutcome, execute_continuation_async, execute_continuation_sync,
73 execute_continuation_with_checkpointing, finalize_execution, prepare_resume, prepare_run,
74 serialize_branch_results,
75};
76pub use runner::WorkflowRunner;
77pub use runner::distributed::CheckpointingRunner;
78pub use runner::in_process::InProcessRunner;
79pub use worker::{
80 ExternalTaskExecutor, ExternalWorkflow, PooledWorker, WorkerHandle, WorkflowIndex,
81 WorkflowRegistry,
82};
83
84pub use sayiir_core::sayiir_ctx;
85#[cfg(feature = "macros")]
86pub use sayiir_macros::{task, workflow};
87pub use sayiir_persistence as persistence;