Struct redis::aio::ConnectionManager [−][src]
pub struct ConnectionManager { /* fields omitted */ }
aio
only.Expand description
A ConnectionManager
is a proxy that wraps a multiplexed
connection and automatically reconnects to the
server when necessary.
Like the MultiplexedConnection
, this
manager can be cloned, allowing requests to be be sent concurrently on
the same underlying connection (tcp/unix socket).
Behavior
- When creating an instance of the
ConnectionManager
, an initial connection will be established and awaited. Connection errors will be returned directly. - When a command sent to the server fails with an error that represents a “connection dropped” condition, that error will be passed on to the user, but it will trigger a reconnection in the background.
- The reconnect code will atomically swap the current (dead) connection
with a future that will eventually resolve to a
MultiplexedConnection
or to aRedisError
- All commands that are issued after the reconnect process has been initiated, will have to await the connection future.
- If reconnecting fails, all pending commands will be failed as well. A new reconnection attempt will be triggered if the error is an I/O error.
Implementations
Connect to the server and store the connection inside the returned ConnectionManager
.
This requires the connection-manager
feature, which will also pull in
the Tokio executor.
Trait Implementations
Sends an already encoded (packed) command into the TCP socket and reads the single response from it. Read more
fn req_packed_commands<'a>(
&'a mut self,
cmd: &'a Pipeline,
offset: usize,
count: usize
) -> RedisFuture<'a, Vec<Value>>
fn req_packed_commands<'a>(
&'a mut self,
cmd: &'a Pipeline,
offset: usize,
count: usize
) -> RedisFuture<'a, Vec<Value>>
Sends multiple already encoded (packed) command into the TCP socket
and reads count
responses from it. This is used to implement
pipelining. Read more
Auto Trait Implementations
impl !RefUnwindSafe for ConnectionManager
impl Send for ConnectionManager
impl Sync for ConnectionManager
impl Unpin for ConnectionManager
impl !UnwindSafe for ConnectionManager
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V