diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2020-11-02 15:23:00 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2020-11-04 13:58:56 +0100 |
commit | 877a1022ce24f315761e0913131d46da4d36c2ab (patch) | |
tree | ffce42b186d5a6a5c220e1cdb70d39aedba8f16e | |
parent | 33eee91b3ed7858aab6129e396ac905c238e04a3 (diff) |
Add module for Orchestrator
-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!() + } + +} |