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.