pub trait RocketServiceHandler {
    // Required methods
    fn init<'life0, 'async_trait>(
        &'life0 mut self,
        ss: StartState
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Rocket<Build>>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn run<'life0, 'async_trait>(
        &'life0 mut self,
        rockets: Vec<Rocket<Ignite>>,
        ser: SvcEvtReader
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn shutdown<'life0, 'async_trait>(
        &'life0 mut self,
        ss: StopState
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Available on crate feature rocket only.
Expand description

Rocket server application handler.

While Rocket is built on top of tokio, it [Rocket] wants to initialize tokio itself.

There are two major ways to write Rocket services using qsu; either the application can let qsu be aware of the server applications’ Rocket instances. It does this by creating the Rocket instances in RocketServiceHandler::init() and returns them. qsu will ignite these rockets and pass them to RocketServiceHandler::run(). The application is responsible for launching the rockets at this point.

The other way to do it is to completely manage the Rocket instances in application code (by not returning rocket instances from init()).

Allowing qsu to manage the Rocket instances will cause qsu to request graceful shutdown of all Rocket instances once a SvcEvt::Shutdown is sent by the runtime.

It is recommended that ctrlc shutdown and termination signals are disabled in each Rocket instance’s configuration, and allow the qsu runtime to be responsible for initiating the Rocket shutdown.

Required Methods§

source

fn init<'life0, 'async_trait>( &'life0 mut self, ss: StartState ) -> Pin<Box<dyn Future<Output = Result<Vec<Rocket<Build>>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Rocket service initialization.

The returned Rockets will be ignited and their shutdown handlers will be triggered on shutdown.

source

fn run<'life0, 'async_trait>( &'life0 mut self, rockets: Vec<Rocket<Ignite>>, ser: SvcEvtReader ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn shutdown<'life0, 'async_trait>( &'life0 mut self, ss: StopState ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§