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