pub struct RedisSentinelHandle { /* private fields */ }Expand description
A running Redis Sentinel topology. Stops everything on Drop.
Implementations§
Source§impl RedisSentinelHandle
impl RedisSentinelHandle
Sourcepub fn master_addr(&self) -> String
pub fn master_addr(&self) -> String
The master’s address.
Sourcepub fn monitored_master_names(&self) -> Vec<&str>
pub fn monitored_master_names(&self) -> Vec<&str>
All monitored master names.
Sourcepub fn monitored_master_addrs(&self) -> Vec<String>
pub fn monitored_master_addrs(&self) -> Vec<String>
All monitored master addresses.
Sourcepub fn pids(&self) -> Vec<u32>
pub fn pids(&self) -> Vec<u32>
The PIDs of all processes in the topology (master, replicas, sentinels).
Sourcepub fn sentinel_addrs(&self) -> Vec<String>
pub fn sentinel_addrs(&self) -> Vec<String>
All sentinel addresses.
Sourcepub fn master_name(&self) -> &str
pub fn master_name(&self) -> &str
The monitored master name.
Sourcepub async fn poke(&self) -> Result<HashMap<String, String>>
pub async fn poke(&self) -> Result<HashMap<String, String>>
Query a sentinel for the primary monitored master’s status.
Iterates over the sentinel processes until one responds, then runs
SENTINEL MASTER <name> and returns the result as a flat key/value map.
Common keys in the returned map include "ip", "port", "flags",
"num-slaves", and "num-other-sentinels".
Returns Error::NoReachableSentinel if no sentinel responds.
Sourcepub async fn poke_master(
&self,
master_name: &str,
) -> Result<HashMap<String, String>>
pub async fn poke_master( &self, master_name: &str, ) -> Result<HashMap<String, String>>
Query a sentinel for a specific monitored master’s status.
Like poke but targets master_name instead of the
primary master configured for this topology.
Sourcepub async fn is_healthy(&self) -> bool
pub async fn is_healthy(&self) -> bool
Check if the topology is healthy.
Sourcepub async fn wait_for_healthy(&self, timeout: Duration) -> Result<()>
pub async fn wait_for_healthy(&self, timeout: Duration) -> Result<()>
Wait until the topology is healthy or timeout.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RedisSentinelHandle
impl RefUnwindSafe for RedisSentinelHandle
impl Send for RedisSentinelHandle
impl Sync for RedisSentinelHandle
impl Unpin for RedisSentinelHandle
impl UnsafeUnpin for RedisSentinelHandle
impl UnwindSafe for RedisSentinelHandle
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> 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