pub struct DaemonLifecycle { /* private fields */ }Expand description
A client’s handle on a resident service host, with typed Provenance.
Implementations§
Source§impl DaemonLifecycle
impl DaemonLifecycle
Sourcepub fn attach_or_launch(
backend: Arc<dyn HostBackend>,
launcher: Option<Launcher>,
config: LifecycleConfig,
) -> Result<Self, LifecycleError>
pub fn attach_or_launch( backend: Arc<dyn HostBackend>, launcher: Option<Launcher>, config: LifecycleConfig, ) -> Result<Self, LifecycleError>
Attach to the live host of the backend’s service, or launch one. See the module docs.
launcher is None for a client that only ever attaches. With a launcher, a host that is
not running is started under the cross-process claim, so two shells starting together
launch exactly one: the loser waits for the winner’s host and attaches to it.
Sourcepub fn attach_or_launch_local(
client: ClientConfig,
expect: HostExpectation,
launcher: Option<Launcher>,
config: LifecycleConfig,
) -> Result<Self, LifecycleError>
pub fn attach_or_launch_local( client: ClientConfig, expect: HostExpectation, launcher: Option<Launcher>, config: LifecycleConfig, ) -> Result<Self, LifecycleError>
attach_or_launch over the local service.json transport.
Sourcepub fn provenance(&self) -> Option<Provenance>
pub fn provenance(&self) -> Option<Provenance>
How the host this lifecycle uses was started, or None when no host is bound now.
Sourcepub fn host(&self) -> Option<HostGeneration>
pub fn host(&self) -> Option<HostGeneration>
The generation of the host bound now.
Sourcepub fn session_count(&self) -> usize
pub fn session_count(&self) -> usize
Sessions held now. The count a presence or idle-exit policy reads.
Sourcepub fn reset_restart_budget(&self)
pub fn reset_restart_budget(&self)
Forget the spent restart budget (an explicit user start).
Sourcepub fn acquire_session(&self, label: &str) -> Result<Session, LifecycleError>
pub fn acquire_session(&self, label: &str) -> Result<Session, LifecycleError>
Revalidate the host (identity, generation, process liveness; relaunch an owned host that
exited when the budget allows) and open a verified connection to it as a Session.
label names the holder for diagnostics.
Sourcepub fn release_session(&self, session: Session) -> ReleaseReport
pub fn release_session(&self, session: Session) -> ReleaseReport
End one session: its connection closes and it leaves the count. Never signals the
host, whatever its provenance: an attached client leaves a shared service running, and
an owned host keeps running until shutdown_owned.
Sourcepub fn shutdown_owned(&self) -> Result<ShutdownReport, LifecycleError>
pub fn shutdown_owned(&self) -> Result<ShutdownReport, LifecycleError>
Stop the host this lifecycle launched: the app’s graceful request first (only after the
host is confirmed to still be the launched generation), then up to the configured grace
for the process to exit, then its process tree is killed, and only while the recorded
AdoptedIdentity still names the launched process.
An attached host (or no owned host) is LifecycleError::NotOwned: nothing is sent and
nothing is signalled. Afterwards this lifecycle is shut down: sessions fail with
LifecycleError::Released and acquire_session is refused.