pub struct ConnectionTable<T>where
T: Clone,{ /* private fields */ }Expand description
A connection table that provides lock-free reads via ArcSwap.
Concurrency design:
- Hot read path (
get,for_each,len,is_empty): lock-free viaArcSwap::load(). A single atomic pointer load gives callers an immutable snapshot of the pool. - Write path (
insert,insert_at,remove): serialised bywrite_lock. Writers load the current snapshot, clone the pool, apply the change, then atomically store the newArc. No write lock is ever held during reads.
Connections are stored as Arc<T> so that pool clones (made on every
write) only bump refcounts rather than deep-copying each connection.
get() returns Option<Arc<T>>; callers can auto-deref into T.
Implementations§
Source§impl<T> ConnectionTable<T>where
T: Clone,
impl<T> ConnectionTable<T>where
T: Clone,
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for ConnectionTable<T>
impl<T> !RefUnwindSafe for ConnectionTable<T>
impl<T> Send for ConnectionTable<T>
impl<T> Sync for ConnectionTable<T>
impl<T> Unpin for ConnectionTable<T>
impl<T> UnsafeUnpin for ConnectionTable<T>
impl<T> UnwindSafe for ConnectionTable<T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
Wrap the input message
T in a tonic::Request