pub struct MultiplexPool<C, ID> { /* private fields */ }std only.Expand description
Connection pool that multiplexes concurrent users over shared connections.
Implementations§
Source§impl<C, ID> MultiplexPool<C, ID>
impl<C, ID> MultiplexPool<C, ID>
Sourcepub fn new(
max_concurrent_streams: NonZeroUsize,
max_total: NonZeroUsize,
) -> Self
pub fn new( max_concurrent_streams: NonZeroUsize, max_total: NonZeroUsize, ) -> Self
Create a new MultiplexPool from validated, non-zero limits.
Sourcepub fn try_new(
max_concurrent_streams: usize,
max_total: usize,
) -> Result<Self, BoxError>
pub fn try_new( max_concurrent_streams: usize, max_total: usize, ) -> Result<Self, BoxError>
Create a new MultiplexPool.
max_concurrent_streams: upper bound on the concurrent users a single connection serves. The actual per-connection concurrency is the minimum of this and the connection’sMaxConcurrencyextension (usize::MAXif unset), so useusize::MAXto defer entirely to what each connection advertises.max_total: max number of connections (across all ids).
Sourcepub fn maybe_with_idle_timeout(self, timeout: Option<Duration>) -> Self
pub fn maybe_with_idle_timeout(self, timeout: Option<Duration>) -> Self
Drop connections that have been idle (no active streams) for longer than the given timeout. Only checked when a connection is requested.
Sourcepub fn maybe_set_idle_timeout(&mut self, timeout: Option<Duration>) -> &mut Self
pub fn maybe_set_idle_timeout(&mut self, timeout: Option<Duration>) -> &mut Self
Drop connections that have been idle (no active streams) for longer than the given timeout. Only checked when a connection is requested.
Sourcepub fn with_idle_timeout(self, timeout: Duration) -> Self
pub fn with_idle_timeout(self, timeout: Duration) -> Self
Drop connections that have been idle (no active streams) for longer than the given timeout. Only checked when a connection is requested.
Sourcepub fn set_idle_timeout(&mut self, timeout: Duration) -> &mut Self
pub fn set_idle_timeout(&mut self, timeout: Duration) -> &mut Self
Drop connections that have been idle (no active streams) for longer than the given timeout. Only checked when a connection is requested.
Sourcepub fn without_idle_timeout(self) -> Self
pub fn without_idle_timeout(self) -> Self
Drop connections that have been idle (no active streams) for longer than the given timeout. Only checked when a connection is requested.
Sourcepub fn unset_idle_timeout(&mut self) -> &mut Self
pub fn unset_idle_timeout(&mut self) -> &mut Self
Drop connections that have been idle (no active streams) for longer than the given timeout. Only checked when a connection is requested.
Sourcepub fn with_selection(self, selection: MuxSelection) -> Self
pub fn with_selection(self, selection: MuxSelection) -> Self
Set the MuxSelection strategy used to pick among same-id connections.
Sourcepub fn set_selection(&mut self, selection: MuxSelection) -> &mut Self
pub fn set_selection(&mut self, selection: MuxSelection) -> &mut Self
Set the MuxSelection strategy used to pick among same-id connections.
pub fn maybe_with_metrics(self, metrics: Option<Arc<PoolMetrics>>) -> Self
opentelemetry only.pub fn maybe_set_metrics( &mut self, metrics: Option<Arc<PoolMetrics>>, ) -> &mut Self
opentelemetry only.pub fn with_metrics(self, metrics: Arc<PoolMetrics>) -> Self
opentelemetry only.pub fn set_metrics(&mut self, metrics: Arc<PoolMetrics>) -> &mut Self
opentelemetry only.pub fn without_metrics(self) -> Self
opentelemetry only.pub fn unset_metrics(&mut self) -> &mut Self
opentelemetry only.Trait Implementations§
Source§impl<C, ID> Clone for MultiplexPool<C, ID>
impl<C, ID> Clone for MultiplexPool<C, ID>
Source§impl<C, ID> Debug for MultiplexPool<C, ID>
impl<C, ID> Debug for MultiplexPool<C, ID>
impl<C, ID> Extension for MultiplexPool<C, ID>
impl<C, ID> NetExtension for MultiplexPool<C, ID>
Source§impl<C, ID> Pool<C, ID> for MultiplexPool<C, ID>
impl<C, ID> Pool<C, ID> for MultiplexPool<C, ID>
type Connection = MultiplexedConnection<C, ID>
type CreatePermit = PoolSlot
Source§async fn get_conn(
&self,
id: &ID,
) -> Result<ConnectionResult<Self::Connection, Self::CreatePermit>, BoxError>
async fn get_conn( &self, id: &ID, ) -> Result<ConnectionResult<Self::Connection, Self::CreatePermit>, BoxError>
Pool::CreatePermit is returned Read moreAuto Trait Implementations§
impl<C, ID> !RefUnwindSafe for MultiplexPool<C, ID>
impl<C, ID> !UnwindSafe for MultiplexPool<C, ID>
impl<C, ID> Freeze for MultiplexPool<C, ID>
impl<C, ID> Send for MultiplexPool<C, ID>
impl<C, ID> Sync for MultiplexPool<C, ID>
impl<C, ID> Unpin for MultiplexPool<C, ID>
impl<C, ID> UnsafeUnpin for MultiplexPool<C, ID>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
Source§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<V, F> ValueFormatter<&V> for F
impl<V, F> ValueFormatter<&V> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &&V)
fn format_value(writer: impl ValueWriter, value: &&V)
value to writerSource§impl<V, F> ValueFormatter<Arc<V>> for F
impl<V, F> ValueFormatter<Arc<V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Arc<V>)
fn format_value(writer: impl ValueWriter, value: &Arc<V>)
value to writerSource§impl<V, F> ValueFormatter<Box<V>> for F
impl<V, F> ValueFormatter<Box<V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Box<V>)
fn format_value(writer: impl ValueWriter, value: &Box<V>)
value to writerSource§impl<V, F> ValueFormatter<Cow<'_, V>> for F
impl<V, F> ValueFormatter<Cow<'_, V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
value to writerSource§impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Option<V>)
fn format_value(writer: impl ValueWriter, value: &Option<V>)
value to writer