Skip to main content

agentstategraph_storage/
lib.rs

1//! agentstategraph-storage — Pluggable storage backends for AgentStateGraph.
2//!
3//! Provides the storage trait definitions and built-in backends:
4//! - `MemoryStorage` — fast, ephemeral, for testing and speculation
5//! - `SqliteStorage` — durable, single-file, the default for production use
6//! - `PostgresStorage` — connection-pooled and shareable: tenants share a database,
7//!   every row partitioned by tenant id, one tenant per handle
8//!
9//! Custom backends can be added by implementing the `Storage` trait
10//! (which is a blanket impl over `ObjectStore + CommitStore + RefStore`).
11
12#[cfg(feature = "indexeddb")]
13pub mod indexeddb;
14#[cfg(feature = "memory")]
15pub mod memory;
16#[cfg(feature = "postgres")]
17pub mod postgres;
18#[cfg(feature = "sqlite")]
19pub mod sqlite;
20pub mod traits;
21
22// Re-export primary types
23#[cfg(feature = "indexeddb")]
24pub use indexeddb::IndexedDbStorage;
25#[cfg(feature = "memory")]
26pub use memory::MemoryStorage;
27#[cfg(feature = "postgres")]
28pub use postgres::{PostgresStorage, RowSecurity, TenantPool};
29#[cfg(feature = "sqlite")]
30pub use sqlite::SqliteStorage;
31pub use traits::{
32    CommitStore, CommitTrace, CommitWalk, DEFAULT_GC_GRACE, EpochStore, GC_FRESHEN_AFTER,
33    GcReachability, GcSweep, HISTORY_NAMESPACE_UNKNOWN, HistoryMilestoneRow, HistoryRollupRow,
34    ObjectStore, RefStore, SessionStore, Storage, StorageError, StoreShape, StoreTotals,
35    TableBytes, TaintStore, VacuumStats,
36};
37/// The Postgres client crates the storage is built on, for a host that keeps
38/// its own tables in the same database through [`PostgresStorage::tenant_pool`].
39#[cfg(feature = "postgres")]
40pub use {oxtel_sql, tokio_postgres};