pub struct ParallelLookupExecutor { /* private fields */ }Expand description
Executes parallel DHT provider lookups with integrated caching.
Implementations§
Source§impl ParallelLookupExecutor
impl ParallelLookupExecutor
Sourcepub fn new(cache: Arc<LookupCache>, config: ParallelLookupConfig) -> Arc<Self> ⓘ
pub fn new(cache: Arc<LookupCache>, config: ParallelLookupConfig) -> Arc<Self> ⓘ
Create a new ParallelLookupExecutor wrapped in an Arc.
Sourcepub async fn lookup<F, Fut>(
&self,
cid_str: &str,
now_ms: u64,
query_fn: F,
) -> ParallelLookupResult
pub async fn lookup<F, Fut>( &self, cid_str: &str, now_ms: u64, query_fn: F, ) -> ParallelLookupResult
Look up providers for cid_str, using the cache first.
§Cache hit
Returns immediately with from_cache = true and lookup_count = 0.
§Cache miss
Runs alpha parallel calls to query_fn(cid_str), merges and
deduplicates the results, stores them in the cache, and returns with
from_cache = false and lookup_count = alpha.
Sourcepub fn cache_saves(&self) -> u64
pub fn cache_saves(&self) -> u64
Total number of cache hits served (lookups avoided).
Sourcepub fn total_lookups(&self) -> u64
pub fn total_lookups(&self) -> u64
Total number of lookup calls (cache hit or miss).
Auto Trait Implementations§
impl !Freeze for ParallelLookupExecutor
impl !RefUnwindSafe for ParallelLookupExecutor
impl !UnwindSafe for ParallelLookupExecutor
impl Send for ParallelLookupExecutor
impl Sync for ParallelLookupExecutor
impl Unpin for ParallelLookupExecutor
impl UnsafeUnpin for ParallelLookupExecutor
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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