pub struct RequestQueue<T> { /* private fields */ }Expand description
Request queue with priority support.
Implementations§
Source§impl<T> RequestQueue<T>
impl<T> RequestQueue<T>
Sourcepub fn new(config: DynamicBatchConfig) -> Self
pub fn new(config: DynamicBatchConfig) -> Self
Create a new request queue.
Sourcepub fn enqueue(&mut self, request: BatchRequest<T>) -> Result<(), BatchingError>
pub fn enqueue(&mut self, request: BatchRequest<T>) -> Result<(), BatchingError>
Enqueue a request.
Sourcepub fn dequeue_batch(&mut self, max_size: usize) -> Vec<BatchRequest<T>>
pub fn dequeue_batch(&mut self, max_size: usize) -> Vec<BatchRequest<T>>
Dequeue requests to form a batch.
Sourcepub fn oldest_age(&self) -> Option<Duration>
pub fn oldest_age(&self) -> Option<Duration>
Get oldest request age.
Sourcepub fn should_form_batch(&self) -> bool
pub fn should_form_batch(&self) -> bool
Check if batch formation criteria are met.
Auto Trait Implementations§
impl<T> Freeze for RequestQueue<T>
impl<T> RefUnwindSafe for RequestQueue<T>where
T: RefUnwindSafe,
impl<T> Send for RequestQueue<T>where
T: Send,
impl<T> Sync for RequestQueue<T>where
T: Sync,
impl<T> Unpin for RequestQueue<T>where
T: Unpin,
impl<T> UnwindSafe for RequestQueue<T>where
T: 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