Skip to main content

Module executor

Module executor 

Source
Expand description

§Evaluation Primitives

Free functions and types that support JSONLogic evaluation in the engine. Built-in function execution lives on each config type (MapConfig::execute, ValidationConfig::execute, …) — this module just provides the shared evaluation machinery they all build on.

The bump arena is held in a thread-local cell on each Tokio worker. Per call, the arena is rewound via Bump::reset (constant-time, retains chunks) before the eval. Chunks accumulate to fit the workload’s high-water mark and persist across calls — no per-task malloc/free churn. Profiling showed per-task Bump::with_capacity malloc was the dominant cost when arena sizing was tuned for realistic workloads; thread-local reuse amortizes that to zero in steady state.

ArenaContext (below) extends this further for mutating tasks (map): the message context is to_arena’d once per task call into a depth‑2 cache, and subsequent writes only re‑arena the dirtied subtree — typically data.MT103 while the heavy data.input stays cached.

Functions§

evaluate_condition
Evaluate a workflow or task condition using a cached compiled logic expression. Returns true when condition_index is None (no condition is treated as “always run”). Evaluation errors are logged and downgraded to false — a condition that fails to evaluate skips its task/workflow rather than aborting the whole message.
evaluate_condition_in_arena
Same as evaluate_condition but evaluates against an arena-resident DataValue and an existing Bump. Used inside a with_arena block (the workflow sync-stretch path) to avoid re-entering the thread-local arena RefCell::borrow_mut.