pub struct QueryOptimizer { /* private fields */ }Expand description
Query optimizer for DHT operations
Implementations§
Source§impl QueryOptimizer
impl QueryOptimizer
Sourcepub fn new(config: QueryOptimizerConfig) -> Self
pub fn new(config: QueryOptimizerConfig) -> Self
Create a new query optimizer
Sourcepub fn start_query(&self, query_id: String)
pub fn start_query(&self, query_id: String)
Start tracking a new query
Sourcepub fn should_terminate_early(
&self,
query_id: &str,
current_results: &[PeerId],
) -> bool
pub fn should_terminate_early( &self, query_id: &str, current_results: &[PeerId], ) -> bool
Check if query should terminate early based on result quality
Sourcepub fn complete_query(&self, query_id: &str, result: QueryResult)
pub fn complete_query(&self, query_id: &str, result: QueryResult)
Complete a query and record metrics
Sourcepub fn mark_early_terminated(&self, query_id: &str)
pub fn mark_early_terminated(&self, query_id: &str)
Mark a query as early terminated
Sourcepub fn record_timeout(&self, query_id: &str)
pub fn record_timeout(&self, query_id: &str)
Record a query timeout
Sourcepub fn get_metrics(&self) -> QueryMetrics
pub fn get_metrics(&self) -> QueryMetrics
Get query metrics
Sourcepub fn early_termination_rate(&self) -> f64
pub fn early_termination_rate(&self) -> f64
Get early termination rate
Sourcepub fn can_pipeline_query(&self) -> bool
pub fn can_pipeline_query(&self) -> bool
Check if we can pipeline a new query
Sourcepub fn active_query_count(&self) -> usize
pub fn active_query_count(&self) -> usize
Get active query count
Auto Trait Implementations§
impl Freeze for QueryOptimizer
impl !RefUnwindSafe for QueryOptimizer
impl Send for QueryOptimizer
impl Sync for QueryOptimizer
impl Unpin for QueryOptimizer
impl !UnwindSafe for QueryOptimizer
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