ConcurrentConnection

Trait ConcurrentConnection 

Source
pub trait ConcurrentConnection: Connection {
    // Required methods
    fn reader_watermark<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        pipeline: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ReaderWatermark>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn pruner_watermark<'life0, 'async_trait>(
        &'life0 mut self,
        pipeline: &'static str,
        delay: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<Option<PrunerWatermark>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_reader_watermark<'life0, 'async_trait>(
        &'life0 mut self,
        pipeline: &'static str,
        reader_lo: u64,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_pruner_watermark<'life0, 'async_trait>(
        &'life0 mut self,
        pipeline: &'static str,
        pruner_hi: u64,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn delegate_to_reader_watermark<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        pipeline_task: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<InitWatermark>>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Extension of Connection for concurrent pipeline watermark operations.

Required Methods§

Source

fn reader_watermark<'life0, 'life1, 'async_trait>( &'life0 mut self, pipeline: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ReaderWatermark>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Given a pipeline, return the reader watermark from the database. This is used by the indexer to determine the new reader_lo or inclusive lower bound of available data.

Source

fn pruner_watermark<'life0, 'async_trait>( &'life0 mut self, pipeline: &'static str, delay: Duration, ) -> Pin<Box<dyn Future<Output = Result<Option<PrunerWatermark>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the bounds for the region that the pruner is allowed to prune, and the time in milliseconds the pruner must wait before it can begin pruning data for the given pipeline. The pruner is allowed to prune the region between the returned pruner_hi (inclusive) and reader_lo (exclusive) after waiting until pruner_timestamp + delay has passed. This minimizes the possibility for the pruner to delete data still expected by inflight read requests.

Source

fn set_reader_watermark<'life0, 'async_trait>( &'life0 mut self, pipeline: &'static str, reader_lo: u64, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update the reader_lo of an existing watermark entry only if it raises reader_lo. Readers will reference this as the inclusive lower bound of available data for the corresponding pipeline.

If an update is to be made, some timestamp (i.e pruner_timestamp) should also be set on the watermark entry to the current time. Ideally, this would be from the perspective of the store. If this is not possible, then it should come from some other common source of time between the indexer and its readers. This timestamp is critical to the indexer’s operations, as it determines when the pruner can safely begin pruning data. When pruner_watermark is called by the indexer, it will retrieve this timestamp to determine how much longer to wait before beginning to prune.

Returns a boolean indicating whether the watermark was actually updated or not.

Source

fn set_pruner_watermark<'life0, 'async_trait>( &'life0 mut self, pipeline: &'static str, pruner_hi: u64, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update the pruner watermark, returns true if the watermark was actually updated.

Provided Methods§

Source

fn delegate_to_reader_watermark<'life0, 'life1, 'async_trait>( &'life0 mut self, pipeline_task: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<InitWatermark>>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Helper to call in Connection::init_watermark impl that delegates to ConcurrentConnection::reader_watermark if impl does not attempt to write data.

Implementors§