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