diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a853a5cc..5446f483 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,9 +32,10 @@ jobs: - deadpool-redis - deadpool-sqlite # Examples + - example-diesel - example-postgres-actix-web + - example-postgres-axum - example-postgres-benchmark - - example-postgres-hyper - example-redis-actix-web runs-on: ubuntu-latest steps: @@ -158,12 +159,11 @@ jobs: - { crate: deadpool-runtime, msrv: '1.75.0' } - { crate: deadpool-sync, msrv: '1.75.0' } - { crate: deadpool, msrv: '1.75.0' } - # Disable Diesel MSRV check as it keeps failing for no obvious reason. - #- { crate: deadpool-diesel, msrv: '1.78.0' } + - { crate: deadpool-diesel, msrv: '1.78.0' } - { crate: deadpool-lapin, msrv: '1.75.0' } - { crate: deadpool-postgres, msrv: '1.75.0' } - { crate: deadpool-redis, msrv: '1.75.0' } - - { crate: deadpool-sqlite, msrv: '1.77.0' } + - { crate: deadpool-sqlite, msrv: '1.80.0' } runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -177,7 +177,7 @@ jobs: toolchain: ${{ matrix.msrv }} override: true - - run: cargo +nightly update -Z minimal-versions + - run: cargo +nightly update -Z direct-minimal-versions - run: cargo check -p ${{ matrix.crate }} --all-features diff --git a/Cargo.toml b/Cargo.toml index 951fbfdd..f1047539 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,59 +1,7 @@ -[package] -name = "deadpool" -version = "0.12.2" -edition = "2021" -rust-version = "1.75" -authors = ["Michael P. Jung "] -description = "Dead simple async pool" -keywords = ["async", "database", "pool"] -license = "MIT OR Apache-2.0" -repository = "https://github.com/bikeshedder/deadpool" -readme = "README.md" - -[package.metadata.docs.rs] -all-features = true -rustdoc-args = ["--cfg", "docsrs"] - -[features] -default = ["managed", "unmanaged"] -managed = [] -unmanaged = [] -rt_tokio_1 = ["deadpool-runtime/tokio_1"] -rt_async-std_1 = ["deadpool-runtime/async-std_1"] - -[dependencies] -num_cpus = "1.11.1" -# `serde` feature -serde = { version = "1.0.103", features = ["derive"], optional = true } -# `rt_async-std_1` feature -deadpool-runtime = { version = "0.1", path = "./runtime" } -# The dependency of tokio::sync is non-optional. Deadpool depends on -# `tokio::sync::Semaphore`. No other features of `tokio` are enabled or used -# unless the `rt_tokio_1` feature is enabled. -tokio = { version = "1.0", features = ["sync"] } - -[dev-dependencies] -async-std = { version = "1.0", features = ["attributes"] } -config = { version = "0.14", features = ["json"] } -criterion = { version = "0.5", features = ["html_reports", "async_tokio"] } -itertools = "0.13" -tokio = { version = "1.5.0", features = [ - "macros", - "rt", - "rt-multi-thread", - "time", -] } - -[[bench]] -name = "managed" -harness = false - -[[bench]] -name = "unmanaged" -harness = false - [workspace] +resolver = "2" members = [ + "deadpool", "diesel", "lapin", "memcached", diff --git a/CHANGELOG.md b/deadpool/CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to deadpool/CHANGELOG.md diff --git a/deadpool/Cargo.toml b/deadpool/Cargo.toml new file mode 100644 index 00000000..cdedce49 --- /dev/null +++ b/deadpool/Cargo.toml @@ -0,0 +1,53 @@ +[package] +name = "deadpool" +version = "0.12.2" +edition = "2021" +rust-version = "1.75" +authors = ["Michael P. Jung "] +description = "Dead simple async pool" +keywords = ["async", "database", "pool"] +license = "MIT OR Apache-2.0" +repository = "https://github.com/bikeshedder/deadpool" +readme = "README.md" + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + +[[bench]] +name = "managed" +harness = false + +[[bench]] +name = "unmanaged" +harness = false + +[features] +default = ["managed", "unmanaged"] +managed = [] +unmanaged = [] +rt_tokio_1 = ["deadpool-runtime/tokio_1"] +rt_async-std_1 = ["deadpool-runtime/async-std_1"] + +[dependencies] +num_cpus = "1.11.1" +# `serde` feature +serde = { version = "1.0.145", features = ["derive"], optional = true } +# `rt_async-std_1` feature +deadpool-runtime = { version = "0.1", path = "../runtime" } +# The dependency of tokio::sync is non-optional. Deadpool depends on +# `tokio::sync::Semaphore`. No other features of `tokio` are enabled or used +# unless the `rt_tokio_1` feature is enabled. +tokio = { version = "1.27", features = ["sync"] } + +[dev-dependencies] +async-std = { version = "1.13", features = ["attributes"] } +config = { version = "0.15", features = ["json"] } +criterion = { version = "0.5", features = ["html_reports", "async_tokio"] } +itertools = "0.14" +tokio = { version = "1.27", features = [ + "macros", + "rt", + "rt-multi-thread", + "time", +] } diff --git a/deadpool/LICENSE-APACHE b/deadpool/LICENSE-APACHE new file mode 120000 index 00000000..965b606f --- /dev/null +++ b/deadpool/LICENSE-APACHE @@ -0,0 +1 @@ +../LICENSE-APACHE \ No newline at end of file diff --git a/deadpool/LICENSE-MIT b/deadpool/LICENSE-MIT new file mode 120000 index 00000000..76219eb7 --- /dev/null +++ b/deadpool/LICENSE-MIT @@ -0,0 +1 @@ +../LICENSE-MIT \ No newline at end of file diff --git a/README.md b/deadpool/README.md similarity index 100% rename from README.md rename to deadpool/README.md diff --git a/benches/managed.rs b/deadpool/benches/managed.rs similarity index 100% rename from benches/managed.rs rename to deadpool/benches/managed.rs diff --git a/benches/unmanaged.rs b/deadpool/benches/unmanaged.rs similarity index 100% rename from benches/unmanaged.rs rename to deadpool/benches/unmanaged.rs diff --git a/src/lib.rs b/deadpool/src/lib.rs similarity index 100% rename from src/lib.rs rename to deadpool/src/lib.rs diff --git a/src/managed/builder.rs b/deadpool/src/managed/builder.rs similarity index 100% rename from src/managed/builder.rs rename to deadpool/src/managed/builder.rs diff --git a/src/managed/config.rs b/deadpool/src/managed/config.rs similarity index 100% rename from src/managed/config.rs rename to deadpool/src/managed/config.rs diff --git a/src/managed/dropguard.rs b/deadpool/src/managed/dropguard.rs similarity index 100% rename from src/managed/dropguard.rs rename to deadpool/src/managed/dropguard.rs diff --git a/src/managed/errors.rs b/deadpool/src/managed/errors.rs similarity index 100% rename from src/managed/errors.rs rename to deadpool/src/managed/errors.rs diff --git a/src/managed/hooks.rs b/deadpool/src/managed/hooks.rs similarity index 100% rename from src/managed/hooks.rs rename to deadpool/src/managed/hooks.rs diff --git a/src/managed/metrics.rs b/deadpool/src/managed/metrics.rs similarity index 100% rename from src/managed/metrics.rs rename to deadpool/src/managed/metrics.rs diff --git a/src/managed/mod.rs b/deadpool/src/managed/mod.rs similarity index 100% rename from src/managed/mod.rs rename to deadpool/src/managed/mod.rs diff --git a/src/managed/reexports.rs b/deadpool/src/managed/reexports.rs similarity index 100% rename from src/managed/reexports.rs rename to deadpool/src/managed/reexports.rs diff --git a/src/unmanaged/config.rs b/deadpool/src/unmanaged/config.rs similarity index 100% rename from src/unmanaged/config.rs rename to deadpool/src/unmanaged/config.rs diff --git a/src/unmanaged/errors.rs b/deadpool/src/unmanaged/errors.rs similarity index 100% rename from src/unmanaged/errors.rs rename to deadpool/src/unmanaged/errors.rs diff --git a/src/unmanaged/mod.rs b/deadpool/src/unmanaged/mod.rs similarity index 100% rename from src/unmanaged/mod.rs rename to deadpool/src/unmanaged/mod.rs diff --git a/tests/managed.rs b/deadpool/tests/managed.rs similarity index 100% rename from tests/managed.rs rename to deadpool/tests/managed.rs diff --git a/tests/managed_cancellation.rs b/deadpool/tests/managed_cancellation.rs similarity index 100% rename from tests/managed_cancellation.rs rename to deadpool/tests/managed_cancellation.rs diff --git a/tests/managed_config.rs b/deadpool/tests/managed_config.rs similarity index 100% rename from tests/managed_config.rs rename to deadpool/tests/managed_config.rs diff --git a/tests/managed_deadlock.rs b/deadpool/tests/managed_deadlock.rs similarity index 100% rename from tests/managed_deadlock.rs rename to deadpool/tests/managed_deadlock.rs diff --git a/tests/managed_hooks.rs b/deadpool/tests/managed_hooks.rs similarity index 100% rename from tests/managed_hooks.rs rename to deadpool/tests/managed_hooks.rs diff --git a/tests/managed_resize.rs b/deadpool/tests/managed_resize.rs similarity index 100% rename from tests/managed_resize.rs rename to deadpool/tests/managed_resize.rs diff --git a/tests/managed_timeout.rs b/deadpool/tests/managed_timeout.rs similarity index 100% rename from tests/managed_timeout.rs rename to deadpool/tests/managed_timeout.rs diff --git a/tests/managed_unreliable_manager.rs b/deadpool/tests/managed_unreliable_manager.rs similarity index 100% rename from tests/managed_unreliable_manager.rs rename to deadpool/tests/managed_unreliable_manager.rs diff --git a/tests/unmanaged.rs b/deadpool/tests/unmanaged.rs similarity index 100% rename from tests/unmanaged.rs rename to deadpool/tests/unmanaged.rs diff --git a/tests/unmanaged_timeout.rs b/deadpool/tests/unmanaged_timeout.rs similarity index 100% rename from tests/unmanaged_timeout.rs rename to deadpool/tests/unmanaged_timeout.rs diff --git a/diesel/Cargo.toml b/diesel/Cargo.toml index 3932e697..9a4740e6 100644 --- a/diesel/Cargo.toml +++ b/diesel/Cargo.toml @@ -25,7 +25,7 @@ serde = ["deadpool/serde"] tracing = ["deadpool-sync/tracing"] [dependencies] -deadpool = { path = "../", version = "0.12.0", default-features = false, features = [ +deadpool = { path = "../deadpool", version = "0.12.0", default-features = false, features = [ "managed", ] } deadpool-sync = { path = "../sync", version = "0.1.1" } @@ -33,4 +33,4 @@ diesel = { version = "2.2.3", default-features = false } [dev-dependencies] diesel = { version = "2.2.3", default-features = false, features = ["sqlite"] } -tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread"] } +tokio = { version = "1.27", features = ["macros", "rt", "rt-multi-thread"] } diff --git a/examples/diesel/Cargo.toml b/examples/diesel/Cargo.toml index e176fdf1..e0995caa 100644 --- a/examples/diesel/Cargo.toml +++ b/examples/diesel/Cargo.toml @@ -9,4 +9,4 @@ publish = false [dependencies] deadpool-diesel = { path = "../../diesel", features = ["postgres"] } dotenvy = "0.15" -thiserror = "1.0" +thiserror = "2" diff --git a/examples/postgres-actix-web/Cargo.toml b/examples/postgres-actix-web/Cargo.toml index 869349bb..966a17e9 100644 --- a/examples/postgres-actix-web/Cargo.toml +++ b/examples/postgres-actix-web/Cargo.toml @@ -7,11 +7,11 @@ authors = ["Michael P. Jung "] publish = false [dependencies] -actix-web = "4.0.1" -config = "0.14" +actix-web = "4" +config = "0.15" deadpool-postgres = { path = "../../postgres", features = ["serde"] } dotenvy = "0.15" -serde = { version = "1.0", features = ["derive"] } -thiserror = "1.0" -tokio-postgres = { version = "0.7", features = ["with-uuid-1"] } +serde = { version = "1.0.145", features = ["derive"] } +thiserror = "2" +tokio-postgres = { version = "0.7.9", features = ["with-uuid-1"] } uuid = { version = "1", features = ["serde"] } diff --git a/examples/postgres-axum/Cargo.toml b/examples/postgres-axum/Cargo.toml index 3a0afb0d..640fbdf4 100644 --- a/examples/postgres-axum/Cargo.toml +++ b/examples/postgres-axum/Cargo.toml @@ -1,16 +1,16 @@ [package] -name = "postgres-axum" +name = "example-postgres-axum" version = "0.1.0" edition = "2021" [dependencies] -axum = { version = "0.7.5", features = ["json"] } -thiserror = "1.0.60" -tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread"] } +axum = { version = "0.8.1", features = ["json"] } +thiserror = "2.0" +tokio = { version = "1.27", features = ["macros", "rt-multi-thread"] } deadpool-postgres = { path = "../../postgres", features = ["serde"] } -tokio-postgres = { version = "0.7.10", features = ["with-uuid-1"] } -dotenvy = "0.15.7" -uuid = { version = "1.8.0", features = ["serde"] } -serde = { version = "1.0.200", features = ["derive"] } -config = "0.14.0" -axum-macros = "0.4.1" +tokio-postgres = { version = "0.7.9", features = ["with-uuid-1"] } +dotenvy = "0.15" +uuid = { version = "1", features = ["serde"] } +serde = { version = "1.0.145", features = ["derive"] } +config = "0.15" +axum-macros = "0.5" diff --git a/examples/postgres-benchmark/Cargo.toml b/examples/postgres-benchmark/Cargo.toml index a6e09899..dbe3c588 100644 --- a/examples/postgres-benchmark/Cargo.toml +++ b/examples/postgres-benchmark/Cargo.toml @@ -7,9 +7,9 @@ authors = ["Michael P. Jung "] publish = false [dependencies] -config = "0.14" +config = "0.15" deadpool-postgres = { path = "../../postgres", features = ["serde"] } dotenvy = "0.15" -serde = { version = "1.0", features = ["derive"] } -tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } -tokio-postgres = { version = "0.7" } +serde = { version = "1.0.145", features = ["derive"] } +tokio = { version = "1.27", features = ["macros", "rt-multi-thread"] } +tokio-postgres = { version = "0.7.9" } diff --git a/examples/postgres-hyper/.gitignore b/examples/postgres-hyper/.gitignore deleted file mode 100644 index 707b8666..00000000 --- a/examples/postgres-hyper/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/target -**/*.rs.bk -Cargo.lock -.env diff --git a/examples/postgres-hyper/Cargo.toml b/examples/postgres-hyper/Cargo.toml deleted file mode 100644 index 11f1a79d..00000000 --- a/examples/postgres-hyper/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -name = "example-postgres-hyper" -version = "0.0.0" -edition = "2018" -resolver = "2" -authors = ["Michael P. Jung "] -publish = false - -[dependencies] -config = "0.14" -deadpool-postgres = { path = "../../postgres", features = ["serde"] } -dotenvy = "0.15" -hyper = { version = "0.14", features = ["http1", "http2", "server", "runtime"] } -serde = { version = "1", features = ["derive"] } -serde_json = "1" -thiserror = "1.0" -tokio = { version = "1", features = ["macros", "rt", "rt-multi-thread"] } -tokio-postgres = { version = "0.7", features = ["with-uuid-1"] } -uuid = { version = "1", features = ["serde"] } diff --git a/examples/postgres-hyper/README.md b/examples/postgres-hyper/README.md deleted file mode 100644 index a8020486..00000000 --- a/examples/postgres-hyper/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# `deadpool-postgres` + `hyper` example - -This example combines `deadpool-postgres` with a `hyper` webservice to -implement a simple API service that responds with JSON read from -PostgreSQL. - -## Prerequisites - -The following instructions assumes that your current user can access the -PostgreSQL running at local host passwordless via unix domain socket. The -default installation of PostgreSQL usually already contains the following line -in its [pg_hba.conf](https://www.postgresql.org/docs/12/auth-pg-hba-conf.html): - -```txt -local all all peer -``` - -All you need to do is to create a PostgreSQL user with the same name as -your system user: - -```shell -sudo -u postgres createuser -s my_user_name -``` - -Now you should be able to run `psql` without any options and connect to -your local running PostgreSQL instance. e.g. by connecting to `template1`: - -```shell -psql template1 -``` - -## How to run the example - -1. Create a database - - ```shell - createdb deadpool - ``` - -2. Load example data - - ```shell - psql -f fixture.sql deadpool - ``` - -3. Create `.env` file in this directory - - ```env - LISTEN=[::1]:8000 - PG__DBNAME=deadpool - ``` - -4. Run the example - - ```shell - cargo run --release - ``` - -## Configuration options - -If you want to connect to your database using a TCP/IP socket you can use -the following template for your `.env` file: - -```env -PG__HOST=127.0.0.1 -PG__PORT=5432 -PG__USER=deadpool -PG__PASSWORD=somepassword -PG__DBNAME=deadpool -``` - -For more configuration options see `deadpool_postgres::Config`. diff --git a/examples/postgres-hyper/fixture.sql b/examples/postgres-hyper/fixture.sql deleted file mode 100644 index 354f783d..00000000 --- a/examples/postgres-hyper/fixture.sql +++ /dev/null @@ -1,37 +0,0 @@ -CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA public; - -CREATE TABLE event ( - id uuid DEFAULT public.gen_random_uuid() NOT NULL, - title text NOT NULL -); - -COPY event (id, title) FROM stdin; -bec734be-97bd-4f48-b042-5ee859998c56 event1 -d36bc40a-fac4-4194-bec4-9ba8c602d994 event2 -18012fcf-3c53-4518-b9a6-22479ebe0212 event3 -6c4094fc-f8f7-4869-9c57-042bc43f257d event4 -e6173a6c-7cf4-4bc5-b676-0871d2705ed6 event5 -0d246195-537f-42dd-b7b3-6495116b8f56 event6 -c6b452b9-c1f3-4e11-9237-e22e0d6f14bd event7 -33ddb912-5bb1-4ba6-a03c-31a087ca8992 event8 -0da79dbe-63e9-4a0a-a3cb-34cfc451aa7e event9 -dec2f1cd-01af-41ed-a0d9-83a34a1c7b6d event10 -ecc1e7e4-828c-4ca3-a8a1-07444bb91300 event11 -c6ca56b1-9e02-4381-a248-3b9ef099eb93 event12 -f94693f0-789a-4a1f-a218-7399c294f00a event13 -c54ee1d7-2f8c-41c5-9478-a01f4c1c0e0b event14 -aa213e86-43fe-448d-8862-f2af9c686c82 event15 -7135cb1f-00ee-47be-b212-d45a791082ea event16 -b7dfa22b-f3a2-4547-a5df-2a6d3f54c90f event17 -c339d9fd-ce35-4578-a7c5-908cf619a321 event18 -7c49ba99-fdc3-4618-b23b-89ea3e5c4ee4 event19 -499b5807-abd2-4c24-9faa-5f463e6a19e3 event20 -d2ccbdb5-5b1e-4113-aded-24634ba1fb03 event21 -f2c82fc6-5b9a-446a-a6bc-27e814b1521b event22 -a818fbed-93dd-4e44-84a8-3591dbff3349 event23 -56dd7210-3869-4f1f-9f7a-fc58b3265f63 event24 -5803b0e8-98fe-47cd-b61d-478949b2ad70 event25 -b4a8d7da-ee5f-4d95-b452-86400697d051 event26 -f55fd18a-5532-453c-990e-098df71f2c24 event27 -3938cd54-65cf-4638-aba8-5861d9ba729e event28 -\. diff --git a/examples/postgres-hyper/src/main.rs b/examples/postgres-hyper/src/main.rs deleted file mode 100644 index 47023e19..00000000 --- a/examples/postgres-hyper/src/main.rs +++ /dev/null @@ -1,102 +0,0 @@ -use std::net::SocketAddr; - -use config::ConfigError; -use deadpool_postgres::{Client, Pool, PoolError, Runtime}; -use dotenvy::dotenv; -use hyper::service::{make_service_fn, service_fn}; -use hyper::{header, Body, Method, Request, Response, Server, StatusCode}; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -#[derive(Debug, Deserialize)] -struct Config { - listen: String, - pg: deadpool_postgres::Config, -} - -impl Config { - fn from_env() -> Result { - config::Config::builder() - .add_source(config::Environment::default().separator("__")) - .build() - .unwrap() - .try_deserialize() - } -} - -#[derive(Deserialize, Serialize)] -struct Event { - id: Uuid, - title: String, -} - -#[derive(Debug, thiserror::Error)] -enum Error { - #[error("{0}")] - PoolError(#[from] PoolError), -} - -async fn event_list(pool: &Pool) -> Result, PoolError> { - let client: Client = pool.get().await?; - let stmt = client.prepare_cached("SELECT id, title FROM event").await?; - let rows = client.query(&stmt, &[]).await?; - Ok(rows - .into_iter() - .map(|row| Event { - id: row.get(0), - title: row.get(1), - }) - .collect()) -} - -async fn handle(req: Request, pool: Pool) -> Result, Error> { - match (req.method(), req.uri().path()) { - (&Method::GET, "/v1.0/event.list") => { - let events = event_list(&pool).await?; - let json = serde_json::to_string(&events).unwrap(); - let response = Response::builder() - .status(StatusCode::OK) - .header(header::CONTENT_TYPE, "application/json") - .body(Body::from(json)) - .unwrap(); - Ok(response) - } - _ => { - let mut not_found = Response::default(); - *not_found.status_mut() = StatusCode::NOT_FOUND; - Ok(not_found) - } - } -} - -#[tokio::main] -async fn main() -> Result<(), Box> { - async { - dotenv().ok(); - let config = Config::from_env()?; - let addr: SocketAddr = config.listen.parse()?; - let pool = config - .pg - .create_pool(Some(Runtime::Tokio1), tokio_postgres::NoTls)?; - - let make_svc = make_service_fn(|_conn| { - let pool = pool.clone(); - async { Ok::<_, Error>(service_fn(move |req| handle(req, pool.clone()))) } - }); - - let server = Server::bind(&addr).serve(make_svc); - - println!("Server running at http://{}/", &config.listen); - println!( - "Try the following URLs: http://{}/v1.0/event.list", - &config.listen - ); - - if let Err(e) = server.await { - eprintln!("server error: {e}"); - } - - Ok(()) - } - .await -} diff --git a/examples/redis-actix-web/Cargo.toml b/examples/redis-actix-web/Cargo.toml index aed33e4f..088bc4ce 100644 --- a/examples/redis-actix-web/Cargo.toml +++ b/examples/redis-actix-web/Cargo.toml @@ -7,6 +7,5 @@ authors = ["Tomas Hromada "] publish = false [dependencies] -actix-web = "4.0.0-beta.8" +actix-web = "4" deadpool-redis = { path = "../../redis" } -redis = { version = "0.25", features = ["tokio-comp"] } diff --git a/lapin/Cargo.toml b/lapin/Cargo.toml index a575a6da..a769a980 100644 --- a/lapin/Cargo.toml +++ b/lapin/Cargo.toml @@ -22,25 +22,19 @@ serde = ["deadpool/serde", "dep:serde"] [dependencies] async-executor-trait = { version = "2.1", optional = true } -deadpool = { path = "../", version = "0.12.0", default-features = false, features = [ +deadpool = { path = "../deadpool", version = "0.12.0", default-features = false, features = [ "managed", ] } lapin = { version = "2.0", default-features = false } -serde = { package = "serde", version = "1.0.103", features = [ +serde = { package = "serde", version = "1.0.145", features = [ "derive", ], optional = true } tokio-executor-trait = { version = "2.1.0", optional = true } -# Not really used, added to survive `minimal-versions` check only. -# TODO: Remove once new `async-std` version above 1.12.0 is released, -# as it's already fixed in their `main` branch. This, of course, -# will require bumping minimal version of `async-std` across the workspace. -async-global-executor = { version = "2.3.1", optional = true, default-features = false } - [dev-dependencies] -config = { version = "0.14", features = ["json"] } +config = { version = "0.15", features = ["json"] } dotenvy = "0.15" -tokio = { version = "1.0", features = ["sync", "macros", "rt-multi-thread"] } +tokio = { version = "1.27", features = ["sync", "macros", "rt-multi-thread"] } [package.metadata.cargo-machete] ignored = ["async-global-executor"] diff --git a/memcached/Cargo.toml b/memcached/Cargo.toml index ff038a29..d7ccb32b 100644 --- a/memcached/Cargo.toml +++ b/memcached/Cargo.toml @@ -23,14 +23,14 @@ tcp = ["async-memcached/tcp"] [dependencies] async-memcached = { version = "0.1", default-features = false } -deadpool = { path = "../", version = "0.12.0", default-features = false, features = [ +deadpool = { path = "../deadpool", version = "0.12.0", default-features = false, features = [ "managed", ] } # This crate doesn't directly depend on tokio but async-memcached 0.1.7 # broke the build by forgetting to add the "net" feature to the tokio # dependency. Once async-memcached is fixed this dependency can be removed # again. -tokio = { version = "1.0", default-features = false, features = ["net"] } +tokio = { version = "1.27", default-features = false, features = ["net"] } [package.metadata.cargo-machete] ignored = ["tokio"] diff --git a/postgres/Cargo.toml b/postgres/Cargo.toml index 0aa9e9a7..7df3fc67 100644 --- a/postgres/Cargo.toml +++ b/postgres/Cargo.toml @@ -21,25 +21,25 @@ serde = ["deadpool/serde", "dep:serde"] [dependencies] async-trait = "0.1.80" -deadpool = { path = "../", version = "0.12.0", default-features = false, features = [ +deadpool = { path = "../deadpool", version = "0.12.0", default-features = false, features = [ "managed", ] } -serde = { package = "serde", version = "1.0", features = [ +serde = { package = "serde", version = "1.0.145", features = [ "derive", ], optional = true } -tokio = { version = "1.29", features = ["rt"] } +tokio = { version = "1.27", features = ["rt"] } tracing = "0.1.37" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] tokio-postgres = "0.7.9" [target.'cfg(target_arch = "wasm32")'.dependencies] -getrandom = { version = "0.2", features = ["js"] } +getrandom = { version = "0.2.3", features = ["js"] } tokio-postgres = { version = "0.7.9", default-features = false } [dev-dependencies] -config = { version = "0.14", features = ["json"] } -dotenvy = "0.15.0" -futures = "0.3.1" +config = { version = "0.15", features = ["json"] } +dotenvy = "0.15" +futures = "0.3" futures-util = "0.3.30" -tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.27", features = ["macros", "rt-multi-thread"] } diff --git a/postgres/src/generic_client.rs b/postgres/src/generic_client.rs index 96f48557..a8396b4e 100644 --- a/postgres/src/generic_client.rs +++ b/postgres/src/generic_client.rs @@ -81,7 +81,7 @@ pub trait GenericClient: Sync + private::Sealed { async fn prepare_typed_cached(&self, query: &str, types: &[Type]) -> Result; /// Like `Client::transaction`. - async fn transaction(&mut self) -> Result, Error>; + async fn transaction<'a>(&'a mut self) -> Result, Error>; /// Like `Client::batch_execute`. async fn batch_execute(&self, query: &str) -> Result<(), Error>; @@ -167,7 +167,7 @@ impl GenericClient for Client { ClientWrapper::prepare_typed_cached(self, query, types).await } - async fn transaction(&mut self) -> Result, Error> { + async fn transaction<'a>(&'a mut self) -> Result, Error> { ClientWrapper::transaction(self).await } diff --git a/r2d2/Cargo.toml b/r2d2/Cargo.toml index e87f12c8..7a6404a3 100644 --- a/r2d2/Cargo.toml +++ b/r2d2/Cargo.toml @@ -22,13 +22,13 @@ serde = ["deadpool/serde"] tracing = ["deadpool-sync/tracing"] [dependencies] -deadpool = { path = "../", version = "0.12.0", default-features = false, features = [ +deadpool = { path = "../deadpool", version = "0.12.0", default-features = false, features = [ "managed", ] } deadpool-sync = { path = "../sync", version = "0.1.1" } r2d2 = { version = "0.8.9", default-features = false } [dev-dependencies] -tokio = { version = "1.0", features = ["macros", "rt", "rt-multi-thread"] } -deadpool = { path = "../", version = "0.12", features = ["rt_tokio_1"] } +tokio = { version = "1.27", features = ["macros", "rt", "rt-multi-thread"] } +deadpool = { path = "../deadpool", version = "0.12", features = ["rt_tokio_1"] } r2d2_postgres = "0.18" diff --git a/redis/Cargo.toml b/redis/Cargo.toml index 0c046bd6..88a9070d 100644 --- a/redis/Cargo.toml +++ b/redis/Cargo.toml @@ -26,20 +26,20 @@ cluster = ["redis/cluster-async"] sentinel = ["redis/sentinel", "tokio/sync"] [dependencies] -deadpool = { path = "../", version = "0.12.0", default-features = false, features = [ +deadpool = { path = "../deadpool", version = "0.12.0", default-features = false, features = [ "managed", ] } redis = { version = "0.28", default-features = false, features = ["aio"] } -serde = { package = "serde", version = "1.0", features = [ +serde = { package = "serde", version = "1.0.145", features = [ "derive", ], optional = true } -tokio = { version = "1.0", default-features = false, optional = true } +tokio = { version = "1.27", default-features = false, optional = true } [dev-dependencies] -config = { version = "0.14", features = ["json"] } -dotenvy = "0.15.0" -futures = "0.3.15" +config = { version = "0.15", features = ["json"] } +dotenvy = "0.15" +futures = "0.3" redis = { version = "0.28", default-features = false, features = [ "tokio-comp", ] } -tokio = { version = "1.0", features = ["macros", "rt-multi-thread", "sync"] } +tokio = { version = "1.27", features = ["macros", "rt-multi-thread", "sync"] } diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index bd430ecb..0ebe1945 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -12,11 +12,15 @@ readme = "README.md" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +async-std_1 = ["dep:async-std_1"] +tokio_1 = ["dep:tokio_1"] + [dependencies] -async-std_1 = { package = "async-std", version = "1.0", features = [ +async-std_1 = { package = "async-std", version = "1.13", features = [ "unstable", ], optional = true } -tokio_1 = { package = "tokio", version = "1.0", features = [ +tokio_1 = { package = "tokio", version = "1.27", features = [ "time", "rt", ], optional = true } diff --git a/sqlite/Cargo.toml b/sqlite/Cargo.toml index b37aba1b..34cf65c8 100644 --- a/sqlite/Cargo.toml +++ b/sqlite/Cargo.toml @@ -22,15 +22,15 @@ serde = ["deadpool/serde", "dep:serde"] tracing = ["deadpool-sync/tracing"] [dependencies] -deadpool = { path = "../", version = "0.12.0", default-features = false, features = [ +deadpool = { path = "../deadpool", version = "0.12.0", default-features = false, features = [ "managed", ] } deadpool-sync = { path = "../sync", version = "0.1.1" } rusqlite = "0.33.0" -serde = { package = "serde", version = "1.0", features = [ +serde = { package = "serde", version = "1.0.145", features = [ "derive", ], optional = true } [dev-dependencies] -config = { version = "0.14", features = ["json"] } -tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } +config = { version = "0.15", features = ["json"] } +tokio = { version = "1.27", features = ["macros", "rt-multi-thread"] } diff --git a/sync/Cargo.toml b/sync/Cargo.toml index f1d1cbf7..42e132cb 100644 --- a/sync/Cargo.toml +++ b/sync/Cargo.toml @@ -14,8 +14,8 @@ readme = "README.md" [dependencies] deadpool-runtime = { version = "0.1.2", path = "../runtime" } -tracing = { version = "0.1", optional = true } +tracing = { version = "0.1.37", optional = true } [dev-dependencies] -deadpool = { version = "0.12", path = "..", features = ["rt_tokio_1"] } -tokio = { version = "1.38.0", features = ["macros", "rt-multi-thread"] } +deadpool = { version = "0.12", path = "../deadpool", features = ["rt_tokio_1"] } +tokio = { version = "1.27", features = ["macros", "rt-multi-thread"] }