Skip to main content

ServiceManager

Trait ServiceManager 

Source
pub trait ServiceManager {
    // Required methods
    fn inspect(
        &self,
        spec: &ServiceSpec,
    ) -> Result<LifecycleSnapshot, ServiceError>;
    fn install(
        &mut self,
        spec: &ServiceSpec,
    ) -> Result<TransitionResult, ServiceError>;
    fn start(
        &mut self,
        spec: &ServiceSpec,
        timeout: Duration,
    ) -> Result<TransitionResult, ServiceError>;
    fn stop(
        &mut self,
        spec: &ServiceSpec,
        timeout: Duration,
    ) -> Result<TransitionResult, ServiceError>;
    fn restart(
        &mut self,
        spec: &ServiceSpec,
        timeout: Duration,
    ) -> Result<TransitionResult, ServiceError>;
    fn uninstall(
        &mut self,
        spec: &ServiceSpec,
    ) -> Result<TransitionResult, ServiceError>;
}
Expand description

Manager-neutral service operations. Platform adapters implement this in later milestones; TestDoubleManager implements it for tests.

Required Methods§

Source

fn inspect(&self, spec: &ServiceSpec) -> Result<LifecycleSnapshot, ServiceError>

Inspects registration and lifecycle state without mutating anything.

§Errors

ServiceError::Manager with a classified ManagerFailureKind: Timeout when the operation’s deadline expires, NotFound when the manager binary or a named manager resource does not exist, Permission when the platform reports an access denial, Spawn when the manager child cannot be created or driven, and Protocol when the manager ran and produced a result the adapter cannot accept.

ServiceError::InvalidInput when the adapter cannot answer for the given spec.

Source

fn install( &mut self, spec: &ServiceSpec, ) -> Result<TransitionResult, ServiceError>

Installs/registers. Allowed for Absent (creation) or Owned (refresh).

§Errors

ServiceError::OwnershipDenied when the observed ownership is Foreign or Unknown, or when a pre-write recheck no longer proves Owned.

ServiceError::Manager with a classified ManagerFailureKind: Timeout when the operation’s deadline expires, NotFound when the manager binary or a named manager resource does not exist, Permission when the platform reports an access denial, Spawn when the manager child cannot be created or driven, Protocol when the manager ran and produced a result the adapter cannot accept, and LocalFilesystem when a local definition write or removal failed.

ServiceError::InvalidInput when the request material is inconsistent with the spec.

ServiceError::Conflict when a no-replace write lost a race with a concurrent creation.

Source

fn start( &mut self, spec: &ServiceSpec, timeout: Duration, ) -> Result<TransitionResult, ServiceError>

Starts an Owned stopped service within timeout.

§Errors

ServiceError::OwnershipDenied when the observed ownership is not Owned.

ServiceError::Manager with a classified ManagerFailureKind: Timeout when the deadline expires, NotFound when the manager binary or a named manager resource does not exist, Permission when the platform reports an access denial, Spawn when the manager child cannot be created or driven, and Protocol when the manager ran and produced a result the adapter cannot accept.

ServiceError::InvalidInput when timeout is out of range, or when the adapter has no start semantics (a cron adapter).

Source

fn stop( &mut self, spec: &ServiceSpec, timeout: Duration, ) -> Result<TransitionResult, ServiceError>

Stops an Owned service within timeout.

An adapter may stop a recognized manager failure state only when exact ownership is revalidated and it can prove there is no remaining work. Other unknown states fail closed.

§Errors

ServiceError::OwnershipDenied when the observed ownership is not Owned.

ServiceError::Manager with a classified ManagerFailureKind: Timeout when the deadline expires, NotFound when the manager binary or a named manager resource does not exist, Permission when the platform reports an access denial, Spawn when the manager child cannot be created or driven, and Protocol when the manager ran and produced a result the adapter cannot accept.

ServiceError::InvalidInput when timeout is out of range, or when the adapter has no stop semantics (a cron adapter).

Source

fn restart( &mut self, spec: &ServiceSpec, timeout: Duration, ) -> Result<TransitionResult, ServiceError>

Restarts an Owned service within timeout.

§Errors

ServiceError::OwnershipDenied when the observed ownership is not Owned.

ServiceError::Manager with a classified ManagerFailureKind: Timeout when the deadline expires, NotFound when the manager binary or a named manager resource does not exist, Permission when the platform reports an access denial, Spawn when the manager child cannot be created or driven, and Protocol when the manager ran and produced a result the adapter cannot accept.

ServiceError::InvalidInput when timeout is out of range, or when the adapter has no restart semantics (a cron adapter).

Source

fn uninstall( &mut self, spec: &ServiceSpec, ) -> Result<TransitionResult, ServiceError>

Removes an Owned registration.

§Errors

ServiceError::OwnershipDenied when the observed ownership is not Owned, or when a pre-write recheck no longer proves Owned.

ServiceError::Manager with a classified ManagerFailureKind: Timeout when the operation’s deadline expires, NotFound when the manager binary or a named manager resource does not exist, Permission when the platform reports an access denial, Spawn when the manager child cannot be created or driven, Protocol when the manager ran and produced a result the adapter cannot accept, and LocalFilesystem when a local definition removal failed.

ServiceError::InvalidInput when the request material is inconsistent with the spec.

ServiceError::Conflict when the observed state changed under the operation.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§