pub struct QueryBatcher { /* private fields */ }Expand description
DHT query batcher
Implementations§
Source§impl QueryBatcher
impl QueryBatcher
Sourcepub fn new(config: QueryBatcherConfig) -> Result<Self, QueryBatcherError>
pub fn new(config: QueryBatcherConfig) -> Result<Self, QueryBatcherError>
Create a new query batcher
Sourcepub fn add_query(&self, query: QueryType) -> Result<(), QueryBatcherError>
pub fn add_query(&self, query: QueryType) -> Result<(), QueryBatcherError>
Add a query to the batch
Sourcepub fn should_send_batch(&self) -> bool
pub fn should_send_batch(&self) -> bool
Check if batch is ready to send
Sourcepub fn take_batch(&self) -> Vec<PendingQuery>
pub fn take_batch(&self) -> Vec<PendingQuery>
Get the current batch and clear it
Sourcepub fn record_result(&self, result: QueryBatchResult)
pub fn record_result(&self, result: QueryBatchResult)
Record query result for adaptive rate limiting
Sourcepub fn stats(&self) -> QueryBatcherStats
pub fn stats(&self) -> QueryBatcherStats
Get current statistics
Sourcepub fn rate_multiplier(&self) -> f64
pub fn rate_multiplier(&self) -> f64
Get current rate multiplier (for adaptive rate limiting)
Sourcepub fn success_rate(&self) -> f64
pub fn success_rate(&self) -> f64
Get current success rate
Sourcepub fn cleanup_dedup_cache(&self)
pub fn cleanup_dedup_cache(&self)
Clean up old deduplication entries
Sourcepub fn reset_stats(&self)
pub fn reset_stats(&self)
Reset statistics
Auto Trait Implementations§
impl Freeze for QueryBatcher
impl !RefUnwindSafe for QueryBatcher
impl Send for QueryBatcher
impl Sync for QueryBatcher
impl Unpin for QueryBatcher
impl !UnwindSafe for QueryBatcher
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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