Skip to main content

laminar_db/
lib.rs

1//! Unified database facade for `LaminarDB`.
2//!
3//! Provides a single entry point (`LaminarDB`) that ties together
4//! the SQL parser, query planner, `DataFusion` context, and streaming API.
5//!
6//! # Example
7//!
8//! ```rust,ignore
9//! use laminar_db::LaminarDB;
10//!
11//! let db = LaminarDB::open()?;
12//!
13//! db.execute("CREATE SOURCE trades (
14//!     symbol VARCHAR, price DOUBLE, ts TIMESTAMP,
15//!     WATERMARK FOR ts AS ts - INTERVAL '1' SECOND
16//! )").await?;
17//!
18//! let query = db.execute("SELECT symbol, AVG(price)
19//!     FROM trades GROUP BY symbol, TUMBLE(ts, INTERVAL '1' MINUTE)
20//! ").await?;
21//! ```
22
23#![deny(missing_docs)]
24#![warn(clippy::all, clippy::pedantic)]
25#![allow(clippy::duration_suboptimal_units)] // MSRV 1.85; from_mins/from_hours are 1.91+
26#![allow(clippy::module_name_repetitions)]
27
28mod aggregate_state;
29/// AI inference module, containing model registry, provider trait, and backends.
30pub mod ai;
31mod ai_catalog;
32mod ai_worker;
33mod asof_batch;
34mod builder;
35mod catalog;
36mod catalog_connector;
37mod changelog_filter;
38/// Unified checkpoint coordination.
39pub mod checkpoint_coordinator;
40mod config;
41mod connector_manager;
42mod core_window_state;
43mod db;
44/// Prometheus metrics for the streaming engine.
45pub mod engine_metrics;
46mod eowc_state;
47// Reopened `impl LaminarDB` modules — split from db.rs
48/// FFI-friendly API for language bindings.
49///
50/// Enable with the `api` feature flag:
51/// ```toml
52/// laminar-db = { version = "0.1", features = ["api"] }
53/// ```
54///
55/// This module provides thread-safe types with numeric error codes,
56/// explicit resource management, and Arrow RecordBatch at all boundaries.
57#[cfg(feature = "api")]
58pub mod api;
59mod ddl;
60mod error;
61mod filter_compile;
62mod handle;
63mod interval_join;
64mod key_column;
65mod log_throttle;
66mod metrics;
67mod metrics_api;
68mod mv_store;
69mod operator;
70mod operator_graph;
71/// Thread-per-core connector pipeline.
72pub mod pipeline;
73mod pipeline_callback;
74mod pipeline_lifecycle;
75/// Deployment profiles.
76pub mod profile;
77/// Dynamic vnode rebalance control plane.
78#[cfg(feature = "cluster")]
79pub mod rebalance;
80/// Unified recovery manager.
81pub mod recovery_manager;
82mod retractable_accumulator;
83mod show_commands;
84mod sink_task;
85mod sql_analysis;
86mod sql_utils;
87/// External `SUBSCRIBE` substrate: per-name broadcast channel and the
88/// per-portal pump task.
89pub mod subscription;
90mod table_backend;
91mod table_cache_mode;
92mod table_provider;
93mod table_store;
94mod temporal_probe;
95mod vnode_partial;
96
97// End-to-end tests for the crypto-sentiment demo pipeline, backed by wiremock.
98// In-crate (not tests/) so it can drive the OperatorGraph directly.
99#[cfg(test)]
100mod e2e_crypto_sentiment;
101
102/// C FFI layer for LaminarDB.
103///
104/// Enable with the `ffi` feature flag:
105/// ```toml
106/// laminar-db = { version = "0.1", features = ["ffi"] }
107/// ```
108///
109/// This module provides `extern "C"` functions for calling LaminarDB from C
110/// and any language with C FFI support (Python, Java, Node.js, .NET, etc.).
111#[cfg(feature = "ffi")]
112pub mod ffi;
113
114pub use builder::LaminarDbBuilder;
115pub use catalog::{ArrowRecord, SourceCatalog, SourceEntry};
116pub use checkpoint_coordinator::{
117    CheckpointConfig, CheckpointCoordinator, CheckpointPhase, CheckpointRequest, CheckpointResult,
118    CheckpointStats,
119};
120pub use config::{BackpressurePolicy, LaminarConfig};
121pub use db::LaminarDB;
122pub use engine_metrics::EngineMetrics;
123pub use error::DbError;
124pub use handle::{
125    DdlInfo, ExecuteResult, FromBatch, MaterializedViewInfo, PipelineEdge, PipelineNode,
126    PipelineNodeType, PipelineTopology, QueryHandle, QueryInfo, SinkInfo, SourceHandle, SourceInfo,
127    StreamInfo, TypedSubscription, UntypedSourceHandle,
128};
129pub use metrics::{PipelineMetrics, PipelineState, SourceMetrics, StreamMetrics};
130pub use profile::{Profile, ProfileError};
131pub use recovery_manager::{RecoveredState, RecoveryManager, VnodeRehydration, VnodeRehydrator};
132
133/// Rebalance-driven state-rehydration types (cluster mode).
134#[cfg(feature = "cluster")]
135pub use db::{RehydratedVnode, SnapshotAdoption};
136
137/// Re-export the connector registry for custom connector registration.
138pub use laminar_connectors::registry::ConnectorRegistry;
139
140/// Re-export connector metadata types for the control-plane HTTP API
141/// (connector catalog / source-creation wizard).
142pub use laminar_connectors::config::{ConfigKeySpec, ConnectorInfo};