ceylon_memory/lib.rs
1//! # Ceylon Memory
2//!
3//! Memory backend implementations for agent state persistence.
4//!
5//! This crate provides pluggable storage backends implementing the [`ceylon_core::Memory`] trait:
6//!
7//! - [`InMemoryBackend`] - Fast, thread-safe in-memory storage (default)
8//! - [`SqliteBackend`] - File-based persistent storage (feature: `sqlite`)
9//! - [`RedisBackend`] - Distributed persistent storage (feature: `redis`)
10//!
11//! # Example
12//!
13//! ```rust,no_run
14//! use ceylon_memory::InMemoryBackend;
15//! use ceylon_core::{Memory, MemoryEntry, MemoryQuery};
16//!
17//! # async fn example() -> anyhow::Result<()> {
18//! let memory = InMemoryBackend::new();
19//!
20//! // Store an entry
21//! let entry = MemoryEntry::new("Important note");
22//! let id = memory.store(entry).await?;
23//!
24//! // Retrieve by ID
25//! if let Some(entry) = memory.get(&id).await? {
26//! println!("Content: {}", entry.content);
27//! }
28//! # Ok(())
29//! # }
30//! ```
31
32mod in_memory;
33
34#[cfg(feature = "sqlite")]
35mod sqlite;
36
37#[cfg(feature = "redis")]
38mod redis;
39
40pub use in_memory::InMemoryBackend;
41
42#[cfg(feature = "sqlite")]
43pub use sqlite::SqliteBackend;
44
45#[cfg(feature = "redis")]
46pub use redis::RedisBackend;
47
48// Re-export core memory types for convenience
49pub use ceylon_core::{Memory, MemoryEntry, MemoryQuery, VectorMemory};