pub struct DhtManager { /* private fields */ }Expand description
DHT manager for peer and content discovery
Implementations§
Source§impl DhtManager
impl DhtManager
Sourcepub fn start_provider_refresh(&mut self)
pub fn start_provider_refresh(&mut self)
Start the provider refresh background task
Sourcepub async fn track_provider(&self, cid: Cid) -> Result<()>
pub async fn track_provider(&self, cid: Cid) -> Result<()>
Track a provider record for automatic refresh
Sourcepub async fn stop_tracking(&self, cid: &Cid) -> Result<()>
pub async fn stop_tracking(&self, cid: &Cid) -> Result<()>
Stop tracking a provider record
Sourcepub fn cache_query_result(&self, cid: &Cid, peers: Vec<PeerId>)
pub fn cache_query_result(&self, cid: &Cid, peers: Vec<PeerId>)
Cache a query result
Sourcepub fn cache_peer(&self, peer_id: PeerId)
pub fn cache_peer(&self, peer_id: PeerId)
Cache a peer
Sourcepub fn is_peer_cached(&self, peer_id: &PeerId) -> bool
pub fn is_peer_cached(&self, peer_id: &PeerId) -> bool
Check if peer is in cache
Sourcepub fn get_cached_peers(&self) -> Vec<PeerId>
pub fn get_cached_peers(&self) -> Vec<PeerId>
Get all cached peers
Sourcepub fn cleanup_cache(&self)
pub fn cleanup_cache(&self)
Clean up expired cache entries
Sourcepub fn record_query_success(&self)
pub fn record_query_success(&self)
Record a successful query
Sourcepub fn record_query_failure(&self)
pub fn record_query_failure(&self)
Record a failed query
Sourcepub fn get_health(&self) -> DhtHealth
pub fn get_health(&self) -> DhtHealth
Get DHT health status
Sourcepub fn is_healthy(&self) -> bool
pub fn is_healthy(&self) -> bool
Check if DHT is healthy
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DhtManager
impl !RefUnwindSafe for DhtManager
impl Send for DhtManager
impl Sync for DhtManager
impl Unpin for DhtManager
impl !UnwindSafe for DhtManager
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