Skip to main content

reifydb_engine/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2025 ReifyDB
3
4//! Query execution and orchestration. The engine consumes a compiled `rql` plan, drives the virtual machine over the
5//! storage tier, applies policy enforcement, manages per-query session state, and produces the columnar result the
6//! caller observes.
7//!
8//! Above this crate sit the user-facing surfaces (the SDK, the server subsystems, the subscription/flow runtime); below
9//! it sit the storage backends, the catalog, the transaction manager, and the policy evaluator. The engine is the
10//! place where a logical query becomes an executed query: instructions are issued to storage, intermediate columns
11//! flow through transforms, side effects (writes, schema changes, test runs) are committed under transactional
12//! guarantees, and policy checks are interleaved at the points where they can decide what the caller is allowed to
13//! see or do.
14//!
15//! Invariant: every public entry point that mutates catalog or storage state runs inside a transaction obtained from
16//! `reifydb-transaction`. Bypassing the transaction layer to read or write directly from a backend defeats MVCC,
17//! policy enforcement, and CDC capture - all of which assume the engine is the single mediator of those concerns.
18
19#![cfg_attr(not(debug_assertions), deny(clippy::disallowed_methods))]
20#![cfg_attr(debug_assertions, warn(clippy::disallowed_methods))]
21#![cfg_attr(not(debug_assertions), deny(warnings))]
22#![allow(clippy::tabs_in_doc_comments)]
23
24use reifydb_core::interface::version::{ComponentType, HasVersion, SystemVersion};
25use reifydb_type::Result;
26
27pub mod arena;
28pub mod bulk_insert;
29pub mod engine;
30pub mod environment;
31pub mod error;
32pub mod expression;
33pub mod flow;
34pub mod policy;
35#[cfg(not(reifydb_single_threaded))]
36pub mod remote;
37pub mod run_tests;
38pub mod session;
39pub mod subscription;
40pub mod test_harness;
41pub mod test_prelude;
42pub mod transaction;
43pub mod vm;
44
45pub struct EngineVersion;
46
47impl HasVersion for EngineVersion {
48	fn version(&self) -> SystemVersion {
49		SystemVersion {
50			name: env!("CARGO_PKG_NAME")
51				.strip_prefix("reifydb-")
52				.unwrap_or(env!("CARGO_PKG_NAME"))
53				.to_string(),
54			version: env!("CARGO_PKG_VERSION").to_string(),
55			description: "Query execution and processing engine module".to_string(),
56			r#type: ComponentType::Module,
57		}
58	}
59}