pub struct BatchProcessor<R, I, O> { /* private fields */ }Expand description
Explicit batch processor for a single inner runnable.
Differences from inner.batch(...):
- Honors per-instance
BatchOptions. - Has [
process_with_results] returning aVec<Result<O>>so partial failures don’t lose data.
Implementations§
Source§impl<R, I, O> BatchProcessor<R, I, O>
impl<R, I, O> BatchProcessor<R, I, O>
Sourcepub fn with_options(inner: R, options: BatchOptions) -> Self
pub fn with_options(inner: R, options: BatchOptions) -> Self
Wrap with explicit options.
Sourcepub fn options_mut(&mut self) -> &mut BatchOptions
pub fn options_mut(&mut self) -> &mut BatchOptions
Mutably borrow options (e.g. to flip return_exceptions mid-life).
Source§impl<R, I, O> BatchProcessor<R, I, O>
impl<R, I, O> BatchProcessor<R, I, O>
Sourcepub async fn process(
&self,
inputs: Vec<I>,
config: RunnableConfig,
) -> Result<Vec<O>>
pub async fn process( &self, inputs: Vec<I>, config: RunnableConfig, ) -> Result<Vec<O>>
Run a batch and short-circuit on the first error. Equivalent to
inner.batch(...) but honors BatchOptions::max_concurrency and
wave_delay.
Sourcepub async fn process_with_results(
&self,
inputs: Vec<I>,
config: RunnableConfig,
) -> Vec<Result<O>> ⓘ
pub async fn process_with_results( &self, inputs: Vec<I>, config: RunnableConfig, ) -> Vec<Result<O>> ⓘ
Run a batch and always return per-input results — failures
surface as Err(CognisError) entries, successful invocations as
Ok(O). Order matches the input order.
Auto Trait Implementations§
impl<R, I, O> Freeze for BatchProcessor<R, I, O>where
R: Freeze,
impl<R, I, O> RefUnwindSafe for BatchProcessor<R, I, O>where
R: RefUnwindSafe,
impl<R, I, O> Send for BatchProcessor<R, I, O>where
R: Send,
impl<R, I, O> Sync for BatchProcessor<R, I, O>where
R: Sync,
impl<R, I, O> Unpin for BatchProcessor<R, I, O>where
R: Unpin,
impl<R, I, O> UnsafeUnpin for BatchProcessor<R, I, O>where
R: UnsafeUnpin,
impl<R, I, O> UnwindSafe for BatchProcessor<R, I, O>where
R: UnwindSafe,
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