Skip to main content

reddb_server/storage/
mod.rs

1// reddb persistent storage core
2//
3// This module exposes the unified RedDB storage engine for tables, documents,
4// graphs, and vectors with a single API surface.
5
6// Low-level primitives (bloom filters, encoding, mmap, serialization)
7pub mod primitives;
8
9// Cross-structure index abstraction (trait + bloom segment helper)
10pub mod index;
11
12// RedDB Storage Engine (page-based, B-tree indexed)
13pub mod engine;
14
15// B+ Tree with MVCC (Concurrent Storage)
16pub mod btree;
17
18// Transaction Management (ACID)
19pub mod transaction;
20
21// Page Cache (SIEVE Algorithm)
22pub mod cache;
23
24// Foreign Data Wrappers (Phase 3.2 PG parity)
25pub mod fdw;
26
27// SQLite Import/Compatibility Layer
28pub mod import;
29
30// Write-ahead log - serializer is now integrated into storage primitives
31
32// Write-Ahead Log (Durability)
33pub mod wal;
34
35// Encryption Layer (Security)
36pub mod encryption;
37
38// Remote Storage Backend Abstraction (S3, R2, GCS, Turso, D1)
39pub mod backend;
40
41// Keyring integration for secure password storage
42pub mod keyring;
43
44// Schema System (Types, Tables, Registry)
45pub mod schema;
46
47// Time-Series Storage
48pub mod timeseries;
49
50// Queue / Deque Storage
51pub mod queue;
52
53// Vector storage stable contract surface (introspection, etc.) — issue #743.
54pub mod vector;
55
56// Graph storage stable contract surface (viewport, etc.) — issue #744.
57pub mod graph;
58
59// Machine Learning registry + async job queue (ML Sprint 1 — scaffold).
60// Feature 5 (classifier), Feature 6 (symbolic regression), and the other
61// five ML capabilities all publish models/versions and submit training
62// jobs through this module.
63pub mod ml;
64
65// Query Engine (Filters, Sorting, Similarity Search)
66pub mod query;
67
68// Unified Storage Layer (Tables + Graphs + Vectors)
69pub(crate) mod unified;
70
71// Per-collection disk usage accounting for runtime catalog views.
72pub(crate) mod disk_accountant;
73
74// Pure tiered storage layout derivation.
75pub mod layout;
76
77// Storage/deploy profile selection contract.
78pub mod profile;
79
80// Embedded single-file `.rdb` artifact skeleton.
81pub mod embedded;
82
83pub(crate) mod operational_manifest;
84
85// Blockchain collection kind: pure logic for hash-chained append-only rows.
86// Storage/wire integration tracked in issue #521.
87pub mod blockchain;
88
89// Signed Writes: ed25519 signer registry + insert verification logic
90// for `CREATE COLLECTION ... SIGNED_BY (...)` (issues #520, #522).
91// Runtime wiring (insert path, reserved-column injection, REST error
92// codes) lands in follow-up slices; this module ships the pure
93// primitives the wiring will call into.
94pub mod signed_writes;
95
96// Public surface re-used by the rest of the codebase.
97pub use backend::{BackendError, LocalBackend, RemoteBackend};
98pub use embedded::{
99    EmbeddedRdbArtifact, EmbeddedRdbManifest, EmbeddedRdbOpen, EmbeddedRdbSuperblock,
100    EMBEDDED_RDB_MANIFEST_OFFSET, EMBEDDED_RDB_SUPERBLOCK_0_OFFSET,
101    EMBEDDED_RDB_SUPERBLOCK_1_OFFSET, EMBEDDED_RDB_SUPERBLOCK_SIZE,
102};
103pub use keyring::{
104    clear_keyring, has_keyring_password, resolve_password, save_to_keyring, PasswordSource,
105};
106pub use layout::{
107    LayoutOverrides, LayoutToggles, LogDestination, LogRoutingOverrides, StorageLayout,
108    TieredLayoutPaths,
109};
110pub use profile::{DeployProfile, StorageDeployPreset, StoragePackaging, StorageProfileSelection};
111pub use unified::RedDB;
112
113// =============================================================================
114// UNIFIED STORAGE INTERFACE (PRIMARY API)
115// =============================================================================
116//
117// The unified storage layer is THE primary interface for all storage operations.
118// Use `storage::Store` and `storage::Query` for all new code.
119//
120// Use `storage::Store` and `storage::Query` for all new code.
121
122pub use unified::{
123    AdjacencyEntry,
124    CrossRef,
125    DslFilter,
126    DslQueryResult as QueryResult,
127    EdgeData,
128    EdgeDirection,
129    EmbeddingSlot,
130    EntityData,
131    // Entity types - Universal data model
132    EntityId,
133    EntityKind,
134    FilterOp,
135    FilterValue,
136    // Graph adjacency index
137    GraphAdjacencyIndex,
138    GraphQueryBuilder,
139    HybridQueryBuilder,
140    IndexEvent,
141    IndexEventKind,
142
143    IndexStats,
144    IndexStatus,
145    // Index lifecycle management
146    IndexType,
147    IntegratedIndexConfig as IndexConfig,
148    IntegratedIndexConfig,
149
150    // Index Manager - Unified indexing (HNSW + Inverted + B-tree + Graph)
151    IntegratedIndexManager as IndexManager,
152    IntegratedIndexManager,
153    InvertedIndex,
154    LifecycleEvent,
155
156    ManagerConfig,
157    ManagerStats,
158    MatchComponents,
159
160    // Metadata
161    Metadata,
162    MetadataQueryFilter,
163    MetadataStorage,
164    MetadataType,
165
166    MetadataValue,
167    // =========================================================================
168    // PRIMARY INTERFACE - Use these for all new code
169    // =========================================================================
170    NativeHeaderRepairPolicy,
171    NodeData,
172    QueryResultItem,
173    RefQueryBuilder,
174    RefType,
175
176    RowData,
177    ScanQueryBuilder,
178    ScoredMatch,
179    SegmentConfig as UnifiedSegmentConfig,
180    SegmentError,
181
182    SegmentId as UnifiedSegmentId,
183    // Manager
184    SegmentManager,
185    SegmentState,
186    SegmentStats,
187    SimilarResult,
188    SortOrder,
189    SparseVector,
190    StoreError,
191
192    StoreStats,
193    TableQueryBuilder,
194    TextSearchBuilder,
195    TextSearchResult,
196    TimeSeriesData,
197    TimeSeriesPointKind,
198    TraversalDirection,
199    UnifiedEntity,
200    UnifiedEntity as Entity,
201    UnifiedMetadataFilter,
202    // Segments
203    UnifiedSegment,
204    // Store - THE primary storage interface
205    UnifiedStore,
206    UnifiedStore as Store,
207    UnifiedStoreConfig,
208    VectorData,
209    // Query builders (for advanced use)
210    VectorQueryBuilder,
211    VectorSearchResult,
212    WhereClause,
213    // Query DSL - Entry point for all queries
214    Q as Query,
215};