pub struct CompositeEngine { /* private fields */ }Expand description
A validation engine that composes two engines: one owns the built-in rules, the other evaluates the caller-supplied Rego rules.
The built-in rules are always evaluated by the CEL engine, which also evaluates custom CEL rules (a CEL-engine feature) and Guard rules (which every engine evaluates through the shared Guard evaluator, so the built-in engine is as good a host as any). Custom Rego rules need a Rego engine, so one is built in external-only mode - contributing no built-in findings of its own - and only when the configuration supplies Rego rules. Findings from both are concatenated; the surrounding validation pipeline performs the single finalize pass (dedup, sort, filter, enrich).
Implementations§
Source§impl CompositeEngine
impl CompositeEngine
Sourcepub fn new(config: CompositeEngineConfig) -> Result<Self>
pub fn new(config: CompositeEngineConfig) -> Result<Self>
Builds the composite engine from a CompositeEngineConfig. The built-in
engine is always constructed; the external engine is constructed only when
the configuration supplies custom Rego rules.
Trait Implementations§
Source§impl ValidationEngine for CompositeEngine
impl ValidationEngine for CompositeEngine
Source§fn external_rule_metadata(&self) -> HashMap<String, RuleMetadataEntry>
fn external_rule_metadata(&self) -> HashMap<String, RuleMetadataEntry>
The external rule metadata is the union of both engines’ external rules: custom CEL and Guard rules from the built-in engine and custom Rego rules from the external engine. The two sets have disjoint rule IDs, so a plain merge cannot drop or overwrite a rule.
fn engine_name(&self) -> &str
fn evaluate_rules( &self, model: &Arc<SemanticModel>, config: &ValidateConfig, ) -> Result<Vec<Diagnostic>, ValidationError>
fn list_rules(&self) -> Vec<RuleInfo>
Source§fn rule_metadata(&self) -> &HashMap<String, RuleMetadataEntry>
fn rule_metadata(&self) -> &HashMap<String, RuleMetadataEntry>
fn init_metric(&self) -> &PhaseMetric
Auto Trait Implementations§
impl !Freeze for CompositeEngine
impl !RefUnwindSafe for CompositeEngine
impl !UnwindSafe for CompositeEngine
impl Send for CompositeEngine
impl Sync for CompositeEngine
impl Unpin for CompositeEngine
impl UnsafeUnpin for CompositeEngine
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer