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;
29mod asof_batch;
30mod builder;
31mod catalog;
32mod catalog_connector;
33mod changelog_filter;
34/// Unified checkpoint coordination.
35pub mod checkpoint_coordinator;
36mod config;
37mod connector_manager;
38mod core_window_state;
39mod db;
40/// Prometheus metrics for the streaming engine.
41pub mod engine_metrics;
42mod eowc_state;
43// Reopened `impl LaminarDB` modules — split from db.rs
44/// FFI-friendly API for language bindings.
45///
46/// Enable with the `api` feature flag:
47/// ```toml
48/// laminar-db = { version = "0.1", features = ["api"] }
49/// ```
50///
51/// This module provides thread-safe types with numeric error codes,
52/// explicit resource management, and Arrow RecordBatch at all boundaries.
53#[cfg(feature = "api")]
54pub mod api;
55mod ddl;
56mod error;
57mod handle;
58mod interval_join;
59mod key_column;
60mod metrics;
61mod metrics_api;
62mod mv_store;
63mod operator;
64mod operator_graph;
65/// Thread-per-core connector pipeline.
66pub mod pipeline;
67mod pipeline_callback;
68mod pipeline_lifecycle;
69/// Deployment profiles.
70pub mod profile;
71/// Dynamic vnode rebalance control plane.
72#[cfg(feature = "cluster-unstable")]
73pub mod rebalance;
74/// Unified recovery manager.
75pub mod recovery_manager;
76mod retractable_accumulator;
77mod show_commands;
78mod sink_task;
79mod sql_analysis;
80mod sql_utils;
81mod table_backend;
82mod table_cache_mode;
83mod table_provider;
84mod table_store;
85mod temporal_probe;
86
87/// C FFI layer for LaminarDB.
88///
89/// Enable with the `ffi` feature flag:
90/// ```toml
91/// laminar-db = { version = "0.1", features = ["ffi"] }
92/// ```
93///
94/// This module provides `extern "C"` functions for calling LaminarDB from C
95/// and any language with C FFI support (Python, Java, Node.js, .NET, etc.).
96#[cfg(feature = "ffi")]
97pub mod ffi;
98
99pub use builder::LaminarDbBuilder;
100pub use catalog::{ArrowRecord, SourceCatalog, SourceEntry};
101pub use checkpoint_coordinator::{
102    CheckpointConfig, CheckpointCoordinator, CheckpointPhase, CheckpointRequest, CheckpointResult,
103    CheckpointStats,
104};
105pub use config::{BackpressurePolicy, IdentifierCaseSensitivity, LaminarConfig, TieringConfig};
106pub use db::LaminarDB;
107pub use engine_metrics::EngineMetrics;
108pub use error::DbError;
109pub use handle::{
110    DdlInfo, ExecuteResult, FromBatch, PipelineEdge, PipelineNode, PipelineNodeType,
111    PipelineTopology, QueryHandle, QueryInfo, SinkInfo, SourceHandle, SourceInfo, StreamInfo,
112    TypedSubscription, UntypedSourceHandle,
113};
114pub use metrics::{PipelineMetrics, PipelineState, SourceMetrics, StreamMetrics};
115pub use profile::{Profile, ProfileError};
116pub use recovery_manager::{RecoveredState, RecoveryManager};
117
118/// Re-export the connector registry for custom connector registration.
119pub use laminar_connectors::registry::ConnectorRegistry;