pub struct ManagedConnection {
pub config: McpServerConnectionConfig,
pub transport: RwLock<Option<Arc<dyn McpTransport>>>,
pub circuit_breaker: CircuitBreaker,
pub restart_count: AtomicU32,
pub shutdown_requested: AtomicBool,
pub restart_notify: Notify,
pub failure_tx: Sender<()>,
}Expand description
Connection state for a managed server.
Fields§
§config: McpServerConnectionConfigOriginal configuration (used for restarts)
transport: RwLock<Option<Arc<dyn McpTransport>>>Current transport (may be replaced on restart)
circuit_breaker: CircuitBreakerCircuit breaker for resilient connections
restart_count: AtomicU32Number of restart attempts
shutdown_requested: AtomicBoolWhether shutdown has been requested
restart_notify: NotifyNotifier for restart events
failure_tx: Sender<()>Broadcast channel to notify pending requests of failure
Implementations§
Source§impl ManagedConnection
impl ManagedConnection
Sourcepub fn new(config: McpServerConnectionConfig) -> Self
pub fn new(config: McpServerConnectionConfig) -> Self
Create a new managed connection.
Sourcepub async fn get_transport(&self) -> Option<Arc<dyn McpTransport>>
pub async fn get_transport(&self) -> Option<Arc<dyn McpTransport>>
Get the transport if available.
Sourcepub fn subscribe_failures(&self) -> Receiver<()>
pub fn subscribe_failures(&self) -> Receiver<()>
Subscribe to failure notifications.
Sourcepub fn notify_failure(&self)
pub fn notify_failure(&self)
Notify pending requests of failure.
Auto Trait Implementations§
impl !Freeze for ManagedConnection
impl !RefUnwindSafe for ManagedConnection
impl Send for ManagedConnection
impl Sync for ManagedConnection
impl Unpin for ManagedConnection
impl !UnwindSafe for ManagedConnection
Blanket Implementations§
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