Remove phase vocabulary from Lazaret interfaces
This commit is contained in:
parent
3f9b1b3543
commit
e7dd95aea6
1 changed files with 547 additions and 579 deletions
|
|
@ -25,9 +25,7 @@ use crate::control::{
|
|||
TrustAnchor,
|
||||
};
|
||||
use crate::domain_store::{DomainStoreMutation, HostCoordinatorDomainStore};
|
||||
use crate::escalation::{
|
||||
ProductionEscalation, ProductionEscalationHandle, ProductionEscalationInputs,
|
||||
};
|
||||
use crate::escalation::{EscalationService, EscalationServiceHandle, EscalationServiceInputs};
|
||||
use crate::git_routing::GitRoutingCoordinator;
|
||||
use crate::lifecycle::{
|
||||
HostCoordinatorLifecycle, LifecycleAction, LifecycleAdapter, SessionAdmissionIdentity,
|
||||
|
|
@ -42,27 +40,27 @@ use crate::state_anchor::{StateAnchorCoordinator, StateAnchorReleaseAuthority};
|
|||
use crate::terminal::SessionPromptTransport;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ProductionLifecycleError(String);
|
||||
pub struct LifecycleServiceError(String);
|
||||
|
||||
impl fmt::Display for ProductionLifecycleError {
|
||||
impl fmt::Display for LifecycleServiceError {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
formatter.write_str(&self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for ProductionLifecycleError {}
|
||||
impl std::error::Error for LifecycleServiceError {}
|
||||
|
||||
impl ProductionLifecycleError {
|
||||
impl LifecycleServiceError {
|
||||
pub(crate) fn service(error: impl fmt::Display) -> Self {
|
||||
Self(error.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
fn failure(error: impl fmt::Display) -> ProductionLifecycleError {
|
||||
ProductionLifecycleError(error.to_string())
|
||||
fn failure(error: impl fmt::Display) -> LifecycleServiceError {
|
||||
LifecycleServiceError(error.to_string())
|
||||
}
|
||||
|
||||
pub struct ProductionBootstrapPlan<'a> {
|
||||
pub struct BootstrapPlan<'a> {
|
||||
pub store: Arc<HostCoordinatorDomainStore>,
|
||||
pub catalog: &'a Catalog,
|
||||
pub configuration: &'a ResolvedDomainConfiguration,
|
||||
|
|
@ -81,24 +79,24 @@ pub struct ProductionBootstrapPlan<'a> {
|
|||
pub non_interactive_executor: Arc<dyn NonInteractiveSessionExecutor>,
|
||||
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(crate) runtime_staging: &'a crate::cold_start::RuntimeStaging,
|
||||
pub git_routing: Option<BootstrapGitRouting>,
|
||||
}
|
||||
|
||||
pub struct ProductionGitRouting {
|
||||
pub struct BootstrapGitRouting {
|
||||
pub mountpoint: HostPath,
|
||||
pub host_root: HostPath,
|
||||
pub isolated_root: HostPath,
|
||||
}
|
||||
|
||||
pub struct ProductionLifecycleAdapter<'a> {
|
||||
plan: ProductionBootstrapPlan<'a>,
|
||||
pub struct CoordinatorLifecycleAdapter<'a> {
|
||||
plan: BootstrapPlan<'a>,
|
||||
registry: Arc<SessionRegistry>,
|
||||
trust_anchor: Option<TrustAnchor>,
|
||||
staged_control: Option<StagedControlFace>,
|
||||
published_control: Option<Arc<PublishedControlFace>>,
|
||||
escalation: Option<ProductionEscalation<'a>>,
|
||||
escalation_handle: Option<ProductionEscalationHandle>,
|
||||
escalation: Option<EscalationService<'a>>,
|
||||
escalation_handle: Option<EscalationServiceHandle>,
|
||||
awaiting_runtime: Option<AwaitingAttachedRunsc>,
|
||||
runtime: Option<CommittedSandboxRuntime>,
|
||||
state_anchor_mount: Option<MountIdentity>,
|
||||
|
|
@ -107,43 +105,43 @@ pub struct ProductionLifecycleAdapter<'a> {
|
|||
state_anchor_absence: Option<StateAnchorAbsenceObservation>,
|
||||
}
|
||||
|
||||
pub type ProductionHostCoordinatorLifecycle<'store, 'resources> = HostCoordinatorLifecycle<
|
||||
pub type CoordinatorLifecycle<'store, 'resources> = HostCoordinatorLifecycle<
|
||||
'store,
|
||||
ProductionLifecycleAdapter<'resources>,
|
||||
ProductionSessionRegistry,
|
||||
CoordinatorLifecycleAdapter<'resources>,
|
||||
CoordinatorSessionRegistry,
|
||||
>;
|
||||
|
||||
/// Composes the cold-start lifecycle with the exact shared production session registry.
|
||||
/// Composes the cold-start lifecycle with the exact shared session registry.
|
||||
///
|
||||
/// # Errors
|
||||
/// Refuses a plan whose Domain Store is not the caller-retained lock-owning store.
|
||||
pub fn production_lifecycle<'store, 'resources>(
|
||||
pub fn coordinator_lifecycle<'store, 'resources>(
|
||||
store: &'store Arc<HostCoordinatorDomainStore>,
|
||||
plan: ProductionBootstrapPlan<'resources>,
|
||||
) -> Result<ProductionHostCoordinatorLifecycle<'store, 'resources>, ProductionLifecycleError> {
|
||||
plan: BootstrapPlan<'resources>,
|
||||
) -> Result<CoordinatorLifecycle<'store, 'resources>, LifecycleServiceError> {
|
||||
if !Arc::ptr_eq(store, &plan.store) {
|
||||
return Err(ProductionLifecycleError(
|
||||
"production bootstrap Domain Store authority differs".into(),
|
||||
return Err(LifecycleServiceError(
|
||||
"bootstrap Domain Store authority differs".into(),
|
||||
));
|
||||
}
|
||||
let (adapter, registry) = ProductionLifecycleAdapter::new(plan);
|
||||
let (adapter, registry) = CoordinatorLifecycleAdapter::new(plan);
|
||||
Ok(HostCoordinatorLifecycle::new(store, adapter, registry))
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ProductionSessionRegistry {
|
||||
pub struct CoordinatorSessionRegistry {
|
||||
registry: Arc<SessionRegistry>,
|
||||
}
|
||||
|
||||
impl ProductionSessionRegistry {
|
||||
impl CoordinatorSessionRegistry {
|
||||
#[must_use]
|
||||
pub fn registry(&self) -> Arc<SessionRegistry> {
|
||||
Arc::clone(&self.registry)
|
||||
}
|
||||
}
|
||||
|
||||
impl SessionLifecycleAdapter for ProductionSessionRegistry {
|
||||
type Error = ProductionLifecycleError;
|
||||
impl SessionLifecycleAdapter for CoordinatorSessionRegistry {
|
||||
type Error = LifecycleServiceError;
|
||||
type Admission = ControlSessionAdmission;
|
||||
|
||||
fn admission_identity(&self, admission: &Self::Admission) -> SessionAdmissionIdentity {
|
||||
|
|
@ -182,9 +180,9 @@ impl SessionLifecycleAdapter for ProductionSessionRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> ProductionLifecycleAdapter<'a> {
|
||||
impl<'a> CoordinatorLifecycleAdapter<'a> {
|
||||
#[must_use]
|
||||
pub fn new(plan: ProductionBootstrapPlan<'a>) -> (Self, ProductionSessionRegistry) {
|
||||
pub fn new(plan: BootstrapPlan<'a>) -> (Self, CoordinatorSessionRegistry) {
|
||||
let registry = Arc::new(SessionRegistry::new(
|
||||
Arc::clone(&plan.store),
|
||||
plan.generation_identity.clone(),
|
||||
|
|
@ -205,7 +203,7 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
state_anchor_release: None,
|
||||
state_anchor_absence: None,
|
||||
},
|
||||
ProductionSessionRegistry { registry },
|
||||
CoordinatorSessionRegistry { registry },
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -216,11 +214,11 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
|
||||
pub(crate) fn take_escalation(
|
||||
&mut self,
|
||||
) -> Option<(ProductionEscalation<'a>, ProductionEscalationHandle)> {
|
||||
) -> Option<(EscalationService<'a>, EscalationServiceHandle)> {
|
||||
Some((self.escalation.take()?, self.escalation_handle.take()?))
|
||||
}
|
||||
|
||||
fn require_generation(&self, generation: &Generation) -> Result<(), ProductionLifecycleError> {
|
||||
fn require_generation(&self, generation: &Generation) -> Result<(), LifecycleServiceError> {
|
||||
if generation.domain_id == self.plan.generation_identity.domain_id
|
||||
&& generation.generation_id == self.plan.generation_identity.generation_id
|
||||
&& generation.configuration_fingerprint
|
||||
|
|
@ -230,8 +228,8 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
{
|
||||
Ok(())
|
||||
} else {
|
||||
Err(ProductionLifecycleError(
|
||||
"production bootstrap generation identity changed".into(),
|
||||
Err(LifecycleServiceError(
|
||||
"bootstrap generation identity changed".into(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
@ -252,18 +250,16 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
StateAnchorCoordinator::new(self.store(), self.plan.catalog)
|
||||
}
|
||||
|
||||
fn create_trust_anchor(&mut self) -> Result<(), ProductionLifecycleError> {
|
||||
fn create_trust_anchor(&mut self) -> Result<(), LifecycleServiceError> {
|
||||
if self.trust_anchor.is_some() {
|
||||
return Err(ProductionLifecycleError(
|
||||
"Trust Anchor already exists".into(),
|
||||
));
|
||||
return Err(LifecycleServiceError("Trust Anchor already exists".into()));
|
||||
}
|
||||
self.trust_anchor =
|
||||
Some(TrustAnchor::create(self.plan.generation_identity.clone()).map_err(failure)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn start_runtime_supervisor(&mut self) -> Result<(), ProductionLifecycleError> {
|
||||
fn start_runtime_supervisor(&mut self) -> Result<(), LifecycleServiceError> {
|
||||
let sandbox = self.sandbox();
|
||||
sandbox
|
||||
.begin_intent(
|
||||
|
|
@ -286,7 +282,7 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn lease_prepared_lower(&self) -> Result<(), ProductionLifecycleError> {
|
||||
fn lease_prepared_lower(&self) -> Result<(), LifecycleServiceError> {
|
||||
self.state_anchor()
|
||||
.begin_acquisition(
|
||||
self.plan.generation_identity.generation_id,
|
||||
|
|
@ -297,13 +293,13 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
.map_err(failure)
|
||||
}
|
||||
|
||||
fn mount_state_anchor(&mut self) -> Result<(), ProductionLifecycleError> {
|
||||
fn mount_state_anchor(&mut self) -> Result<(), LifecycleServiceError> {
|
||||
let store = Arc::clone(&self.plan.store);
|
||||
let coordinator = StateAnchorCoordinator::new(&store, self.plan.catalog);
|
||||
let mount = self
|
||||
.awaiting_runtime
|
||||
.as_mut()
|
||||
.ok_or_else(|| ProductionLifecycleError("Runtime Supervisor is absent".into()))?
|
||||
.ok_or_else(|| LifecycleServiceError("Runtime Supervisor is absent".into()))?
|
||||
.mount_state_anchor(
|
||||
&coordinator,
|
||||
self.plan.prepared_artifact.prepared_artifact_id,
|
||||
|
|
@ -323,7 +319,7 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
let git_mount = self
|
||||
.awaiting_runtime
|
||||
.as_mut()
|
||||
.ok_or_else(|| ProductionLifecycleError("Runtime Supervisor is absent".into()))?
|
||||
.ok_or_else(|| LifecycleServiceError("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);
|
||||
|
|
@ -331,32 +327,32 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn start_connectivity_helper(&mut self) -> Result<(), ProductionLifecycleError> {
|
||||
fn start_connectivity_helper(&mut self) -> Result<(), LifecycleServiceError> {
|
||||
let store = Arc::clone(&self.plan.store);
|
||||
let network = NetworkCoordinator::new(&store);
|
||||
self.awaiting_runtime
|
||||
.as_mut()
|
||||
.ok_or_else(|| ProductionLifecycleError("Runtime Supervisor is absent".into()))?
|
||||
.ok_or_else(|| LifecycleServiceError("Runtime Supervisor is absent".into()))?
|
||||
.receive_helper_staged(&network)
|
||||
.map(|_| ())
|
||||
.map_err(|error| failure(format!("starting connectivity helper: {error}")))
|
||||
}
|
||||
|
||||
fn start_sidecar(&mut self) -> Result<(), ProductionLifecycleError> {
|
||||
fn start_sidecar(&mut self) -> Result<(), LifecycleServiceError> {
|
||||
self.awaiting_runtime
|
||||
.as_mut()
|
||||
.ok_or_else(|| ProductionLifecycleError("Runtime Supervisor is absent".into()))?
|
||||
.ok_or_else(|| LifecycleServiceError("Runtime Supervisor is absent".into()))?
|
||||
.start_sidecar()
|
||||
.map_err(|error| failure(format!("starting sidecar: {error}")))
|
||||
}
|
||||
|
||||
fn mark_network_ready(&mut self) -> Result<(), ProductionLifecycleError> {
|
||||
fn mark_network_ready(&mut self) -> Result<(), LifecycleServiceError> {
|
||||
let store = Arc::clone(&self.plan.store);
|
||||
let network = NetworkCoordinator::new(&store);
|
||||
let mut probe = self.plan.network_probe.clone();
|
||||
self.awaiting_runtime
|
||||
.as_mut()
|
||||
.ok_or_else(|| ProductionLifecycleError("Runtime Supervisor is absent".into()))?
|
||||
.ok_or_else(|| LifecycleServiceError("Runtime Supervisor is absent".into()))?
|
||||
.receive_network_readiness(
|
||||
&network,
|
||||
self.plan.network_policy,
|
||||
|
|
@ -370,13 +366,13 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
.map_err(|error| failure(format!("marking network ready: {error}")))
|
||||
}
|
||||
|
||||
fn start_sandbox(&mut self) -> Result<(), ProductionLifecycleError> {
|
||||
fn start_sandbox(&mut self) -> Result<(), LifecycleServiceError> {
|
||||
let store = Arc::clone(&self.plan.store);
|
||||
let sandbox = SandboxCoordinator::new(&store);
|
||||
let mut pending = self
|
||||
.awaiting_runtime
|
||||
.take()
|
||||
.ok_or_else(|| ProductionLifecycleError("Runtime Supervisor is absent".into()))?;
|
||||
.ok_or_else(|| LifecycleServiceError("Runtime Supervisor is absent".into()))?;
|
||||
let staged = pending
|
||||
.receive_staged(&sandbox)
|
||||
.map_err(|error| failure(format!("receiving attached runsc staging: {error}")))?;
|
||||
|
|
@ -394,11 +390,11 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn stage_publication(&mut self) -> Result<(), ProductionLifecycleError> {
|
||||
fn stage_publication(&mut self) -> Result<(), LifecycleServiceError> {
|
||||
let mut anchor = self
|
||||
.trust_anchor
|
||||
.take()
|
||||
.ok_or_else(|| ProductionLifecycleError("Trust Anchor is absent".into()))?;
|
||||
.ok_or_else(|| LifecycleServiceError("Trust Anchor is absent".into()))?;
|
||||
if self
|
||||
.plan
|
||||
.configuration
|
||||
|
|
@ -421,7 +417,7 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
lazaret_core::identity::RequestId::new([0; 32]),
|
||||
),
|
||||
};
|
||||
let (escalation, handle) = ProductionEscalation::new(ProductionEscalationInputs {
|
||||
let (escalation, handle) = EscalationService::new(EscalationServiceInputs {
|
||||
configuration: self.plan.configuration,
|
||||
publication,
|
||||
credentials,
|
||||
|
|
@ -476,11 +472,11 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn expose_publication(&mut self) -> Result<(), ProductionLifecycleError> {
|
||||
fn expose_publication(&mut self) -> Result<(), LifecycleServiceError> {
|
||||
let published = self
|
||||
.staged_control
|
||||
.take()
|
||||
.ok_or_else(|| ProductionLifecycleError("staged control face is absent".into()))?
|
||||
.ok_or_else(|| LifecycleServiceError("staged control face is absent".into()))?
|
||||
.expose()
|
||||
.map_err(failure)?;
|
||||
let ownership = published.recovery_ownership().map_err(failure)?;
|
||||
|
|
@ -500,7 +496,7 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn clean_publication_after_withdrawal(&self) -> Result<(), ProductionLifecycleError> {
|
||||
fn clean_publication_after_withdrawal(&self) -> Result<(), LifecycleServiceError> {
|
||||
let generation_id = self.plan.generation_identity.generation_id;
|
||||
let current = self
|
||||
.plan
|
||||
|
|
@ -513,7 +509,7 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
participant.generation_id() == generation_id
|
||||
&& participant.role() == ParticipantRole::Publication
|
||||
})
|
||||
.ok_or_else(|| ProductionLifecycleError("Publication participant is absent".into()))?;
|
||||
.ok_or_else(|| LifecycleServiceError("Publication participant is absent".into()))?;
|
||||
let release = Participant::snapshot(
|
||||
generation_id,
|
||||
ParticipantRole::Publication,
|
||||
|
|
@ -537,19 +533,19 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
.map_err(failure)
|
||||
}
|
||||
|
||||
fn stop_sandbox(&mut self) -> Result<(), ProductionLifecycleError> {
|
||||
fn stop_sandbox(&mut self) -> Result<(), LifecycleServiceError> {
|
||||
let store = Arc::clone(&self.plan.store);
|
||||
let sandbox = SandboxCoordinator::new(&store);
|
||||
self.runtime
|
||||
.as_mut()
|
||||
.ok_or_else(|| ProductionLifecycleError("committed runtime is absent".into()))?
|
||||
.ok_or_else(|| LifecycleServiceError("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()))?
|
||||
.ok_or_else(|| LifecycleServiceError("committed runtime is absent".into()))?
|
||||
.stop_git_routing(&git_routing)
|
||||
.map_err(failure)?;
|
||||
self.git_routing_mount = None;
|
||||
|
|
@ -557,7 +553,7 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
self.plan.runtime_staging.cleanup_overlay().map_err(failure)
|
||||
}
|
||||
|
||||
fn stop_sidecar(&mut self) -> Result<(), ProductionLifecycleError> {
|
||||
fn stop_sidecar(&mut self) -> Result<(), LifecycleServiceError> {
|
||||
let store = Arc::clone(&self.plan.store);
|
||||
let network = NetworkCoordinator::new(&store);
|
||||
network
|
||||
|
|
@ -565,7 +561,7 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
.map_err(failure)?;
|
||||
self.runtime
|
||||
.as_mut()
|
||||
.ok_or_else(|| ProductionLifecycleError("committed runtime is absent".into()))?
|
||||
.ok_or_else(|| LifecycleServiceError("committed runtime is absent".into()))?
|
||||
.stop_sidecar()
|
||||
.map_err(failure)?;
|
||||
network
|
||||
|
|
@ -573,7 +569,7 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
.map_err(failure)
|
||||
}
|
||||
|
||||
fn unmount_state_anchor(&mut self) -> Result<(), ProductionLifecycleError> {
|
||||
fn unmount_state_anchor(&mut self) -> Result<(), LifecycleServiceError> {
|
||||
let coordinator = self.state_anchor();
|
||||
self.state_anchor_release = Some(
|
||||
coordinator
|
||||
|
|
@ -586,11 +582,11 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
let runtime = self
|
||||
.runtime
|
||||
.as_mut()
|
||||
.ok_or_else(|| ProductionLifecycleError("committed runtime is absent".into()))?;
|
||||
.ok_or_else(|| LifecycleServiceError("committed runtime is absent".into()))?;
|
||||
let release = self
|
||||
.state_anchor_release
|
||||
.as_ref()
|
||||
.ok_or_else(|| ProductionLifecycleError("State Anchor release is absent".into()))?;
|
||||
.ok_or_else(|| LifecycleServiceError("State Anchor release is absent".into()))?;
|
||||
runtime
|
||||
.unmount_state_anchor(release.mount())
|
||||
.map_err(failure)?;
|
||||
|
|
@ -607,18 +603,18 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn release_prepared_lower(&mut self) -> Result<(), ProductionLifecycleError> {
|
||||
fn release_prepared_lower(&mut self) -> Result<(), LifecycleServiceError> {
|
||||
let release = self
|
||||
.state_anchor_release
|
||||
.as_ref()
|
||||
.ok_or_else(|| ProductionLifecycleError("State Anchor release is absent".into()))?;
|
||||
.ok_or_else(|| LifecycleServiceError("State Anchor release is absent".into()))?;
|
||||
let first_observation = self.state_anchor_absence.ok_or_else(|| {
|
||||
ProductionLifecycleError("State Anchor absence evidence is absent".into())
|
||||
LifecycleServiceError("State Anchor absence evidence is absent".into())
|
||||
})?;
|
||||
let runtime = self
|
||||
.runtime
|
||||
.as_mut()
|
||||
.ok_or_else(|| ProductionLifecycleError("committed runtime is absent".into()))?;
|
||||
.ok_or_else(|| LifecycleServiceError("committed runtime is absent".into()))?;
|
||||
let coordinator = StateAnchorCoordinator::new(&self.plan.store, self.plan.catalog);
|
||||
coordinator
|
||||
.complete_release_after_unmount(
|
||||
|
|
@ -650,17 +646,17 @@ impl<'a> ProductionLifecycleAdapter<'a> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn graceful_exit(&mut self) -> Result<(), ProductionLifecycleError> {
|
||||
fn graceful_exit(&mut self) -> Result<(), LifecycleServiceError> {
|
||||
self.runtime
|
||||
.take()
|
||||
.ok_or_else(|| ProductionLifecycleError("committed runtime is absent".into()))?
|
||||
.ok_or_else(|| LifecycleServiceError("committed runtime is absent".into()))?
|
||||
.graceful_exit()
|
||||
.map_err(failure)
|
||||
}
|
||||
}
|
||||
|
||||
impl LifecycleAdapter for ProductionLifecycleAdapter<'_> {
|
||||
type Error = ProductionLifecycleError;
|
||||
impl LifecycleAdapter for CoordinatorLifecycleAdapter<'_> {
|
||||
type Error = LifecycleServiceError;
|
||||
|
||||
fn execute(
|
||||
&mut self,
|
||||
|
|
@ -721,13 +717,11 @@ impl LifecycleAdapter for ProductionLifecycleAdapter<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Serves one production control connection through the exact retained lifecycle owner.
|
||||
/// Serves one control connection through the exact retained lifecycle owner.
|
||||
///
|
||||
/// # Errors
|
||||
/// Refuses absent publication, poisoned lifecycle ownership, or control/session failure.
|
||||
pub fn serve_production_control(
|
||||
lifecycle: &Mutex<ProductionHostCoordinatorLifecycle<'_, '_>>,
|
||||
) -> Result<(), ControlError> {
|
||||
pub fn serve_control(lifecycle: &Mutex<CoordinatorLifecycle<'_, '_>>) -> Result<(), ControlError> {
|
||||
let face = lifecycle
|
||||
.lock()
|
||||
.map_err(|_| ControlError::LockPoisoned)?
|
||||
|
|
@ -735,22 +729,22 @@ pub fn serve_production_control(
|
|||
.published_control()
|
||||
.ok_or(ControlError::StaleGeneration)?;
|
||||
let connection = face.accept_connection()?;
|
||||
serve_production_control_connection(lifecycle, &face, connection)
|
||||
serve_control_connection(lifecycle, &face, connection)
|
||||
}
|
||||
|
||||
pub(crate) fn serve_production_control_connection(
|
||||
lifecycle: &Mutex<ProductionHostCoordinatorLifecycle<'_, '_>>,
|
||||
pub(crate) fn serve_control_connection(
|
||||
lifecycle: &Mutex<CoordinatorLifecycle<'_, '_>>,
|
||||
face: &PublishedControlFace,
|
||||
connection: AcceptedControlConnection,
|
||||
) -> Result<(), ControlError> {
|
||||
serve_production_control_connection_with_escalation(lifecycle, face, connection, None)
|
||||
serve_control_connection_with_escalation(lifecycle, face, connection, None)
|
||||
}
|
||||
|
||||
pub(crate) fn serve_production_control_connection_with_escalation(
|
||||
lifecycle: &Mutex<ProductionHostCoordinatorLifecycle<'_, '_>>,
|
||||
pub(crate) fn serve_control_connection_with_escalation(
|
||||
lifecycle: &Mutex<CoordinatorLifecycle<'_, '_>>,
|
||||
face: &PublishedControlFace,
|
||||
connection: AcceptedControlConnection,
|
||||
escalation: Option<&ProductionEscalationHandle>,
|
||||
escalation: Option<&EscalationServiceHandle>,
|
||||
) -> Result<(), ControlError> {
|
||||
face.serve_connection_coordinated(
|
||||
connection,
|
||||
|
|
|
|||
Loading…
Reference in a new issue