pub struct IsleDrivers { /* private fields */ }Expand description
The lifecycle owners of the connection threads a session’s log lives on.
rusqlite_isle::AsyncIsle hands back a cloneable handle and a driver
that is not clonable: the driver owns the thread’s join handle and is the
only thing that can drain and stop it. A session cannot hold its own —
the whole point of the drop backstop is that a handle nobody closed can
still hand its session_closed to the isle after the handle is gone, and
a thread its own store had already stopped could not take it.
So the drivers are parked here instead: one collection per host run, shut
down once at the end of it, exactly as the std.ts connection thread is.
Cheap to clone (an Arc), because every site that opens a store needs to
reach it.
The lock is a plain Mutex and is never held across an .await:
IsleDrivers::shutdown takes the whole list out under the lock and
releases it before it starts waiting on the first thread.
Implementations§
Source§impl IsleDrivers
impl IsleDrivers
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether no connection thread has been opened (or all were drained).
Sourcepub async fn shutdown(&self) -> Vec<IsleError>
pub async fn shutdown(&self) -> Vec<IsleError>
Drain every thread: queued jobs run to completion, then each thread stops and is joined.
The queued jobs matter — the drop backstop submits its session_closed
without waiting for it, so this is where those land. Failures are
collected rather than raised on the first one: a thread that panicked
is no reason to leave the rest running.
Idempotent: a second call finds nothing parked and returns an empty list.
Trait Implementations§
Source§impl Clone for IsleDrivers
impl Clone for IsleDrivers
Source§fn clone(&self) -> IsleDrivers
fn clone(&self) -> IsleDrivers
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 IsleDrivers
impl Debug for IsleDrivers
Source§impl Default for IsleDrivers
impl Default for IsleDrivers
Source§fn default() -> IsleDrivers
fn default() -> IsleDrivers
Auto Trait Implementations§
impl Freeze for IsleDrivers
impl RefUnwindSafe for IsleDrivers
impl Send for IsleDrivers
impl Sync for IsleDrivers
impl Unpin for IsleDrivers
impl UnsafeUnpin for IsleDrivers
impl UnwindSafe for IsleDrivers
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> 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 more