pub enum RecycleStrategy {
SelectOne,
Ping,
None,
Custom(RecycleCheck),
}Expand description
Variants§
SelectOne
Run an unconditional ROLLBACK round-trip on every checkout. The
default — catches a half-dead connection at acquire time at the cost
of one round-trip, and discharges any transaction left open by a
panicked or cancelled AsyncTransaction
guard (issue #263: Rust has no async Drop, so that guard cannot
roll back itself and can only warn). ROLLBACK on a connection with
no open transaction is a harmless, zero-row no-op — confirmed against
the real engine — so this costs exactly the same one round-trip that
the prior SELECT 1 probe did; it does not add a second round-trip.
Ping
Call AsyncConnection::ping on every checkout (equivalent round-trip,
expressed via the connection’s own health primitive).
Unlike SelectOne, this does not discharge a
transaction left open by a panicked or cancelled AsyncTransaction
guard — ping only reads. Prefer SelectOne (the default) if your
workload uses AsyncTransaction.
None
Skip connection validation entirely: no round-trip, and no passive check either — recycling is a genuine no-op, so a connection is handed out in whatever state the previous borrower left it. Use on hot paths where the round-trip cost outweighs detecting a dead connection early, and expect the failure to surface on first use instead.
Does not discharge a transaction left open by a panicked or cancelled
AsyncTransaction guard — there is no round-trip at all to piggyback
on. Avoid combining with AsyncTransaction unless you independently
guarantee every transaction is committed or rolled back.
Custom(RecycleCheck)
Run a user-supplied async check on every checkout.
Like Ping, does not itself discharge a transaction
left open by a panicked or cancelled AsyncTransaction guard; add an
unconditional ROLLBACK to your check if your workload needs that.
Trait Implementations§
Source§impl Clone for RecycleStrategy
impl Clone for RecycleStrategy
Source§fn clone(&self) -> RecycleStrategy
fn clone(&self) -> RecycleStrategy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RecycleStrategy
impl Debug for RecycleStrategy
Source§impl Default for RecycleStrategy
impl Default for RecycleStrategy
Source§fn default() -> RecycleStrategy
fn default() -> RecycleStrategy
Auto Trait Implementations§
impl !RefUnwindSafe for RecycleStrategy
impl !UnwindSafe for RecycleStrategy
impl Freeze for RecycleStrategy
impl Send for RecycleStrategy
impl Sync for RecycleStrategy
impl Unpin for RecycleStrategy
impl UnsafeUnpin for RecycleStrategy
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> 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