From 949b01cb9d93cb1fe7ee4eb54c9d1f3c6c6e988c Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Tue, 21 Jul 2020 15:09:44 -0700 Subject: [PATCH] Remove 'redis' integration from 'contrib'. The latest version of 'redis' is async and implements its own connection retrieval. --- contrib/lib/Cargo.toml | 3 --- contrib/lib/src/databases.rs | 19 ------------------- scripts/test.sh | 1 - site/guide/6-state.md | 3 --- 4 files changed, 26 deletions(-) diff --git a/contrib/lib/Cargo.toml b/contrib/lib/Cargo.toml index 2cea1959..60797a2c 100644 --- a/contrib/lib/Cargo.toml +++ b/contrib/lib/Cargo.toml @@ -35,7 +35,6 @@ diesel_mysql_pool = ["databases", "diesel/mysql", "diesel/r2d2"] postgres_pool = ["databases", "postgres", "r2d2_postgres"] mysql_pool = ["databases", "mysql", "r2d2_mysql"] sqlite_pool = ["databases", "rusqlite", "r2d2_sqlite"] -redis_pool = ["databases", "redis", "r2d2_redis"] memcache_pool = ["databases", "memcache", "r2d2-memcache"] [dependencies] @@ -68,8 +67,6 @@ mysql = { version = "18.0", optional = true } r2d2_mysql = { version = "18.0", optional = true } rusqlite = { version = "0.23", optional = true } r2d2_sqlite = { version = "0.16", optional = true } -redis = { version = "0.15", optional = true } -r2d2_redis = { version = "0.13", optional = true } memcache = { version = "0.14", optional = true } r2d2-memcache = { version = "0.5", optional = true } diff --git a/contrib/lib/src/databases.rs b/contrib/lib/src/databases.rs index 86f14035..16dae8ba 100644 --- a/contrib/lib/src/databases.rs +++ b/contrib/lib/src/databases.rs @@ -345,18 +345,15 @@ //! | Postgres | [Rust-Postgres] | `0.17` | [`postgres::Client`] | `postgres_pool` | //! | Sqlite | [Diesel] | `1` | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` | //! | Sqlite | [`Rusqlite`] | `0.23` | [`rusqlite::Connection`] | `sqlite_pool` | -//! | Redis | [`redis-rs`] | `0.15` | [`redis::Connection`] | `redis_pool` | //! | Memcache | [`memcache`] | `0.14` | [`memcache::Client`] | `memcache_pool` | //! //! [Diesel]: https://diesel.rs -//! [`redis::Connection`]: https://docs.rs/redis/0.15.0/redis/struct.Connection.html //! [`rusqlite::Connection`]: https://docs.rs/rusqlite/0.23.0/rusqlite/struct.Connection.html //! [`diesel::SqliteConnection`]: http://docs.diesel.rs/diesel/prelude/struct.SqliteConnection.html //! [`postgres::Client`]: https://docs.rs/postgres/0.17/postgres/struct.Client.html //! [`diesel::PgConnection`]: http://docs.diesel.rs/diesel/pg/struct.PgConnection.html //! [`mysql::Conn`]: https://docs.rs/mysql/18/mysql/struct.Conn.html //! [`diesel::MysqlConnection`]: http://docs.diesel.rs/diesel/mysql/struct.MysqlConnection.html -//! [`redis-rs`]: https://github.com/mitsuhiko/redis-rs //! [`Rusqlite`]: https://github.com/jgallagher/rusqlite //! [Rust-Postgres]: https://github.com/sfackler/rust-postgres //! [`rust-mysql-simple`]: https://github.com/blackbeam/rust-mysql-simple @@ -410,9 +407,6 @@ use self::r2d2::ManageConnection; #[cfg(feature = "sqlite_pool")] pub extern crate rusqlite; #[cfg(feature = "sqlite_pool")] pub extern crate r2d2_sqlite; -#[cfg(feature = "redis_pool")] pub extern crate redis; -#[cfg(feature = "redis_pool")] pub extern crate r2d2_redis; - #[cfg(feature = "memcache_pool")] pub extern crate memcache; #[cfg(feature = "memcache_pool")] pub extern crate r2d2_memcache; @@ -614,7 +608,6 @@ impl<'a> Display for ConfigError { /// * `postgres::Connection` /// * `mysql::Conn` /// * `rusqlite::Connection` -/// * `redis::Connection` /// /// # Implementation Guide /// @@ -777,18 +770,6 @@ impl Poolable for rusqlite::Connection { } } -#[cfg(feature = "redis_pool")] -impl Poolable for redis::Connection { - type Manager = r2d2_redis::RedisConnectionManager; - type Error = DbError; - - fn pool(config: DatabaseConfig<'_>) -> Result, Self::Error> { - let manager = r2d2_redis::RedisConnectionManager::new(config.url).map_err(DbError::Custom)?; - r2d2::Pool::builder().max_size(config.pool_size).build(manager) - .map_err(DbError::PoolError) - } -} - #[cfg(feature = "memcache_pool")] impl Poolable for memcache::Client { type Manager = r2d2_memcache::MemcacheConnectionManager; diff --git a/scripts/test.sh b/scripts/test.sh index 5ee3f49b..3110477b 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -75,7 +75,6 @@ if [ "$1" = "--contrib" ]; then postgres_pool mysql_pool sqlite_pool - redis_pool memcache_pool brotli_compression gzip_compression diff --git a/site/guide/6-state.md b/site/guide/6-state.md index bbac0716..11102932 100644 --- a/site/guide/6-state.md +++ b/site/guide/6-state.md @@ -235,19 +235,16 @@ Presently, Rocket provides built-in support for the following databases: | Postgres | [Rust-Postgres] | `0.17` | [`postgres::Client`] | `postgres_pool` | | Sqlite | [Diesel] | `1` | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` | | Sqlite | [`Rusqlite`] | `0.23` | [`rusqlite::Connection`] | `sqlite_pool` | -| Redis | [`redis-rs`] | `0.15` | [`redis::Connection`] | `redis_pool` | | Memcache | [`memcache`] | `0.14` | [`memcache::Client`] | `memcache_pool` | [`r2d2`]: https://crates.io/crates/r2d2 [Diesel]: https://diesel.rs -[`redis::Connection`]: https://docs.rs/redis/0.15.0/redis/struct.Connection.html [`rusqlite::Connection`]: https://docs.rs/rusqlite/0.23.0/rusqlite/struct.Connection.html [`diesel::SqliteConnection`]: http://docs.diesel.rs/diesel/prelude/struct.SqliteConnection.html [`postgres::Client`]: https://docs.rs/postgres/0.17/postgres/struct.Client.html [`diesel::PgConnection`]: http://docs.diesel.rs/diesel/pg/struct.PgConnection.html [`mysql::Conn`]: https://docs.rs/mysql/18/mysql/struct.Conn.html [`diesel::MysqlConnection`]: http://docs.diesel.rs/diesel/mysql/struct.MysqlConnection.html -[`redis-rs`]: https://github.com/mitsuhiko/redis-rs [`Rusqlite`]: https://github.com/jgallagher/rusqlite [Rust-Postgres]: https://github.com/sfackler/rust-postgres [`rust-mysql-simple`]: https://github.com/blackbeam/rust-mysql-simple