Bind prepared artifact selection against reclaim
This commit is contained in:
parent
d799cf4837
commit
1bd1d395d9
1 changed files with 209 additions and 21 deletions
|
|
@ -11,6 +11,7 @@ use lazaret_core::records::{
|
|||
Generation, GenerationIdentity, Participant, ParticipantOwnership, ParticipantRole,
|
||||
ParticipantState, PreparedArtifact,
|
||||
};
|
||||
use lazaret_linux::filesystem::SharedFileLock;
|
||||
use lazaret_linux::process::{ProcessOwnershipContext, current_process_identity};
|
||||
use lazaret_runtime_supervisor::sandbox::SandboxBundle;
|
||||
use lazaret_runtime_supervisor::supervision::RuntimeSupervisorLaunch;
|
||||
|
|
@ -65,6 +66,7 @@ pub struct BootstrapPlan<'a> {
|
|||
pub configuration: &'a ResolvedDomainConfiguration,
|
||||
pub generation_identity: GenerationIdentity,
|
||||
pub prepared_artifact: &'a PreparedArtifact,
|
||||
pub prepared_artifact_selection: Option<SharedFileLock>,
|
||||
pub state_anchor_layout: &'a StateAnchorLayout<'a>,
|
||||
pub runtime_launch: RuntimeSupervisorLaunch,
|
||||
pub sandbox_bundle: &'a SandboxBundle,
|
||||
|
|
@ -281,15 +283,21 @@ impl<'a> CoordinatorLifecycleAdapter<'a> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn lease_prepared_lower(&self) -> Result<(), LifecycleServiceError> {
|
||||
fn lease_prepared_lower(&mut self) -> Result<(), LifecycleServiceError> {
|
||||
self.state_anchor()
|
||||
.begin_acquisition(
|
||||
self.plan.generation_identity.generation_id,
|
||||
self.plan.prepared_artifact,
|
||||
self.plan.state_anchor_layout,
|
||||
)
|
||||
.map(|_| ())
|
||||
.map_err(failure)
|
||||
.map_err(failure)?;
|
||||
drop(
|
||||
self.plan
|
||||
.prepared_artifact_selection
|
||||
.take()
|
||||
.ok_or_else(|| LifecycleServiceError("prepared artifact claim is absent".into()))?,
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn mount_state_anchor(&mut self) -> Result<(), LifecycleServiceError> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue