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
// Copyright (c) 2025 LLM DevOps
// SPDX-License-Identifier: MIT OR Apache-2.0
//! State persistence and recovery for LLM workflow orchestrator.
//!
//! This crate provides database-backed state management for workflows with support for:
//! - Workflow state persistence (PostgreSQL and SQLite)
//! - Automatic checkpointing for recovery
//! - Connection pooling and transactions
//! - Workflow resumption after crashes
//!
//! # Examples
//!
//! ## PostgreSQL
//!
//! ```no_run
//! # use llm_orchestrator_state::{PostgresStateStore, StateStore, WorkflowState};
//! # use serde_json::json;
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! // Create PostgreSQL state store
//! let store = PostgresStateStore::new(
//! "postgresql://user:pass@localhost/workflows",
//! Some(5), // min connections
//! Some(20), // max connections
//! ).await?;
//!
//! // Create workflow state
//! let state = WorkflowState::new(
//! "my-workflow",
//! "My Workflow",
//! Some("user-123".to_string()),
//! json!({"inputs": {"key": "value"}}),
//! );
//!
//! // Save state
//! store.save_workflow_state(&state).await?;
//!
//! // Load state
//! let loaded = store.load_workflow_state(&state.id).await?;
//! # Ok(())
//! # }
//! ```
//!
//! ## SQLite
//!
//! ```no_run
//! # use llm_orchestrator_state::{SqliteStateStore, StateStore};
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! // Create SQLite state store
//! let store = SqliteStateStore::new("./workflows.db").await?;
//!
//! // Use same API as PostgreSQL
//! store.health_check().await?;
//! # Ok(())
//! # }
//! ```
// Re-export commonly used types
pub use ;
pub use PostgresStateStore;
pub use SqliteStateStore;
pub use ;
/// Library version.
pub const VERSION: &str = env!;