Browse Source

[Salvo] Upgrade to 0.74 (#9437)

* [Salvo] Upgrade to  0.74

* rust 1.83

* docker update
Chrislearn Young 8 months ago
parent
commit
6007c64ae5

+ 4 - 4
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

+ 1 - 1
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

+ 1 - 1
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
 

+ 1 - 1
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

+ 1 - 1
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

+ 1 - 1
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

+ 1 - 1
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
 

+ 1 - 1
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

+ 1 - 1
frameworks/Rust/salvo/salvo.dockerfile

@@ -1,4 +1,4 @@
-FROM rust:1.78-buster
+FROM rust:1.83
 
 ADD ./ /salvo
 WORKDIR /salvo

+ 1 - 1
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};

+ 1 - 1
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;

+ 2 - 2
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))

+ 2 - 2
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));

+ 1 - 1
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;

+ 1 - 1
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;

+ 1 - 1
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};