Skip to main content

DaemonLifecycle

Struct DaemonLifecycle 

Source
pub struct DaemonLifecycle { /* private fields */ }
Expand description

A client’s handle on a resident service host, with typed Provenance.

Implementations§

Source§

impl DaemonLifecycle

Source

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.

Source

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.

Source

pub fn provenance(&self) -> Option<Provenance>

How the host this lifecycle uses was started, or None when no host is bound now.

Source

pub fn host(&self) -> Option<HostGeneration>

The generation of the host bound now.

Source

pub fn epoch(&self) -> u64

The fence epoch: advances whenever the bound host changes.

Source

pub fn session_count(&self) -> usize

Sessions held now. The count a presence or idle-exit policy reads.

Source

pub fn reset_restart_budget(&self)

Forget the spent restart budget (an explicit user start).

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.