feat(server): create stub for validating branch positions
Some checks failed
ci/woodpecker/push/docker Pipeline was successful
ci/woodpecker/push/release Pipeline was successful
ci/woodpecker/push/todo-check Pipeline was successful
ci/woodpecker/push/build Pipeline failed

This commit is contained in:
Paul Campbell 2024-04-09 15:31:59 +01:00
parent ca37045e3a
commit bdea942bcb
3 changed files with 19 additions and 4 deletions

View file

@ -0,0 +1,9 @@
pub(crate) async fn validate_positions(
_config: crate::server::config::RepoConfig,
_addr: actix::prelude::Addr<super::RepoActor>,
_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!()
}

View file

@ -1,3 +1,4 @@
mod branch;
mod config;
use actix::prelude::*;
@ -43,9 +44,14 @@ impl Handler<StartRepo> for RepoActor {
struct LoadedConfig(pub RepoConfig);
impl Handler<LoadedConfig> 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);
}
}

View file

@ -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,