Skip to main content

slipstream/
lib.rs

1//! Shared KV store abstraction for Beyond services.
2//!
3//! This crate provides a backend-agnostic interface for key-value storage,
4//! with NATS JetStream as the primary implementation.
5//!
6//! # Architecture
7//!
8//! ```text
9//! ┌─────────────────────────────────────────────────────────────┐
10//! │              KvReader │ KvWatcher │ KvWriter                │
11//! │                 (core KV operations)                        │
12//! ├─────────────────────────────────────────────────────────────┤
13//! │                        KvStore                              │
14//! │            (named bucket with reader/watcher/writer)        │
15//! ├─────────────────────────────────────────────────────────────┤
16//! │                       Connection                            │
17//! │              (lifecycle, store factory, capabilities)       │
18//! ├─────────────────────────────────────────────────────────────┤
19//! │                    NatsConnection                           │
20//! │               (concrete implementation)                     │
21//! └─────────────────────────────────────────────────────────────┘
22//! ```
23
24#![deny(unsafe_code)]
25
26mod applied;
27mod kv;
28mod nats;
29pub mod snapshot;
30#[cfg(feature = "fjall")]
31mod snapshot_fjall;
32mod stores;
33
34pub use applied::{BatchConfig, WatchScope, watch_applied};
35pub use kv::{
36    KvEntry, KvError, KvReader, KvTtl, KvUpdate, KvWatcher, KvWriter, VersionToken, WatchCursor,
37};
38pub use nats::{NatsConnection, NatsConnectionConfig, nats_connect};
39pub use snapshot::{AppendLogSnapshot, SnapshotStore};
40#[cfg(feature = "fjall")]
41pub use snapshot_fjall::{FjallConfig, FjallReader, FjallSnapshot};
42pub use stores::{Connection, ConnectionCapabilities, KvStore, StorageType, StoreConfig};