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