pub trait Service: Sync + Send {
// Required methods
fn start_service<'life0, 'async_trait>(
&'life0 mut self,
fds: Option<ListenFds>,
shutdown: ShutdownWatch,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn name(&self) -> &str;
// Provided method
fn threads(&self) -> Option<usize> { ... }
}
Expand description
The service interface
Required Methods§
Sourcefn start_service<'life0, 'async_trait>(
&'life0 mut self,
fds: Option<ListenFds>,
shutdown: ShutdownWatch,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start_service<'life0, 'async_trait>(
&'life0 mut self,
fds: Option<ListenFds>,
shutdown: ShutdownWatch,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
This function will be called when the server is ready to start the service.
fds
(Unix only): a collection of listening file descriptors. During zero downtime restart thefds
would contain the listening sockets passed from the old service, services should take the sockets they need to use then. If the sockets the service looks for don’t appear in the collection, the service should create its own listening sockets and then put them into the collection in order for them to be passed to the next server.shutdown
: the shutdown signal this server would receive.