From 820099c2cabf41d34dd6e23c899db0a0b04c3b9b Mon Sep 17 00:00:00 2001 From: _ <> Date: Sun, 21 Mar 2021 03:09:44 +0000 Subject: [PATCH] :arrow_up: deps: replace ulid with rusty_ulid so I can drop rand 0.6.x --- Cargo.lock | 204 ++++-------------- crates/debug_proxy/Cargo.toml | 2 +- crates/debug_proxy/src/lib.rs | 3 +- crates/ptth_forwarding_relay/Cargo.toml | 2 +- crates/ptth_forwarding_relay/src/main.rs | 5 +- crates/ptth_relay/Cargo.toml | 2 +- crates/ptth_relay/src/lib.rs | 2 +- crates/ptth_relay/src/server_endpoint.rs | 2 +- crates/ptth_server/Cargo.toml | 2 +- crates/ptth_server/src/file_server/metrics.rs | 4 +- 10 files changed, 47 insertions(+), 181 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6f926ee..bbea7be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -191,12 +191,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "autocfg" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" - [[package]] name = "autocfg" version = "1.0.1" @@ -319,13 +313,11 @@ version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ - "js-sys", "libc", "num-integer", "num-traits", "serde", "time", - "wasm-bindgen", "winapi", ] @@ -344,15 +336,6 @@ dependencies = [ "vec_map", ] -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags", -] - [[package]] name = "concurrent-queue" version = "1.2.2" @@ -473,11 +456,11 @@ dependencies = [ "http", "hyper", "reqwest", + "rusty_ulid", "tokio", "tokio-stream", "tracing", "tracing-subscriber", - "ulid", ] [[package]] @@ -498,6 +481,12 @@ dependencies = [ "generic-array 0.14.4", ] +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + [[package]] name = "either" version = "1.6.1" @@ -565,12 +554,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - [[package]] name = "futures" version = "0.3.13" @@ -993,7 +976,7 @@ version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" dependencies = [ - "autocfg 1.0.1", + "autocfg", "hashbrown", ] @@ -1204,7 +1187,7 @@ version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "autocfg 1.0.1", + "autocfg", "num-traits", ] @@ -1214,7 +1197,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" dependencies = [ - "autocfg 1.0.1", + "autocfg", "num-integer", "num-traits", ] @@ -1225,7 +1208,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "autocfg 1.0.1", + "autocfg", ] [[package]] @@ -1276,7 +1259,7 @@ version = "0.9.61" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f" dependencies = [ - "autocfg 1.0.1", + "autocfg", "cc", "libc", "pkg-config", @@ -1561,13 +1544,13 @@ dependencies = [ "futures", "futures-util", "hyper", + "rusty_ulid", "thiserror", "tokio", "tokio-stream", "tracing", "tracing-futures", "tracing-subscriber", - "ulid", ] [[package]] @@ -1597,8 +1580,9 @@ dependencies = [ "hyper", "itertools", "ptth_core", - "rand 0.8.3", + "rand", "rmp-serde 0.14.4", + "rusty_ulid", "serde", "serde_json", "thiserror", @@ -1608,7 +1592,6 @@ dependencies = [ "tracing", "tracing-futures", "tracing-subscriber", - "ulid", ] [[package]] @@ -1631,10 +1614,11 @@ dependencies = [ "percent-encoding", "ptth_core", "pulldown-cmark", - "rand 0.8.3", + "rand", "regex", "reqwest", "rmp-serde 0.14.4", + "rusty_ulid", "serde", "serde_json", "structopt", @@ -1645,7 +1629,6 @@ dependencies = [ "tracing", "tracing-futures", "tracing-subscriber", - "ulid", "uom", ] @@ -1688,25 +1671,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" -dependencies = [ - "autocfg 0.1.7", - "libc", - "rand_chacha 0.1.1", - "rand_core 0.4.2", - "rand_hc 0.1.0", - "rand_isaac", - "rand_jitter", - "rand_os", - "rand_pcg", - "rand_xorshift", - "winapi", -] - [[package]] name = "rand" version = "0.8.3" @@ -1714,19 +1678,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" dependencies = [ "libc", - "rand_chacha 0.3.0", - "rand_core 0.6.2", - "rand_hc 0.3.0", -] - -[[package]] -name = "rand_chacha" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" -dependencies = [ - "autocfg 0.1.7", - "rand_core 0.3.1", + "rand_chacha", + "rand_core", + "rand_hc", ] [[package]] @@ -1736,24 +1690,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" dependencies = [ "ppv-lite86", - "rand_core 0.6.2", + "rand_core", ] -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - [[package]] name = "rand_core" version = "0.6.2" @@ -1763,85 +1702,13 @@ dependencies = [ "getrandom", ] -[[package]] -name = "rand_hc" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" -dependencies = [ - "rand_core 0.3.1", -] - [[package]] name = "rand_hc" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" dependencies = [ - "rand_core 0.6.2", -] - -[[package]] -name = "rand_isaac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rand_jitter" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" -dependencies = [ - "libc", - "rand_core 0.4.2", - "winapi", -] - -[[package]] -name = "rand_os" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" -dependencies = [ - "cloudabi", - "fuchsia-cprng", - "libc", - "rand_core 0.4.2", - "rdrand", - "wasm-bindgen", - "winapi", -] - -[[package]] -name = "rand_pcg" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" -dependencies = [ - "autocfg 0.1.7", - "rand_core 0.4.2", -] - -[[package]] -name = "rand_xorshift" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", + "rand_core", ] [[package]] @@ -1955,6 +1822,18 @@ dependencies = [ "serde", ] +[[package]] +name = "rusty_ulid" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f20752f9e92feede73bccf88845bb4004b28fac9fdcb2e0c8731d939df67b2d" +dependencies = [ + "chrono", + "doc-comment", + "rand", + "serde", +] + [[package]] name = "ryu" version = "1.0.5" @@ -2189,7 +2068,7 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ "cfg-if 1.0.0", "libc", - "rand 0.8.3", + "rand", "redox_syscall", "remove_dir_all", "winapi", @@ -2274,7 +2153,7 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "134af885d758d645f0f0505c9a8b3f9bf8a348fd822e112ab5248138348f1722" dependencies = [ - "autocfg 1.0.1", + "autocfg", "bytes", "libc", "memchr", @@ -2452,17 +2331,6 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" -[[package]] -name = "ulid" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e95a59b292ca0cf9b45be2e52294d1ca6cb24eb11b08ef4376f73f1a00c549" -dependencies = [ - "chrono", - "lazy_static", - "rand 0.6.5", -] - [[package]] name = "unicase" version = "2.6.0" diff --git a/crates/debug_proxy/Cargo.toml b/crates/debug_proxy/Cargo.toml index aadca56..f2c0c4b 100644 --- a/crates/debug_proxy/Cargo.toml +++ b/crates/debug_proxy/Cargo.toml @@ -14,8 +14,8 @@ futures-util = "0.3.8" http = "0.2.1" hyper = { version = "0.14.4", features = ["server", "stream"] } reqwest = "0.11.1" +rusty_ulid = "0.10.1" tokio = "1.2.0" tokio-stream = "0.1.3" tracing = "0.1.21" tracing-subscriber = "0.2.15" -ulid = "0.4.1" diff --git a/crates/debug_proxy/src/lib.rs b/crates/debug_proxy/src/lib.rs index 7e486a9..3fc3497 100644 --- a/crates/debug_proxy/src/lib.rs +++ b/crates/debug_proxy/src/lib.rs @@ -25,7 +25,6 @@ use tokio::{ }, }; use tokio_stream::wrappers::ReceiverStream; -use ulid::Ulid; #[async_trait] trait ProxyFilter { @@ -94,7 +93,7 @@ struct State { async fn handle_all (req: Request , state: Arc >) -> anyhow::Result > { - let req_id = Ulid::new ().to_string (); + let req_id = rusty_ulid::generate_ulid_string (); let (head, mut body) = req.into_parts (); tracing::debug! ("{} Got URI {}", req_id, head.uri); diff --git a/crates/ptth_forwarding_relay/Cargo.toml b/crates/ptth_forwarding_relay/Cargo.toml index aa8f278..91b9bab 100644 --- a/crates/ptth_forwarding_relay/Cargo.toml +++ b/crates/ptth_forwarding_relay/Cargo.toml @@ -11,10 +11,10 @@ anyhow = "1.0.38" futures = "0.3.7" futures-util = "0.3.8" hyper = "0.14.4" +rusty_ulid = "0.10.1" thiserror = "1.0.24" tokio = { version = "1.2.0", features = [] } tokio-stream = "0.1.3" tracing = "0.1.25" tracing-futures = "0.2.5" tracing-subscriber = "0.2.16" -ulid = "0.4.1" diff --git a/crates/ptth_forwarding_relay/src/main.rs b/crates/ptth_forwarding_relay/src/main.rs index 81cd84c..e3b48ee 100644 --- a/crates/ptth_forwarding_relay/src/main.rs +++ b/crates/ptth_forwarding_relay/src/main.rs @@ -29,7 +29,6 @@ use tracing_subscriber::{ fmt::format::FmtSpan, EnvFilter, }; -use ulid::Ulid; #[derive (Default)] struct RelayState { @@ -144,7 +143,7 @@ impl HttpService { let (mut tx, rx) = mpsc::channel (1); spawn (async move { - let id = Ulid::new ().to_string (); + let id = rusty_ulid::generate_ulid_string (); trace! ("Downstream {} started", id); Self::handle_downstream (tx).await.ok (); trace! ("Downstream {} ended", id); @@ -157,7 +156,7 @@ impl HttpService { async fn handle_posts (req: Request , state: &RelayState) -> Result , anyhow::Error> { - let id = Ulid::new ().to_string (); + let id = rusty_ulid::generate_ulid_string (); trace! ("Upstream {} started", id); let mut body = req.into_body (); while let Some (Ok (item)) = body.next ().await { diff --git a/crates/ptth_relay/Cargo.toml b/crates/ptth_relay/Cargo.toml index a7286f3..4ddc8c2 100644 --- a/crates/ptth_relay/Cargo.toml +++ b/crates/ptth_relay/Cargo.toml @@ -21,6 +21,7 @@ hyper = { version = "0.14.4", features = ["server", "stream"] } itertools = "0.9.0" rand = "0.8.3" rmp-serde = "0.14.4" +rusty_ulid = "0.10.1" serde = { version = "1.0.117", features = ["derive"] } serde_json = "1.0.60" thiserror = "1.0.22" @@ -30,6 +31,5 @@ toml = "0.5.7" tracing = "0.1.25" tracing-futures = "0.2.4" tracing-subscriber = "0.2.15" -ulid = "0.4.1" ptth_core = { path = "../ptth_core" } diff --git a/crates/ptth_relay/src/lib.rs b/crates/ptth_relay/src/lib.rs index acfe508..370a2c1 100644 --- a/crates/ptth_relay/src/lib.rs +++ b/crates/ptth_relay/src/lib.rs @@ -111,7 +111,7 @@ async fn handle_http_request ( let (tx, rx) = oneshot::channel (); - let req_id = ulid::Ulid::new ().to_string (); + let req_id = rusty_ulid::generate_ulid_string (); { let response_rendezvous = state.response_rendezvous.read ().await; response_rendezvous.insert (req_id.clone (), tx); diff --git a/crates/ptth_relay/src/server_endpoint.rs b/crates/ptth_relay/src/server_endpoint.rs index f38343c..cde62b0 100644 --- a/crates/ptth_relay/src/server_endpoint.rs +++ b/crates/ptth_relay/src/server_endpoint.rs @@ -99,7 +99,7 @@ pub async fn handle_listen ( let (tx, rx) = oneshot::channel (); - let listen_id = ulid::Ulid::new ().to_string (); + let listen_id = rusty_ulid::generate_ulid_string (); { let mut request_rendezvous = state.request_rendezvous.lock ().await; diff --git a/crates/ptth_server/Cargo.toml b/crates/ptth_server/Cargo.toml index 0391ee7..a15ea8b 100644 --- a/crates/ptth_server/Cargo.toml +++ b/crates/ptth_server/Cargo.toml @@ -25,6 +25,7 @@ rand = "0.8.3" regex = "1.4.1" reqwest = { version = "0.11.1", features = [] } rmp-serde = "0.14.4" +rusty_ulid = "0.10.1" serde = {version = "1.0.117", features = ["derive"]} serde_json = "1.0.60" structopt = "0.3.20" @@ -35,7 +36,6 @@ tracing = "0.1.25" tracing-futures = "0.2.5" tracing-subscriber = "0.2.16" toml = "0.5.7" -ulid = "0.4.1" uom = "0.30.0" always_equal = { path = "../always_equal" } diff --git a/crates/ptth_server/src/file_server/metrics.rs b/crates/ptth_server/src/file_server/metrics.rs index c2bcf07..9ad8f90 100644 --- a/crates/ptth_server/src/file_server/metrics.rs +++ b/crates/ptth_server/src/file_server/metrics.rs @@ -5,10 +5,10 @@ use std::{ use arc_swap::ArcSwap; use chrono::{DateTime, Utc}; +use rusty_ulid::Ulid; use tracing::{ debug, error, trace, }; -use ulid::Ulid; // Metrics are named for when they're updated: // - Startup (Once, when the server state is initialized) @@ -59,7 +59,7 @@ impl Startup { machine_id: get_machine_id (), git_version: None, server_name, - instance_id: ulid::Ulid::new (), + instance_id: Ulid::generate (), startup_utc: Utc::now (), };