pub struct ConnectionManager { /* private fields */ }Implementations§
Source§impl ConnectionManager
impl ConnectionManager
pub fn new() -> Self
pub async fn upsert_pending( &self, connection_id: String, node_id: Option<String>, device_id_hint: Option<String>, endpoint_id: Option<String>, ) -> ConnectionRecord
pub async fn set_connecting( &self, connection_id: &str, ) -> Option<ConnectionRecord>
pub async fn set_connected( &self, connection_id: &str, endpoint_id: Option<String>, ) -> Option<ConnectionRecord>
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>
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>
Sourcepub 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>
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.
Sourcepub 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>
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.
Sourcepub async fn set_closed_if_current(
&self,
connection_id: &str,
expected_transport_stable_id: u64,
reason: Option<String>,
) -> Option<ConnectionRecord>
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.
pub async fn set_failed_if_current( &self, connection_id: &str, expected_transport_stable_id: u64, reason: Option<String>, ) -> Option<ConnectionRecord>
pub async fn current_transport_matches( &self, connection_id: &str, transport_stable_id: Option<u64>, ) -> bool
pub async fn set_device_id( &self, connection_id: &str, device_id: String, ) -> Option<ConnectionRecord>
pub async fn set_closing( &self, connection_id: &str, reason: Option<String>, ) -> Option<ConnectionRecord>
pub async fn set_closed( &self, connection_id: &str, reason: Option<String>, ) -> Option<ConnectionRecord>
pub async fn set_failed( &self, connection_id: &str, reason: Option<String>, ) -> Option<ConnectionRecord>
pub async fn remove(&self, connection_id: &str) -> Option<ConnectionRecord>
pub async fn get_by_connection_id( &self, connection_id: &str, ) -> Option<ConnectionRecord>
pub async fn get_by_node_id(&self, node_id: &str) -> Vec<ConnectionRecord>
pub async fn get_by_device_id(&self, device_id: &str) -> Vec<ConnectionRecord>
pub async fn get_by_endpoint_id( &self, endpoint_id: &str, ) -> Vec<ConnectionRecord>
pub async fn list_all(&self) -> Vec<ConnectionRecord>
pub async fn list_active(&self) -> Vec<ConnectionRecord>
pub async fn add_scope(&self, id: &str, scope: &str) -> Vec<String>
pub async fn release_scope(&self, id: &str, scope: Option<&str>) -> Vec<String>
pub async fn get_scopes(&self, id: &str) -> Vec<String>
pub async fn are_same_peer(&self, left: &str, right: &str) -> bool
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>
pub async fn set_health( &self, id: &str, health: ConnectionHealth, ) -> Option<PeerSnapshot>
pub async fn set_health_if_current( &self, connection_id: &str, expected_transport_stable_id: u64, health: ConnectionHealth, ) -> Option<PeerSnapshot>
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>
pub async fn clear_status_reason( &self, connection_id: &str, expected_reason: Option<&str>, ) -> Option<PeerSnapshot>
Sourcepub async fn report_transport_health(
&self,
id: &str,
transport: &str,
health: ConnectionHealth,
) -> Option<PeerSnapshot>
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.
Sourcepub async fn clear_transport_health(&self, id: &str)
pub async fn clear_transport_health(&self, id: &str)
Clear all per-transport health entries for a peer (e.g. on disconnect).