pub struct PostgresStoreConfig {
pub max_connections: u32,
pub min_connections: u32,
pub acquire_timeout: Duration,
pub idle_timeout: Option<Duration>,
pub max_lifetime: Option<Duration>,
pub lock_timeout: Option<Duration>,
pub statement_timeout: Option<Duration>,
}Expand description
Connection-pool and per-connection timeout knobs for PostgresStorage.
Session commits use optimistic CAS on the head (UPDATE … WHERE head_revision = expected), not a held SELECT … FOR UPDATE, so concurrent
writers never pin a pool connection while blocked on a lock. lock_timeout is
defense in depth: it caps how long the single CAS write may wait on the head
row’s lock before erroring (surfaced as a retryable conflict), so a pathological
burst can never starve the pool.
Fields§
§max_connections: u32Maximum pooled connections. Default 16.
min_connections: u32Minimum idle connections kept warm. Default 0.
acquire_timeout: DurationHow long acquire waits for a free connection before erroring. Default 30s.
idle_timeout: Option<Duration>Close a connection after this idle period. Default 10m.
max_lifetime: Option<Duration>Recycle a connection after this lifetime. Default 30m.
lock_timeout: Option<Duration>Postgres lock_timeout applied to every connection. Default 10s.
statement_timeout: Option<Duration>Postgres statement_timeout applied to every connection. Default 30s — a
backstop so a wedged query can never hold a connection indefinitely.
Trait Implementations§
Source§impl Clone for PostgresStoreConfig
impl Clone for PostgresStoreConfig
Source§fn clone(&self) -> PostgresStoreConfig
fn clone(&self) -> PostgresStoreConfig
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 PostgresStoreConfig
impl Debug for PostgresStoreConfig
Auto Trait Implementations§
impl Freeze for PostgresStoreConfig
impl RefUnwindSafe for PostgresStoreConfig
impl Send for PostgresStoreConfig
impl Sync for PostgresStoreConfig
impl Unpin for PostgresStoreConfig
impl UnsafeUnpin for PostgresStoreConfig
impl UnwindSafe for PostgresStoreConfig
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
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