pub struct TargetSupervisor { /* private fields */ }Expand description
Supervises the two webhook relay targets on demand.
Why: one supervisor across both services rather than one each, so the
live-child cap is a statement about console’s whole child population.
What: ensure_running keyed by source (review / analyze), with the
binary located lazily so an already-running or externally-managed target
never requires it to be installed.
Test: spawn_adopts_a_socket_that_is_already_served,
spawn_maps_each_source_to_its_binary. The external-mode opt-out itself is
trusty-common’s external_env_only_honours_exactly_one — console supplies
only the variable name, and a test here would have to mutate a
process-global env var that every sibling in the binary can see.
Implementations§
Source§impl TargetSupervisor
impl TargetSupervisor
Sourcepub fn new() -> Self
pub fn new() -> Self
Build a supervisor for the relay targets.
max_live is 2 — there are exactly two targets, and a cap that reaped
one to make room for the other would thrash under a two-source burst.
Sourcepub fn spawned_count(&self) -> u64
pub fn spawned_count(&self) -> u64
How many children this supervisor has launched.
Sourcepub async fn ensure_running(
&self,
source: &str,
socket: &Path,
) -> Result<PathBuf, SupervisorError>
pub async fn ensure_running( &self, source: &str, socket: &Path, ) -> Result<PathBuf, SupervisorError>
Ensure something is serving socket for source.
Why: called immediately before a relay, so the socket is bound by the time the frame is written. The supervisor’s own fast path means a target already serving costs one probe, not a spawn.
§Errors
SupervisorError when the binary cannot be found, the spawn fails, or
the child never binds. Every one leaves the delivery unrelayed and
therefore unacked — the caller records it as Unreachable, which keeps
the spool entry.
Test: spawn_adopts_a_socket_that_is_already_served covers the path
that resolves no binary; the spawn path itself is covered by
trusty-common’s supervisor suite rather than by launching a real
trusty-review from a unit test.
Trait Implementations§
Source§impl Debug for TargetSupervisor
impl Debug for TargetSupervisor
Auto Trait Implementations§
impl !Freeze for TargetSupervisor
impl !RefUnwindSafe for TargetSupervisor
impl !UnwindSafe for TargetSupervisor
impl Send for TargetSupervisor
impl Sync for TargetSupervisor
impl Unpin for TargetSupervisor
impl UnsafeUnpin for TargetSupervisor
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<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> 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