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// Boot-time memory budget resolver (ADR 0073 ยง1). Resolves the single
81// process-wide budget from operator config, the deployment-profile default,
82// the cgroup limit, or a conservative fraction of physical RAM. Pool sizing
83// and admission enforcement are downstream slices consuming the number.
84pub mod memory_budget;
85
86// Embedded single-file `.rdb` artifact skeleton.
87pub mod embedded;
88
89pub(crate) mod operational_manifest;
90
91// Blockchain collection kind: pure logic for hash-chained append-only rows.
92// Storage/wire integration tracked in issue #521.
93pub mod blockchain;
94
95// Signed Writes: ed25519 signer registry + insert verification logic
96// for `CREATE COLLECTION ... SIGNED_BY (...)` (issues #520, #522).
97// Runtime wiring (insert path, reserved-column injection, REST error
98// codes) lands in follow-up slices; this module ships the pure
99// primitives the wiring will call into.
100pub mod signed_writes;
101
102// Columnar analytics projection (ADR 0069, #1766): the derived, disposable
103// columnar representation of an append-only collection. Emitted on the
104// checkpoint path, sealed under the crypto page envelope, and read via the
105// LSN-pinned analytical scan (columnar segments + un-materialized row tail
106// under one pinned snapshot). Runtime wiring into `SegmentManager` checkpoint
107// and the query executor lands in follow-up slices.
108pub mod columnar_projection;
109
110// Public surface re-used by the rest of the codebase.
111pub use backend::{BackendError, LocalBackend, RemoteBackend};
112pub use embedded::{
113 EmbeddedRdbArtifact, EmbeddedRdbManifest, EmbeddedRdbOpen, EmbeddedRdbSuperblock,
114 EMBEDDED_RDB_MANIFEST_OFFSET, EMBEDDED_RDB_SUPERBLOCK_0_OFFSET,
115 EMBEDDED_RDB_SUPERBLOCK_1_OFFSET, EMBEDDED_RDB_SUPERBLOCK_SIZE,
116};
117pub use keyring::{
118 clear_keyring, has_keyring_password, resolve_password, save_to_keyring, PasswordSource,
119};
120pub use layout::{
121 LayoutOverrides, LayoutToggles, LogDestination, LogRoutingOverrides, StorageLayout,
122 TieredLayoutPaths,
123};
124pub use memory_budget::{
125 InvalidMemoryBudget, MemoryBudget, MemoryBudgetInputs, MemoryBudgetSource,
126};
127pub use profile::{DeployProfile, StorageDeployPreset, StoragePackaging, StorageProfileSelection};
128pub use unified::RedDB;
129
130// =============================================================================
131// UNIFIED STORAGE INTERFACE (PRIMARY API)
132// =============================================================================
133//
134// The unified storage layer is THE primary interface for all storage operations.
135// Use `storage::Store` and `storage::Query` for all new code.
136//
137// Use `storage::Store` and `storage::Query` for all new code.
138
139pub use unified::{
140 AdjacencyEntry,
141 CrossRef,
142 DslFilter,
143 DslQueryResult as QueryResult,
144 EdgeData,
145 EdgeDirection,
146 EmbeddingSlot,
147 EntityData,
148 // Entity types - Universal data model
149 EntityId,
150 EntityKind,
151 FilterOp,
152 FilterValue,
153 // Graph adjacency index
154 GraphAdjacencyIndex,
155 GraphQueryBuilder,
156 HybridQueryBuilder,
157 IndexEvent,
158 IndexEventKind,
159
160 IndexStats,
161 IndexStatus,
162 // Index lifecycle management
163 IndexType,
164 IntegratedIndexConfig as IndexConfig,
165 IntegratedIndexConfig,
166
167 // Index Manager - Unified indexing (HNSW + Inverted + B-tree + Graph)
168 IntegratedIndexManager as IndexManager,
169 IntegratedIndexManager,
170 InvertedIndex,
171 LifecycleEvent,
172
173 ManagerConfig,
174 ManagerStats,
175 MatchComponents,
176
177 // Metadata
178 Metadata,
179 MetadataQueryFilter,
180 MetadataStorage,
181 MetadataType,
182
183 MetadataValue,
184 // =========================================================================
185 // PRIMARY INTERFACE - Use these for all new code
186 // =========================================================================
187 NativeHeaderRepairPolicy,
188 NodeData,
189 QueryResultItem,
190 RefQueryBuilder,
191 RefType,
192
193 RowData,
194 ScanQueryBuilder,
195 ScoredMatch,
196 SegmentConfig as UnifiedSegmentConfig,
197 SegmentError,
198
199 SegmentId as UnifiedSegmentId,
200 // Manager
201 SegmentManager,
202 SegmentState,
203 SegmentStats,
204 SimilarResult,
205 SortOrder,
206 SparseVector,
207 StoreError,
208
209 StoreStats,
210 TableQueryBuilder,
211 TextSearchBuilder,
212 TextSearchResult,
213 TimeSeriesData,
214 TimeSeriesPointKind,
215 TraversalDirection,
216 UnifiedEntity,
217 UnifiedEntity as Entity,
218 UnifiedMetadataFilter,
219 // Segments
220 UnifiedSegment,
221 // Store - THE primary storage interface
222 UnifiedStore,
223 UnifiedStore as Store,
224 UnifiedStoreConfig,
225 VectorData,
226 // Query builders (for advanced use)
227 VectorQueryBuilder,
228 VectorSearchResult,
229 WhereClause,
230 FIRST_USER_ENTITY_ID,
231 // Query DSL - Entry point for all queries
232 Q as Query,
233};