alpha_core_framework/
pipeline.rs1use std::sync::Arc;
2use tokio::sync::RwLock;
3
4pub struct Orchestrator {
6 pub name: String,
7 pub tasks: Arc<RwLock<Vec<String>>>,
8}
9
10impl Orchestrator {
11 pub fn new(name: &str) -> Self {
12 Self {
13 name: name.to_string(),
14 tasks: Arc::new(RwLock::new(Vec::new())),
15 }
16 }
17
18 pub async fn add_task(&self, task_name: &str) {
19 let mut tasks = self.tasks.write().await;
20 tasks.push(task_name.to_string());
21 println!("Task '{}' added to pipeline '{}'", task_name, self.name);
22 }
23
24 pub async fn run(&self) {
25 let tasks = self.tasks.read().await;
26 println!("Starting execution of {} tasks...", tasks.len());
27 for task in tasks.iter() {
28 println!("Running: {}", task);
29 }
30 }
31}