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
| Feature | Default | Description |
|---|---|---|
datafusion-backend | yes | Enables the OlapBackend::DataFusion variant backed by rhei_datafusion::DataFusionEngine |
duckdb-backend | no | Enables the [OlapBackend::DuckDb] variant backed by [rhei_duckdb::DuckDbEngine] |
full | no | Both datafusion-backend and duckdb-backend simultaneously |
cloud-storage | no | Passes 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§
Modules§
- error
- Unified error types for the OLAP and OLTP backend dispatchers.
Structs§
- Data
Fusion Engine - DataFusion-backed OLAP engine.
- Rusqlite
CdcProducer - Reads CDC events from the
_rhei_cdc_logtable in the OLTP database. - Rusqlite
Engine - Rusqlite-backed OLTP engine.
- Shared
Data Fusion Engine - A cheaply-cloneable,
Arc-wrappedDataFusionEnginethat implementsrhei_core::OlapEngine.
Enums§
- DfOlap
Error - Errors that can occur in the DataFusion OLAP backend.
- Olap
Backend - Unified OLAP backend that wraps all supported engines.
- Oltp
Backend - Unified OLTP backend enum.
- Rusqlite
Oltp Error - Unified error type for the Rusqlite OLTP engine.
- Storage
Mode - Storage mode for the DataFusion OLAP engine.