Skip to main content

reddb_server/
lib.rs

1#![allow(clippy::unwrap_used)]
2#![allow(dead_code, unused_imports, unused_variables)]
3// Structural lints we accept for API design reasons:
4#![allow(
5    clippy::too_many_arguments,   // complex DB operations legitimately need many params
6    clippy::type_complexity,      // internal types with nested generics
7    clippy::result_large_err,     // tonic::Status is 176 bytes, can't box it
8    clippy::should_implement_trait, // from_str() returns Option, not Result — different semantics
9    clippy::new_without_default,  // some constructors have side effects
10    clippy::enum_variant_names,   // JoinPhase variants all end in Start by design
11    clippy::wrong_self_convention, // to_bytes on Copy types in our serialization
12    clippy::len_without_is_empty, // segment structs don't need is_empty
13    // Legacy allow for the too_many_lines ratchet (PRD #1252): this crate has
14    // many pre-existing functions over the 120-line threshold. The lint bites
15    // on new/changed code; remove once those functions are split up.
16    clippy::too_many_lines,
17    // Legacy allow for the cast_possible_truncation ratchet (PRD #1252): this
18    // crate has many pre-existing truncating `as` casts on lengths/offsets and
19    // numeric narrowing. The lint bites on new/changed code; remove once those
20    // casts become explicit checked conversions.
21    clippy::cast_possible_truncation
22)]
23
24pub mod ai;
25pub mod api;
26pub mod application;
27pub mod auth;
28pub mod backup_bootstrap;
29pub mod catalog;
30pub mod cli;
31pub mod cluster;
32pub mod config;
33pub mod crypto;
34pub mod document_body;
35pub mod document_migration;
36pub mod ec;
37pub mod engine;
38pub mod geo;
39pub mod grpc;
40pub mod health;
41pub mod index;
42pub mod json_field;
43pub mod log;
44pub mod mcp;
45pub mod modules;
46pub mod notifications;
47pub mod operational_bootstrap;
48pub mod physical;
49pub(crate) mod presentation;
50pub mod regress;
51pub mod replication;
52pub(crate) mod reserved_fields;
53pub mod rpc_stdio;
54pub mod runtime;
55pub mod serde_json;
56pub mod server;
57pub mod service_cli;
58mod service_router;
59pub mod sqlstate;
60pub mod storage;
61pub mod streams;
62pub mod telemetry;
63pub mod utils;
64pub mod wire;
65
66/// Re-export of the shared `reddb-wire` crate.
67///
68/// `reddb-wire` is the transport-agnostic protocol vocabulary:
69/// connection strings, audit-safe sanitizers, RedWire frames/codecs,
70/// payloads, topology, and replication wire messages. Exposed here so
71/// existing `use reddb::...` callers can reach the shared protocol
72/// contracts without a separate dependency.
73pub use reddb_wire as wire_proto;
74
75/// Re-export shim for the in-house JSON aggregator + `json!` macro
76/// (ADR 0053). Both the `crate::json::{Value, Map, to_vec, ...}`
77/// aggregator module and the `crate::json!` macro now live in
78/// `reddb-io-types`; this single re-export carries both namespaces so
79/// every existing call-site (200+ uses of `crate::json::...` and
80/// `crate::json!(...)`) compiles unchanged. Replaces the former
81/// `pub mod json;` + local `json.rs` aggregator.
82pub use reddb_types::json;
83
84pub mod prelude {
85    pub use crate::api::{
86        Capability, CapabilitySet, CatalogService, CatalogSnapshot, CollectionStats, DataOps,
87        QueryPlanner, RedDBError, RedDBOptions, RedDBResult, SchemaManifest, StorageMode,
88        DEFAULT_EXPORT_RETENTION, DEFAULT_SNAPSHOT_RETENTION, REDDB_FORMAT_VERSION,
89        REDDB_PROTOCOL_VERSION,
90    };
91    pub use crate::application::{
92        AdminUseCases, CatalogUseCases, EntityUseCases, GraphUseCases, NativeUseCases,
93        QueryUseCases, RuntimeAdminPort, RuntimeCatalogPort, RuntimeEntityPort, RuntimeGraphPort,
94        RuntimeNativePort, RuntimeQueryPort, RuntimeSchemaPort, SchemaUseCases,
95    };
96    pub use crate::auth::store::AuthStore;
97    pub use crate::auth::{AuthConfig, AuthError, Role as AuthRole};
98    pub use crate::catalog::{
99        snapshot_store, CatalogModelSnapshot, CollectionDescriptor, CollectionModel, SchemaMode,
100    };
101    pub use crate::engine::{EngineInfo, EngineStats, RedDBEngine};
102    pub use crate::grpc::{GrpcServerOptions, GrpcTlsOptions, RedDBGrpcServer};
103    pub use crate::health::{HealthIssue, HealthProvider, HealthReport, HealthState};
104    pub use crate::index::{
105        IndexCatalog, IndexCatalogSnapshot, IndexConfig, IndexKind, IndexMetric, IndexRuntime,
106        IndexStats,
107    };
108    pub use crate::physical::{
109        ArtifactState, BlockReference, CompactionPolicy, ExportDescriptor, GridLayout,
110        ManifestEvent, ManifestEventKind, ManifestPointers, PhysicalAnalyticsJob,
111        PhysicalGraphProjection, PhysicalIndexState, PhysicalLayout, PhysicalMetadataFile,
112        SnapshotDescriptor, SuperblockHeader, WalPolicy, DEFAULT_MANIFEST_EVENT_HISTORY,
113        PHYSICAL_METADATA_PROTOCOL_VERSION,
114    };
115    pub use crate::runtime::{
116        ConnectionPoolConfig, RedDBRuntime, RuntimeConnection, RuntimeFilter, RuntimeFilterValue,
117        RuntimeGraphCentralityAlgorithm, RuntimeGraphCentralityResult, RuntimeGraphCentralityScore,
118        RuntimeGraphClusteringResult, RuntimeGraphCommunity, RuntimeGraphCommunityAlgorithm,
119        RuntimeGraphCommunityResult, RuntimeGraphComponent, RuntimeGraphComponentsMode,
120        RuntimeGraphComponentsResult, RuntimeGraphCyclesResult, RuntimeGraphDegreeScore,
121        RuntimeGraphDirection, RuntimeGraphEdge, RuntimeGraphHitsResult,
122        RuntimeGraphNeighborhoodResult, RuntimeGraphNode, RuntimeGraphPath,
123        RuntimeGraphPathAlgorithm, RuntimeGraphPathResult, RuntimeGraphPattern,
124        RuntimeGraphProjection, RuntimeGraphTopologicalSortResult, RuntimeGraphTraversalResult,
125        RuntimeGraphTraversalStrategy, RuntimeGraphVisit, RuntimeIvfMatch, RuntimeIvfSearchResult,
126        RuntimeQueryResult, RuntimeQueryWeights, RuntimeStats, ScanCursor, ScanPage,
127    };
128    pub use crate::server::{RedDBServer, ServerOptions, ServerReplicationState};
129    pub use crate::storage::{
130        DeployProfile, StorageDeployPreset, StoragePackaging, StorageProfileSelection,
131    };
132}
133
134pub use crate::api::{
135    tier_wiring, Capability, CapabilitySet, CatalogService, CatalogSnapshot, CollectionStats,
136    DataOps, QueryPlanner, RedDBError, RedDBOptions, RedDBResult, SchemaManifest, StorageMode,
137    DEFAULT_EXPORT_RETENTION, DEFAULT_SNAPSHOT_RETENTION, REDDB_FORMAT_VERSION,
138    REDDB_PROTOCOL_VERSION,
139};
140pub use crate::application::{
141    AdminUseCases, CatalogUseCases, EntityUseCases, GraphUseCases, NativeUseCases, QueryUseCases,
142    RuntimeAdminPort, RuntimeCatalogPort, RuntimeEntityPort, RuntimeGraphPort, RuntimeNativePort,
143    RuntimeQueryPort, RuntimeSchemaPort, SchemaUseCases,
144};
145pub use crate::catalog::{
146    snapshot_store, CatalogModelSnapshot, CollectionDescriptor, CollectionModel, SchemaMode,
147};
148pub use crate::engine::{EngineInfo, EngineStats, RedDBEngine};
149pub use crate::grpc::{GrpcServerOptions, GrpcTlsOptions, RedDBGrpcServer};
150pub use crate::health::{HealthIssue, HealthProvider, HealthReport, HealthState};
151pub use crate::index::{
152    IndexCatalog, IndexCatalogSnapshot, IndexConfig, IndexKind, IndexMetric, IndexRuntime,
153    IndexStats,
154};
155pub use crate::physical::{
156    fold_dwb_into_wal_enabled, fold_pager_meta_enabled, meta_json_sidecar_enabled, provision_shm,
157    read_shm_header, seqn_journal_enabled, seqn_journal_retention, set_fold_dwb_into_wal_enabled,
158    set_fold_pager_meta_enabled, set_meta_json_sidecar_enabled, set_seqn_journal_enabled,
159    set_seqn_journal_retention, set_shm_provisioning_enabled, shm_path_for,
160    shm_provisioning_enabled, ArtifactState, BlockReference, CompactionPolicy, ExportDescriptor,
161    GridLayout, ManifestEvent, ManifestEventKind, ManifestPointers, PhysicalAnalyticsJob,
162    PhysicalGraphProjection, PhysicalIndexState, PhysicalLayout, PhysicalMetadataFile, ShmHandle,
163    ShmHeader, ShmProvisionState, SnapshotDescriptor, SuperblockHeader, WalPolicy,
164    DEFAULT_MANIFEST_EVENT_HISTORY, DEFAULT_METADATA_JOURNAL_RETENTION,
165    OPT_IN_METADATA_JOURNAL_RETENTION, PHYSICAL_METADATA_PROTOCOL_VERSION, SHM_FILE_SIZE,
166    SHM_HEADER_SIZE, SHM_MAGIC, SHM_VERSION,
167};
168pub use crate::replication::{ReplicationConfig, ReplicationRole};
169pub use crate::runtime::{
170    ConnectionPoolConfig, RedDBRuntime, RuntimeConnection, RuntimeFilter, RuntimeFilterValue,
171    RuntimeGraphCentralityAlgorithm, RuntimeGraphCentralityResult, RuntimeGraphCentralityScore,
172    RuntimeGraphClusteringResult, RuntimeGraphCommunity, RuntimeGraphCommunityAlgorithm,
173    RuntimeGraphCommunityResult, RuntimeGraphComponent, RuntimeGraphComponentsMode,
174    RuntimeGraphComponentsResult, RuntimeGraphCyclesResult, RuntimeGraphDegreeScore,
175    RuntimeGraphDirection, RuntimeGraphEdge, RuntimeGraphHitsResult,
176    RuntimeGraphNeighborhoodResult, RuntimeGraphNode, RuntimeGraphPath, RuntimeGraphPathAlgorithm,
177    RuntimeGraphPathResult, RuntimeGraphPattern, RuntimeGraphProjection,
178    RuntimeGraphTopologicalSortResult, RuntimeGraphTraversalResult, RuntimeGraphTraversalStrategy,
179    RuntimeGraphVisit, RuntimeIvfMatch, RuntimeIvfSearchResult, RuntimeQueryResult,
180    RuntimeQueryWeights, RuntimeStats, ScanCursor, ScanPage,
181};
182pub use crate::server::{RedDBServer, ServerOptions, ServerReplicationState};
183pub use reddb_file::{TimelineHistory, TimelineId};
184
185pub use crate::storage::*;