rust_logic_graph/distributed/
mod.rs

1//! Distributed Context Sharing
2//!
3//! This module provides distributed context management for sharing state
4//! across microservices in a distributed system.
5//!
6//! # Features
7//!
8//! - **Context Serialization**: Efficient serialization for remote execution
9//! - **State Sharing**: Share context between microservices
10//! - **Distributed Caching**: Redis/Memcached integration
11//! - **Versioning**: Context versioning with conflict resolution
12//!
13//! # Example
14//!
15//! ```rust,no_run
16//! use rust_logic_graph::distributed::{DistributedContext, ContextStore};
17//! use serde_json::json;
18//!
19//! # async fn example() -> anyhow::Result<()> {
20//! // Create distributed context with versioning
21//! let mut context = DistributedContext::new("session-123");
22//! context.set("user_id", json!("user-456"));
23//! context.set("tenant", json!("acme-corp"));
24//!
25//! // Serialize for transmission
26//! let serialized = context.serialize()?;
27//!
28//! // Deserialize on remote service
29//! let remote_context = DistributedContext::deserialize(&serialized)?;
30//! # Ok(())
31//! # }
32//! ```
33
34pub mod cache;
35pub mod context;
36pub mod store;
37pub mod versioning;
38
39pub use context::{ContextSnapshot, DistributedContext, SharedContext};
40pub use store::{ContextStore, InMemoryStore};
41
42#[cfg(feature = "redis")]
43pub use store::RedisStore;
44
45pub use cache::{CacheStrategy, CacheWarmer, DistributedCache};
46pub use store::MemcachedStore;
47pub use versioning::{ConflictResolution, ContextVersion, ThreeWayMerge, VersionedContext};