mecha10-core 0.8.1

Mecha10 core runtime and foundational types
Documentation
//! 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().await?;
//!
//!     // 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

mod concrete;
mod filesystem;
mod filesystem_impl;
mod manager_trait;
mod memory;
mod memory_impl;
mod types;

pub use concrete::ConcreteStateManager;
pub use filesystem::FilesystemStateManager;
pub use manager_trait::StateManager;
pub use memory::MemoryStateManager;
pub use types::{StateOptions, StateSnapshot, VersionedState};