pub struct Sentinel { /* private fields */ }
sentinel
only.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 master’s address for the given name, and returns a client for that master. This will connect to the master node to verify that it considers itself master so errors can originate from interaction either with Sentinel or with the master node.
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 master’s address for the given name, and returns a client for that master. This will connect to the master node to verify that it considers itself master so errors can originate from interaction either with Sentinel or with the master node.
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. Errors can originate from interaction either with Sentinel or with the replica.
Sourcepub async fn async_replica_rotate_for(
&mut self,
service_name: &str,
node_connection_info: Option<&SentinelNodeConnectionInfo>,
) -> RedisResult<Client>
pub async fn async_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.