Add upload path

This commit is contained in:
Adrian Woźniak 2022-05-06 07:51:12 +02:00
parent cf6263ccc4
commit 40ba0b4acd
No known key found for this signature in database
GPG Key ID: 0012845A89C7352B
4 changed files with 63 additions and 3 deletions

47
Cargo.lock generated
View File

@ -113,6 +113,7 @@ dependencies = [
"mime_guess", "mime_guess",
"percent-encoding", "percent-encoding",
"pin-project-lite", "pin-project-lite",
"tokio-uring 0.2.0",
] ]
[[package]] [[package]]
@ -239,6 +240,7 @@ dependencies = [
"actix-macros", "actix-macros",
"futures-core", "futures-core",
"tokio", "tokio",
"tokio-uring 0.3.0",
] ]
[[package]] [[package]]
@ -256,6 +258,7 @@ dependencies = [
"num_cpus", "num_cpus",
"socket2", "socket2",
"tokio", "tokio",
"tokio-uring 0.3.0",
"tracing", "tracing",
] ]
@ -1700,6 +1703,16 @@ dependencies = [
"cfg-if", "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]] [[package]]
name = "ipnet" name = "ipnet"
version = "2.5.0" version = "2.5.0"
@ -2725,6 +2738,12 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "scoped-tls"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
[[package]] [[package]]
name = "scopeguard" name = "scopeguard"
version = "1.1.0" version = "1.1.0"
@ -3451,6 +3470,34 @@ dependencies = [
"tokio", "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]] [[package]]
name = "tokio-util" name = "tokio-util"
version = "0.6.9" version = "0.6.9"

View File

@ -9,13 +9,13 @@ actix-rt = { version = "2.7", features = [] }
actix-web = { version = "4.0", features = [] } actix-web = { version = "4.0", features = [] }
actix-web-httpauth = { version = "0.6", features = [] } actix-web-httpauth = { version = "0.6", features = [] }
actix-cors = { 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-broker = { version = "0.4", features = [] }
actix-identity = { version = "0.4", features = [] } actix-identity = { version = "0.4", features = [] }
actix-web-opentelemetry = { version = "0.12", features = [] } actix-web-opentelemetry = { version = "0.12", features = [] }
actix-session = { version = "0.6", features = ["actix-redis", "redis-actor-session"] } actix-session = { version = "0.6", features = ["actix-redis", "redis-actor-session"] }
actix-redis = { version = "0.11", features = [] } 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 = [] } gumdrop = { version = "0.8", features = [] }

View File

@ -2,6 +2,7 @@ mod accounts;
mod orders; mod orders;
mod products; mod products;
mod stocks; mod stocks;
mod uploads;
use actix_web::web::{scope, ServiceConfig}; use actix_web::web::{scope, ServiceConfig};
@ -11,6 +12,7 @@ pub fn configure(config: &mut ServiceConfig) {
.configure(products::configure) .configure(products::configure)
.configure(stocks::configure) .configure(stocks::configure)
.configure(accounts::configure) .configure(accounts::configure)
.configure(orders::configure), .configure(orders::configure)
.configure(uploads::configure),
); );
} }

View File

@ -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);
}