# post-cortex-storage
[](https://crates.io/crates/post-cortex-storage)
[](https://docs.rs/post-cortex-storage)
[](../../LICENSE)
Storage backends for [post-cortex](https://docs.rs/post-cortex). Provides the [`Storage`] trait plus the lock-free RocksDB backend ([`RealRocksDBStorage`]) and an optional SurrealDB backend behind the `surrealdb-storage` feature.
## Install
```toml
[dependencies]
post-cortex-storage = "0.2" # RocksDB only
post-cortex-storage = { version = "0.2", features = ["surrealdb-storage"] } # + SurrealDB
```
## Features
| `surrealdb-storage` | no | SurrealDB backend (kv-mem + protocol-ws) |
| `surrealdb-tikv` | no | SurrealDB with TiKV distributed KV |
| `otel` | no | OpenTelemetry instrumentation hooks |
The RocksDB backend is always compiled — it's the post-cortex default and what the daemon ships with.
## Example
```rust,no_run
use post_cortex_storage::{RealRocksDBStorage, Storage};
use std::sync::Arc;
# async fn run() -> Result<(), Box<dyn std::error::Error>> {
let storage = Arc::new(RealRocksDBStorage::new("./pcx-data")?);
// `Storage` is `dyn`-compatible — pass `Arc<dyn Storage>` to any consumer.
let session_count = storage.list_sessions().await?.len();
println!("{session_count} sessions persisted");
# Ok(()) }
```
## License
MIT — see [LICENSE](../../LICENSE).