pub struct BatchProcessor<T: Send + 'static> { /* private fields */ }Expand description
Batch processor for inference requests
Implementations§
Source§impl<T: Send + 'static> BatchProcessor<T>
impl<T: Send + 'static> BatchProcessor<T>
Sourcepub fn new(config: BatchConfig) -> Self
pub fn new(config: BatchConfig) -> Self
Create a new batch processor
Sourcepub async fn submit(&self, payload: T) -> Result<BatchResult<T>, BatchError>
pub async fn submit(&self, payload: T) -> Result<BatchResult<T>, BatchError>
Submit a request and wait for the result
Sourcepub fn stats(&self) -> BatchStats
pub fn stats(&self) -> BatchStats
Get batch statistics
Sourcepub fn collect_batch(&self) -> Vec<(T, Sender<BatchResult<T>>, Instant)>
pub fn collect_batch(&self) -> Vec<(T, Sender<BatchResult<T>>, Instant)>
Collect a batch of requests (up to max_batch_size)
Sourcepub fn complete_batch(
&self,
results: Vec<(T, Sender<BatchResult<T>>, Instant, T)>,
)
pub fn complete_batch( &self, results: Vec<(T, Sender<BatchResult<T>>, Instant, T)>, )
Complete a batch with results
Sourcepub async fn wait_for_batch(&self) -> bool
pub async fn wait_for_batch(&self) -> bool
Wait for a batch to be ready
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for BatchProcessor<T>
impl<T> !RefUnwindSafe for BatchProcessor<T>
impl<T> Send for BatchProcessor<T>
impl<T> Sync for BatchProcessor<T>
impl<T> Unpin for BatchProcessor<T>
impl<T> !UnwindSafe for BatchProcessor<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more