Trait hydro_deploy::Service

source ·
pub trait Service: Send + Sync {
    // Required methods
    fn collect_resources(&self, resource_batch: &mut ResourceBatch);
    fn deploy<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        resource_result: &'life1 Arc<ResourceResult>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn ready<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn start<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stop<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

source

fn collect_resources(&self, resource_batch: &mut ResourceBatch)

Makes requests for physical resources server ports that this service needs to run. This should not recursively call collect_resources on the host, since we guarantee that collect_resources is only called once per host.

This should also perform any “free”, non-blocking computations (compilations), because the deploy method will be called after these resources are allocated.

source

fn deploy<'life0, 'life1, 'async_trait>( &'life0 mut self, resource_result: &'life1 Arc<ResourceResult>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Connects to the acquired resources and prepares the service to be launched.

source

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

Launches the service, which should start listening for incoming network connections. The service should not start computing at this point.

source

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

Starts the service by having it connect to other services and start computations.

source

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

Stops the service by having it disconnect from other services and stop computations.

Implementors§