assemble_core/startup/
execution_graph.rs1use crate::project::requests::TaskRequests;
2use crate::task::{FullTask, TaskOrderingKind};
3use parking_lot::RwLock;
4use petgraph::graph::DiGraph;
5use std::sync::Arc;
6
7#[derive(Debug, Clone)]
15pub struct ExecutionGraph {
16 graph: Arc<RwLock<DiGraph<SharedAnyTask, TaskOrderingKind>>>,
18 requested_tasks: Arc<TaskRequests>,
20}
21
22impl ExecutionGraph {
23 pub fn new(
24 graph: DiGraph<SharedAnyTask, TaskOrderingKind>,
25 requested_tasks: TaskRequests,
26 ) -> Self {
27 Self {
28 graph: Arc::new(RwLock::new(graph)),
29 requested_tasks: Arc::new(requested_tasks),
30 }
31 }
32 pub fn requested_tasks(&self) -> &Arc<TaskRequests> {
33 &self.requested_tasks
34 }
35 pub fn graph(&self) -> &Arc<RwLock<DiGraph<SharedAnyTask, TaskOrderingKind>>> {
36 &self.graph
37 }
38}
39
40pub type SharedAnyTask = Arc<RwLock<Box<dyn FullTask>>>;