pub struct Sentinel { /* private fields */ }
Expand description
The Sentinel type, serves as a special purpose client which builds other clients on demand.
Implementations§
source§impl Sentinel
impl Sentinel
sourcepub fn build<T: IntoConnectionInfo>(params: Vec<T>) -> RedisResult<Sentinel>
pub fn build<T: IntoConnectionInfo>(params: Vec<T>) -> RedisResult<Sentinel>
Creates a Sentinel client performing some basic checks on the URLs that might make the operation fail.
sourcepub fn master_for(
&mut self,
service_name: &str,
node_connection_info: Option<&SentinelNodeConnectionInfo>
) -> RedisResult<Client>
pub fn master_for( &mut self, service_name: &str, node_connection_info: Option<&SentinelNodeConnectionInfo> ) -> RedisResult<Client>
Determines the masters address for the given name, and returns a client for that master.
sourcepub fn replica_for(
&mut self,
service_name: &str,
node_connection_info: Option<&SentinelNodeConnectionInfo>
) -> RedisResult<Client>
pub fn replica_for( &mut self, service_name: &str, node_connection_info: Option<&SentinelNodeConnectionInfo> ) -> RedisResult<Client>
Connects to a randomly chosen replica of the given master name.
sourcepub fn replica_rotate_for(
&mut self,
service_name: &str,
node_connection_info: Option<&SentinelNodeConnectionInfo>
) -> RedisResult<Client>
pub fn replica_rotate_for( &mut self, service_name: &str, node_connection_info: Option<&SentinelNodeConnectionInfo> ) -> RedisResult<Client>
Attempts to connect to a different replica of the given master name each time. There is no guarantee that we’ll actually be connecting to a different replica in the next call, but in a static set of replicas (no replicas added or removed), on average we’ll choose each replica the same number of times.
source§impl Sentinel
impl Sentinel
sourcepub async fn async_master_for(
&mut self,
service_name: &str,
node_connection_info: Option<&SentinelNodeConnectionInfo>
) -> RedisResult<Client>
pub async fn async_master_for( &mut self, service_name: &str, node_connection_info: Option<&SentinelNodeConnectionInfo> ) -> RedisResult<Client>
Determines the masters address for the given name, and returns a client for that master.
sourcepub async fn async_replica_for(
&mut self,
service_name: &str,
node_connection_info: Option<&SentinelNodeConnectionInfo>
) -> RedisResult<Client>
pub async fn async_replica_for( &mut self, service_name: &str, node_connection_info: Option<&SentinelNodeConnectionInfo> ) -> RedisResult<Client>
Connects to a randomly chosen replica of the given master name.
sourcepub async fn async_replica_rotate_for<'a>(
&mut self,
service_name: &str,
node_connection_info: Option<&SentinelNodeConnectionInfo>
) -> RedisResult<Client>
pub async fn async_replica_rotate_for<'a>( &mut self, service_name: &str, node_connection_info: Option<&SentinelNodeConnectionInfo> ) -> RedisResult<Client>
Attempts to connect to a different replica of the given master name each time. There is no guarantee that we’ll actually be connecting to a different replica in the next call, but in a static set of replicas (no replicas added or removed), on average we’ll choose each replica the same number of times.