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#![deny(unused_must_use)]
26
27mod applied;
28mod artifact;
29mod export_lease;
30mod kv;
31mod nats;
32pub mod snapshot;
33#[cfg(feature = "fjall")]
34mod snapshot_fjall;
35#[cfg(any(feature = "fjall", feature = "rocksdb"))]
36mod snapshot_record;
37#[cfg(feature = "rocksdb")]
38mod snapshot_rocksdb;
39mod stores;
40#[cfg(feature = "transport")]
41mod transport;
42
43pub use applied::{BatchConfig, ExportRequest, WatchScope, watch_applied};
44pub use artifact::{ARTIFACT_SCHEMA_VERSION, ArtifactFile, ExportManifest, MANIFEST_FILE};
45pub use export_lease::{ExportLease, LeaseGuard, LeaseRecord};
46pub use kv::{
47    KvEntry, KvError, KvReader, KvTtl, KvUpdate, KvWatcher, KvWriter, VersionToken, WatchCursor,
48};
49pub use nats::{NatsConnection, NatsConnectionConfig, nats_connect};
50pub use snapshot::{AppendLogSnapshot, SnapshotStore};
51#[cfg(feature = "fjall")]
52pub use snapshot_fjall::{FjallConfig, FjallReader, FjallSnapshot};
53#[cfg(feature = "rocksdb")]
54pub use snapshot_rocksdb::{RocksDbConfig, RocksDbReader, RocksDbSnapshot};
55pub use stores::{Connection, ConnectionCapabilities, KvStore, StorageType, StoreConfig};
56#[cfg(feature = "transport")]
57pub use transport::{ArtifactTransport, ObjectStoreTransport, run_export_round};