Expand description
CPEX host facade.
A single dependency that re-exports the CPEX host runtime, so hosts
depend on this crate instead of pinning apl-cmf, apl-cpex, and
cpex-core one by one.
By default this is the engine only — no builtin plugins are compiled
in. The bundled extension set lives in cpex-builtins
and is pulled in only when a builtins feature is enabled.
§Usage
Engine only (register your own factories):
use std::sync::Arc;
use cpex::PluginManager;
let mgr = Arc::new(PluginManager::default());
// ... register host factories, then `apl_cpex::register_apl(&mgr, opts)`.With the bundled builtins (enable the builtins or full feature):
use std::sync::Arc;
use cpex::PluginManager;
let mgr = Arc::new(PluginManager::default());
// Register every enabled builtin factory and install the APL config
// visitor (in-process defaults) in one call:
cpex::install_builtins(&mgr);
// ... then load a config that references the enabled `kind`s.§Features
No plugins are on by default (cpex = "0.2" is the engine alone).
builtins enables the common in-process set; full adds the Valkey
session store; or pick a granular subset (jwt, oauth, pii,
audit, cedar, cel, valkey). When any builtins feature is on, the
registration helpers and the concrete factory types are re-exported here
from cpex-builtins.
Re-exports§
Structs§
- AplOptions
- Configuration for
register_apl. All runtime collaborators APL needs to do its work are funneled through here so the call site reads as a single block instead of a multi-step builder. - Dispatch
Cache - Host-owned dispatch cache. Construct once, share via
Arc<DispatchCache>across allCmfPluginInvoker::for_requestcalls so plans built for one request can be reused by the next. - Memory
Session Store - In-process
SessionStorebacked by aHashMapofHashSets. Suitable for tests, single-process deployments, and as the default when no distributed store is configured. Cloning the store viaArcshares state across all consumers. - Plugin
Manager
Traits§
- PdpFactory
- Build a
PdpResolverfrom a unified-config block. Implemented per PDP backend (cedar-direct, opa, …) and registered with the apl-cpex visitor so unified-config YAML can declare PDPs without the host pre-constructing them in code. - Session
Store - Pluggable session-state backend. Implementations must be
Send + Sync— the same store is shared across all concurrent requests. - Session
Store Factory - Factory the visitor consults when it encounters a
global.apl.session_storeblock in the unified config. Mirrorsapl_core::step::PdpFactory: each factory advertises akind()string matching the YAML block’skind:field, andbuildturns the block into a live store. Registered up front viacrate::AplOptions::session_store_factories; the visitor selects the active store from config during its global-config walk, before any route handler captures the store.
Functions§
- register_
apl - Build an
AplConfigVisitorfrom the supplied options and register it on the manager. Returns theArc<AplConfigVisitor>so the caller can stash it for later inspection (or callregister_pdpon it after the fact for late-bound resolvers) — but in the typical case the return value is dropped and the visitor lives inside the manager’s visitor list.