pub struct ReplicaPoolManager { /* private fields */ }Expand description
Database pool manager with read replica support
Implementations§
Source§impl ReplicaPoolManager
impl ReplicaPoolManager
Sourcepub async fn new(config: ReplicaConfig) -> Result<Self>
pub async fn new(config: ReplicaConfig) -> Result<Self>
Create a new replica pool manager
Sourcepub async fn with_retry(
config: ReplicaConfig,
retry_config: &RetryConfig,
) -> Result<Self>
pub async fn with_retry( config: ReplicaConfig, retry_config: &RetryConfig, ) -> Result<Self>
Create with retry configuration
Sourcepub fn write_pool(&self) -> &PgPool
pub fn write_pool(&self) -> &PgPool
Get a pool for write operations (always primary)
Sourcepub fn all_pools(&self) -> impl Iterator<Item = &PgPool>
pub fn all_pools(&self) -> impl Iterator<Item = &PgPool>
Get all pools (primary + replicas) for operations that need both
Sourcepub fn replica_count(&self) -> usize
pub fn replica_count(&self) -> usize
Get number of available replicas
Sourcepub fn has_replicas(&self) -> bool
pub fn has_replicas(&self) -> bool
Check if replicas are configured
Sourcepub async fn health_status(&self) -> ReplicaHealthStatus
pub async fn health_status(&self) -> ReplicaHealthStatus
Get health status of all pools
Auto Trait Implementations§
impl !Freeze for ReplicaPoolManager
impl !RefUnwindSafe for ReplicaPoolManager
impl Send for ReplicaPoolManager
impl Sync for ReplicaPoolManager
impl Unpin for ReplicaPoolManager
impl !UnwindSafe for ReplicaPoolManager
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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