pub struct MultiConnectorRunner { /* private fields */ }Expand description
Runs N independently-approvable connectors over a shared transport.
See module-level docs for transport semantics. From the Matrix server’s
point of view, each registration is a normal Connect RPC.
Implementations§
Source§impl MultiConnectorRunner
impl MultiConnectorRunner
Sourcepub fn new(
opts: MultiTransportOptions,
registrations: Vec<ConnectorRegistration>,
) -> Self
pub fn new( opts: MultiTransportOptions, registrations: Vec<ConnectorRegistration>, ) -> Self
Create a new runner. Construction does not open any connections —
transport is established lazily by MultiConnectorRunner::run.
Duplicate registrations (same tenant.type.instance) are rejected by
MultiConnectorRunner::add; duplicates passed in here are reduced
to the first occurrence and logged.
Sourcepub async fn add(&self, registration: ConnectorRegistration) -> Result<()>
pub async fn add(&self, registration: ConnectorRegistration) -> Result<()>
Append a registration. Only valid before MultiConnectorRunner::run
is called; returns an error if run() has already started or if the
registration’s tenant.type.instance collides with an existing one.
running is checked inside the same write-lock critical section
that run() uses to snapshot the registration list, so a concurrent
add either lands before the snapshot (and is driven) or returns
ConnectorError::AlreadyRunning. There is no window where the
registration is silently dropped.
Sourcepub fn shutdown_handle(&self) -> ShutdownHandle
pub fn shutdown_handle(&self) -> ShutdownHandle
Get a ShutdownHandle that signals every registration to exit.
Sourcepub async fn registrations(&self) -> Vec<RegistrationKey>
pub async fn registrations(&self) -> Vec<RegistrationKey>
Snapshot of the registered keys (in insertion order).
Sourcepub async fn metrics_snapshot(
&self,
) -> HashMap<RegistrationKey, ConnectorMetrics>
pub async fn metrics_snapshot( &self, ) -> HashMap<RegistrationKey, ConnectorMetrics>
Per-registration metrics snapshot.
Each registration owns its own ConnectorMetrics (no global
singleton), so values are independent across registrations sharing the
same transport.
Sourcepub async fn run(&self) -> Result<()>
pub async fn run(&self) -> Result<()>
Run all registrations to completion or until shutdown.
Returns once every registration has exited. Individual registration
failures are logged but do not abort the runner unless
MultiTransportOptions::reconnect_enabled is false.
Auto Trait Implementations§
impl !Freeze for MultiConnectorRunner
impl !RefUnwindSafe for MultiConnectorRunner
impl Send for MultiConnectorRunner
impl Sync for MultiConnectorRunner
impl Unpin for MultiConnectorRunner
impl UnsafeUnpin for MultiConnectorRunner
impl !UnwindSafe for MultiConnectorRunner
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request