forked from kemitix/git-next
feat(server): create stub for validating branch positions
This commit is contained in:
parent
ca37045e3a
commit
bdea942bcb
3 changed files with 19 additions and 4 deletions
9
src/server/actors/repo/branch.rs
Normal file
9
src/server/actors/repo/branch.rs
Normal 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!()
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
mod branch;
|
||||||
mod config;
|
mod config;
|
||||||
|
|
||||||
use actix::prelude::*;
|
use actix::prelude::*;
|
||||||
|
@ -43,9 +44,14 @@ impl Handler<StartRepo> for RepoActor {
|
||||||
struct LoadedConfig(pub RepoConfig);
|
struct LoadedConfig(pub RepoConfig);
|
||||||
impl Handler<LoadedConfig> for RepoActor {
|
impl Handler<LoadedConfig> for RepoActor {
|
||||||
type Result = ();
|
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;
|
let config = msg.0;
|
||||||
info!(%self.details, %config, "Config loaded");
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl ServerConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, Deserialize)]
|
||||||
pub struct RepoConfig {
|
pub struct RepoConfig {
|
||||||
branches: RepoBranches,
|
branches: RepoBranches,
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ impl Display for RepoConfig {
|
||||||
write!(f, "{:?}", self.branches)
|
write!(f, "{:?}", self.branches)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[derive(Debug, PartialEq, Eq, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Eq, Deserialize)]
|
||||||
pub struct RepoBranches {
|
pub struct RepoBranches {
|
||||||
main: String,
|
main: String,
|
||||||
next: String,
|
next: String,
|
||||||
|
|
Loading…
Reference in a new issue