MultiRegionPoolManager

Struct MultiRegionPoolManager 

Source
pub struct MultiRegionPoolManager { /* private fields */ }
Expand description

Multi-region pool manager

Implementations§

Source§

impl MultiRegionPoolManager

Source

pub fn new(max_lag_seconds: f64) -> Self

Create a new multi-region pool manager

Source

pub async fn add_regional_pool(&self, config: RegionalPoolConfig) -> Result<()>

Add a regional pool

Source

pub fn get_regional_pool(&self, region_code: &str) -> Result<PgPool>

Get pool for a specific region

Source

pub fn get_closest_pool( &self, latitude: f64, longitude: f64, ) -> Result<(String, PgPool)>

Get pool for the closest region to a given location

Source

pub fn get_primary_pool(&self) -> Result<PgPool>

Get primary pool

Source

pub fn get_current_pool(&self) -> Result<PgPool>

Get pool for the current active region

Source

pub fn failover_to_region(&self, region_code: &str) -> Result<()>

Switch to a different region (failover)

Source

pub async fn measure_replication_lag( &self, source_region: &str, replica_region: &str, ) -> Result<ReplicationLag>

Measure replication lag for a replica

Source

pub fn get_replication_lags(&self) -> HashMap<String, ReplicationLag>

Get all replication lags

Source

pub fn are_all_replicas_healthy(&self) -> bool

Check if all replicas are healthy

Source

pub fn get_unhealthy_replicas(&self) -> Vec<String>

Get unhealthy replicas

Source

pub fn auto_failover(&self) -> Result<String>

Auto-failover to the best available region

Source

pub fn list_regions(&self) -> Vec<RegionalPoolConfig>

List all regions

Source

pub fn get_current_region(&self) -> Option<String>

Get current region

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more