pub struct LeaderConfig {
pub check_interval: Duration,
pub lease_duration: Duration,
pub lock_validate_interval: Duration,
pub keepalive_interval: Duration,
}Expand description
Leader election configuration.
Fields§
§check_interval: DurationHow often standbys check leader health and leaders refresh the
forge_leaders lease row.
lease_duration: DurationLease duration. The leader must refresh before expiry or standbys will assume the seat is vacant.
lock_validate_interval: DurationHow often the leader re-checks pg_locks to confirm it still holds
the advisory lock on its lock-owning connection. Defaults to 1s so
a long lease (60s) still detects an out-of-band lock loss within a
second instead of waiting for the next refresh tick.
keepalive_interval: DurationHow often a lightweight SELECT 1 is issued on the lock-owning
connection to prevent firewalls, load-balancers, or PostgreSQL’s own
tcp_keepalives_idle from silently terminating an idle connection
and thereby releasing the advisory lock without the process noticing.
Should be well below the shortest idle-connection timeout in the
network path (typical firewall idle timeout is 5–10 minutes; 30 s
gives a comfortable margin). Defaults to 30 s.
Trait Implementations§
Source§impl Clone for LeaderConfig
impl Clone for LeaderConfig
Source§fn clone(&self) -> LeaderConfig
fn clone(&self) -> LeaderConfig
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 LeaderConfig
impl Debug for LeaderConfig
Auto Trait Implementations§
impl Freeze for LeaderConfig
impl RefUnwindSafe for LeaderConfig
impl Send for LeaderConfig
impl Sync for LeaderConfig
impl Unpin for LeaderConfig
impl UnsafeUnpin for LeaderConfig
impl UnwindSafe for LeaderConfig
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