Trait Handler

Source
pub trait Handler: Processor<Value: FieldCount> {
    const MIN_EAGER_ROWS: usize = 50usize;
    const MAX_PENDING_ROWS: usize = 5_000usize;
    const MAX_WATERMARK_UPDATES: usize = 10_000usize;

    // Required method
    fn commit<'a, 'life0, 'life1, 'async_trait>(
        values: &'life0 [Self::Value],
        conn: &'life1 mut Connection<'a>,
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn prune<'a, 'life0, 'life1, 'async_trait>(
        &'life0 self,
        _from: u64,
        _to_exclusive: u64,
        _conn: &'life1 mut Connection<'a>,
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Postgres-specific handler trait for concurrent indexing pipelines.

The trait automatically implements the framework’s Handler trait with a PgBatch that respects the 32,767 bind parameter limit.

Provided Associated Constants§

Source

const MIN_EAGER_ROWS: usize = 50usize

If at least this many rows are pending, the committer will commit them eagerly.

Source

const MAX_PENDING_ROWS: usize = 5_000usize

If there are more than this many rows pending, the committer applies backpressure.

Source

const MAX_WATERMARK_UPDATES: usize = 10_000usize

The maximum number of watermarks that can show up in a single batch.

Required Methods§

Source

fn commit<'a, 'life0, 'life1, 'async_trait>( values: &'life0 [Self::Value], conn: &'life1 mut Connection<'a>, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Take a chunk of values and commit them to the database, returning the number of rows affected.

Provided Methods§

Source

fn prune<'a, 'life0, 'life1, 'async_trait>( &'life0 self, _from: u64, _to_exclusive: u64, _conn: &'life1 mut Connection<'a>, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Clean up data between checkpoints _from and _to_exclusive (exclusive) in the database, returning the number of rows affected. This function is optional, and defaults to not pruning at all.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§