diff options
-rw-r--r-- | src/main.rs | 1 | ||||
-rw-r--r-- | src/orchestrator/mod.rs | 3 | ||||
-rw-r--r-- | src/orchestrator/orchestrator.rs | 50 |
3 files changed, 54 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 82cad0b..d5d57d1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,6 +24,7 @@ mod config; mod repository; mod filestore; mod ui; +mod orchestrator; use crate::config::*; use crate::repository::Repository; use crate::package::PackageName; diff --git a/src/orchestrator/mod.rs b/src/orchestrator/mod.rs new file mode 100644 index 0000000..3cff622 --- /dev/null +++ b/src/orchestrator/mod.rs @@ -0,0 +1,3 @@ +mod orchestrator; +pub use orchestrator::*; + diff --git a/src/orchestrator/orchestrator.rs b/src/orchestrator/orchestrator.rs new file mode 100644 index 0000000..a14cda4 --- /dev/null +++ b/src/orchestrator/orchestrator.rs @@ -0,0 +1,50 @@ +use std::path::PathBuf; +use std::sync::RwLock; +use std::sync::Arc; + +use anyhow::Result; +use typed_builder::TypedBuilder; + +use crate::endpoint::EndpointManagerConfiguration; +use crate::endpoint::EndpointScheduler; +use crate::job::JobSet; +use crate::job::RunnableJob; +use crate::log::LogItem; +use crate::filestore::StagingStore; +use crate::filestore::ReleaseStore; + +pub struct Orchestrator { + scheduler: EndpointScheduler, + staging_store: Arc<RwLock<StagingStore>>, + release_store: Arc<RwLock<ReleaseStore>>, + jobsets: Vec<JobSet>, +} + +#[derive(TypedBuilder)] +pub struct OrchestratorSetup { + ep_cfg: Vec<EndpointManagerConfiguration>, + staging_store: Arc<RwLock<StagingStore>>, + release_store: Arc<RwLock<ReleaseStore>>, + jobsets: Vec<JobSet>, +} + +impl OrchestratorSetup { + pub async fn setup(self) -> Result<Orchestrator> { + let scheduler = EndpointScheduler::setup(self.ep_cfg, self.staging_store.clone()).await?; + + Ok(Orchestrator { + scheduler: scheduler, + staging_store: self.staging_store, + release_store: self.release_store, + jobsets: self.jobsets, + }) + } +} + +impl Orchestrator { + + pub async fn run(self) -> Result<()> { + unimplemented!() + } + +} |