Struct sqlsrv::ConnPool

source ·
pub struct ConnPool { /* private fields */ }
Expand description

SQLite connection pool.

This is a somewhat specialized connection pool that only allows a single writer but multiple readers.

Implementations§

source§

impl ConnPool

source

pub fn reader(&self) -> Result<PooledConnection<SqliteConnectionManager>, Error>

Acquire a read-only connection.

source

pub fn writer(&self) -> WrConn

Acquire the read/write connection.

If the writer is already taken, then block and wait for it to become available.

source

pub fn try_writer(&self) -> Option<WrConn>

Attempt to acquire the writer connection.

Returns Some(conn) if the writer connection was available at the time of the request. Returns None if the writer has already been taken.

source

pub fn ro_run<F>(&self, f: F) -> Result<(), Error>
where F: FnOnce(&Connection) + Send + 'static,

Run a closure with a read-only connection

source

pub fn ro_run_result<F, T, E>(&self, f: F) -> Result<WaitCtx<T, (), E>, Error>
where F: FnOnce(&Connection, SetCtx<T, (), E>) + Send + 'static, T: Send + 'static, E: Send + 'static,

Run a closure with read-only connection, returning a channel end-point for retreiving result.

source

pub fn rw_run<F>(&self, f: F)
where F: FnOnce(&mut Connection) + Send + 'static,

Run a closure with read/write connection

source

pub fn rw_run_result<F, T, E>(&self, f: F) -> WaitCtx<T, (), E>
where F: FnOnce(&mut Connection, SetCtx<T, (), E>) + Send + 'static, T: Send + 'static, E: Send + 'static,

Run a closure with read/write connection, returning a channel end-point for retreiving result.

source

pub fn incremental_vacuum(&self, n: Option<usize>) -> WaitCtx<(), (), Error>

Perform an incremental vacuum.

n is the number of freelist nodes to reclaim. If None all nodes will be reclaimed.

source

pub fn shutdown(self)

Consume self and wait for all threads in thread pool to complete.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V