pub struct TransportRegistry {
Transports: HashMap<String, Arc<dyn CommonTransportStrategy>>,
Active: Option<String>,
Selector: TransportSelector,
}Expand description
Central registry for managing transport strategies.
Fields§
§Transports: HashMap<String, Arc<dyn CommonTransportStrategy>>Registered transports (name -> Arc<dyn CommonTransportStrategy>)
Active: Option<String>Currently active transport name
Selector: TransportSelectorTransport selector for auto-selection
Implementations§
Source§impl TransportRegistry
impl TransportRegistry
Sourcepub fn WithSelector(Selector: TransportSelector) -> Self
pub fn WithSelector(Selector: TransportSelector) -> Self
Creates a new registry with a custom selector.
Sourcepub fn Register(
&mut self,
Name: String,
Transport: Arc<dyn CommonTransportStrategy>,
)
pub fn Register( &mut self, Name: String, Transport: Arc<dyn CommonTransportStrategy>, )
Registers a new transport with the registry.
Sourcepub async fn Unregister(&mut self, Name: &str) -> Result<(), TransportError>
pub async fn Unregister(&mut self, Name: &str) -> Result<(), TransportError>
Unregisters a transport from the registry.
Sourcepub async fn Select(&mut self, Name: &str) -> Result<(), TransportError>
pub async fn Select(&mut self, Name: &str) -> Result<(), TransportError>
Selects a transport by name as the active transport.
Sourcepub async fn AutoSelect(
&mut self,
Context: &TransportContext,
) -> Result<String, TransportError>
pub async fn AutoSelect( &mut self, Context: &TransportContext, ) -> Result<String, TransportError>
Automatically selects the best transport based on the provided context.
Sourcepub fn GetActive(&self) -> Option<Arc<dyn CommonTransportStrategy>>
pub fn GetActive(&self) -> Option<Arc<dyn CommonTransportStrategy>>
Gets the currently active transport, if any.
Sourcepub fn Get(&self, Name: &str) -> Option<Arc<dyn CommonTransportStrategy>>
pub fn Get(&self, Name: &str) -> Option<Arc<dyn CommonTransportStrategy>>
Gets a specific transport by name.
Sourcepub fn GetAllMetrics(&self) -> HashMap<String, TransportMetrics>
pub fn GetAllMetrics(&self) -> HashMap<String, TransportMetrics>
Gets metrics for all registered transports.
Sourcepub fn GetHealthStatus(&self) -> HashMap<String, bool>
pub fn GetHealthStatus(&self) -> HashMap<String, bool>
Gets health status (connected/not connected) for all transports.
Sourcepub fn ActiveName(&self) -> Option<&str>
pub fn ActiveName(&self) -> Option<&str>
Gets the name of the currently active transport.
Sourcepub fn SetSelector(&mut self, Selector: TransportSelector)
pub fn SetSelector(&mut self, Selector: TransportSelector)
Sets the selector to use for auto-selection.
Sourcepub async fn WaitForReady(
&self,
Name: &str,
Timeout: Duration,
) -> Result<(), TransportError>
pub async fn WaitForReady( &self, Name: &str, Timeout: Duration, ) -> Result<(), TransportError>
Waits for a transport to be ready (connected) with timeout.