From d7cf6a7ee4bc9e0ded6a2106b480e9150f2924d9 Mon Sep 17 00:00:00 2001 From: cijiugechu Date: Wed, 4 Jun 2025 23:13:55 +0800 Subject: [PATCH] chore(server): upgrade to `axum` 0.8 --- Cargo.lock | 90 ++++++++++++++++++++++++++++++------------- Cargo.toml | 4 +- src/ops/py_factory.rs | 9 ++--- src/server.rs | 14 +++---- 4 files changed, 76 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 848cbd6dc..ec57e8e89 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -676,16 +676,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" dependencies = [ "async-trait", - "axum-core", + "axum-core 0.4.5", "bytes", "futures-util", "http 1.3.1", "http-body 1.0.1", "http-body-util", + "itoa", + "matchit 0.7.3", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper", + "tower 0.5.2", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "021e862c184ae977658b36c4500f7feac3221ca5da43e3f25bd04ab6c79a29b5" +dependencies = [ + "axum-core 0.5.2", + "bytes", + "form_urlencoded", + "futures-util", + "http 1.3.1", + "http-body 1.0.1", + "http-body-util", "hyper 1.6.0", "hyper-util", "itoa", - "matchit", + "matchit 0.8.4", "memchr", "mime", "percent-encoding", @@ -721,28 +748,48 @@ dependencies = [ "sync_wrapper", "tower-layer", "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68464cd0412f486726fb3373129ef5d2993f90c34bc2bc1c1e9943b2f4fc7ca6" +dependencies = [ + "bytes", + "futures-core", + "http 1.3.1", + "http-body 1.0.1", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper", + "tower-layer", + "tower-service", "tracing", ] [[package]] name = "axum-extra" -version = "0.9.6" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c794b30c904f0a1c2fb7740f7df7f7972dfaa14ef6f57cb6178dc63e5dca2f04" +checksum = "45bf463831f5131b7d3c756525b305d40f1185b688565648a92e1392ca35713d" dependencies = [ - "axum", - "axum-core", + "axum 0.8.4", + "axum-core 0.5.2", "bytes", - "fastrand", + "form_urlencoded", "futures-util", "http 1.3.1", "http-body 1.0.1", "http-body-util", "mime", - "multer", "pin-project-lite", + "rustversion", "serde", "serde_html_form", + "serde_path_to_error", "tower 0.5.2", "tower-layer", "tower-service", @@ -1002,7 +1049,7 @@ dependencies = [ "aws-config", "aws-sdk-s3", "aws-sdk-sqs", - "axum", + "axum 0.8.4", "axum-extra", "base64 0.22.1", "blake2", @@ -2610,6 +2657,12 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + [[package]] name = "md-5" version = "0.10.6" @@ -2677,23 +2730,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "multer" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e87776546dc87511aa5ee218730c92b666d7264ab6ed41f9d215af9cd5224b" -dependencies = [ - "bytes", - "encoding_rs", - "futures-util", - "http 1.3.1", - "httparse", - "memchr", - "mime", - "spin", - "version_check", -] - [[package]] name = "neo4rs" version = "0.8.0" @@ -4653,7 +4689,7 @@ checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52" dependencies = [ "async-stream", "async-trait", - "axum", + "axum 0.7.9", "base64 0.22.1", "bytes", "flate2", diff --git a/Cargo.toml b/Cargo.toml index 1a19b22ba..6d33f4fd2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,8 +20,8 @@ pyo3-async-runtimes = { version = "0.24.0", features = ["tokio-runtime"] } anyhow = { version = "1.0.97", features = ["std"] } async-trait = "0.1.88" -axum = "0.7.9" -axum-extra = { version = "0.9.6", features = ["query"] } +axum = "0.8.4" +axum-extra = { version = "0.10.1", features = ["query"] } base64 = "0.22.1" chrono = "0.4.40" config = "0.14.1" diff --git a/src/ops/py_factory.rs b/src/ops/py_factory.rs index adabc6ba9..4b3d202ea 100644 --- a/src/ops/py_factory.rs +++ b/src/ops/py_factory.rs @@ -1,11 +1,10 @@ use std::sync::Arc; -use axum::async_trait; -use futures::{future::BoxFuture, FutureExt}; +use async_trait::async_trait; +use futures::{FutureExt, future::BoxFuture}; use pyo3::{ - pyclass, pymethods, + IntoPyObjectExt, Py, PyAny, Python, pyclass, pymethods, types::{IntoPyDict, PyString, PyTuple}, - IntoPyObjectExt, Py, PyAny, Python, }; use pythonize::pythonize; @@ -14,7 +13,7 @@ use crate::{ builder::plan, py::{self, FromPyResult}, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use super::interface::{FlowInstanceContext, SimpleFunctionExecutor, SimpleFunctionFactory}; diff --git a/src/server.rs b/src/server.rs index f653dfa5c..1b52b8186 100644 --- a/src/server.rs +++ b/src/server.rs @@ -46,31 +46,31 @@ pub async fn init_server( Router::new() .route("/flows", routing::get(service::flows::list_flows)) .route( - "/flows/:flowInstName", + "/flows/{flowInstName}", routing::get(service::flows::get_flow), ) .route( - "/flows/:flowInstName/schema", + "/flows/{flowInstName}/schema", routing::get(service::flows::get_flow_schema), ) .route( - "/flows/:flowInstName/keys", + "/flows/{flowInstName}/keys", routing::get(service::flows::get_keys), ) .route( - "/flows/:flowInstName/data", + "/flows/{flowInstName}/data", routing::get(service::flows::evaluate_data), ) .route( - "/flows/:flowInstName/rowStatus", + "/flows/{flowInstName}/rowStatus", routing::get(service::flows::get_row_indexing_status), ) .route( - "/flows/:flowInstName/update", + "/flows/{flowInstName}/update", routing::post(service::flows::update), ) .route( - "/flows/:flowInstName/search", + "/flows/{flowInstName}/search", routing::get(service::search::search), ) .layer(