Trait DBListenerTrait

Source
pub trait DBListenerTrait {
    // Required methods
    fn start<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(Arc<Mutex<Receiver<Value>>>, JoinHandle<()>), DBListenerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stop<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), DBListenerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait defining a generic database listener.

Required Methods§

Source

fn start<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(Arc<Mutex<Receiver<Value>>>, JoinHandle<()>), DBListenerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Starts the listener and returns a receiver channel for event notifications.

§Returns

A Result containing a tuple of an Arc<Mutex<Receiver<Value>>> and a JoinHandle<()>, or an error if the listener fails to start.

Source

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

Stops the database listener gracefully.

§Returns

A Result indicating success or failure.

Implementors§