Integrate routed Git workspaces with persistent state
This commit is contained in:
parent
943c56eea8
commit
917409fcc6
1 changed files with 2363 additions and 119 deletions
|
|
@ -4,7 +4,7 @@ use std::sync::Arc;
|
|||
use std::sync::Mutex;
|
||||
|
||||
use lazaret_core::configuration::ResolvedDomainConfiguration;
|
||||
use lazaret_core::identity::{BundleDigest, ContainerId, MountIdentity};
|
||||
use lazaret_core::identity::{BundleDigest, ContainerId, HostPath, MountIdentity};
|
||||
use lazaret_core::network::{CanonicalDerivedNetworkPolicy, ReachabilityExpectation};
|
||||
use lazaret_core::records::Session;
|
||||
use lazaret_core::records::{
|
||||
|
|
@ -24,6 +24,7 @@ use crate::control::{
|
|||
SessionRegistry, StagedControlFace, TrustAnchor,
|
||||
};
|
||||
use crate::domain_store::{DomainStoreMutation, HostCoordinatorDomainStore};
|
||||
use crate::git_routing::GitRoutingCoordinator;
|
||||
use crate::lifecycle::{
|
||||
HostCoordinatorLifecycle, LifecycleAction, LifecycleAdapter, SessionAdmissionIdentity,
|
||||
SessionLifecycleAdapter,
|
||||
|
|
@ -77,6 +78,13 @@ pub struct ProductionBootstrapPlan<'a> {
|
|||
pub interactive_executor: Arc<dyn InteractiveSessionExecutor>,
|
||||
pub prompt_transport: Arc<SessionPromptTransport>,
|
||||
pub(crate) runtime_staging: &'a crate::production::RuntimeStaging,
|
||||
pub git_routing: Option<ProductionGitRouting>,
|
||||
}
|
||||
|
||||
pub struct ProductionGitRouting {
|
||||
pub mountpoint: HostPath,
|
||||
pub host_root: HostPath,
|
||||
pub isolated_root: HostPath,
|
||||
}
|
||||
|
||||
pub struct ProductionLifecycleAdapter<'a> {
|
||||
|
|
@ -88,6 +96,7 @@ pub struct ProductionLifecycleAdapter<'a> {
|
|||
awaiting_runtime: Option<AwaitingAttachedRunsc>,
|
||||
runtime: Option<CommittedSandboxRuntime>,
|
||||
state_anchor_mount: Option<MountIdentity>,
|
||||
git_routing_mount: Option<MountIdentity>,
|
||||
state_anchor_release: Option<StateAnchorReleaseAuthority>,
|
||||
state_anchor_absence: Option<StateAnchorAbsenceObservation>,
|
||||
}
|
||||
|
|
@ -184,6 +193,7 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
awaiting_runtime: None,
|
||||
runtime: None,
|
||||
state_anchor_mount: None,
|
||||
git_routing_mount: None,
|
||||
state_anchor_release: None,
|
||||
state_anchor_absence: None,
|
||||
},
|
||||
|
|
@ -286,6 +296,24 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
)
|
||||
.map_err(|error| failure(format!("mounting State Anchor: {error}")))?;
|
||||
self.state_anchor_mount = Some(mount);
|
||||
if let Some(routing) = &self.plan.git_routing {
|
||||
let git_routing = GitRoutingCoordinator::new(&store);
|
||||
git_routing
|
||||
.begin_intent(
|
||||
self.plan.generation_identity.generation_id,
|
||||
routing.mountpoint.clone(),
|
||||
routing.host_root.clone(),
|
||||
routing.isolated_root.clone(),
|
||||
)
|
||||
.map_err(failure)?;
|
||||
let git_mount = self
|
||||
.awaiting_runtime
|
||||
.as_mut()
|
||||
.ok_or_else(|| ProductionLifecycleError("Runtime Supervisor is absent".into()))?
|
||||
.start_git_routing(&git_routing)
|
||||
.map_err(|error| failure(format!("starting Git routing: {error}")))?;
|
||||
self.git_routing_mount = Some(git_mount);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -465,6 +493,15 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
.ok_or_else(|| ProductionLifecycleError("committed runtime is absent".into()))?
|
||||
.stop_sandbox(&sandbox)
|
||||
.map_err(failure)?;
|
||||
if self.plan.git_routing.is_some() {
|
||||
let git_routing = GitRoutingCoordinator::new(&store);
|
||||
self.runtime
|
||||
.as_mut()
|
||||
.ok_or_else(|| ProductionLifecycleError("committed runtime is absent".into()))?
|
||||
.stop_git_routing(&git_routing)
|
||||
.map_err(failure)?;
|
||||
self.git_routing_mount = None;
|
||||
}
|
||||
self.plan.runtime_staging.cleanup_overlay().map_err(failure)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue