From 207f4024ace99c1acb412d21be523ab2bed8a986 Mon Sep 17 00:00:00 2001 From: ramiroaisen <52116153+ramiroaisen@users.noreply.github.com> Date: Fri, 20 Oct 2023 14:50:17 -0300 Subject: [PATCH] feat: upgrade mongodb to 2.7.0, bson patch no longer needed, change panic behavior to abort --- Cargo.lock | 158 +++++++++--------- Cargo.toml | 20 ++- rs/bin/openstream/Cargo.toml | 4 +- .../Cargo.toml | 2 +- .../create-test-accounts/Cargo.toml | 2 +- rs/internal-scripts/migrations/Cargo.toml | 2 +- .../purge-deleted-items/Cargo.toml | 2 +- rs/packages/api/Cargo.toml | 2 +- rs/packages/api2/Cargo.toml | 2 +- rs/packages/db/Cargo.toml | 2 +- rs/packages/http/Cargo.toml | 2 +- rs/packages/media/Cargo.toml | 2 +- rs/packages/router/Cargo.toml | 2 +- rs/packages/serde-util/Cargo.toml | 4 +- rs/packages/serde-util/src/datetime.rs | 7 +- rs/packages/serde-util/src/lib.rs | 11 +- rs/packages/source-alt/Cargo.toml | 2 +- rs/packages/stream/Cargo.toml | 2 +- rs/packages/upload/Cargo.toml | 2 +- 19 files changed, 128 insertions(+), 102 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7ba4bae2..9508a09f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -80,6 +80,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if", + "getrandom 0.2.8", "once_cell", "version_check", ] @@ -364,7 +365,7 @@ dependencies = [ "flate2", "http 0.2.9", "log", - "rustls 0.21.1", + "rustls", "url", "webpki", "webpki-roots 0.23.0", @@ -552,6 +553,18 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "block-buffer" version = "0.10.3" @@ -594,13 +607,17 @@ dependencies = [ [[package]] name = "bson" -version = "2.5.0" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58da0ae1e701ea752cc46c1bb9f39d5ecefc7395c3ecd526261a566d4f16e0c2" dependencies = [ - "ahash 0.7.6", + "ahash 0.8.3", "base64 0.13.1", + "bitvec", "hex", "indexmap 1.9.2", - "lazy_static", + "js-sys", + "once_cell", "rand 0.8.5", "serde", "serde_bytes", @@ -1912,6 +1929,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + [[package]] name = "futf" version = "0.1.5" @@ -2503,9 +2526,9 @@ checksum = "0646026eb1b3eea4cd9ba47912ea5ce9cc07713d105b1a14698f4e6433d348b7" dependencies = [ "http 0.2.9", "hyper", - "rustls 0.21.1", + "rustls", "tokio", - "tokio-rustls 0.24.0", + "tokio-rustls", ] [[package]] @@ -2924,12 +2947,12 @@ dependencies = [ "nom", "once_cell", "quoted_printable", - "rustls 0.21.1", + "rustls", "rustls-pemfile", "socket2 0.4.9", "tokio", "tokio-native-tls", - "tokio-rustls 0.24.0", + "tokio-rustls", "webpki-roots 0.23.0", ] @@ -3446,9 +3469,9 @@ dependencies = [ [[package]] name = "mongodb" -version = "2.4.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a37fe10c1485a0cd603468e284a1a8535b4ecf46808f5f7de3639a1e1252dbf8" +checksum = "e22d517e7e678e1c9a2983ec704b43f3b22f38b1b7a247ea3ddb36d21578bf4e" dependencies = [ "async-trait", "base64 0.13.1", @@ -3469,7 +3492,7 @@ dependencies = [ "percent-encoding", "rand 0.8.5", "rustc_version_runtime", - "rustls 0.20.7", + "rustls", "rustls-pemfile", "serde", "serde_bytes", @@ -3482,14 +3505,13 @@ dependencies = [ "take_mut", "thiserror", "tokio", - "tokio-rustls 0.23.4", + "tokio-rustls", "tokio-util", "trust-dns-proto", "trust-dns-resolver", "typed-builder", "uuid", - "webpki-roots 0.22.6", - "zstd", + "webpki-roots 0.25.2", ] [[package]] @@ -4331,6 +4353,12 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3866219251662ec3b26fc217e3e05bf9c4f84325234dfb96bf0bf840889e49" +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.4.6" @@ -4630,14 +4658,14 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.21.1", + "rustls", "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "tokio", "tokio-native-tls", - "tokio-rustls 0.24.0", + "tokio-rustls", "tokio-util", "tower-service", "url", @@ -4888,25 +4916,13 @@ dependencies = [ [[package]] name = "rustls" -version = "0.20.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" -dependencies = [ - "log", - "ring", - "sct", - "webpki", -] - -[[package]] -name = "rustls" -version = "0.21.1" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c911ba11bc8433e811ce56fde130ccf32f5127cab0e0194e9c68c5a5b671791e" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring", - "rustls-webpki", + "rustls-webpki 0.101.6", "sct", ] @@ -4929,6 +4945,16 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustls-webpki" +version = "0.101.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.11" @@ -5909,6 +5935,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "tempfile" version = "3.7.0" @@ -6148,22 +6180,11 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.23.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" -dependencies = [ - "rustls 0.20.7", - "tokio", - "webpki", -] - -[[package]] -name = "tokio-rustls" -version = "0.24.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0d409377ff5b1e3ca6437aa86c1eb7d40c134bfec254e44c830defa92669db5" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.1", + "rustls", "tokio", ] @@ -6882,9 +6903,15 @@ version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa54963694b65584e170cf5dc46aeb4dcaa5584e652ff5f3952e56d66aff0125" dependencies = [ - "rustls-webpki", + "rustls-webpki 0.100.1", ] +[[package]] +name = "webpki-roots" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" + [[package]] name = "weezl" version = "0.1.7" @@ -7135,6 +7162,15 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + [[package]] name = "xml5ever" version = "0.17.0" @@ -7152,36 +7188,6 @@ version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" -[[package]] -name = "zstd" -version = "0.11.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.5+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc50ffce891ad571e9f9afe5039c4837bede781ac4bb13052ed7ae695518596" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - [[package]] name = "zune-inflate" version = "0.2.54" diff --git a/Cargo.toml b/Cargo.toml index a770b908..14caa89a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,20 @@ -[workspace] +[profile.dev] +panic = "abort" + +[profile.release] +panic = "abort" + +[profile.test ] +panic = "abort" +[profile.bench] +panic = "abort" + +[profile.doc] +panic = "abort" + +[workspace] resolver = "2" members = [ @@ -72,5 +86,5 @@ members = [ ] [patch.crates-io] -bson = { path = "./rs/patches/bson" } -ts-rs = { path = "./rs/patches/ts-rs/ts-rs" } +# bson = { path = "./rs/patches/bson" } +ts-rs = { path = "./rs/patches/ts-rs/ts-rs" } \ No newline at end of file diff --git a/rs/bin/openstream/Cargo.toml b/rs/bin/openstream/Cargo.toml index 6bd9971f..90f86d69 100644 --- a/rs/bin/openstream/Cargo.toml +++ b/rs/bin/openstream/Cargo.toml @@ -21,7 +21,7 @@ dotenv = "0.15.0" owo-colors = { version = "3.5.0", path = "../../packages/owo-colors" } config = { version = "0.1.0", path = "../../packages/config" } db = { version = "0.1.0", path = "../../packages/db" } -mongodb = { version = "2.4.0", features = [ "zstd-compression" ] } +mongodb = "2.7.0" drop-tracer = { version = "0.1.0", path = "../../packages/drop-tracer" } shutdown = { version = "0.1.0", path = "../../packages/shutdown" } which = "4.3.0" @@ -44,4 +44,4 @@ mailer = { version = "0.1.0", path = "../../packages/mailer" } payments = { version = "0.1.0", path = "../../packages/payments" } assets = { version = "0.1.0", path = "../../packages/assets" } console-subscriber = { version = "0.1.9", features = ["parking_lot"] } -media = { version = "0.1.0", path = "../../packages/media" } +media = { version = "0.1.0", path = "../../packages/media" } \ No newline at end of file diff --git a/rs/internal-scripts/create-random-stream-connections/Cargo.toml b/rs/internal-scripts/create-random-stream-connections/Cargo.toml index fd577a20..f82e615e 100644 --- a/rs/internal-scripts/create-random-stream-connections/Cargo.toml +++ b/rs/internal-scripts/create-random-stream-connections/Cargo.toml @@ -14,7 +14,7 @@ futures-util = "0.3.25" geoip = { version = "0.1.0", path = "../../packages/geoip" } log = "0.4.17" logger = { version = "0.1.0", path = "../../packages/logger" } -mongodb = "2.4.0" +mongodb = "2.7.0" owo-colors = { version = "3.5.0", path = "../../packages/owo-colors" } rand = "0.8.5" serde-util = { version = "0.1.0", path = "../../packages/serde-util" } diff --git a/rs/internal-scripts/create-test-accounts/Cargo.toml b/rs/internal-scripts/create-test-accounts/Cargo.toml index 5232a618..f1d45c0d 100644 --- a/rs/internal-scripts/create-test-accounts/Cargo.toml +++ b/rs/internal-scripts/create-test-accounts/Cargo.toml @@ -13,7 +13,7 @@ futures = "0.3.25" futures-util = "0.3.25" log = "0.4.17" logger = { version = "0.1.0", path = "../../packages/logger" } -mongodb = "2.4.0" +mongodb = "2.7.0" owo-colors = { version = "3.5.0", path = "../../packages/owo-colors" } serde-util = { version = "0.1.0", path = "../../packages/serde-util" } thiserror = "1.0.38" diff --git a/rs/internal-scripts/migrations/Cargo.toml b/rs/internal-scripts/migrations/Cargo.toml index e7a85363..0e0c2996 100644 --- a/rs/internal-scripts/migrations/Cargo.toml +++ b/rs/internal-scripts/migrations/Cargo.toml @@ -27,7 +27,7 @@ futures-util = "0.3.25" log = "0.4.17" logger = { version = "0.1.0", path = "../../packages/logger" } macros = { version = "0.1.0", path = "../../packages/macros" } -mongodb = "2.4.0" +mongodb = "2.7.0" owo-colors = { version = "3.5.0", path = "../../packages/owo-colors" } serde = { version = "1.0.152", features = ["derive"] } serde-util = { version = "0.1.0", path = "../../packages/serde-util" } diff --git a/rs/internal-scripts/purge-deleted-items/Cargo.toml b/rs/internal-scripts/purge-deleted-items/Cargo.toml index 5bdd1816..b3470e4d 100644 --- a/rs/internal-scripts/purge-deleted-items/Cargo.toml +++ b/rs/internal-scripts/purge-deleted-items/Cargo.toml @@ -19,7 +19,7 @@ futures-util = "0.3.25" log = "0.4.17" logger = { version = "0.1.0", path = "../../packages/logger" } macros = { version = "0.1.0", path = "../../packages/macros" } -mongodb = "2.4.0" +mongodb = "2.7.0" owo-colors = { version = "3.5.0", path = "../../packages/owo-colors" } serde = { version = "1.0.152", features = ["derive"] } serde-util = { version = "0.1.0", path = "../../packages/serde-util" } diff --git a/rs/packages/api/Cargo.toml b/rs/packages/api/Cargo.toml index be915f5b..c7b72490 100644 --- a/rs/packages/api/Cargo.toml +++ b/rs/packages/api/Cargo.toml @@ -29,7 +29,7 @@ lazy-regex = "2.5.0" log = "0.4.17" mailer = { version = "0.1.0", path = "../mailer" } media = { version = "0.1.0", path = "../media" } -mongodb = "2.4.0" +mongodb = "2.7.0" owo-colors = { version = "3.5.0", path = "../owo-colors" } parking_lot = "0.12.1" payments = { version = "0.1.0", path = "../payments" } diff --git a/rs/packages/api2/Cargo.toml b/rs/packages/api2/Cargo.toml index 91307de9..a88e75fc 100644 --- a/rs/packages/api2/Cargo.toml +++ b/rs/packages/api2/Cargo.toml @@ -15,7 +15,7 @@ geoip = { version = "0.1.0", path = "../geoip" } http = { version = "0.2" } hyper = "0.14.27" macros = { version = "0.1.0", path = "../macros" } -mongodb = "2.4.0" +mongodb = "2.7.0" serde = { version = "1.0.171", features = ["derive"] } serde-util = { version = "0.1.0", path = "../serde-util" } thiserror = "1.0.43" diff --git a/rs/packages/db/Cargo.toml b/rs/packages/db/Cargo.toml index df2de076..92bd14d1 100644 --- a/rs/packages/db/Cargo.toml +++ b/rs/packages/db/Cargo.toml @@ -19,7 +19,7 @@ test-analytics-base-measure = [] # syn = "1.0.103" # quote = "1.0.21" lazy_static = "1.4.0" -mongodb = "2.4.0" +mongodb = "2.7.0" serde = "1.0.145" tokio = { version = "1.29.0", features = [ "full" ] } chrono = { version = "0.4.22", features = [ "serde" ] } diff --git a/rs/packages/http/Cargo.toml b/rs/packages/http/Cargo.toml index 132c34f9..6d9c285d 100644 --- a/rs/packages/http/Cargo.toml +++ b/rs/packages/http/Cargo.toml @@ -10,7 +10,7 @@ db = { version = "0.1.0", path = "../db" } # merge-streams = "0.1.2" # tokio-stream = "0.1.11" hyper = "0.14.27" -mongodb = "2.4.0" +mongodb = "2.7.0" pin-project = "1.0.12" prex = { version = "0.1.0", path = "../prex" } serde = "1.0.149" diff --git a/rs/packages/media/Cargo.toml b/rs/packages/media/Cargo.toml index e175eea3..24a36b44 100644 --- a/rs/packages/media/Cargo.toml +++ b/rs/packages/media/Cargo.toml @@ -19,7 +19,7 @@ ffmpeg = { version = "0.1.0", path = "../ffmpeg" } futures-util = "0.3.25" hyper = { version = "0.14.27", features = ["full"] } log = "0.4.17" -mongodb = "2.4.0" +mongodb = "2.7.0" parking_lot = { version = "0.12.1", features = ["send_guard", "arc_lock"] } rand = "0.8.5" regex_static = "0.1.1" diff --git a/rs/packages/router/Cargo.toml b/rs/packages/router/Cargo.toml index c2fc8dd3..0c6d0fc8 100644 --- a/rs/packages/router/Cargo.toml +++ b/rs/packages/router/Cargo.toml @@ -12,7 +12,7 @@ futures = "0.3.25" http = { version = "0.1.0", path = "../http" } hyper = { version = "0.14.27", features = ["full"] } log = "0.4.17" -mongodb = "2.4.0" +mongodb = "2.7.0" owo-colors = { version = "3.5.0", path = "../owo-colors" } prex = { version = "0.1.0", path = "../prex" } serde = { version = "1.0.147", features = ["derive"] } diff --git a/rs/packages/serde-util/Cargo.toml b/rs/packages/serde-util/Cargo.toml index ad47620f..459cb581 100644 --- a/rs/packages/serde-util/Cargo.toml +++ b/rs/packages/serde-util/Cargo.toml @@ -6,15 +6,13 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -# speedate = "0.7.0" -# bson = { version = "2", features = [ "chrono-0_4" ] } base64 = "0.13.0" bytes = "1.2.1" chrono = { version = "0.4", features = ["serde"] } hyper = "0.14.27" iso8601-timestamp = "0.2.7" log = "0.4.17" -mongodb = "2.4.0" +mongodb = "2.7.0" serde = "1" serde_json = { version = "1.0", features = ["preserve_order"] } static_init = "1.0.3" diff --git a/rs/packages/serde-util/src/datetime.rs b/rs/packages/serde-util/src/datetime.rs index 5196cce1..032f17b9 100644 --- a/rs/packages/serde-util/src/datetime.rs +++ b/rs/packages/serde-util/src/datetime.rs @@ -185,6 +185,7 @@ impl From for time::OffsetDateTime { #[cfg(test)] pub mod test { use super::*; + use mongodb::bson::SerializerOptions; use time::macros::datetime; #[test] fn serde_json() { @@ -233,7 +234,11 @@ pub mod test { for date in dates { let date = DateTime::new(date); - let serialized = bson::to_bson(&date).unwrap(); + let serialized = bson::to_bson_with_options( + &date, + SerializerOptions::builder().human_readable(false).build(), + ) + .unwrap(); let deserialized: DateTime = bson::from_bson(serialized).unwrap(); assert_eq!(date, deserialized) } diff --git a/rs/packages/serde-util/src/lib.rs b/rs/packages/serde-util/src/lib.rs index ec3c05a0..9abf8993 100644 --- a/rs/packages/serde-util/src/lib.rs +++ b/rs/packages/serde-util/src/lib.rs @@ -26,17 +26,20 @@ mod test { use serde::Deserializer; use serde::Serializer; - #[test] - fn local_patch() { - assert!(bson::is_local_patch()); - } + // #[ignore] + // #[test] + // fn local_patch() { + // assert!(bson::is_local_patch()); + // } + #[ignore] #[test] fn serializer_is_not_human_readable() { let ser = bson::Serializer::new(); assert!(!ser.is_human_readable()) } + #[ignore] #[test] fn deserializer_is_not_human_readable() { let de = bson::Deserializer::new(Bson::Null); diff --git a/rs/packages/source-alt/Cargo.toml b/rs/packages/source-alt/Cargo.toml index d2741f7b..3285539b 100644 --- a/rs/packages/source-alt/Cargo.toml +++ b/rs/packages/source-alt/Cargo.toml @@ -31,7 +31,7 @@ geoip = { version = "0.1.0", path = "../geoip" } rand = "0.8.5" socket2 = "0.5.2" thiserror = "1.0.40" -mongodb = "2.4.0" +mongodb = "2.7.0" serde = { version = "1.0.160", features = ["derive"] } lazy-regex = "2.5.0" serde-util = { version = "0.1.0", path = "../serde-util" } diff --git a/rs/packages/stream/Cargo.toml b/rs/packages/stream/Cargo.toml index d3699ba7..a92b3a57 100644 --- a/rs/packages/stream/Cargo.toml +++ b/rs/packages/stream/Cargo.toml @@ -22,7 +22,7 @@ futures = "0.3.25" http = { version = "0.1.0", path = "../http" } db = { version = "0.1.0", path = "../db" } serde-util = { version = "0.1.0", path = "../serde-util" } -mongodb = "2.4.0" # 2.3.1 +mongodb = "2.7.0" parking_lot = "0.12.1" constants = { version = "0.1.0", path = "../../config/constants" } thiserror = "1.0.38" diff --git a/rs/packages/upload/Cargo.toml b/rs/packages/upload/Cargo.toml index 4d020ac8..f99374c4 100644 --- a/rs/packages/upload/Cargo.toml +++ b/rs/packages/upload/Cargo.toml @@ -18,7 +18,7 @@ hex = "0.4.3" log = "0.4.17" # logger = { version = "0.1.0", path = "../logger" } md-5 = "0.10.5" -mongodb = "2.4.0" +mongodb = "2.7.0" serde-util = { version = "0.1.0", path = "../serde-util" } sha2 = "0.10.6" stream-util = { version = "0.1.0", path = "../stream-util" }