Skip to main content

Crate laminar_db

Crate laminar_db 

Source
Expand description

Unified database facade for LaminarDB.

Provides a single entry point (LaminarDB) that ties together the SQL parser, query planner, DataFusion context, and streaming API.

§Example

ⓘ
use laminar_db::LaminarDB;

let db = LaminarDB::open()?;

db.execute("CREATE SOURCE trades (
    symbol VARCHAR, price DOUBLE, ts TIMESTAMP,
    WATERMARK FOR ts AS ts - INTERVAL '1' SECOND
)").await?;

let query = db.execute("SELECT symbol, AVG(price)
    FROM trades GROUP BY symbol, TUMBLE(ts, INTERVAL '1' MINUTE)
").await?;

Re-exports§

pub use engine_metrics::EngineMetrics;
pub use profile::Profile;
pub use profile::ProfileError;
pub use recovery_manager::RecoveredState;
pub use recovery_manager::RecoveryManager;
pub use subscription::ClusterSubscriptionError;

Modules§

ai
AI inference module, containing model registry, provider trait, and backends. Backend-agnostic AI inference types: registry, provider trait, cache, call log, adapters, and backends. Inference runs on a Ring 1 worker, never Ring 0.
api
FFI-friendly API for language bindings.
checkpoint_timing
Bounded process-local evidence for cluster checkpoint barrier pauses. Bounded process-local evidence for cluster checkpoint barrier pauses.
engine_metrics
Prometheus metrics for the streaming engine. Prometheus metrics for the streaming engine.
ffi
C FFI layer for LaminarDB.
pipeline
Thread-per-core connector pipeline. Streaming connector pipeline. Each source connector runs as a tokio task pushing batches via crossfire mpsc to the StreamingCoordinator, which drives SQL execution cycles, routes results to sinks, and manages checkpoint barriers. See the streaming_coordinator submodule for the runtime topology.
process_function
Keyed process functions with engine-owned state and timers.
profile
Deployment profiles. Deployment profiles for LaminarDB.
rebalance
Dynamic vnode rebalance control plane. Dynamic vnode rebalance control plane.
recovery_manager
Unified recovery manager. Exact-cut recovery from committed v10 checkpoint manifests.
subscription
External named-subscription substrate: byte-bounded shared logs and cursor portals. SUBSCRIBE substrate: one shared byte-bounded log per object and cursor portals.

Structs§

ArrowRecord
Record type for Arrow-based streaming subscriptions.
CheckpointResult
CheckpointStats
ClusterTopologyAdoptionRequest
Explicit adoption of an existing sealed inventory after a coordinated binary upgrade.
ClusterTopologyObjectPlan
One catalog-bound entry of the local compatibility descriptor, sorted by canonical name.
ClusterTopologyRequest
One atomic candidate graph and the request identity reused on every retry.
ClusterTopologyStatus
Durable catalog version and this process’s independently observed runtime activation.
ClusterTopologyValidation
Effect-free candidate validation. This is neither a durable admission nor an activation receipt.
CommittedQuery
Rows of a committed read, and the committed cut every view in it was read at.
CommittedVnodeFrame
Per-vnode state of keyed operators, live and at the committed checkpoint. Per-vnode state of keyed operators, live and at the committed checkpoint. Per-vnode state of keyed operators, live and at the committed checkpoint. One vnode’s state frame in a committed checkpoint.
ConfigKeySpec
Re-export connector metadata types for the control-plane HTTP API (connector catalog / source-creation wizard). Specification for a configuration key.
ConnectorInfo
Re-export connector metadata types for the control-plane HTTP API (connector catalog / source-creation wizard). Metadata about a connector implementation.
ConnectorRegistry
Re-export the connector registry for custom connector registration. Registry of available connector implementations. Connectors register a factory per type string; the runtime resolves the connector named by FROM in CREATE SOURCE or INTO in CREATE SINK.
DdlInfo
Information about a local DDL result or durable cluster migration admission.
LaminarConfig
Configuration for a LaminarDB instance.
LaminarDB
The main LaminarDB database handle.
LaminarDbBuilder
Fluent builder for constructing a LaminarDB instance.
LiveVnodeLoad
Per-vnode state of keyed operators, live and at the committed checkpoint. Per-vnode state of keyed operators, live and at the committed checkpoint. Per-vnode state of keyed operators, live and at the committed checkpoint. One vnode’s state on this node at the last sample.
MaterializedViewInfo
JSON-serializable projection of a MaterializedView for the control-plane HTTP API.
OperatorVnodeLoad
Per-vnode state of keyed operators, live and at the committed checkpoint. Per-vnode state of keyed operators, live and at the committed checkpoint. Per-vnode state of keyed operators, live and at the committed checkpoint. One operator’s state per vnode.
PipelineEdge
A directed edge in the pipeline topology graph.
PipelineMetrics
Pipeline-wide metrics snapshot.
PipelineNode
A node in the pipeline topology graph.
PipelineTopology
The complete pipeline topology: nodes and edges.
PreparedTopologyRestore
One unstarted target state image. It owns the existing local compiler slot until dropped. It has no source/sink actors or installation/output authority. Existing fenced parent transport handles provide channel decoding context; no receiver or sender is started by preparation. Even a successful preparation requires observed predecessor retirement, fresh authority checks, Commit and coordinated target Release before it can become a runtime graph.
QueryHandle
Handle to a running streaming query.
QueryInfo
Information about a running query.
QueryRows
The rows of an ad-hoc query, in order. Reading them to the end returns every row the query produced; a query that fails, or is cancelled before its last row, ends them with an error.
ReadCut
The committed checkpoint a read observed.
ReadResult
The rows of an ad-hoc read and the committed cut it observed.
RestartPolicy
Auto-restart policy for the fault supervisor (see LaminarDB::enable_supervision).
SinkInfo
Information about a registered sink.
SnapshotAdoption
Cluster assignment lifecycle results. Cluster assignment lifecycle results. Cluster assignment lifecycle results. Summary of a single LaminarDB::adopt_assignment_snapshot call.
SourceCatalog
Central registry of sources, sinks, streams, and queries.
SourceEntry
A registered source in the catalog.
SourceHandle
Typed handle for pushing data into a registered source.
SourceInfo
Information about a registered source.
SourceMetrics
Metrics for a single registered source.
StreamInfo
Metadata about a registered stream.
StreamMetrics
Metrics for a single registered stream.
TypedSubscription
Typed subscription that deserializes named-stream RecordBatch rows.
TypedSubscriptionEnvelope
Typed compatibility frame plus optional durable cluster partition metadata.
UntypedSourceHandle
Untyped handle for pushing raw RecordBatch data.
VnodeLoadCheckpoint
Per-vnode state of keyed operators, live and at the committed checkpoint. Per-vnode state of keyed operators, live and at the committed checkpoint. Per-vnode state of keyed operators, live and at the committed checkpoint. The committed checkpoint a VnodeLoadReport’s frame sizes come from.
VnodeLoadEntry
Per-vnode state of keyed operators, live and at the committed checkpoint. Per-vnode state of keyed operators, live and at the committed checkpoint. Per-vnode state of keyed operators, live and at the committed checkpoint. One vnode of one operator.
VnodeLoadReport
Per-vnode state of keyed operators, live and at the committed checkpoint. Per-vnode state of keyed operators, live and at the committed checkpoint. Per-vnode state of keyed operators, live and at the committed checkpoint. How keyed operator state spreads over vnodes, as one cluster node sees it.

Enums§

BackpressurePolicy
What to do when an operator’s input buffer exceeds its cap.
CheckpointFailureDisposition
CheckpointPhase
ClusterStartupDisposition
Cluster assignment lifecycle results. Cluster assignment lifecycle results. Cluster assignment lifecycle results. Result of certifying a clustered process at startup.
ClusterTopologyObjectTransition
Supported catalog-object transitions at an exact checkpoint cut.
CommittedRead
Which committed cut a read observes.
CommittedReadError
Why a committed read could not be served.
DbError
Errors from database operations.
DeliveryGuarantee
Delivery guarantee level for the pipeline.
ExecuteResult
Result of executing a SQL statement.
PipelineNodeType
Type of a node in the pipeline topology.
PipelineState
The state of a streaming pipeline.
PreparedTopologySourcePosition
A source’s preparation boundary. A sealed new-source cursor is never processing history.
ReadLevel
How an ad-hoc query reads the materialized views it scans.
SubscriptionError
Terminal failure from a named subscription.
TopologyActivationRequirement
Authorization still needed before this local plan can activate a target graph.
TopologyInitialization
Required initialization semantics. These are requirements, never concrete cut positions.
TopologyValidationScope
What a successful validation proves. Participant agreement and runtime authorization follow.
TypedSubscriptionFrame
A typed frame from a named subscription.

Constants§

DEFAULT_DATAFUSION_MEMORY_LIMIT_BYTES
Default per-DB limit for participating DataFusion reservations (256 MiB). This does not limit direct Arrow allocations or process RSS.
DEFAULT_MATERIALIZED_VIEW_MAX_BYTES
Default retained-memory charge limit per local materialized view (256 MiB).
DEFAULT_MATERIALIZED_VIEW_MAX_ROWS
Default live row limit per local materialized view (distinct rows for multisets).
DEFAULT_MATERIALIZED_VIEW_READ_CACHE_BYTES
Default byte budget of decoded committed view state cached for reads (256 MiB).
DEFAULT_MAX_MANAGED_STATE_BYTES
Default pipeline-wide lower-bound charge allowed for managed operator working state.
DEFAULT_REFERENCE_TABLE_MAX_BYTES
Default retained-memory charge limit for each local reference table (256 MiB).
DEFAULT_REFERENCE_TABLE_MAX_ROWS
Default maximum number of live rows in each local reference table.
DEFAULT_SOURCE_QUEUE_MAX_BYTES
Default shared connector-to-coordinator Arrow-byte budget (64 MiB).
MAX_SOURCE_QUEUE_BYTES
Largest source queue budget supported by byte-sized semaphore reservations.

Traits§

FromBatch
Deserialize rows from a RecordBatch. Auto-generated by #[derive(FromRecordBatch)].

Functions§

validate_managed_state_max_bytes
Validate the pipeline-wide managed operator state budget.
validate_materialized_view_limits
Validate the live row and retained-memory limits for each local materialized view.
validate_reference_table_limits
Validate per-table live row and retained-memory limits.
validate_source_queue_max_bytes
Validates the shared source queue byte budget before connector I/O.