Skip to main content

DecisionEngine

Trait DecisionEngine 

Source
pub trait DecisionEngine: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn state(&self) -> DecisionState;
    fn start<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = DecisionResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stop<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = DecisionResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn make_decisions<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        input: DecisionInput,
        criteria: &'life1 DecisionCriteria,
    ) -> Pin<Box<dyn Future<Output = DecisionResult<Vec<Decision>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn record_outcome<'life0, 'async_trait>(
        &'life0 mut self,
        outcome: DecisionOutcome,
    ) -> Pin<Box<dyn Future<Output = DecisionResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_stats(&self) -> DecisionStats;
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = DecisionResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn reset<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = DecisionResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Core trait for the Decision Engine

Required Methods§

Source

fn name(&self) -> &str

Get the name of this decision engine

Source

fn state(&self) -> DecisionState

Get the current state

Source

fn start<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = DecisionResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Start the decision engine

Source

fn stop<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = DecisionResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stop the decision engine

Source

fn make_decisions<'life0, 'life1, 'async_trait>( &'life0 mut self, input: DecisionInput, criteria: &'life1 DecisionCriteria, ) -> Pin<Box<dyn Future<Output = DecisionResult<Vec<Decision>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Make decisions based on analyzer input

§Arguments
  • input - Input from the analyzer engine
  • criteria - Decision criteria to use
§Returns

Vector of decisions to execute

Source

fn record_outcome<'life0, 'async_trait>( &'life0 mut self, outcome: DecisionOutcome, ) -> Pin<Box<dyn Future<Output = DecisionResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Record the outcome of a decision

Source

fn get_stats(&self) -> DecisionStats

Get decision statistics

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = DecisionResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Health check

Source

fn reset<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = DecisionResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reset the decision engine state

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§