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