Skip to main content

TransportRegistry

Struct TransportRegistry 

Source
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: TransportSelector

Transport selector for auto-selection

Implementations§

Source§

impl TransportRegistry

Source

pub fn New() -> Self

Creates a new, empty transport registry.

Source

pub fn WithSelector(Selector: TransportSelector) -> Self

Creates a new registry with a custom selector.

Source

pub fn Register( &mut self, Name: String, Transport: Arc<dyn CommonTransportStrategy>, )

Registers a new transport with the registry.

Source

pub async fn Unregister(&mut self, Name: &str) -> Result<(), TransportError>

Unregisters a transport from the registry.

Source

pub async fn Select(&mut self, Name: &str) -> Result<(), TransportError>

Selects a transport by name as the active transport.

Source

pub async fn AutoSelect( &mut self, Context: &TransportContext, ) -> Result<String, TransportError>

Automatically selects the best transport based on the provided context.

Source

pub fn GetActive(&self) -> Option<Arc<dyn CommonTransportStrategy>>

Gets the currently active transport, if any.

Source

pub fn Get(&self, Name: &str) -> Option<Arc<dyn CommonTransportStrategy>>

Gets a specific transport by name.

Source

pub fn List(&self) -> Vec<String>

Lists all registered transport names.

Source

pub fn Has(&self, Name: &str) -> bool

Checks if a transport with the given name is registered.

Source

pub fn GetAllMetrics(&self) -> HashMap<String, TransportMetrics>

Gets metrics for all registered transports.

Source

pub fn GetHealthStatus(&self) -> HashMap<String, bool>

Gets health status (connected/not connected) for all transports.

Source

pub fn ActiveName(&self) -> Option<&str>

Gets the name of the currently active transport.

Source

pub fn SetSelector(&mut self, Selector: TransportSelector)

Sets the selector to use for auto-selection.

Source

pub async fn WaitForReady( &self, Name: &str, Timeout: Duration, ) -> Result<(), TransportError>

Waits for a transport to be ready (connected) with timeout.

Trait Implementations§

Source§

impl Default for TransportRegistry

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<T> AutoreleaseSafe for T
where T: ?Sized,