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
impl Engine
Sourcepub fn new(config: EngineConfig) -> Result<Self, EngineError>
pub fn new(config: EngineConfig) -> Result<Self, EngineError>
Create a new engine from configuration.
Sourcepub fn config(&self) -> &EngineConfig
pub fn config(&self) -> &EngineConfig
Return a reference to the engine config.
Sourcepub fn plan(
&self,
registry: &Registry,
graph: Graph,
) -> Result<PlannerOutput, EngineError>
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(®istry, Graph::default());Sourcepub fn build_runtime_plan(
&self,
plan: &ExecutionPlan,
) -> Result<RuntimePlan, EngineError>
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);Sourcepub fn execute<H: NodeHandler + Send + Sync + 'static>(
&self,
runtime_plan: RuntimePlan,
handler: H,
) -> Result<ExecutionTelemetry, EngineError>
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);Sourcepub fn execute_with_host<H: NodeHandler + Send + Sync + 'static>(
&self,
runtime_plan: RuntimePlan,
host: HostBridgeManager,
handler: H,
) -> Result<ExecutionTelemetry, EngineError>
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);Sourcepub fn run<H: NodeHandler + Send + Sync + 'static>(
&self,
registry: &Registry,
graph: Graph,
handler: H,
) -> Result<RunResult, EngineError>
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(®istry, 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 UnsafeUnpin for Engine
impl UnwindSafe for Engine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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