Skip to main content

RelayHook

Trait RelayHook 

Source
pub trait RelayHook: MaybeSend + MaybeSync {
    // Required method
    fn before_apply<'a>(
        &'a self,
        target: &'a Partition,
        rows: &'a [(u64, RelayV1)],
        pre: &'a mut Vec<Precondition>,
        writes: &'a mut Vec<Write>,
    ) -> BoxFuture<'a, Result<(), StoreError>>;

    // Provided methods
    fn read_keys(
        &self,
        _target: &Partition,
        _rows: &[(u64, RelayV1)],
    ) -> Result<Vec<Key>, StoreError> { ... }
    fn before_apply_observed<'a>(
        &'a self,
        target: &'a Partition,
        rows: &'a [(u64, RelayV1)],
        _observed: &'a [(Key, Option<Value>)],
        pre: &'a mut Vec<Precondition>,
        writes: &'a mut Vec<Write>,
    ) -> BoxFuture<'a, Result<(), StoreError>> { ... }
    fn reserved_ops(
        &self,
        _target: &Partition,
        _rows: &[(u64, RelayV1)],
    ) -> usize { ... }
}
Expand description

Runs before each target apply attempt, including retries on contention or shrinking a combined group to fit hook additions within the store limits. Added effects must fit the batch limits and tolerate repeated delivery. An error leaves this target’s rows queued and does not block other targets.

Required Methods§

Source

fn before_apply<'a>( &'a self, target: &'a Partition, rows: &'a [(u64, RelayV1)], pre: &'a mut Vec<Precondition>, writes: &'a mut Vec<Write>, ) -> BoxFuture<'a, Result<(), StoreError>>

Extend the atomic target batch, or fail delivery for this target.

Provided Methods§

Source

fn read_keys( &self, _target: &Partition, _rows: &[(u64, RelayV1)], ) -> Result<Vec<Key>, StoreError>

Additional raw observations, batched with the target watermark read. The delivery engine deduplicates and bounds this declaration before IO.

Source

fn before_apply_observed<'a>( &'a self, target: &'a Partition, rows: &'a [(u64, RelayV1)], _observed: &'a [(Key, Option<Value>)], pre: &'a mut Vec<Precondition>, writes: &'a mut Vec<Write>, ) -> BoxFuture<'a, Result<(), StoreError>>

Extend using the declared snapshot, without hidden IO. Older hooks retain their original callback; production content hooks override this.

Source

fn reserved_ops(&self, _target: &Partition, _rows: &[(u64, RelayV1)]) -> usize

Target-local extensions may reserve operations before a remote apply. The relay shrinks groups until their base effects and this reserve fit.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§