Skip to main content

Crate rhei_olap

Crate rhei_olap 

Source
Expand description

Backend-agnostic OLAP and OLTP dispatcher for the Rhei HTAP engine.

§Purpose

This crate provides two enum dispatchers — OlapBackend and OltpBackend — that forward every rhei_core::OlapEngine and rhei_core::OltpEngine method call to the concrete engine selected at configuration time. The consuming crates (rhei, rhei-sync, rhei-flight) only ever see one type, so they are compiled once regardless of which backend combination is enabled.

Using an enum (instead of Box<dyn OlapEngine>) avoids heap allocation and virtual-dispatch overhead in the hot sync path while still allowing the backend choice to be deferred until runtime configuration.

§OLAP feature flags

FeatureDefaultDescription
datafusion-backendyesEnables the OlapBackend::DataFusion variant backed by rhei_datafusion::DataFusionEngine
duckdb-backendnoEnables the [OlapBackend::DuckDb] variant backed by [rhei_duckdb::DuckDbEngine]
fullnoBoth datafusion-backend and duckdb-backend simultaneously
cloud-storagenoPasses the cloud-storage flag through to rhei-datafusion (S3 / GCS Parquet backends)

At least one of datafusion-backend or duckdb-backend must be enabled; the crate will not compile if both are absent.

§Dispatch pattern

Every async method on OlapBackend is a thin match over the active variant that calls the same method on the inner engine and maps its error to OlapError. The same pattern applies to OltpBackend and OltpError.

§Re-exports

For consumer convenience this crate re-exports the concrete engine types and their errors so that callers do not need to depend on rhei-datafusion or rhei-duckdb directly.

Re-exports§

pub use error::OlapError;
pub use error::OltpError;

Modules§

error
Unified error types for the OLAP and OLTP backend dispatchers.

Structs§

DataFusionEngine
DataFusion-backed OLAP engine.
RusqliteCdcProducer
Reads CDC events from the _rhei_cdc_log table in the OLTP database.
RusqliteEngine
Rusqlite-backed OLTP engine.
SharedDataFusionEngine
A cheaply-cloneable, Arc-wrapped DataFusionEngine that implements rhei_core::OlapEngine.

Enums§

DfOlapError
Errors that can occur in the DataFusion OLAP backend.
OlapBackend
Unified OLAP backend that wraps all supported engines.
OltpBackend
Unified OLTP backend enum.
RusqliteOltpError
Unified error type for the Rusqlite OLTP engine.
StorageMode
Storage mode for the DataFusion OLAP engine.