Engine

Struct Engine 

Source
pub struct Engine { /* private fields */ }
Expand description

High-level engine facade for planning and execution.

use daedalus_engine::{Engine, EngineConfig};
let engine = Engine::new(EngineConfig::default()).unwrap();
let _ = engine.config();

Implementations§

Source§

impl Engine

Source

pub fn new(config: EngineConfig) -> Result<Self, EngineError>

Create a new engine from configuration.

Source

pub fn config(&self) -> &EngineConfig

Return a reference to the engine config.

Source

pub fn plan( &self, registry: &Registry, graph: Graph, ) -> Result<PlannerOutput, EngineError>

Run planner on the provided graph + registry.

use daedalus_engine::{Engine, EngineConfig};
use daedalus_registry::store::Registry;
use daedalus_planner::Graph;
let engine = Engine::new(EngineConfig::default()).unwrap();
let registry = Registry::new();
let _ = engine.plan(&registry, Graph::default());
Source

pub fn build_runtime_plan( &self, plan: &ExecutionPlan, ) -> Result<RuntimePlan, EngineError>

Construct a runtime plan from a planner plan using configured policies.

use daedalus_engine::{Engine, EngineConfig};
use daedalus_planner::{ExecutionPlan, Graph};
let engine = Engine::new(EngineConfig::default()).unwrap();
let plan = ExecutionPlan::new(Graph::default(), vec![]);
let _ = engine.build_runtime_plan(&plan);
Source

pub fn execute<H: NodeHandler + Send + Sync + 'static>( &self, runtime_plan: RuntimePlan, handler: H, ) -> Result<ExecutionTelemetry, EngineError>

Execute a runtime plan using the provided handler.

use daedalus_engine::{Engine, EngineConfig};
use daedalus_runtime::{RuntimePlan, RuntimeNode};
use daedalus_runtime::executor::NodeError;
use daedalus_planner::{ExecutionPlan, Graph};

let engine = Engine::new(EngineConfig::default()).unwrap();
let plan = RuntimePlan::from_execution(&ExecutionPlan::new(Graph::default(), vec![]));
let handler = |_node: &RuntimeNode,
              _ctx: &daedalus_runtime::state::ExecutionContext,
              _io: &mut daedalus_runtime::io::NodeIo|
       -> Result<(), NodeError> { Ok(()) };
let _ = engine.execute(plan, handler);
Source

pub fn execute_with_host<H: NodeHandler + Send + Sync + 'static>( &self, runtime_plan: RuntimePlan, host: HostBridgeManager, handler: H, ) -> Result<ExecutionTelemetry, EngineError>

Execute a runtime plan with host bridge support.

use daedalus_engine::{Engine, EngineConfig};
use daedalus_runtime::{HostBridgeManager, RuntimePlan, RuntimeNode};
use daedalus_runtime::executor::NodeError;
use daedalus_planner::{ExecutionPlan, Graph};

let engine = Engine::new(EngineConfig::default()).unwrap();
let plan = RuntimePlan::from_execution(&ExecutionPlan::new(Graph::default(), vec![]));
let host = HostBridgeManager::new();
let handler = |_node: &RuntimeNode,
              _ctx: &daedalus_runtime::state::ExecutionContext,
              _io: &mut daedalus_runtime::io::NodeIo|
       -> Result<(), NodeError> { Ok(()) };
let _ = engine.execute_with_host(plan, host, handler);
Source

pub fn run<H: NodeHandler + Send + Sync + 'static>( &self, registry: &Registry, graph: Graph, handler: H, ) -> Result<RunResult, EngineError>

Full run: load registry (if not provided), plan, and execute.

use daedalus_engine::{Engine, EngineConfig};
use daedalus_registry::store::Registry;
use daedalus_planner::Graph;
use daedalus_runtime::executor::NodeError;

let engine = Engine::new(EngineConfig::default()).unwrap();
let registry = Registry::new();
let handler = |_node: &daedalus_runtime::RuntimeNode,
              _ctx: &daedalus_runtime::state::ExecutionContext,
              _io: &mut daedalus_runtime::io::NodeIo|
       -> Result<(), NodeError> { Ok(()) };
let _ = engine.run(&registry, Graph::default(), handler);

Auto Trait Implementations§

§

impl Freeze for Engine

§

impl RefUnwindSafe for Engine

§

impl Send for Engine

§

impl Sync for Engine

§

impl Unpin for Engine

§

impl UnwindSafe for Engine

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.