Skip to main content

juncture_checkpoint/
lib.rs

1//! Juncture checkpoint persistence
2//!
3//! This crate provides checkpoint persistence for Juncture state machine executions.
4//! It enables time-travel debugging, crash recovery, and human-in-the-loop workflows.
5//!
6//! # Overview
7//!
8//! Checkpoint persistence captures the complete state of graph execution at specific points,
9//! allowing execution to be paused, resumed, or rolled back to any previous state.
10//!
11//! # Core Components
12//!
13//! - [`juncture_core::checkpoint::CheckpointSaver`]: Trait defining checkpoint storage operations
14//! - [`MemorySaver`]: In-memory implementation for development/testing
15//! - [`juncture_core::checkpoint::Checkpoint`]: Complete execution state snapshot
16//! - [`juncture_core::checkpoint::CheckpointMetadata`]: Execution context and provenance
17//!
18//! # Example
19//!
20//! ```ignore
21//! use juncture_checkpoint::MemorySaver;
22//! use juncture_core::{RunnableConfig, checkpoint::CheckpointSaver};
23//!
24//! #[tokio::main]
25//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
26//!     let saver = MemorySaver::new();
27//!     let config = RunnableConfig::default().with_thread_id("my-thread");
28//!
29//!     // Save a checkpoint
30//!     let checkpoint = /* create checkpoint */;
31//!     let metadata = /* create metadata */;
32//!     let updated_config = saver.put(&config, checkpoint, metadata).await?;
33//!
34//!     // Retrieve latest checkpoint
35//!     let tuple = saver.get_tuple(&updated_config).await?.unwrap();
36//!
37//!     Ok(())
38//! }
39//! ```
40
41pub mod cache;
42pub mod error;
43pub mod memory;
44pub mod serde;
45pub mod types;
46
47#[cfg(feature = "postgres")]
48pub mod postgres;
49
50#[cfg(feature = "sqlite")]
51pub mod sqlite;
52
53// Public re-exports
54pub use cache::{BaseCache, MemoryCache};
55pub use error::CheckpointError;
56pub use memory::MemorySaver;
57
58#[cfg(feature = "postgres")]
59pub use postgres::PostgresSaver;
60
61pub use serde::{
62    CheckpointSerializer, JsonPlusSerializer, JsonSerializer, MsgpackSerializer,
63    SerializationFormat, SerializerKind, deserialize_auto, detect_format,
64};
65
66#[cfg(feature = "sqlite")]
67pub use sqlite::SqliteSaver;
68
69// Re-export CheckpointSaver from juncture-core for convenience
70pub use juncture_core::checkpoint::CheckpointSaver;
71
72#[cfg(feature = "encryption")]
73pub use serde::EncryptedSerializer;
74
75pub use types::*;
76
77// Rust guideline compliant 2026-05-19