ironflow_store/lib.rs
1//! # ironflow-store
2//!
3//! Storage abstraction for the **ironflow** workflow engine. This crate provides
4//! the [`RunStore`](store::RunStore) trait and data entities for persisting workflow
5//! runs and steps.
6//!
7//! # Implementations
8//!
9//! | Store | Feature | Description |
10//! |-------|---------|-------------|
11//! | [`InMemoryStore`](memory::InMemoryStore) | `store-memory` (default) | In-process, no external dependencies. |
12//! | [`PostgresStore`](postgres::PostgresStore) | `store-postgres` | Production-ready with `SELECT FOR UPDATE SKIP LOCKED`. |
13//!
14//! # Quick start
15//!
16//! ```no_run
17//! use ironflow_store::prelude::*;
18//! use serde_json::json;
19//!
20//! # async fn example() -> Result<(), ironflow_store::error::StoreError> {
21//! let store = InMemoryStore::new();
22//!
23//! let run = store.create_run(NewRun {
24//! workflow_name: "deploy".to_string(),
25//! trigger: TriggerKind::Manual,
26//! payload: json!({}),
27//! max_retries: 3,
28//! }).await?;
29//!
30//! println!("Run {} is {:?}", run.id, run.status);
31//! # Ok(())
32//! # }
33//! ```
34
35pub mod api_key_store;
36pub mod entities;
37pub mod error;
38pub mod store;
39pub mod user_store;
40
41/// Backward-compatible alias — prefer `entities` for new code.
42pub use entities as models;
43
44#[cfg(feature = "store-memory")]
45pub mod memory;
46
47#[cfg(feature = "store-postgres")]
48pub mod postgres;
49
50/// Convenience re-exports for common usage.
51pub mod prelude {
52 pub use crate::api_key_store::ApiKeyStore;
53 pub use crate::entities::*;
54 pub use crate::error::StoreError;
55 pub use crate::store::RunStore;
56 pub use crate::user_store::UserStore;
57
58 #[cfg(feature = "store-memory")]
59 pub use crate::memory::InMemoryStore;
60
61 #[cfg(feature = "store-postgres")]
62 pub use crate::postgres::PostgresStore;
63}