diff --git a/Cargo.lock b/Cargo.lock index b7b53b6a0b57fad4f5897d2ea0673100eedcab77..1bbab12d79bec6225ce4d4b019c8971d9a415bf3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -312,112 +312,6 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a1bb320f97e6edf9f756bf015900038e43c7700e059688e5724a928c8f3b8d5" -[[package]] -name = "async-channel" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319" -dependencies = [ - "concurrent-queue", - "event-listener", - "futures-core", -] - -[[package]] -name = "async-executor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" -dependencies = [ - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "once_cell", - "slab", -] - -[[package]] -name = "async-global-executor" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9586ec52317f36de58453159d48351bc244bc24ced3effc1fce22f3d48664af6" -dependencies = [ - "async-channel", - "async-executor", - "async-io", - "async-mutex", - "blocking", - "futures-lite", - "num_cpus", - "once_cell", - "tokio", -] - -[[package]] -name = "async-io" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b" -dependencies = [ - "concurrent-queue", - "futures-lite", - "libc", - "log", - "once_cell", - "parking", - "polling", - "slab", - "socket2", - "waker-fn", - "winapi", -] - -[[package]] -name = "async-lock" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6a8ea61bf9947a1007c5cada31e647dbc77b103c679858150003ba697ea798b" -dependencies = [ - "event-listener", -] - -[[package]] -name = "async-mutex" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" -dependencies = [ - "event-listener", -] - -[[package]] -name = "async-std" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8056f1455169ab86dd47b47391e4ab0cbd25410a70e9fe675544f49bafaf952" -dependencies = [ - "async-channel", - "async-global-executor", - "async-io", - "async-lock", - "crossbeam-utils", - "futures-channel", - "futures-core", - "futures-io", - "futures-lite", - "gloo-timers", - "kv-log-macro", - "log", - "memchr", - "num_cpus", - "once_cell", - "pin-project-lite", - "pin-utils", - "slab", - "wasm-bindgen-futures", -] - [[package]] name = "async-task" version = "4.1.0" @@ -444,12 +338,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "atomic-waker" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" - [[package]] name = "atty" version = "0.2.14" @@ -560,20 +448,6 @@ dependencies = [ "byte-tools", ] -[[package]] -name = "blocking" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046e47d4b2d391b1f6f8b407b1deb8dee56c1852ccd868becf2710f601b5f427" -dependencies = [ - "async-channel", - "async-task", - "atomic-waker", - "fastrand", - "futures-lite", - "once_cell", -] - [[package]] name = "brotli" version = "3.3.3" @@ -639,12 +513,6 @@ dependencies = [ "bytes", ] -[[package]] -name = "cache-padded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" - [[package]] name = "cc" version = "1.0.72" @@ -714,15 +582,6 @@ dependencies = [ "tokio-util", ] -[[package]] -name = "concurrent-queue" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" -dependencies = [ - "cache-padded", -] - [[package]] name = "const-oid" version = "0.6.2" @@ -867,16 +726,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "ctor" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccc0a48a9b826acdf4028595adc9db92caea352f7af011a3034acd172a52a0aa" -dependencies = [ - "quote", - "syn", -] - [[package]] name = "dashmap" version = "4.0.2" @@ -994,12 +843,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "event-listener" -version = "2.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71" - [[package]] name = "fake-simd" version = "0.1.2" @@ -1151,21 +994,6 @@ version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" -[[package]] -name = "futures-lite" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", -] - [[package]] name = "futures-macro" version = "0.3.21" @@ -1243,18 +1071,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "gloo-timers" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d12a7f4e95cfe710f1d624fb1210b7d961a5fb05c4fd942f4feab06e61f590e" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - [[package]] name = "h2" version = "0.3.11" @@ -1524,15 +1340,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "kv-log-macro" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" -dependencies = [ - "log", -] - [[package]] name = "language-tags" version = "0.3.2" @@ -1622,7 +1429,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ "cfg-if", - "value-bag", ] [[package]] @@ -1934,12 +1740,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "parking" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" - [[package]] name = "parking_lot" version = "0.11.2" @@ -2136,19 +1936,6 @@ version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" -[[package]] -name = "polling" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259" -dependencies = [ - "cfg-if", - "libc", - "log", - "wepoll-ffi", - "winapi", -] - [[package]] name = "ppv-lite86" version = "0.2.16" @@ -2586,18 +2373,16 @@ dependencies = [ [[package]] name = "rustus" -version = "0.4.2" +version = "0.4.3" dependencies = [ "actix-files", "actix-rt", "actix-web", - "async-std", "async-trait", "base64", "chrono", "derive_more", "fern", - "futures", "httptest", "lapin", "lazy_static", @@ -3472,16 +3257,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "value-bag" -version = "1.0.0-alpha.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79923f7731dc61ebfba3633098bf3ac533bbd35ccd8c57e7088d9a5eebe0263f" -dependencies = [ - "ctor", - "version_check", -] - [[package]] name = "vcpkg" version = "0.2.15" @@ -3500,12 +3275,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "waker-fn" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" - [[package]] name = "want" version = "0.3.0" @@ -3617,15 +3386,6 @@ dependencies = [ "webpki", ] -[[package]] -name = "wepoll-ffi" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" -dependencies = [ - "cc", -] - [[package]] name = "whoami" version = "1.2.1" diff --git a/Cargo.toml b/Cargo.toml index c9c94887af953e0cdcdfc8b382ba88ad98c7bcbc..525541321413b0d9cdcbcd8edd73d9c5a5ca4a1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustus" -version = "0.4.2" +version = "0.4.3" edition = "2021" description = "TUS protocol implementation written in Rust." @@ -31,10 +31,6 @@ version = "0.6.0-beta.13" [dependencies.actix-web] version = "^4.0.0-beta.20" -[dependencies.async-std] -features = ["tokio1"] -version = "^1.10.0" - [dependencies.chrono] features = ["serde"] version = "^0.4.19" @@ -48,10 +44,6 @@ version = "^0.99.9" features = ["colored"] version = "0.6.0" -[dependencies.futures] -features = ["executor"] -version = "^0.3.19" - [dependencies.lapin] optional = true version = "^1.9.0" @@ -120,5 +112,6 @@ httptest = "0.15.4" [profile] [profile.release] lto = true +panic = "abort" opt-level = "z" codegen-units = 1 diff --git a/README.md b/README.md index db7914bf337fc9c8ce1c335fb876d34d0a922a1f..9023bf0134326aded0556529d58b0ef3c6c1ea41 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ <div align="center"> - <img src="./imgs/logo.svg" alt="logo" height="400"> + <img src="./imgs/logo_horizontal.svg" alt="logo" width="500"> <div> <p></p> <img alt="Docker Image Size (latest by date)" src="https://img.shields.io/docker/image-size/s3rius/rustus?sort=date&style=for-the-badge"> diff --git a/imgs/logo_horizontal.svg b/imgs/logo_horizontal.svg new file mode 100644 index 0000000000000000000000000000000000000000..c2a9dc4d45af9577a8617e8726d6e02c3aa0524d --- /dev/null +++ b/imgs/logo_horizontal.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1156.21 392.31"><defs><style>.cls-1{fill:url(#БезымÑнный_градиент_9);}.cls-2{fill:url(#БезымÑнный_градиент_9-2);}.cls-3{fill:#2659a5;}.cls-4{fill:#45baec;}</style><linearGradient id="БезымÑнный_градиент_9" x1="213.3" y1="392.31" x2="213.3" y2="6.18" gradientUnits="userSpaceOnUse"><stop offset="0.25" stop-color="#45baec"/><stop offset="0.34" stop-color="#42b1e5"/><stop offset="0.48" stop-color="#3a99d4"/><stop offset="0.66" stop-color="#2e71b7"/><stop offset="0.75" stop-color="#2659a5"/></linearGradient><linearGradient id="БезымÑнный_градиент_9-2" x1="112.8" y1="392.31" x2="112.8" y2="6.18" xlink:href="#БезымÑнный_градиент_9"/></defs><g id="Слой_2" data-name="Слой 2"><g id="Слой_1-2" data-name="Слой 1"><path class="cls-1" d="M213.11,392.31q-53.36,0-83-30t-29.64-85.94V49.86c10.11-9.42,14.29-13.31,23.56-22h0c11.55-10.71,16.8-15.6,23.56-21.68V274.52q0,75.84,65.14,75.82,65.51,0,65.5-75.82v-120A23.55,23.55,0,0,1,301.81,131h.73a23.55,23.55,0,0,1,23.56,23.55V276.37q0,56-29.8,85.94T213.11,392.31Z"/><path class="cls-2" d="M29.8,362.31Q0,332.33,0,276.37V154.55A23.55,23.55,0,0,1,23.56,131h.73a23.55,23.55,0,0,1,23.56,23.55v120q0,75.84,65.5,75.82,65.15,0,65.14-75.82V6.18c6.76,6.08,12,11,23.56,21.68h0c9.27,8.69,13.45,12.58,23.56,22V276.37q0,56-29.64,85.94t-83,30Q59.62,392.31,29.8,362.31Z"/><path class="cls-3" d="M77.73,125.52A23,23,0,0,1,62.05,85.68l85.33-79.5a23,23,0,0,1,31.36,33.66L93.41,119.35A23,23,0,0,1,77.73,125.52Z"/><path class="cls-3" d="M248.37,125.52a23,23,0,0,1-15.68-6.17L147.38,39.84A23,23,0,1,1,178.74,6.18l85.31,79.5a23,23,0,0,1-15.68,39.84Z"/><path class="cls-3" d="M385.36,264.84V134.43h36.89v16.86q15.27-19.75,50.05-19.23v39a38.88,38.88,0,0,0-19-4.47q-12.65,0-21.86,10.27T422.25,205v59.8Z"/><path class="cls-3" d="M546.33,266.42q-25.56,0-41-16.86T490,202.14V134.43h36.88v63.76q0,17.66,7.78,27.13t20.68,9.49q14,0,21.86-9.75t7.91-27.66v-63h36.88V264.84H585.58V249h-.52Q570.83,266.43,546.33,266.42Z"/><path class="cls-3" d="M698.87,269.58q-20.82,0-37.28-9.88T639.06,233l31.88-10q7.63,17.13,28.45,17.13,10.54,0,16.6-4.09a13,13,0,0,0,6.06-11.46q0-5.53-5.53-8.3a31.35,31.35,0,0,0-13-3q-7.51-.27-18.44-1.72a74.25,74.25,0,0,1-18.58-4.61q-22.4-10-22.39-33.19,0-18.18,15.54-30.56t37.94-12.38q21.08,0,35.17,9.74a45.51,45.51,0,0,1,18.57,26.09l-31.35,8.69A21.66,21.66,0,0,0,712.3,163q-5.79-4.61-14.49-4.61t-14.36,4.21q-5.66,4.22-5.66,10.28,0,7.64,9,10.4T711,187.52q15.28,1.46,23.45,4.87,23.45,9.75,23.45,32.67,0,20-16.6,32.27T698.87,269.58Z"/><path class="cls-3" d="M843.23,265.37q-22.38,0-36.35-12.78t-14-33.85V166.58H765.26V134.43h27.66V96.5h36.35v37.93h36.36v32.15H829.27v44q0,21.08,22.4,21.08a45.42,45.42,0,0,0,13.43-2.11l3.95,31.61A86.12,86.12,0,0,1,843.23,265.37Z"/><path class="cls-3" d="M944.66,266.42q-25.54,0-41-16.86t-15.41-47.42V134.43h36.88v63.76q0,17.66,7.77,27.13t20.68,9.49q14,0,21.87-9.75t7.9-27.66v-63h36.88V264.84H983.92V249h-.53Q969.17,266.43,944.66,266.42Z"/><path class="cls-3" d="M1097.2,269.58q-20.81,0-37.28-9.88T1037.4,233l31.88-10q7.63,17.13,28.45,17.13,10.53,0,16.6-4.09a13,13,0,0,0,6.06-11.46q0-5.53-5.53-8.3a31.36,31.36,0,0,0-13-3q-7.5-.27-18.44-1.72a74,74,0,0,1-18.57-4.61q-22.4-10-22.39-33.19,0-18.18,15.54-30.56t37.94-12.38q21.08,0,35.17,9.74a45.51,45.51,0,0,1,18.57,26.09l-31.35,8.69a21.66,21.66,0,0,0-7.64-12.25q-5.81-4.61-14.49-4.61t-14.36,4.21q-5.67,4.22-5.66,10.28,0,7.64,9,10.4t24.23,4.22q15.29,1.46,23.45,4.87,23.45,9.75,23.44,32.67,0,20-16.59,32.27T1097.2,269.58Z"/><path class="cls-4" d="M385.36,353.32V306.8H391l18.47,33.29,18.41-33.29h5.59v46.52h-4.85V315.1l-17.22,30.64h-3.92l-17.15-30.57v38.15Z"/><path class="cls-4" d="M456.74,353.72a15.05,15.05,0,0,1-11.39-4.89,17.79,17.79,0,0,1,0-23.92A15.05,15.05,0,0,1,456.74,320q8.91,0,13.43,6.85v-6.45h4.65v32.9h-4.65v-6.38Q465.58,353.72,456.74,353.72ZM448.9,346a12.43,12.43,0,0,0,17.68,0,13.3,13.3,0,0,0,0-18.18,12.36,12.36,0,0,0-17.68,0,13.3,13.3,0,0,0,0,18.18Z"/><path class="cls-4" d="M483.33,353.32V303.47H488v30.78h7.18l12.9-13.83h6l-15,16,15,16.88h-5.92l-13-14.69H488v14.69Z"/><path class="cls-4" d="M533.51,319.56a16.26,16.26,0,0,1,11.86,4.65,16.79,16.79,0,0,1,5,12V338H521a12.53,12.53,0,0,0,3.95,8.7,12.34,12.34,0,0,0,8.74,3.39q7.11,0,10.9-5l3,2.39q-4.71,6.58-14,6.58a16.31,16.31,0,0,1-12-5,16.57,16.57,0,0,1-5-12.13,17,17,0,0,1,4.85-12.32A16.19,16.19,0,0,1,533.51,319.56Zm0,4a12,12,0,0,0-8.11,2.92,12.78,12.78,0,0,0-4.25,7.64h24.79a13,13,0,0,0-4.19-7.64A12,12,0,0,0,533.51,323.55Z"/><path class="cls-4" d="M568.8,354.38a17.5,17.5,0,0,1-8.87-2.26,12.43,12.43,0,0,1-5.62-6.84l4-1.26q2.73,6.57,10.57,6.58a10.69,10.69,0,0,0,6.68-1.87,6,6,0,0,0,2.42-5,3.78,3.78,0,0,0-1.76-3.36,8.57,8.57,0,0,0-4.05-1.36q-2.29-.19-5.65-.6a21.52,21.52,0,0,1-5.35-1.19q-5.46-2.13-5.45-7.71a8.77,8.77,0,0,1,3.55-7,13.61,13.61,0,0,1,8.94-2.93,13.78,13.78,0,0,1,8.44,2.46A11.18,11.18,0,0,1,581,328.4l-4,1.13a8.91,8.91,0,0,0-2.93-4.49,8.81,8.81,0,0,0-5.78-1.76,9.15,9.15,0,0,0-5.95,1.86,5.51,5.51,0,0,0-2.29,4.39,4.26,4.26,0,0,0,3,4.32,30.07,30.07,0,0,0,7.84,1.56,22.45,22.45,0,0,1,7,1.43c3.15,1.42,4.72,3.74,4.72,7a9.24,9.24,0,0,1-3.75,7.64Q575,354.39,568.8,354.38Z"/><path class="cls-4" d="M613,320.42h17v32.9h-4.58V324.54H613v28.78h-4.65V324.54h-7.11v-4.12h7.11v-2.59a19.13,19.13,0,0,1,1.26-7.35A10.12,10.12,0,0,1,613,306a13.46,13.46,0,0,1,4.25-2.1,16.94,16.94,0,0,1,4.55-.6,27.23,27.23,0,0,1,7.05,1.07l-.67,4.38a19.8,19.8,0,0,0-6-.93,9.86,9.86,0,0,0-6.39,2.2q-2.72,2.19-2.72,7.77Z"/><path class="cls-4" d="M645.9,353.45a7.81,7.81,0,0,1-6-2.32,9,9,0,0,1-2.2-6.45V303.47h4.66V344a5.38,5.38,0,0,0,1.26,3.85,4.44,4.44,0,0,0,3.39,1.33,7.4,7.4,0,0,0,2.39-.4l.53,4.13A15.79,15.79,0,0,1,645.9,353.45Z"/><path class="cls-4" d="M669.49,319.56a16.3,16.3,0,0,1,11.87,4.65,16.78,16.78,0,0,1,4.95,12V338H656.93a12.5,12.5,0,0,0,4,8.7,12.31,12.31,0,0,0,8.74,3.39q7.11,0,10.9-5l3,2.39q-4.72,6.58-14,6.58a16.34,16.34,0,0,1-12-5,16.57,16.57,0,0,1-5-12.13,17.05,17.05,0,0,1,4.85-12.32A16.19,16.19,0,0,1,669.49,319.56Zm0,4a12,12,0,0,0-8.11,2.92,12.83,12.83,0,0,0-4.25,7.64h24.79a12.91,12.91,0,0,0-4.19-7.64A12,12,0,0,0,669.49,323.55Z"/><path class="cls-4" d="M721.2,353.72A13.41,13.41,0,0,1,711,349.57Q707,345.42,707,337.3V320.42h4.66V337q0,6.38,2.86,9.54a9.27,9.27,0,0,0,7.17,3.16,9.76,9.76,0,0,0,7.78-3.39q2.93-3.39,2.92-9.58V320.42h4.66v32.9h-4.66V347.8h-.06A12.51,12.51,0,0,1,721.2,353.72Z"/><path class="cls-4" d="M745.59,369.94V320.42h4.66v6.45q4.51-6.84,13.42-6.85a15,15,0,0,1,11.43,4.89,17.83,17.83,0,0,1,0,23.92,15.06,15.06,0,0,1-11.4,4.89q-8.83,0-13.42-6.78v23Zm17.08-20.27a11.66,11.66,0,0,0,8.74-3.69,13.39,13.39,0,0,0,0-18.18,11.61,11.61,0,0,0-8.74-3.72,11.81,11.81,0,0,0-8.84,3.72,13.33,13.33,0,0,0,0,18.18A11.86,11.86,0,0,0,762.67,349.67Z"/><path class="cls-4" d="M794.44,353.45a7.83,7.83,0,0,1-6-2.32,9,9,0,0,1-2.19-6.45V303.47h4.65V344a5.38,5.38,0,0,0,1.26,3.85,4.47,4.47,0,0,0,3.39,1.33,7.46,7.46,0,0,0,2.4-.4l.53,4.13A15.86,15.86,0,0,1,794.44,353.45Z"/><path class="cls-4" d="M830.66,349.07a17.31,17.31,0,1,1,5.06-12.17A16.66,16.66,0,0,1,830.66,349.07ZM809.6,346a12.36,12.36,0,0,0,17.68,0,13.41,13.41,0,0,0,0-18.24,12.27,12.27,0,0,0-17.68,0,13.38,13.38,0,0,0,0,18.24Z"/><path class="cls-4" d="M856.52,353.72a15.06,15.06,0,0,1-11.4-4.89,17.79,17.79,0,0,1,0-23.92,15.06,15.06,0,0,1,11.4-4.89q8.91,0,13.43,6.85v-6.45h4.65v32.9H870v-6.38Q865.36,353.72,856.52,353.72ZM848.68,346a12.43,12.43,0,0,0,17.68,0,13.3,13.3,0,0,0,0-18.18,12.36,12.36,0,0,0-17.68,0,13.3,13.3,0,0,0,0,18.18Z"/><path class="cls-4" d="M897.2,353.72a15.06,15.06,0,0,1-11.4-4.89,17.79,17.79,0,0,1,0-23.92A15.06,15.06,0,0,1,897.2,320q8.89,0,13.42,6.85v-23.4h4.65v49.85h-4.65v-6.38Q906,353.72,897.2,353.72Zm1-4.05A11.84,11.84,0,0,0,907,346a13.3,13.3,0,0,0,0-18.18,11.8,11.8,0,0,0-8.84-3.72,11.63,11.63,0,0,0-8.74,3.72,13.41,13.41,0,0,0,0,18.18A11.67,11.67,0,0,0,898.19,349.67Z"/><path class="cls-4" d="M936.47,354.38a17.52,17.52,0,0,1-8.87-2.26,12.37,12.37,0,0,1-5.61-6.84l4-1.26q2.73,6.57,10.57,6.58a10.67,10.67,0,0,0,6.68-1.87,6,6,0,0,0,2.43-5,3.79,3.79,0,0,0-1.77-3.36,8.57,8.57,0,0,0-4-1.36q-2.3-.19-5.65-.6a21.52,21.52,0,0,1-5.35-1.19q-5.45-2.13-5.45-7.71a8.78,8.78,0,0,1,3.56-7,13.61,13.61,0,0,1,8.94-2.93,13.82,13.82,0,0,1,8.44,2.46,11.21,11.21,0,0,1,4.32,6.32l-4,1.13a9,9,0,0,0-2.92-4.49,8.84,8.84,0,0,0-5.79-1.76,9.15,9.15,0,0,0-6,1.86,5.53,5.53,0,0,0-2.29,4.39,4.27,4.27,0,0,0,3,4.32,30.07,30.07,0,0,0,7.84,1.56,22.45,22.45,0,0,1,7,1.43c3.15,1.42,4.72,3.74,4.72,7a9.24,9.24,0,0,1-3.75,7.64Q942.72,354.39,936.47,354.38Z"/><path class="cls-4" d="M986.79,319.56a16.28,16.28,0,0,1,11.86,4.65,16.74,16.74,0,0,1,5,12V338H974.22a12.54,12.54,0,0,0,4,8.7,12.33,12.33,0,0,0,8.74,3.39q7.11,0,10.9-5l3,2.39q-4.72,6.58-14,6.58a16.31,16.31,0,0,1-12-5,16.54,16.54,0,0,1-5-12.13,17.05,17.05,0,0,1,4.85-12.32A16.22,16.22,0,0,1,986.79,319.56Zm0,4a12,12,0,0,0-8.11,2.92,12.84,12.84,0,0,0-4.26,7.64h24.8a13,13,0,0,0-4.19-7.64A12,12,0,0,0,986.79,323.55Z"/><path class="cls-4" d="M1023.81,353.72a15.06,15.06,0,0,1-11.4-4.89,17.79,17.79,0,0,1,0-23.92,15.06,15.06,0,0,1,11.4-4.89q8.89,0,13.42,6.85v-6.45h4.65v32.9h-4.65v-6.38Q1032.64,353.72,1023.81,353.72ZM1016,346a12.43,12.43,0,0,0,17.68,0,13.3,13.3,0,0,0,0-18.18,12.36,12.36,0,0,0-17.68,0,13.3,13.3,0,0,0,0,18.18Z"/><path class="cls-4" d="M1062.89,354.38a17.56,17.56,0,0,1-8.88-2.26,12.41,12.41,0,0,1-5.61-6.84l4-1.26q2.71,6.57,10.56,6.58a10.65,10.65,0,0,0,6.68-1.87,6,6,0,0,0,2.43-5,3.8,3.8,0,0,0-1.76-3.36,8.64,8.64,0,0,0-4.06-1.36q-2.29-.19-5.65-.6a21.63,21.63,0,0,1-5.35-1.19q-5.45-2.13-5.45-7.71a8.78,8.78,0,0,1,3.56-7,13.61,13.61,0,0,1,8.94-2.93,13.82,13.82,0,0,1,8.44,2.46,11.16,11.16,0,0,1,4.32,6.32l-4,1.13a8.33,8.33,0,0,0-8.7-6.25,9.15,9.15,0,0,0-5.95,1.86,5.52,5.52,0,0,0-2.3,4.39,4.27,4.27,0,0,0,3,4.32,30.16,30.16,0,0,0,7.84,1.56,22.52,22.52,0,0,1,7,1.43c3.14,1.42,4.72,3.74,4.72,7a9.25,9.25,0,0,1-3.76,7.64Q1069.14,354.39,1062.89,354.38Z"/><path class="cls-4" d="M1084.89,313.51a2.82,2.82,0,0,1-2-.83,2.72,2.72,0,0,1-.86-2,2.66,2.66,0,0,1,.86-2,2.82,2.82,0,0,1,2-.83,2.76,2.76,0,0,1,2,.83,2.67,2.67,0,0,1,.83,2,2.73,2.73,0,0,1-.83,2A2.76,2.76,0,0,1,1084.89,313.51Zm-2.26,39.81v-32.9h4.58v32.9Z"/><path class="cls-4" d="M1110.54,319.56a16.26,16.26,0,0,1,11.86,4.65,16.79,16.79,0,0,1,5,12V338H1098a12.53,12.53,0,0,0,4,8.7,12.34,12.34,0,0,0,8.74,3.39q7.11,0,10.9-5l3,2.39q-4.71,6.58-14,6.58a16.31,16.31,0,0,1-12-5,16.57,16.57,0,0,1-5-12.13,17,17,0,0,1,4.85-12.32A16.19,16.19,0,0,1,1110.54,319.56Zm0,4a12,12,0,0,0-8.11,2.92,12.78,12.78,0,0,0-4.25,7.64H1123a13,13,0,0,0-4.19-7.64A12,12,0,0,0,1110.54,323.55Z"/><path class="cls-4" d="M1133.47,353.32v-32.9h4.65V326q3.8-6.18,12.7-6v4.85a10.24,10.24,0,0,0-3.19-.39,9.3,9.3,0,0,0-6.75,3.12,11.1,11.1,0,0,0-2.76,7.84v17.88Z"/></g></g></svg> \ No newline at end of file diff --git a/src/info_storages/file_info_storage.rs b/src/info_storages/file_info_storage.rs index bafa5bcfb55c4cbbf4eabbffa664ca609a192b73..08f977bc8238c13678f98bd37ae1958c47f9e0d9 100644 --- a/src/info_storages/file_info_storage.rs +++ b/src/info_storages/file_info_storage.rs @@ -1,10 +1,9 @@ use std::path::PathBuf; -use async_std::fs::{read_to_string, remove_file, DirBuilder, OpenOptions}; use async_trait::async_trait; -use futures::io::BufWriter; -use futures::AsyncWriteExt; use log::error; +use tokio::fs::{read_to_string, remove_file, DirBuilder, OpenOptions}; +use tokio::io::{AsyncWriteExt, BufWriter}; use crate::errors::{RustusError, RustusResult}; use crate::info_storages::{FileInfo, InfoStorage}; @@ -48,7 +47,7 @@ impl InfoStorage for FileInfoStorage { })?; let mut writer = BufWriter::new(file); writer - .write_all( + .write( serde_json::to_string(&file_info) .map_err(|err| { error!("{:#?}", err); diff --git a/src/notifiers/http_notifier.rs b/src/notifiers/http_notifier.rs index 2e710047d16bf3a3099c6ab20008dd5ed36c75dd..36956d55c315cc1d991f7c04412370e6fc32b755 100644 --- a/src/notifiers/http_notifier.rs +++ b/src/notifiers/http_notifier.rs @@ -4,7 +4,6 @@ use crate::notifiers::{Hook, Notifier}; use actix_web::http::header::HeaderMap; use async_trait::async_trait; -use futures::future::try_join_all; use log::debug; use reqwest::Client; use std::time::Duration; @@ -56,9 +55,8 @@ impl Notifier for HttpNotifier { } request.body(message.clone()).send() }); - let responses = try_join_all(requests_vec).await?; - for resp in responses { - resp.error_for_status()?; + for response in requests_vec { + response.await?.error_for_status()?; } Ok(()) } diff --git a/src/storages/file_storage.rs b/src/storages/file_storage.rs index ba448192cf94570ed804ee0ff0d9bcd62ac4d139..607dbc17b8bb798278b5911b6e2055cbab22b404 100644 --- a/src/storages/file_storage.rs +++ b/src/storages/file_storage.rs @@ -1,18 +1,16 @@ use std::path::PathBuf; use actix_files::NamedFile; -use async_std::fs::{remove_file, DirBuilder, File, OpenOptions}; -use async_std::io::copy; use async_trait::async_trait; use log::error; +use tokio::fs::{remove_file, DirBuilder, OpenOptions}; +use tokio::io::{copy, AsyncWriteExt, BufWriter}; use crate::errors::{RustusError, RustusResult}; use crate::info_storages::FileInfo; use crate::storages::Storage; use crate::utils::dir_struct::dir_struct; use derive_more::Display; -use futures::io::BufWriter; -use futures::AsyncWriteExt; #[derive(Display)] #[display(fmt = "file_storage")] @@ -98,12 +96,14 @@ impl Storage for FileStorage { RustusError::UnableToWrite(err.to_string()) })?; let mut writer = BufWriter::new(file); - writer.write_all(bytes).await.map_err(|err| { + writer.write(bytes).await.map_err(|err| { + error!("{:?}", err); + RustusError::UnableToWrite(info.path.clone().unwrap()) + })?; + writer.flush().await.map_err(|err| { error!("{:?}", err); RustusError::UnableToWrite(info.path.clone().unwrap()) })?; - // Updating information about file. - writer.flush().await?; Ok(()) } @@ -144,7 +144,10 @@ impl Storage for FileStorage { if part.path.is_none() { return Err(RustusError::FileNotFound); } - let mut part_file = File::open(part.path.as_ref().unwrap()).await?; + let mut part_file = OpenOptions::new() + .read(true) + .open(part.path.as_ref().unwrap()) + .await?; copy(&mut part_file, &mut file).await?; } file.sync_data().await?;