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// Public surface re-used by the rest of the codebase.
72pub use backend::{BackendError, LocalBackend, RemoteBackend};
73pub use keyring::{
74    clear_keyring, has_keyring_password, resolve_password, save_to_keyring, PasswordSource,
75};
76pub use layout::{LayoutOverrides, LayoutToggles, StorageLayout, TieredLayoutPaths};
77pub use unified::RedDB;
78
79// =============================================================================
80// UNIFIED STORAGE INTERFACE (PRIMARY API)
81// =============================================================================
82//
83// The unified storage layer is THE primary interface for all storage operations.
84// Use `storage::Store` and `storage::Query` for all new code.
85//
86// Use `storage::Store` and `storage::Query` for all new code.
87
88pub use unified::{
89    AdjacencyEntry,
90    CrossRef,
91    DslFilter,
92    DslQueryResult as QueryResult,
93    EdgeData,
94    EdgeDirection,
95    EmbeddingSlot,
96    EntityData,
97    // Entity types - Universal data model
98    EntityId,
99    EntityKind,
100    FilterOp,
101    FilterValue,
102    // Graph adjacency index
103    GraphAdjacencyIndex,
104    GraphQueryBuilder,
105    HybridQueryBuilder,
106    IndexEvent,
107    IndexEventKind,
108
109    IndexStats,
110    IndexStatus,
111    // Index lifecycle management
112    IndexType,
113    IntegratedIndexConfig as IndexConfig,
114    IntegratedIndexConfig,
115
116    // Index Manager - Unified indexing (HNSW + Inverted + B-tree + Graph)
117    IntegratedIndexManager as IndexManager,
118    IntegratedIndexManager,
119    InvertedIndex,
120    LifecycleEvent,
121
122    ManagerConfig,
123    ManagerStats,
124    MatchComponents,
125
126    // Metadata
127    Metadata,
128    MetadataQueryFilter,
129    MetadataStorage,
130    MetadataType,
131
132    MetadataValue,
133    // =========================================================================
134    // PRIMARY INTERFACE - Use these for all new code
135    // =========================================================================
136    NativeHeaderRepairPolicy,
137    NodeData,
138    QueryResultItem,
139    RefQueryBuilder,
140    RefType,
141
142    RowData,
143    ScanQueryBuilder,
144    ScoredMatch,
145    SegmentConfig as UnifiedSegmentConfig,
146    SegmentError,
147
148    SegmentId as UnifiedSegmentId,
149    // Manager
150    SegmentManager,
151    SegmentState,
152    SegmentStats,
153    SimilarResult,
154    SortOrder,
155    SparseVector,
156    StoreError,
157
158    StoreStats,
159    TableQueryBuilder,
160    TextSearchBuilder,
161    TextSearchResult,
162    TimeSeriesData,
163    TimeSeriesPointKind,
164    TraversalDirection,
165    UnifiedEntity,
166    UnifiedEntity as Entity,
167    UnifiedMetadataFilter,
168    // Segments
169    UnifiedSegment,
170    // Store - THE primary storage interface
171    UnifiedStore,
172    UnifiedStore as Store,
173    UnifiedStoreConfig,
174    VectorData,
175    // Query builders (for advanced use)
176    VectorQueryBuilder,
177    VectorSearchResult,
178    WhereClause,
179    // Query DSL - Entry point for all queries
180    Q as Query,
181};