Struct redis_sk::aio::ConnectionManager[][src]

pub struct ConnectionManager { /* fields omitted */ }
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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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.