pub struct ReplicaManager { /* private fields */ }Expand description
Read replica manager
Implementations§
Source§impl ReplicaManager
impl ReplicaManager
Sourcepub fn new(primary: String, replicas: Vec<ReplicaConfig>) -> Self
pub fn new(primary: String, replicas: Vec<ReplicaConfig>) -> Self
Create a new replica manager
Sourcepub async fn get_read_replica(&self, preferred_region: Option<&str>) -> String
pub async fn get_read_replica(&self, preferred_region: Option<&str>) -> String
Get the best replica for read operations
Sourcepub fn get_primary(&self) -> &str
pub fn get_primary(&self) -> &str
Get primary connection for write operations
Sourcepub async fn update_health(
&self,
replica_id: &str,
is_healthy: bool,
lag_ms: u64,
)
pub async fn update_health( &self, replica_id: &str, is_healthy: bool, lag_ms: u64, )
Update replica health status
Sourcepub async fn health_check_all(&self)
pub async fn health_check_all(&self)
Health check all replicas
Auto Trait Implementations§
impl Freeze for ReplicaManager
impl !RefUnwindSafe for ReplicaManager
impl Send for ReplicaManager
impl Sync for ReplicaManager
impl Unpin for ReplicaManager
impl !UnwindSafe for ReplicaManager
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