pub struct ConnectionManager { /* private fields */ }
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 a RedisError
  • 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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Sends an already encoded (packed) command into the TCP socket and reads the single response from it. Read more

Sends multiple already encoded (packed) command into the TCP socket and reads count responses from it. This is used to implement pipelining. Read more

Returns the database this connection is bound to. Note that this information might be unreliable because it’s initially cached and also might be incorrect if the connection like object is not actually connected. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.