pub struct FallbackManager { /* private fields */ }Expand description
Fallback manager for coordinating fallback strategies
Implementations§
Source§impl FallbackManager
impl FallbackManager
Sourcepub fn new(config: FallbackConfig) -> Self
pub fn new(config: FallbackConfig) -> Self
Create a new fallback manager
Sourcepub fn add_alternatives(&self, key: &str, peers: Vec<PeerId>)
pub fn add_alternatives(&self, key: &str, peers: Vec<PeerId>)
Add alternative peers for a key (content ID or operation)
Sourcepub fn get_next_alternative(&self, key: &str) -> Option<PeerId>
pub fn get_next_alternative(&self, key: &str) -> Option<PeerId>
Get next alternative peer for a key
Sourcepub fn add_relay_peer(&self, peer: PeerId)
pub fn add_relay_peer(&self, peer: PeerId)
Add a relay peer
Sourcepub fn get_relay_peers(&self) -> Vec<PeerId>
pub fn get_relay_peers(&self) -> Vec<PeerId>
Get available relay peers
Sourcepub fn get_fallback_strategy(
&self,
peer_id: PeerId,
key: Option<&str>,
) -> Option<FallbackStrategy>
pub fn get_fallback_strategy( &self, peer_id: PeerId, key: Option<&str>, ) -> Option<FallbackStrategy>
Get fallback strategy for a failed connection
Sourcepub fn reset_retry_state(&self, peer_id: &PeerId)
pub fn reset_retry_state(&self, peer_id: &PeerId)
Reset retry state for a peer (after successful connection)
Sourcepub fn enter_degraded_mode(&self, reason: &str)
pub fn enter_degraded_mode(&self, reason: &str)
Enter degraded mode
Sourcepub fn exit_degraded_mode(&self)
pub fn exit_degraded_mode(&self)
Exit degraded mode
Sourcepub fn is_degraded(&self) -> bool
pub fn is_degraded(&self) -> bool
Check if in degraded mode
Sourcepub fn retry_stats(&self) -> RetryStats
pub fn retry_stats(&self) -> RetryStats
Get retry statistics
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for FallbackManager
impl !RefUnwindSafe for FallbackManager
impl Send for FallbackManager
impl Sync for FallbackManager
impl Unpin for FallbackManager
impl UnwindSafe for FallbackManager
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