1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//! Core types and traits for the Sayiir durable workflow engine.
//!
//! This crate defines the foundational abstractions that every other `sayiir-*`
//! crate builds on. It is intentionally **runtime-agnostic** — no persistence,
//! no execution strategy, just pure workflow modelling.
//!
//! # Key Abstractions
//!
//! | Type / Trait | Purpose |
//! |---|---|
//! | [`Workflow`] / [`SerializableWorkflow`] | The continuation tree that describes *what* to execute |
//! | [`WorkflowBuilder`] | Fluent builder for assembling sequential, forked, and joined pipelines |
//! | [`CoreTask`] | Trait implemented by every task (input → output, with metadata) |
//! | [`Codec`] | Trait for pluggable serialization (JSON, rkyv, …) |
//! | [`WorkflowContext`] | Per-execution context carrying the codec, workflow ID, and user metadata |
//! | [`WorkflowSnapshot`](snapshot::WorkflowSnapshot) | Checkpoint of in-flight execution state (completed tasks + outputs) |
//! | [`TaskRegistry`] | Name → factory map used for deserializing workflows across process boundaries |
//!
//! # Architecture
//!
//! ```text
//! sayiir-core (this crate — types & traits only)
//! ↑
//! sayiir-persistence (SnapshotStore, SignalStore, TaskClaimStore)
//! ↑
//! sayiir-runtime (CheckpointingRunner, PooledWorker, execution loop)
//! ↑
//! sayiir-macros (#[task], workflow! — optional convenience)
//! ```
//!
//! # Quick Example
//!
//! ```rust,ignore
//! use sayiir_core::prelude::*;
//! use std::sync::Arc;
//!
//! // Create a context (codec + workflow ID)
//! // (Codec is generic — bring your own or use sayiir-runtime's JsonCodec / RkyvCodec)
//! let ctx = WorkflowContext::new("order-pipeline", Arc::new(my_codec), Arc::new(()));
//!
//! // Build a workflow: validate → charge
//! let wf = WorkflowBuilder::new(ctx)
//! .then("validate", |order: String| async move { Ok(order) })
//! .then("charge", |order: String| async move { Ok(42u64) })
//! .build()?;
//! ```
//!
//! For the proc-macro experience (`#[task]` + `workflow!`), see
//! [`sayiir-macros`](https://docs.rs/sayiir-macros).
//!
//! [`Workflow`]: workflow::Workflow
//! [`SerializableWorkflow`]: workflow::SerializableWorkflow
//! [`WorkflowBuilder`]: builder::WorkflowBuilder
//! [`CoreTask`]: task::CoreTask
//! [`Codec`]: codec::Codec
//! [`WorkflowContext`]: context::WorkflowContext
//! [`TaskRegistry`]: registry::TaskRegistry
pub use ;
pub use LoopResult;
pub use ;
pub use ;
pub use MaxIterationsPolicy;