pub trait Supervisor {
// Required methods
fn up(&self, spec: &AgentSpec) -> Result<()>;
fn down(&self, spec: &AgentSpec) -> Result<()>;
fn state(&self, spec: &AgentSpec) -> Result<AgentState>;
// Provided methods
fn drain(
&self,
spec: &AgentSpec,
_timeout: Duration,
) -> Result<DrainOutcome> { ... }
fn drain_poll_interval(&self) -> Duration { ... }
}Required Methods§
fn up(&self, spec: &AgentSpec) -> Result<()>
fn down(&self, spec: &AgentSpec) -> Result<()>
fn state(&self, spec: &AgentSpec) -> Result<AgentState>
Provided Methods§
Sourcefn drain(&self, spec: &AgentSpec, _timeout: Duration) -> Result<DrainOutcome>
fn drain(&self, spec: &AgentSpec, _timeout: Duration) -> Result<DrainOutcome>
Stop an agent gracefully. The default implementation falls
back to down() for back-ends that don’t implement signal
delivery (or where graceful shutdown isn’t meaningful — e.g.
a MockSupervisor in tests).
Sourcefn drain_poll_interval(&self) -> Duration
fn drain_poll_interval(&self) -> Duration
Cadence at which drain polls for Stopped after the
graceful-stop signal is sent. Default 250ms — fine on every
host we’ve tested. The hook exists so tests can inject a
shorter cadence (no real-time waits) without going through
the OS, and so a future slow-tmux host has an escape valve
without forking the orchestration.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".