pub struct BatchPolicy { /* private fields */ }Expand description
Batch resequencing policy.
Buffers exchanges per correlation key. Completion is triggered by
window (size and/or timeout). On completion, sorts buffered exchanges
by sort_expr and returns them as a burst. Timeout tasks hold a
Weak<Self> reference obtained via Arc::new_cyclic.
Implementations§
Source§impl BatchPolicy
impl BatchPolicy
Sourcepub fn new_cyclic(
correlation_expr: Arc<dyn Expression>,
sort_expr: Arc<dyn Expression>,
completion: BatchCompletion,
) -> Arc<Self> ⓘ
pub fn new_cyclic( correlation_expr: Arc<dyn Expression>, sort_expr: Arc<dyn Expression>, completion: BatchCompletion, ) -> Arc<Self> ⓘ
Create a new Arc<BatchPolicy> using Arc::new_cyclic so the
policy holds a Weak<Self> for timeout task spawning.
Trait Implementations§
Source§impl ResequencePolicy for BatchPolicy
impl ResequencePolicy for BatchPolicy
Source§fn accept<'life0, 'async_trait>(
&'life0 self,
input: Exchange,
) -> Pin<Box<dyn Future<Output = Vec<Exchange>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn accept<'life0, 'async_trait>(
&'life0 self,
input: Exchange,
) -> Pin<Box<dyn Future<Output = Vec<Exchange>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Accept an input; return the list of now-ready exchanges (in emit order).
Source§fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<Exchange>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<Exchange>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Flush all buffered state (shutdown). Return any remaining, ordered.
Source§fn set_timeout_tx(&self, tx: Sender<Exchange>)
fn set_timeout_tx(&self, tx: Sender<Exchange>)
Set the driver channel for timeout-triggered emissions.
Default is a no-op.
BatchPolicy overrides this to receive
the channel that feeds the post-driver.Auto Trait Implementations§
impl !Freeze for BatchPolicy
impl !RefUnwindSafe for BatchPolicy
impl !UnwindSafe for BatchPolicy
impl Send for BatchPolicy
impl Sync for BatchPolicy
impl Unpin for BatchPolicy
impl UnsafeUnpin for BatchPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more