Skip to main content

ConnectionManager

Struct ConnectionManager 

Source
pub struct ConnectionManager { /* private fields */ }

Implementations§

Source§

impl ConnectionManager

Source

pub fn new() -> Self

Source

pub async fn upsert_pending( &self, connection_id: String, node_id: Option<String>, device_id_hint: Option<String>, endpoint_id: Option<String>, ) -> ConnectionRecord

Source

pub async fn set_connecting( &self, connection_id: &str, ) -> Option<ConnectionRecord>

Source

pub async fn set_connected( &self, connection_id: &str, endpoint_id: Option<String>, ) -> Option<ConnectionRecord>

Source

pub async fn set_connected_with_transport( &self, connection_id: &str, endpoint_id: Option<String>, transport_stable_id: Option<u64>, transport_source: Option<String>, ) -> Option<ConnectionRecord>

Source

pub async fn mark_transport_replaced( &self, connection_id: &str, transport_stable_id: Option<u64>, transport_source: Option<String>, status_reason: Option<String>, ) -> Option<ConnectionRecord>

Source

pub async fn mark_transport_replaced_if_current( &self, connection_id: &str, expected_transport_stable_id: u64, transport_source: Option<String>, status_reason: Option<String>, ) -> Option<ConnectionRecord>

Clear a physical transport only when it is still the active generation.

Close notifications and liveness probes race with replacement dials. The comparison and mutation must therefore share one write lock; a separate current_transport_matches check would leave a window where an old observation could clear the newly installed transport.

Source

pub async fn mark_transport_replaced_by_if_current( &self, connection_id: &str, expected_transport_stable_id: u64, replacement_transport_stable_id: u64, transport_source: Option<String>, ) -> Option<ConnectionRecord>

Install a replacement physical transport only when the captured generation is still current. The comparison and replacement share the store write lock so a delayed close cannot overwrite a newer winner.

Source

pub async fn set_closed_if_current( &self, connection_id: &str, expected_transport_stable_id: u64, reason: Option<String>, ) -> Option<ConnectionRecord>

Apply a terminal close only to the physical generation that produced it.

Source

pub async fn set_failed_if_current( &self, connection_id: &str, expected_transport_stable_id: u64, reason: Option<String>, ) -> Option<ConnectionRecord>

Source

pub async fn current_transport_matches( &self, connection_id: &str, transport_stable_id: Option<u64>, ) -> bool

Source

pub async fn set_device_id( &self, connection_id: &str, device_id: String, ) -> Option<ConnectionRecord>

Source

pub async fn set_closing( &self, connection_id: &str, reason: Option<String>, ) -> Option<ConnectionRecord>

Source

pub async fn set_closed( &self, connection_id: &str, reason: Option<String>, ) -> Option<ConnectionRecord>

Source

pub async fn set_failed( &self, connection_id: &str, reason: Option<String>, ) -> Option<ConnectionRecord>

Source

pub async fn remove(&self, connection_id: &str) -> Option<ConnectionRecord>

Source

pub async fn get_by_connection_id( &self, connection_id: &str, ) -> Option<ConnectionRecord>

Source

pub async fn get_by_node_id(&self, node_id: &str) -> Vec<ConnectionRecord>

Source

pub async fn get_by_device_id(&self, device_id: &str) -> Vec<ConnectionRecord>

Source

pub async fn get_by_endpoint_id( &self, endpoint_id: &str, ) -> Vec<ConnectionRecord>

Source

pub async fn list_all(&self) -> Vec<ConnectionRecord>

Source

pub async fn list_active(&self) -> Vec<ConnectionRecord>

Source

pub async fn add_scope(&self, id: &str, scope: &str) -> Vec<String>

Source

pub async fn release_scope(&self, id: &str, scope: Option<&str>) -> Vec<String>

Source

pub async fn get_scopes(&self, id: &str) -> Vec<String>

Source

pub async fn are_same_peer(&self, left: &str, right: &str) -> bool

Source

pub async fn report_transport_status_if_current( &self, connection_id: &str, expected_transport_stable_id: u64, expected_transport_generation: u64, expected_route_generation: u64, active_transport: String, parallel_transport: Option<String>, ) -> Option<PeerSnapshot>

Source

pub async fn set_health( &self, id: &str, health: ConnectionHealth, ) -> Option<PeerSnapshot>

Source

pub async fn set_health_if_current( &self, connection_id: &str, expected_transport_stable_id: u64, health: ConnectionHealth, ) -> Option<PeerSnapshot>

Source

pub async fn set_settled_if_current( &self, connection_id: &str, expected_transport_stable_id: u64, expected_transport_generation: u64, expected_route_generation: u64, settled: bool, ) -> Option<PeerSnapshot>

Source

pub async fn clear_status_reason( &self, connection_id: &str, expected_reason: Option<&str>, ) -> Option<PeerSnapshot>

Source

pub async fn report_transport_health( &self, id: &str, transport: &str, health: ConnectionHealth, ) -> Option<PeerSnapshot>

Report per-transport health for a peer. Aggregates across all known transports and updates the peer-level health accordingly. Returns the updated peer snapshot.

Source

pub async fn clear_transport_health(&self, id: &str)

Clear all per-transport health entries for a peer (e.g. on disconnect).

Source

pub async fn peer_snapshot(&self, id: &str) -> Option<PeerSnapshot>

Source

pub async fn list_peer_snapshots(&self) -> Vec<PeerSnapshot>

Source

pub async fn best_connection_for_peer( &self, id: &str, ) -> Option<ConnectionRecord>

Trait Implementations§

Source§

impl Default for ConnectionManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SendSyncBound for T
where T: Send + Sync,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more