pub struct WarmSwap<G, D, L, R> { /* private fields */ }Expand description
The warm drain-swap-resume orchestrator over its four control seams.
Holds the admission gate, the drain, the lease control, and the resume seam.
WarmSwap::run drives the fixed sequence, delegating the swap core (verify →
apply → health check → auto-rollback) to a Stager whose Activator is a
process or image swap. The orchestrator adds only the ordering: close before
drain, drain before release, release before swap, swap before re-acquire,
re-acquire before resume.
Implementations§
Source§impl<G, D, L, R> WarmSwap<G, D, L, R>
impl<G, D, L, R> WarmSwap<G, D, L, R>
Sourcepub const fn new(gate: G, drain: D, lease: L, resume: R) -> Self
pub const fn new(gate: G, drain: D, lease: L, resume: R) -> Self
Build a warm-swap orchestrator over its four control seams.
Sourcepub fn run<S, V, A, H>(
&self,
verdict: &Compatibility,
stager: &mut Stager<S, V, A, H>,
release: &ReleaseId,
) -> Result<WarmSwapReport, WarmSwapError>
pub fn run<S, V, A, H>( &self, verdict: &Compatibility, stager: &mut Stager<S, V, A, H>, release: &ReleaseId, ) -> Result<WarmSwapReport, WarmSwapError>
Run the warm drain-swap-resume for a Warm-classified release.
The sequence is fixed and its ordering is the invariant:
- gate on the classifier — refuse anything but
Compatibility::Warmbefore touching any seam; - close admission, so no new turn is admitted while draining;
- drain to a committed checkpoint — in-flight turns and paused approvals
reach their
turn_completemarker, captured as aCheckpoint, while the lease is still held; - release the lease;
- swap via the
Stager— verify the new binary’s signature, apply the pointer flip, health-check, and auto-roll-back on failure; - re-acquire the lease — always, on whichever binary is now live, so the conversation is never left drained-but-dead;
- resume from the checkpoint, re-driving paused approvals, and verify it restarted from exactly the drained turn.
The lease re-acquire in step 6 runs even when the swap rolled back or its signature was refused, so a failed swap surfaces its error only after the conversation is back under a held lease.
§Errors
Returns WarmSwapError::NotWarm when verdict is not warm (nothing is
drained or swapped); WarmSwapError::Admission or
WarmSwapError::Drain when the pre-swap steps fail (the lease is still
held); WarmSwapError::Lease when a release or re-acquire fails;
WarmSwapError::Stage when the stager cannot verify or apply the swap
(surfaced after the lease is re-acquired); and WarmSwapError::Resume or
WarmSwapError::ResumeMismatch when resume fails or restarts from the
wrong turn.
Auto Trait Implementations§
impl<G, D, L, R> Freeze for WarmSwap<G, D, L, R>
impl<G, D, L, R> RefUnwindSafe for WarmSwap<G, D, L, R>
impl<G, D, L, R> Send for WarmSwap<G, D, L, R>
impl<G, D, L, R> Sync for WarmSwap<G, D, L, R>
impl<G, D, L, R> Unpin for WarmSwap<G, D, L, R>
impl<G, D, L, R> UnsafeUnpin for WarmSwap<G, D, L, R>
impl<G, D, L, R> UnwindSafe for WarmSwap<G, D, L, R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request