Skip to main content

reddb_server/
lib.rs

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