[][src]Trait mpool::ManageConnection

pub trait ManageConnection: Send + Sync + 'static {
    type Connection: Send + 'static;
    fn connect<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Self::Connection>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn check<'life0, 'life1, 'async_trait>(
        &'life0 self,
        conn: &'life1 mut Self::Connection
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
; }

A trait which provides connection-specific functionality.

Associated Types

type Connection: Send + 'static

The connection type this manager deals with.

Loading content...

Required methods

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

Attempts to create a new connection.

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

Check if the connection is still valid, check background every check_interval.

A standard implementation would check if a simple query like PING succee, if the Connection is broken, error should return.

Loading content...

Implementors

Loading content...