QueueMethods

Trait QueueMethods 

Source
pub trait QueueMethods {
    type ItemType: QueueExt + 'static + Clone + Debug;
    type FeatureQueue: FeatureQueue + 'static;

    // Required methods
    fn capacity(&self) -> usize;
    fn get_producer(&mut self) -> &mut RustScouterProducer;
    fn queue(&self) -> Arc<ArrayQueue<Self::ItemType>>;
    fn feature_queue(&self) -> Arc<Self::FeatureQueue>;
    fn last_publish(&self) -> Arc<RwLock<DateTime<Utc>>>;
    fn should_process(&self, current_count: usize) -> bool;
    fn flush<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), EventError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn update_last_publish(&mut self) -> Result<(), EventError> { ... }
    fn publish<'life0, 'async_trait>(
        &'life0 mut self,
        records: ServerRecords,
    ) -> Pin<Box<dyn Future<Output = Result<(), EventError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn insert<'life0, 'async_trait>(
        &'life0 mut self,
        item: Self::ItemType,
    ) -> Pin<Box<dyn Future<Output = Result<(), EventError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn try_publish<'life0, 'async_trait>(
        &'life0 mut self,
        queue: Arc<ArrayQueue<Self::ItemType>>,
    ) -> Pin<Box<dyn Future<Output = Result<(), EventError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn insert_with_backpressure<'life0, 'async_trait>(
        &'life0 mut self,
        item: Self::ItemType,
    ) -> Pin<Box<dyn Future<Output = Result<(), EventError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

This is a primary trait implemented on all queues It provides the basic functionality for inserting, publishing, and flushing

Required Associated Types§

Required Methods§

Source

fn capacity(&self) -> usize

These all need to be implemented in the concrete queue type

Source

fn get_producer(&mut self) -> &mut RustScouterProducer

Source

fn queue(&self) -> Arc<ArrayQueue<Self::ItemType>>

Source

fn feature_queue(&self) -> Arc<Self::FeatureQueue>

Source

fn last_publish(&self) -> Arc<RwLock<DateTime<Utc>>>

Source

fn should_process(&self, current_count: usize) -> bool

Source

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

Flush the queue and shut down background tasks

Provided Methods§

Source

fn update_last_publish(&mut self) -> Result<(), EventError>

Source

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

Publish the records to the producer Remember - everything flows down from python, so the async producers need to be called in a blocking manner

Source

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

Insert an item into the queue

Source

fn try_publish<'life0, 'async_trait>( &'life0 mut self, queue: Arc<ArrayQueue<Self::ItemType>>, ) -> Pin<Box<dyn Future<Output = Result<(), EventError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Process the queue and publish records

Source

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

Backpressure handling for inserting items into the queue This will retry inserting the item a few times with exponential backoff

Implementors§