diff --git a/src/server/actors/repo/branch.rs b/src/server/actors/repo/branch.rs new file mode 100644 index 00000000..14e06fb2 --- /dev/null +++ b/src/server/actors/repo/branch.rs @@ -0,0 +1,9 @@ +pub(crate) async fn validate_positions( + _config: crate::server::config::RepoConfig, + _addr: actix::prelude::Addr, + _net: kxio::network::Network, +) { + // TODO: validate repo - next is no more than one commit ahead of main + // TODO: validate repo - dev is same as or is ahead of next + todo!() +} diff --git a/src/server/actors/repo/mod.rs b/src/server/actors/repo/mod.rs index 84b4341a..07340817 100644 --- a/src/server/actors/repo/mod.rs +++ b/src/server/actors/repo/mod.rs @@ -1,3 +1,4 @@ +mod branch; mod config; use actix::prelude::*; @@ -43,9 +44,14 @@ impl Handler for RepoActor { struct LoadedConfig(pub RepoConfig); impl Handler for RepoActor { type Result = (); - fn handle(&mut self, msg: LoadedConfig, _ctx: &mut Self::Context) -> Self::Result { + fn handle(&mut self, msg: LoadedConfig, ctx: &mut Self::Context) -> Self::Result { let config = msg.0; info!(%self.details, %config, "Config loaded"); - self.config.replace(config); + self.config.replace(config.clone()); + let addr = ctx.address(); + let net = self.net.clone(); + branch::validate_positions(config, addr, net) + .into_actor(self) + .wait(ctx); } } diff --git a/src/server/config.rs b/src/server/config.rs index a3de9aa8..a8c99c51 100644 --- a/src/server/config.rs +++ b/src/server/config.rs @@ -25,7 +25,7 @@ impl ServerConfig { } } -#[derive(Debug, PartialEq, Eq, Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq, Deserialize)] pub struct RepoConfig { branches: RepoBranches, } @@ -44,7 +44,7 @@ impl Display for RepoConfig { write!(f, "{:?}", self.branches) } } -#[derive(Debug, PartialEq, Eq, Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq, Deserialize)] pub struct RepoBranches { main: String, next: String,