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
//! Persistent State Storage Abstraction for Nodes
//!
//! This module provides a unified interface for nodes to persist and restore
//! state across restarts, crashes, or deployments.
//!
//! # Features
//!
//! - Multiple storage backends (in-memory, filesystem, Redis, PostgreSQL)
//! - Type-safe state serialization/deserialization
//! - Versioned state with migration support
//! - Atomic updates with compare-and-swap
//! - State snapshots and restoration
//! - TTL support for temporary state
//! - Namespace isolation per node
//!
//! # Usage
//!
//! ```rust
//! use mecha10_core::prelude::*;
//!
//! #[derive(Debug, Clone, Serialize, Deserialize)]
//! struct MyNodeState {
//! counter: u64,
//! last_position: (f64, f64),
//! calibration_data: Vec<f32>,
//! }
//!
//! async fn example(ctx: &Context) -> Result<()> {
//! let state_mgr = ctx.state_manager();
//!
//! // Save state
//! let state = MyNodeState {
//! counter: 42,
//! last_position: (1.5, 2.3),
//! calibration_data: vec![0.1, 0.2, 0.3],
//! };
//! state_mgr.save("my_node", &state).await?;
//!
//! // Load state
//! if let Some(restored) = state_mgr.load::<MyNodeState>("my_node").await? {
//! println!("Restored state: {:?}", restored);
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! This module is organized into:
//! - `types`: `VersionedState`, `StateSnapshot`, `StateOptions`
//! - `manager_trait`: The `StateManager` trait
//! - `memory` / `memory_impl`: The in-memory backend and its `StateManager` impl
//! - `filesystem` / `filesystem_impl`: The filesystem backend and its `StateManager` impl
//! - `concrete`: `ConcreteStateManager`, a `dyn`-free enum wrapper over backends
pub use ConcreteStateManager;
pub use FilesystemStateManager;
pub use StateManager;
pub use MemoryStateManager;
pub use ;