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 pager_zone_migration;
49pub mod physical;
50pub(crate) mod presentation;
51pub mod regress;
52pub mod replication;
53pub(crate) mod reserved_fields;
54pub mod rpc_stdio;
55pub mod runtime;
56pub mod serde_json;
57pub mod server;
58pub mod service_cli;
59mod service_router;
60pub mod sqlstate;
61pub mod storage;
62pub mod streams;
63pub mod telemetry;
64pub mod utils;
65pub mod wire;
66
67/// Re-export of the shared `reddb-wire` crate.
68///
69/// `reddb-wire` is the transport-agnostic protocol vocabulary:
70/// connection strings, audit-safe sanitizers, RedWire frames/codecs,
71/// payloads, topology, and replication wire messages. Exposed here so
72/// existing `use reddb::...` callers can reach the shared protocol
73/// contracts without a separate dependency.
74pub use reddb_wire as wire_proto;
75
76/// Re-export shim for the in-house JSON aggregator + `json!` macro
77/// (ADR 0053). Both the `crate::json::{Value, Map, to_vec, ...}`
78/// aggregator module and the `crate::json!` macro now live in
79/// `reddb-io-types`; this single re-export carries both namespaces so
80/// every existing call-site (200+ uses of `crate::json::...` and
81/// `crate::json!(...)`) compiles unchanged. Replaces the former
82/// `pub mod json;` + local `json.rs` aggregator.
83pub use reddb_types::json;
84
85pub mod prelude {
86    pub use crate::api::{
87        Capability, CapabilitySet, CatalogService, CatalogSnapshot, CollectionStats, DataOps,
88        QueryPlanner, RedDBError, RedDBOptions, RedDBResult, SchemaManifest, StorageMode,
89        DEFAULT_EXPORT_RETENTION, DEFAULT_SNAPSHOT_RETENTION, REDDB_FORMAT_VERSION,
90        REDDB_PROTOCOL_VERSION,
91    };
92    pub use crate::application::{
93        AdminUseCases, CatalogUseCases, EntityUseCases, GraphUseCases, NativeUseCases,
94        QueryUseCases, RuntimeAdminPort, RuntimeCatalogPort, RuntimeEntityPort, RuntimeGraphPort,
95        RuntimeNativePort, RuntimeQueryPort, RuntimeSchemaPort, SchemaUseCases,
96    };
97    pub use crate::auth::store::AuthStore;
98    pub use crate::auth::{AuthConfig, AuthError, Role as AuthRole};
99    pub use crate::catalog::{
100        snapshot_store, CatalogModelSnapshot, CollectionDescriptor, CollectionModel, SchemaMode,
101    };
102    pub use crate::engine::{EngineInfo, EngineStats, RedDBEngine};
103    pub use crate::grpc::{GrpcServerOptions, GrpcTlsOptions, RedDBGrpcServer};
104    pub use crate::health::{HealthIssue, HealthProvider, HealthReport, HealthState};
105    pub use crate::index::{
106        IndexCatalog, IndexCatalogSnapshot, IndexConfig, IndexKind, IndexMetric, IndexRuntime,
107        IndexStats,
108    };
109    pub use crate::physical::{
110        ArtifactState, BlockReference, CompactionPolicy, ExportDescriptor, GridLayout,
111        ManifestEvent, ManifestEventKind, ManifestPointers, PhysicalAnalyticsJob,
112        PhysicalGraphProjection, PhysicalIndexState, PhysicalLayout, PhysicalMetadataFile,
113        SnapshotDescriptor, SuperblockHeader, WalPolicy, DEFAULT_MANIFEST_EVENT_HISTORY,
114        PHYSICAL_METADATA_PROTOCOL_VERSION,
115    };
116    pub use crate::runtime::{
117        ConnectionPoolConfig, RedDBRuntime, RuntimeConnection, RuntimeFilter, RuntimeFilterValue,
118        RuntimeGraphCentralityAlgorithm, RuntimeGraphCentralityResult, RuntimeGraphCentralityScore,
119        RuntimeGraphClusteringResult, RuntimeGraphCommunity, RuntimeGraphCommunityAlgorithm,
120        RuntimeGraphCommunityResult, RuntimeGraphComponent, RuntimeGraphComponentsMode,
121        RuntimeGraphComponentsResult, RuntimeGraphCyclesResult, RuntimeGraphDegreeScore,
122        RuntimeGraphDirection, RuntimeGraphEdge, RuntimeGraphHitsResult,
123        RuntimeGraphNeighborhoodResult, RuntimeGraphNode, RuntimeGraphPath,
124        RuntimeGraphPathAlgorithm, RuntimeGraphPathResult, RuntimeGraphPattern,
125        RuntimeGraphProjection, RuntimeGraphTopologicalSortResult, RuntimeGraphTraversalResult,
126        RuntimeGraphTraversalStrategy, RuntimeGraphVisit, RuntimeIvfMatch, RuntimeIvfSearchResult,
127        RuntimeQueryResult, RuntimeQueryWeights, RuntimeStats, ScanCursor, ScanPage,
128    };
129    pub use crate::server::{RedDBServer, ServerOptions, ServerReplicationState};
130    pub use crate::storage::{
131        DeployProfile, StorageDeployPreset, StoragePackaging, StorageProfileSelection,
132    };
133}
134
135pub use crate::api::{
136    tier_wiring, Capability, CapabilitySet, CatalogService, CatalogSnapshot, CollectionStats,
137    DataOps, QueryPlanner, RedDBError, RedDBOptions, RedDBResult, SchemaManifest, StorageMode,
138    DEFAULT_EXPORT_RETENTION, DEFAULT_SNAPSHOT_RETENTION, REDDB_FORMAT_VERSION,
139    REDDB_PROTOCOL_VERSION,
140};
141pub use crate::application::{
142    AdminUseCases, CatalogUseCases, EntityUseCases, GraphUseCases, NativeUseCases, QueryUseCases,
143    RuntimeAdminPort, RuntimeCatalogPort, RuntimeEntityPort, RuntimeGraphPort, RuntimeNativePort,
144    RuntimeQueryPort, RuntimeSchemaPort, SchemaUseCases,
145};
146pub use crate::catalog::{
147    snapshot_store, CatalogModelSnapshot, CollectionDescriptor, CollectionModel, SchemaMode,
148};
149pub use crate::engine::{EngineInfo, EngineStats, RedDBEngine};
150pub use crate::grpc::{GrpcServerOptions, GrpcTlsOptions, RedDBGrpcServer};
151pub use crate::health::{HealthIssue, HealthProvider, HealthReport, HealthState};
152pub use crate::index::{
153    IndexCatalog, IndexCatalogSnapshot, IndexConfig, IndexKind, IndexMetric, IndexRuntime,
154    IndexStats,
155};
156pub use crate::physical::{
157    fold_dwb_into_wal_enabled, meta_json_sidecar_enabled, provision_shm, read_shm_header,
158    seqn_journal_enabled, seqn_journal_retention, set_fold_dwb_into_wal_enabled,
159    set_meta_json_sidecar_enabled, set_seqn_journal_enabled, set_seqn_journal_retention,
160    set_shm_provisioning_enabled, shm_path_for, shm_provisioning_enabled, ArtifactState,
161    BlockReference, CompactionPolicy, ExportDescriptor, GridLayout, ManifestEvent,
162    ManifestEventKind, ManifestPointers, PhysicalAnalyticsJob, PhysicalGraphProjection,
163    PhysicalIndexState, PhysicalLayout, PhysicalMetadataFile, ShmHandle, ShmHeader,
164    ShmProvisionState, SnapshotDescriptor, SuperblockHeader, WalPolicy,
165    DEFAULT_MANIFEST_EVENT_HISTORY, DEFAULT_METADATA_JOURNAL_RETENTION,
166    OPT_IN_METADATA_JOURNAL_RETENTION, PHYSICAL_METADATA_PROTOCOL_VERSION, SHM_FILE_SIZE,
167    SHM_HEADER_SIZE, SHM_MAGIC, SHM_VERSION,
168};
169pub use crate::replication::{ReplicationConfig, ReplicationRole};
170pub use crate::runtime::impl_ephemeral::{EphemeralError, EphemeralTable, POSITIONAL_ALIAS};
171pub use crate::runtime::{
172    ConnectionPoolConfig, RedDBRuntime, RuntimeConnection, RuntimeFilter, RuntimeFilterValue,
173    RuntimeGraphCentralityAlgorithm, RuntimeGraphCentralityResult, RuntimeGraphCentralityScore,
174    RuntimeGraphClusteringResult, RuntimeGraphCommunity, RuntimeGraphCommunityAlgorithm,
175    RuntimeGraphCommunityResult, RuntimeGraphComponent, RuntimeGraphComponentsMode,
176    RuntimeGraphComponentsResult, RuntimeGraphCyclesResult, RuntimeGraphDegreeScore,
177    RuntimeGraphDirection, RuntimeGraphEdge, RuntimeGraphHitsResult,
178    RuntimeGraphNeighborhoodResult, RuntimeGraphNode, RuntimeGraphPath, RuntimeGraphPathAlgorithm,
179    RuntimeGraphPathResult, RuntimeGraphPattern, RuntimeGraphProjection,
180    RuntimeGraphTopologicalSortResult, RuntimeGraphTraversalResult, RuntimeGraphTraversalStrategy,
181    RuntimeGraphVisit, RuntimeIvfMatch, RuntimeIvfSearchResult, RuntimeQueryResult,
182    RuntimeQueryWeights, RuntimeStats, ScanCursor, ScanPage,
183};
184pub use crate::server::{RedDBServer, ServerOptions, ServerReplicationState};
185pub use reddb_file::{TimelineHistory, TimelineId};
186
187pub use crate::storage::*;