From 6007c64ae5ba71eb19b49756601d355aa66e2e01 Mon Sep 17 00:00:00 2001 From: Chrislearn Young Date: Tue, 10 Dec 2024 00:00:21 +0800 Subject: [PATCH] [Salvo] Upgrade to 0.74 (#9437) * [Salvo] Upgrade to 0.74 * rust 1.83 * docker update --- frameworks/Rust/salvo/Cargo.toml | 8 ++++---- frameworks/Rust/salvo/salvo-diesel.dockerfile | 2 +- frameworks/Rust/salvo/salvo-lru.dockerfile | 2 +- frameworks/Rust/salvo/salvo-mongo-raw.dockerfile | 2 +- frameworks/Rust/salvo/salvo-mongo.dockerfile | 2 +- frameworks/Rust/salvo/salvo-pg-pool.dockerfile | 2 +- frameworks/Rust/salvo/salvo-pg.dockerfile | 2 +- frameworks/Rust/salvo/salvo-sqlx.dockerfile | 2 +- frameworks/Rust/salvo/salvo.dockerfile | 2 +- frameworks/Rust/salvo/src/main_diesel.rs | 2 +- frameworks/Rust/salvo/src/main_lru.rs | 2 +- frameworks/Rust/salvo/src/main_mongo.rs | 4 ++-- frameworks/Rust/salvo/src/main_mongo_raw.rs | 4 ++-- frameworks/Rust/salvo/src/main_pg.rs | 2 +- frameworks/Rust/salvo/src/main_pg_pool.rs | 2 +- frameworks/Rust/salvo/src/main_sqlx.rs | 2 +- 16 files changed, 21 insertions(+), 21 deletions(-) diff --git a/frameworks/Rust/salvo/Cargo.toml b/frameworks/Rust/salvo/Cargo.toml index a7795fc6636..58fa4a6a315 100644 --- a/frameworks/Rust/salvo/Cargo.toml +++ b/frameworks/Rust/salvo/Cargo.toml @@ -43,13 +43,13 @@ diesel = { version = "2", features = ["postgres", "r2d2"] } deadpool = { version = "0.12", features = ["rt_tokio_1", "serde", "managed"] } deadpool-postgres = "0.14" futures-util = "0.3" -lru = "0.12.0" +lru = "0.12" markup = "0.15" # mimalloc = { version = "0.1", default-features = false } -mongodb = { version = "2.4.0", features = ["zstd-compression", "snappy-compression", "zlib-compression"] } +mongodb = { version = "2", features = ["zstd-compression", "snappy-compression", "zlib-compression"] } once_cell = "1" rand = { version = "0.8", features = ["min_const_gen", "small_rng"] } -salvo = { version = "0.68", default-features = false, features = ["anyhow", "server", "http1", "affix"] } +salvo = { version = "0.74", default-features = false, features = ["anyhow", "server", "http1", "affix-state"] } serde = { version = "1", features = ["derive"] } serde_json = "1" # smallvec = "1" @@ -60,7 +60,7 @@ tokio-pg-mapper = "0.2.0" tokio-pg-mapper-derive = "0.2.0" tokio-postgres = "0.7" v_htmlescape = "0.15" -dotenv = "0.15.0" +dotenvy = "0.15" [profile.release] lto = true diff --git a/frameworks/Rust/salvo/salvo-diesel.dockerfile b/frameworks/Rust/salvo/salvo-diesel.dockerfile index 1577e454443..0943b3af73a 100644 --- a/frameworks/Rust/salvo/salvo-diesel.dockerfile +++ b/frameworks/Rust/salvo/salvo-diesel.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.78-buster +FROM rust:1.83 ENV TECHEMPOWER_POSTGRES_URL=postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world ENV TECHEMPOWER_MAX_POOL_SIZE=28 diff --git a/frameworks/Rust/salvo/salvo-lru.dockerfile b/frameworks/Rust/salvo/salvo-lru.dockerfile index 5f668adaf76..4dd1d4511be 100644 --- a/frameworks/Rust/salvo/salvo-lru.dockerfile +++ b/frameworks/Rust/salvo/salvo-lru.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.78-buster +FROM rust:1.83 ENV TECHEMPOWER_POSTGRES_URL=postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world diff --git a/frameworks/Rust/salvo/salvo-mongo-raw.dockerfile b/frameworks/Rust/salvo/salvo-mongo-raw.dockerfile index 2fb904eb558..2f15faea13c 100644 --- a/frameworks/Rust/salvo/salvo-mongo-raw.dockerfile +++ b/frameworks/Rust/salvo/salvo-mongo-raw.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.78-buster +FROM rust:1.83 ENV TECHEMPOWER_MONGODB_URL=mongodb://tfb-database:27017 ENV TECHEMPOWER_MAX_POOL_SIZE=28 diff --git a/frameworks/Rust/salvo/salvo-mongo.dockerfile b/frameworks/Rust/salvo/salvo-mongo.dockerfile index e8a454910c1..2eccf7dd4be 100644 --- a/frameworks/Rust/salvo/salvo-mongo.dockerfile +++ b/frameworks/Rust/salvo/salvo-mongo.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.78-buster +FROM rust:1.83 ENV TECHEMPOWER_MONGODB_URL=mongodb://tfb-database:27017 ENV TECHEMPOWER_MAX_POOL_SIZE=28 diff --git a/frameworks/Rust/salvo/salvo-pg-pool.dockerfile b/frameworks/Rust/salvo/salvo-pg-pool.dockerfile index 8ef7fc1eeda..bb4f4dba212 100644 --- a/frameworks/Rust/salvo/salvo-pg-pool.dockerfile +++ b/frameworks/Rust/salvo/salvo-pg-pool.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.78-buster +FROM rust:1.83 ENV TECHEMPOWER_POSTGRES_URL=postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world ENV TECHEMPOWER_MAX_POOL_SIZE=28 diff --git a/frameworks/Rust/salvo/salvo-pg.dockerfile b/frameworks/Rust/salvo/salvo-pg.dockerfile index 70deda13cd6..da1009087e1 100644 --- a/frameworks/Rust/salvo/salvo-pg.dockerfile +++ b/frameworks/Rust/salvo/salvo-pg.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.78-buster +FROM rust:1.83 ENV TECHEMPOWER_POSTGRES_URL=postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world diff --git a/frameworks/Rust/salvo/salvo-sqlx.dockerfile b/frameworks/Rust/salvo/salvo-sqlx.dockerfile index 7d88a5d20d9..6da69983675 100644 --- a/frameworks/Rust/salvo/salvo-sqlx.dockerfile +++ b/frameworks/Rust/salvo/salvo-sqlx.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.78-buster +FROM rust:1.83 ENV TECHEMPOWER_POSTGRES_URL=postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world ENV TECHEMPOWER_MAX_POOL_SIZE=56 diff --git a/frameworks/Rust/salvo/salvo.dockerfile b/frameworks/Rust/salvo/salvo.dockerfile index 8f0d750dcee..11553801801 100644 --- a/frameworks/Rust/salvo/salvo.dockerfile +++ b/frameworks/Rust/salvo/salvo.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.78-buster +FROM rust:1.83 ADD ./ /salvo WORKDIR /salvo diff --git a/frameworks/Rust/salvo/src/main_diesel.rs b/frameworks/Rust/salvo/src/main_diesel.rs index 7e2e9f8b36a..12e8bdc283a 100644 --- a/frameworks/Rust/salvo/src/main_diesel.rs +++ b/frameworks/Rust/salvo/src/main_diesel.rs @@ -15,7 +15,7 @@ use std::thread::available_parallelism; use anyhow::Error; use diesel::prelude::*; use diesel::r2d2::{ConnectionManager, Pool, PoolError, PooledConnection}; -use dotenv::dotenv; +use dotenvy::dotenv; use once_cell::sync::OnceCell; use rand::rngs::SmallRng; use rand::{Rng, SeedableRng}; diff --git a/frameworks/Rust/salvo/src/main_lru.rs b/frameworks/Rust/salvo/src/main_lru.rs index 77186e58ba9..0f4abcceefc 100644 --- a/frameworks/Rust/salvo/src/main_lru.rs +++ b/frameworks/Rust/salvo/src/main_lru.rs @@ -10,7 +10,7 @@ use std::thread::available_parallelism; use anyhow::Error; use bytes::Bytes; -use dotenv::dotenv; +use dotenvy::dotenv; use lru::LruCache; use once_cell::sync::OnceCell; use rand::rngs::SmallRng; diff --git a/frameworks/Rust/salvo/src/main_mongo.rs b/frameworks/Rust/salvo/src/main_mongo.rs index 372fc5bd7b8..54dfca1b183 100644 --- a/frameworks/Rust/salvo/src/main_mongo.rs +++ b/frameworks/Rust/salvo/src/main_mongo.rs @@ -10,7 +10,7 @@ use std::time::Duration; use anyhow::Error; use bytes::Bytes; -use dotenv::dotenv; +use dotenvy::dotenv; use mongodb::{ options::{ClientOptions, Compressor}, Client, Database, @@ -177,7 +177,7 @@ async fn serve() { let database = client.database("hello_world"); let router = Router::new() - .hoop(salvo::affix::inject(database)) + .hoop(salvo::affix_state::inject(database)) .push(Router::with_path("db").get(world_row)) .push(Router::with_path("fortunes").get(fortunes)) .push(Router::with_path("queries").get(queries)) diff --git a/frameworks/Rust/salvo/src/main_mongo_raw.rs b/frameworks/Rust/salvo/src/main_mongo_raw.rs index 8c4e5af5efb..ba575dc33bc 100644 --- a/frameworks/Rust/salvo/src/main_mongo_raw.rs +++ b/frameworks/Rust/salvo/src/main_mongo_raw.rs @@ -9,7 +9,7 @@ use std::time::Duration; use anyhow::Error; use bytes::Bytes; -use dotenv::dotenv; +use dotenvy::dotenv; use mongodb::{ options::{ClientOptions, Compressor}, Client, Database, @@ -140,7 +140,7 @@ async fn serve() { let database = client.database("hello_world"); let router = Router::new() - .hoop(salvo::affix::inject(database)) + .hoop(salvo::affix_state::inject(database)) .push(Router::with_path("db").get(world_row)) .push(Router::with_path("queries").get(queries)) .push(Router::with_path("updates").get(updates)); diff --git a/frameworks/Rust/salvo/src/main_pg.rs b/frameworks/Rust/salvo/src/main_pg.rs index dfa6be4ef9f..af04bf4b718 100644 --- a/frameworks/Rust/salvo/src/main_pg.rs +++ b/frameworks/Rust/salvo/src/main_pg.rs @@ -9,7 +9,7 @@ use std::thread::available_parallelism; use async_trait::async_trait; use bytes::Bytes; -use dotenv::dotenv; +use dotenvy::dotenv; use salvo::conn::tcp::TcpAcceptor; use salvo::http::header::{self, HeaderValue}; use salvo::http::ResBody; diff --git a/frameworks/Rust/salvo/src/main_pg_pool.rs b/frameworks/Rust/salvo/src/main_pg_pool.rs index f72f1c64a09..1e5d6c0b6ec 100644 --- a/frameworks/Rust/salvo/src/main_pg_pool.rs +++ b/frameworks/Rust/salvo/src/main_pg_pool.rs @@ -11,7 +11,7 @@ use std::thread::available_parallelism; use anyhow::Error; use bytes::Bytes; use deadpool_postgres::Pool; -use dotenv::dotenv; +use dotenvy::dotenv; use futures_util::{stream::FuturesUnordered, TryStreamExt}; use once_cell::sync::OnceCell; use rand::rngs::SmallRng; diff --git a/frameworks/Rust/salvo/src/main_sqlx.rs b/frameworks/Rust/salvo/src/main_sqlx.rs index 6fc8f72c922..ca52a8e6b61 100644 --- a/frameworks/Rust/salvo/src/main_sqlx.rs +++ b/frameworks/Rust/salvo/src/main_sqlx.rs @@ -9,7 +9,7 @@ use std::thread::available_parallelism; use anyhow::Error; use bytes::Bytes; -use dotenv::dotenv; +use dotenvy::dotenv; use once_cell::sync::OnceCell; use rand::rngs::SmallRng; use rand::{Rng, SeedableRng};