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// Machine Learning registry + async job queue (ML Sprint 1 — scaffold).
54// Feature 5 (classifier), Feature 6 (symbolic regression), and the other
55// five ML capabilities all publish models/versions and submit training
56// jobs through this module.
57pub mod ml;
58
59// Query Engine (Filters, Sorting, Similarity Search)
60pub mod query;
61
62// Unified Storage Layer (Tables + Graphs + Vectors)
63pub(crate) mod unified;
64
65// Per-collection disk usage accounting for runtime catalog views.
66pub(crate) mod disk_accountant;
67
68// Pure tiered storage layout derivation.
69pub mod layout;
70
71// Blockchain collection kind: pure logic for hash-chained append-only rows.
72// Storage/wire integration tracked in issue #521.
73pub mod blockchain;
74
75// Signed Writes: ed25519 signer registry + insert verification logic
76// for `CREATE COLLECTION ... SIGNED_BY (...)` (issues #520, #522).
77// Runtime wiring (insert path, reserved-column injection, REST error
78// codes) lands in follow-up slices; this module ships the pure
79// primitives the wiring will call into.
80pub mod signed_writes;
81
82// Public surface re-used by the rest of the codebase.
83pub use backend::{BackendError, LocalBackend, RemoteBackend};
84pub use keyring::{
85    clear_keyring, has_keyring_password, resolve_password, save_to_keyring, PasswordSource,
86};
87pub use layout::{
88    LayoutOverrides, LayoutToggles, LogDestination, LogRoutingOverrides, StorageLayout,
89    TieredLayoutPaths,
90};
91pub use unified::RedDB;
92
93// =============================================================================
94// UNIFIED STORAGE INTERFACE (PRIMARY API)
95// =============================================================================
96//
97// The unified storage layer is THE primary interface for all storage operations.
98// Use `storage::Store` and `storage::Query` for all new code.
99//
100// Use `storage::Store` and `storage::Query` for all new code.
101
102pub use unified::{
103    AdjacencyEntry,
104    CrossRef,
105    DslFilter,
106    DslQueryResult as QueryResult,
107    EdgeData,
108    EdgeDirection,
109    EmbeddingSlot,
110    EntityData,
111    // Entity types - Universal data model
112    EntityId,
113    EntityKind,
114    FilterOp,
115    FilterValue,
116    // Graph adjacency index
117    GraphAdjacencyIndex,
118    GraphQueryBuilder,
119    HybridQueryBuilder,
120    IndexEvent,
121    IndexEventKind,
122
123    IndexStats,
124    IndexStatus,
125    // Index lifecycle management
126    IndexType,
127    IntegratedIndexConfig as IndexConfig,
128    IntegratedIndexConfig,
129
130    // Index Manager - Unified indexing (HNSW + Inverted + B-tree + Graph)
131    IntegratedIndexManager as IndexManager,
132    IntegratedIndexManager,
133    InvertedIndex,
134    LifecycleEvent,
135
136    ManagerConfig,
137    ManagerStats,
138    MatchComponents,
139
140    // Metadata
141    Metadata,
142    MetadataQueryFilter,
143    MetadataStorage,
144    MetadataType,
145
146    MetadataValue,
147    // =========================================================================
148    // PRIMARY INTERFACE - Use these for all new code
149    // =========================================================================
150    NativeHeaderRepairPolicy,
151    NodeData,
152    QueryResultItem,
153    RefQueryBuilder,
154    RefType,
155
156    RowData,
157    ScanQueryBuilder,
158    ScoredMatch,
159    SegmentConfig as UnifiedSegmentConfig,
160    SegmentError,
161
162    SegmentId as UnifiedSegmentId,
163    // Manager
164    SegmentManager,
165    SegmentState,
166    SegmentStats,
167    SimilarResult,
168    SortOrder,
169    SparseVector,
170    StoreError,
171
172    StoreStats,
173    TableQueryBuilder,
174    TextSearchBuilder,
175    TextSearchResult,
176    TimeSeriesData,
177    TimeSeriesPointKind,
178    TraversalDirection,
179    UnifiedEntity,
180    UnifiedEntity as Entity,
181    UnifiedMetadataFilter,
182    // Segments
183    UnifiedSegment,
184    // Store - THE primary storage interface
185    UnifiedStore,
186    UnifiedStore as Store,
187    UnifiedStoreConfig,
188    VectorData,
189    // Query builders (for advanced use)
190    VectorQueryBuilder,
191    VectorSearchResult,
192    WhereClause,
193    // Query DSL - Entry point for all queries
194    Q as Query,
195};