diff --git a/Cargo.lock b/Cargo.lock index 285c6cc..01ce6b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -113,6 +113,7 @@ dependencies = [ "mime_guess", "percent-encoding", "pin-project-lite", + "tokio-uring 0.2.0", ] [[package]] @@ -239,6 +240,7 @@ dependencies = [ "actix-macros", "futures-core", "tokio", + "tokio-uring 0.3.0", ] [[package]] @@ -256,6 +258,7 @@ dependencies = [ "num_cpus", "socket2", "tokio", + "tokio-uring 0.3.0", "tracing", ] @@ -1700,6 +1703,16 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "io-uring" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d75829ed9377bab6c90039fe47b9d84caceb4b5063266142e21bcce6550cda8" +dependencies = [ + "bitflags", + "libc", +] + [[package]] name = "ipnet" version = "2.5.0" @@ -2725,6 +2738,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "scoped-tls" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" + [[package]] name = "scopeguard" version = "1.1.0" @@ -3451,6 +3470,34 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-uring" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "062a33613d97344c5054d9635b35beb14492b66d9aa4bdbf21ecde1682d256df" +dependencies = [ + "bytes", + "io-uring", + "libc", + "scoped-tls", + "slab", + "tokio", +] + +[[package]] +name = "tokio-uring" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3ad494f39874984d990ade7f6319dafbcd3301ff0b1841f8a55a1ebb3e742c8" +dependencies = [ + "io-uring", + "libc", + "scoped-tls", + "slab", + "socket2", + "tokio", +] + [[package]] name = "tokio-util" version = "0.6.9" diff --git a/api/Cargo.toml b/api/Cargo.toml index ad50ec6..6ba743d 100644 --- a/api/Cargo.toml +++ b/api/Cargo.toml @@ -9,13 +9,13 @@ actix-rt = { version = "2.7", features = [] } actix-web = { version = "4.0", features = [] } actix-web-httpauth = { version = "0.6", features = [] } actix-cors = { version = "0.6", features = [] } -actix-files = { version = "0.6", features = [] } -actix-multipart = { version = "0.4", features = [] } actix-broker = { version = "0.4", features = [] } actix-identity = { version = "0.4", features = [] } actix-web-opentelemetry = { version = "0.12", features = [] } actix-session = { version = "0.6", features = ["actix-redis", "redis-actor-session"] } actix-redis = { version = "0.11", features = [] } +actix-files = { version = "0.6", features = ["experimental-io-uring"] } +actix-multipart = { version = "0.4", features = [] } gumdrop = { version = "0.8", features = [] } diff --git a/api/src/routes/admin/api_v1.rs b/api/src/routes/admin/api_v1.rs index 6b82988..2d0d882 100644 --- a/api/src/routes/admin/api_v1.rs +++ b/api/src/routes/admin/api_v1.rs @@ -2,6 +2,7 @@ mod accounts; mod orders; mod products; mod stocks; +mod uploads; use actix_web::web::{scope, ServiceConfig}; @@ -11,6 +12,7 @@ pub fn configure(config: &mut ServiceConfig) { .configure(products::configure) .configure(stocks::configure) .configure(accounts::configure) - .configure(orders::configure), + .configure(orders::configure) + .configure(uploads::configure), ); } diff --git a/api/src/routes/admin/api_v1/uploads.rs b/api/src/routes/admin/api_v1/uploads.rs new file mode 100644 index 0000000..d2b82e3 --- /dev/null +++ b/api/src/routes/admin/api_v1/uploads.rs @@ -0,0 +1,11 @@ +use actix_web::web::ServiceConfig; +use actix_web::{post, HttpResponse}; + +#[post("/product-image")] +async fn upload_product_image() -> HttpResponse { + HttpResponse::NotImplemented().finish() +} + +pub fn configure(config: &mut ServiceConfig) { + config.service(upload_product_image); +}