pub struct CandidateCache { /* private fields */ }Expand description
Candidate cache with TTL for efficient candidate management
Implementations§
Source§impl CandidateCache
impl CandidateCache
Sourcepub fn new(config: CandidateCacheConfig) -> Self
pub fn new(config: CandidateCacheConfig) -> Self
Create a new candidate cache
Sourcepub async fn start(&mut self) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn start(&mut self) -> Result<(), Box<dyn Error + Send + Sync>>
Start the candidate cache with cleanup task
Sourcepub async fn get_candidates(
&self,
peer_id: PeerId,
) -> Option<Vec<CandidateAddress>>
pub async fn get_candidates( &self, peer_id: PeerId, ) -> Option<Vec<CandidateAddress>>
Get cached candidates for a peer
Sourcepub async fn cache_candidates(
&self,
peer_id: PeerId,
candidates: Vec<CandidateAddress>,
ttl: Option<Duration>,
) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn cache_candidates( &self, peer_id: PeerId, candidates: Vec<CandidateAddress>, ttl: Option<Duration>, ) -> Result<(), Box<dyn Error + Send + Sync>>
Cache candidates for a peer
Sourcepub async fn cache_validation_result(
&self,
peer_id: PeerId,
address: SocketAddr,
is_valid: bool,
rtt: Option<Duration>,
) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn cache_validation_result( &self, peer_id: PeerId, address: SocketAddr, is_valid: bool, rtt: Option<Duration>, ) -> Result<(), Box<dyn Error + Send + Sync>>
Cache validation result for a candidate
Sourcepub async fn get_validation_result(
&self,
peer_id: PeerId,
address: SocketAddr,
) -> Option<(bool, Option<Duration>)>
pub async fn get_validation_result( &self, peer_id: PeerId, address: SocketAddr, ) -> Option<(bool, Option<Duration>)>
Get cached validation result
Sourcepub async fn get_stats(&self) -> CandidateCacheStats
pub async fn get_stats(&self) -> CandidateCacheStats
Get cache statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CandidateCache
impl RefUnwindSafe for CandidateCache
impl Send for CandidateCache
impl Sync for CandidateCache
impl Unpin for CandidateCache
impl UnwindSafe for CandidateCache
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