rust_logic_graph/orchestrator/
mod.rs1use anyhow::Result;
2use tracing::info;
3
4use crate::core::{Executor, Graph};
5
6pub struct Orchestrator {
7 executor: Executor,
8}
9
10impl Orchestrator {
11 pub fn new(executor: Executor) -> Self {
13 Self { executor }
14 }
15
16 pub async fn execute(&mut self, graph: &mut Graph) -> Result<()> {
18 info!("Orchestrator: Starting orchestration...");
19 self.executor.execute(graph).await?;
20 info!("Orchestrator: Orchestration completed");
21 Ok(())
22 }
23
24 pub async fn execute_graph(graph: &mut Graph) -> Result<()> {
26 info!("Orchestrator: Building executor from graph definition");
27 let executor = Executor::from_graph_def(&graph.def)?;
28 let mut orchestrator = Self::new(executor);
29 orchestrator.execute(graph).await
30 }
31}
32
33impl Default for Orchestrator {
34 fn default() -> Self {
35 Self::new(Executor::default())
36 }
37}