pub(crate) struct Healing {
workspace: Weak<Workspace>,
restart: Arc<dyn SeatRestart>,
notify: Arc<dyn Fn(&SessionSlot, &str) + Send + Sync>,
seats: Mutex<HashMap<SessionSlot, Seat>>,
}Expand description
The auto-heal supervisor. One per workspace, built lazily the first time a death reaches it.
Fields§
§workspace: Weak<Workspace>§restart: Arc<dyn SeatRestart>§notify: Arc<dyn Fn(&SessionSlot, &str) + Send + Sync>§seats: Mutex<HashMap<SessionSlot, Seat>>Implementations§
Source§impl Healing
impl Healing
pub(crate) fn new( workspace: Weak<Workspace>, restart: Arc<dyn SeatRestart>, notify: Arc<dyn Fn(&SessionSlot, &str) + Send + Sync>, ) -> Arc<Self> ⓘ
Sourcepub(crate) fn for_workspace(workspace: &Arc<Workspace>) -> Arc<Self> ⓘ
pub(crate) fn for_workspace(workspace: &Arc<Workspace>) -> Arc<Self> ⓘ
Production wiring: the restart dispatches through the workspace, and a worker’s notice is a peer message to its project’s lead.
Sourcepub(crate) fn note_death(self: &Arc<Self>, slot: &SessionSlot, diagnostic: &str)
pub(crate) fn note_death(self: &Arc<Self>, slot: &SessionSlot, diagnostic: &str)
A seat that had been up died and its connection failed. Walks the policy and either schedules the next attempt or leaves the seat failed with its diagnostic.
Sourcefn schedule(
self: &Arc<Self>,
workspace: &Arc<Workspace>,
slot: &SessionSlot,
project_key: &ProjectKey,
diagnostic: &str,
died_at: SystemTime,
)
fn schedule( self: &Arc<Self>, workspace: &Arc<Workspace>, slot: &SessionSlot, project_key: &ProjectKey, diagnostic: &str, died_at: SystemTime, )
Count one death and either schedule the next attempt or leave the seat failed and escalate. A subprocess death and an attempt whose resume was refused both walk this path, so both spend the same budget and carry their own diagnostic.
Sourcepub(crate) fn note_connected(&self, slot: &SessionSlot)
pub(crate) fn note_connected(&self, slot: &SessionSlot)
An occupant connected on slot: any scheduled attempt is cancelled,
and the run’s clock starts.
Sourcepub(crate) fn note_stopped(&self, slot: &SessionSlot)
pub(crate) fn note_stopped(&self, slot: &SessionSlot)
The seat was deliberately stopped (a close or a despawn). Its count and its pending attempt go, and the stop is remembered so the subprocess death the stop causes is not mistaken for a crash.
Sourcefn forget(&self, slot: &SessionSlot)
fn forget(&self, slot: &SessionSlot)
Forget one seat’s attempts without touching the row: used when a death turns out not to be heal-eligible.
Sourceasync fn fire(
self: Arc<Self>,
slot: &SessionSlot,
generation: u64,
died_at: SystemTime,
diagnostic: &str,
attempt: u32,
attempts: usize,
)
async fn fire( self: Arc<Self>, slot: &SessionSlot, generation: u64, died_at: SystemTime, diagnostic: &str, attempt: u32, attempts: usize, )
A scheduled attempt fired. Re-check that the seat is still the one that was scheduled, and still dead, then restart it and tell the lead what happened.
Auto Trait Implementations§
impl !Freeze for Healing
impl !RefUnwindSafe for Healing
impl !UnwindSafe for Healing
impl Send for Healing
impl Sync for Healing
impl Unpin for Healing
impl UnsafeUnpin for Healing
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more