diff --git a/Cargo.lock b/Cargo.lock index 9a3774819..c05a6709b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,9 +40,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7d5a2cecb58716e47d67d5703a249964b14c7be1ec3cad3affc295b2d1c35d" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", "getrandom", @@ -437,7 +437,7 @@ dependencies = [ name = "athena" version = "0.0.1-pre.4" dependencies = [ - "ahash 0.8.5", + "ahash 0.8.6", "async-trait", "deadpool-redis", "either", @@ -685,9 +685,9 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "basic-toml" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bfc506e7a2370ec239e1d072507b2a80c833083699d3c6fa176fbb4de8448c6" +checksum = "2f2139706359229bfa8f19142ac1155b4b80beafb7a60471ac5dd109d4a19778" dependencies = [ "serde", ] @@ -819,9 +819,9 @@ checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "bytecount" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56f99948f5dd725fb7e351c80765ae80044f243169e141188a874105da83e9e" +checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205" [[package]] name = "byteorder" @@ -1168,9 +1168,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fbc60abd742b35f2492f808e1abbb83d45f72db402e14c55057edc9c7b1e9e4" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -2002,9 +2002,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -2017,9 +2017,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -2027,15 +2027,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -2044,9 +2044,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-lite" @@ -2065,9 +2065,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", @@ -2098,21 +2098,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-channel", "futures-core", @@ -2137,9 +2137,9 @@ dependencies = [ [[package]] name = "garde" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94320acdd9159591d0f8079eb347fb52c2ffbe206b5214f6f4d482f2866e4d91" +checksum = "d16596022bab79d38f74999f49b2fa08db8e4e568b43a95a2bd78afbee13f55c" dependencies = [ "compact_str", "garde_derive", @@ -2152,9 +2152,9 @@ dependencies = [ [[package]] name = "garde_derive" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c617dc2454b80bcf7232a47efccdbd7aee2acb2a92a332b3ea7398dcc7f31d" +checksum = "38ae3270e3d5914fcf8ac7b3f77d2e7d424018913e62f5f3ade51995da109412" dependencies = [ "proc-macro2", "quote", @@ -2281,7 +2281,7 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ff8ae62cd3a9102e5637afc8452c55acf3844001bd5374e0b0bd7b6616c038" dependencies = [ - "ahash 0.8.5", + "ahash 0.8.6", ] [[package]] @@ -2290,7 +2290,7 @@ version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" dependencies = [ - "ahash 0.8.5", + "ahash 0.8.6", "allocator-api2", ] @@ -2480,9 +2480,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http", @@ -2878,7 +2878,7 @@ dependencies = [ "serde", "smol_str", "tokio", - "toml 0.8.4", + "toml 0.8.6", ] [[package]] @@ -2971,7 +2971,7 @@ dependencies = [ "simd-json", "speedy-uuid", "thiserror", - "tracing-log", + "tracing-log 0.2.0", "typed-builder", ] @@ -3057,7 +3057,7 @@ dependencies = [ "kitsune-retry-policies", "mimalloc", "tokio", - "toml 0.8.4", + "toml 0.8.6", "tracing", ] @@ -3077,7 +3077,7 @@ dependencies = [ name = "kitsune-messaging" version = "0.0.1-pre.4" dependencies = [ - "ahash 0.8.5", + "ahash 0.8.6", "async-trait", "futures-util", "kitsune-retry-policies", @@ -3195,9 +3195,9 @@ dependencies = [ [[package]] name = "lettre" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d47084ad58f99c26816d174702f60e873f861fcef3f9bd6075b4ad2dd72d07d5" +checksum = "a466bc111374ccf4d90877dba636924a2185e67e5be4b35d32043199365097b2" dependencies = [ "async-trait", "base64 0.21.5", @@ -3224,6 +3224,15 @@ dependencies = [ "webpki-roots", ] +[[package]] +name = "lexical" +version = "6.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7aefb36fd43fef7003334742cbf77b243fcd36418a1d1bdd480d613a67968f6" +dependencies = [ + "lexical-core", +] + [[package]] name = "lexical-core" version = "0.8.5" @@ -3453,6 +3462,17 @@ dependencies = [ "tendril", ] +[[package]] +name = "masto-id-convert" +version = "0.0.1-pre.4" +dependencies = [ + "criterion", + "lexical", + "nanorand", + "time", + "uuid", +] + [[package]] name = "match_cfg" version = "0.1.0" @@ -3535,7 +3555,7 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fde3af1a009ed76a778cb84fdef9e7dbbdf5775ae3e4cc1f434a6a307f6f76c5" dependencies = [ - "ahash 0.8.5", + "ahash 0.8.6", "metrics-macros", "portable-atomic", ] @@ -3751,6 +3771,12 @@ dependencies = [ "version_check", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" + [[package]] name = "new_debug_unreachable" version = "1.0.4" @@ -4736,7 +4762,7 @@ name = "redis" version = "0.23.3" source = "git+https://github.com/aumetra/redis-rs.git?rev=3c4ee09d432a69e1d87d66dcba14c519467c9b81#3c4ee09d432a69e1d87d66dcba14c519467c9b81" dependencies = [ - "ahash 0.8.5", + "ahash 0.8.6", "arc-swap", "async-trait", "bytes", @@ -4767,15 +4793,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -4796,6 +4813,26 @@ dependencies = [ "thiserror", ] +[[package]] +name = "ref-cast" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acde58d073e9c79da00f2b5b84eed919c8326832648a5b109b3fce1bb1175280" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "regex" version = "1.10.2" @@ -4911,16 +4948,14 @@ dependencies = [ [[package]] name = "rsa" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab43bb47d23c1a631b4b680199a45255dce26fa9ab2fa902581f624ff13e6a8" +checksum = "86ef35bf3e7fe15a53c4ab08a998e42271eab13eb0db224126bc7bc4c4bad96d" dependencies = [ - "byteorder", "const-oid", "digest", "num-bigint-dig", "num-integer", - "num-iter", "num-traits 0.2.17", "pkcs1", "pkcs8", @@ -5001,9 +5036,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.20" +version = "0.38.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" dependencies = [ "bitflags 2.4.1", "errno", @@ -5117,17 +5152,16 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scraper" -version = "0.17.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c95a930e03325234c18c7071fd2b60118307e025d6fff3e12745ffbf63a3d29c" +checksum = "3693f9a0203d49a7ba8f38aa915316b3d535c1862d03dae7009cb71a3408b36a" dependencies = [ - "ahash 0.8.5", + "ahash 0.8.6", "cssparser", "ego-tree", "html5ever", "once_cell", "selectors", - "smallvec", "tendril", ] @@ -5208,9 +5242,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" dependencies = [ "serde_derive", ] @@ -5227,9 +5261,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2", "quote", @@ -5451,13 +5485,14 @@ dependencies = [ [[package]] name = "simd-json" -version = "0.12.0" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f07a84c7456b901b8dd2c1d44caca8b0fd2c2616206ee5acc9d9da61e8d9ec" +checksum = "d123f285a3635e423ec2ef5b67e0168dcf86c0d62fffbcea88fcd1c926e47413" dependencies = [ "getrandom", "halfbrown", "lexical-core", + "ref-cast", "serde", "serde_json", "simdutf8", @@ -5746,13 +5781,13 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" [[package]] name = "tempfile" -version = "3.8.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if", "fastrand 2.0.1", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "rustix", "windows-sys 0.48.0", ] @@ -5976,9 +6011,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", "futures-core", @@ -6003,14 +6038,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ef75d881185fd2df4a040793927c153d863651108a93c7e17a9e591baa95cc6" +checksum = "8ff9e3abce27ee2c9a37f9ad37238c1bdd4e789c84ba37df76aa4d528f5072cc" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.20.4", + "toml_edit 0.20.7", ] [[package]] @@ -6037,9 +6072,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.20.4" +version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380f9e8120405471f7c9ad1860a713ef5ece6a670c7eae39225e477340f32fc4" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ "indexmap 2.0.2", "serde", @@ -6206,6 +6241,17 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + [[package]] name = "tracing-opentelemetry" version = "0.21.0" @@ -6231,7 +6277,7 @@ dependencies = [ "smallvec", "thread_local", "tracing-core", - "tracing-log", + "tracing-log 0.1.4", ] [[package]] @@ -6454,9 +6500,9 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "value-trait" -version = "0.6.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a5b6c8ceb01263b969cac48d4a6705134d490ded13d889e52c0cfc80c6945e" +checksum = "ea87257cfcbedcb9444eda79c59fdfea71217e6305afee8ee33f500375c2ac97" dependencies = [ "float-cmp", "halfbrown", @@ -6846,18 +6892,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.12" +version = "0.7.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8db0ac2df3d060f81ec0380ccc5b71c2a7c092cfced671feeee1320e95559c87" +checksum = "a1808c6e5aa42cb2b67578276190258f08679c275d92a19735aad5d359e1b154" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.12" +version = "0.7.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b6093bc6d5265ff40b479c834cdd25d8e20784781a2a29a8106327393d0a9ff" +checksum = "ea597733532c780ce3e110401fc3b359b984cc78e17ac0917d3f371ffd1c1618" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index c1b103412..e3cb97170 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,6 +39,7 @@ members = [ "kitsune-cli", "kitsune-job-runner", "lib/athena", + "lib/masto-id-convert", "lib/post-process", "lib/speedy-uuid", ] diff --git a/crates/kitsune-cache/Cargo.toml b/crates/kitsune-cache/Cargo.toml index a3dd34760..eca6a89d1 100644 --- a/crates/kitsune-cache/Cargo.toml +++ b/crates/kitsune-cache/Cargo.toml @@ -9,8 +9,8 @@ deadpool-redis = "0.13.0" enum_dispatch = "0.3.12" moka = { version = "0.12.1", features = ["sync"] } redis = "0.23.3" -serde = "1.0.189" -simd-json = "0.12.0" +serde = "1.0.190" +simd-json = "0.13.3" thiserror = "1.0.50" tracing = "0.1.40" typed-builder = "0.18.0" diff --git a/crates/kitsune-captcha/Cargo.toml b/crates/kitsune-captcha/Cargo.toml index 3c7a0383c..2b984e511 100644 --- a/crates/kitsune-captcha/Cargo.toml +++ b/crates/kitsune-captcha/Cargo.toml @@ -8,9 +8,9 @@ async-trait = "0.1.74" enum_dispatch = "0.3.12" http = "0.2.9" kitsune-http-client = { path = "../kitsune-http-client" } -serde = { version = "1.0.189", features = ["derive"] } +serde = { version = "1.0.190", features = ["derive"] } serde_urlencoded = "0.7.1" -simd-json = "0.12.0" +simd-json = "0.13.3" strum = { version = "0.25.0", features = ["derive"] } thiserror = "1.0.50" typed-builder = "0.18.0" diff --git a/crates/kitsune-config/Cargo.toml b/crates/kitsune-config/Cargo.toml index e73cb8155..814f333b3 100644 --- a/crates/kitsune-config/Cargo.toml +++ b/crates/kitsune-config/Cargo.toml @@ -5,7 +5,7 @@ version.workspace = true [dependencies] eyre = "0.6.8" -serde = { version = "1.0.189", features = ["derive"] } +serde = { version = "1.0.190", features = ["derive"] } smol_str = { version = "0.2.0", features = ["serde"] } tokio = { version = "1.33.0", features = ["fs"] } -toml = { version = "0.8.4", default-features = false, features = ["parse"] } +toml = { version = "0.8.6", default-features = false, features = ["parse"] } diff --git a/crates/kitsune-core/Cargo.toml b/crates/kitsune-core/Cargo.toml index 8ab05908a..ddf87aa19 100644 --- a/crates/kitsune-core/Cargo.toml +++ b/crates/kitsune-core/Cargo.toml @@ -21,8 +21,8 @@ derive_builder = "0.12.0" diesel = "2.1.3" diesel-async = { version = "0.4.1", features = ["postgres"] } eyre = "0.6.8" -futures-util = "0.3.28" -garde = { version = "0.16.0", default-features = false, features = [ +futures-util = "0.3.29" +garde = { version = "0.16.1", default-features = false, features = [ "derive", "email", "email-idna", @@ -57,12 +57,12 @@ pulldown-cmark = { version = "0.9.3", default-features = false, features = [ "simd", ] } rand = "0.8.5" -rsa = "0.9.2" +rsa = "0.9.3" rusty-s3 = { version = "0.5.0", default-features = false } scoped-futures = "0.1.3" -serde = { version = "1.0.189", features = ["derive"] } +serde = { version = "1.0.190", features = ["derive"] } sha2 = "0.10.8" -simd-json = "0.12.0" +simd-json = "0.13.3" smol_str = "0.2.0" speedy-uuid = { path = "../../lib/speedy-uuid", features = ["diesel"] } thiserror = "1.0.50" @@ -90,5 +90,5 @@ kitsune-test = { path = "../kitsune-test" } pretty_assertions = "1.4.0" redis = "0.23.3" serial_test = "2.0.0" -tempfile = "3.8.0" +tempfile = "3.8.1" tower = "0.4.13" diff --git a/crates/kitsune-db/Cargo.toml b/crates/kitsune-db/Cargo.toml index 42d4efde4..dc638162e 100644 --- a/crates/kitsune-db/Cargo.toml +++ b/crates/kitsune-db/Cargo.toml @@ -20,9 +20,9 @@ kitsune-language = { path = "../kitsune-language" } kitsune-type = { path = "../kitsune-type" } num-derive = "0.4.1" num-traits = "0.2.17" -serde = { version = "1.0.189", features = ["derive"] } -simd-json = "0.12.0" +serde = { version = "1.0.190", features = ["derive"] } +simd-json = "0.13.3" speedy-uuid = { path = "../../lib/speedy-uuid", features = ["diesel"] } thiserror = "1.0.50" -tracing-log = "0.1.4" +tracing-log = "0.2.0" typed-builder = "0.18.0" diff --git a/crates/kitsune-email/Cargo.toml b/crates/kitsune-email/Cargo.toml index 167a7e442..a20e7a6b5 100644 --- a/crates/kitsune-email/Cargo.toml +++ b/crates/kitsune-email/Cargo.toml @@ -9,7 +9,7 @@ ignored = ["askama_axum"] # See reason below. [dependencies] askama = "0.12.1" askama_axum = "0.3.0" # Damn it, cargo. Because "kitsune" uses "askama" with the axum feature, we have to have the crate available here as well.. -lettre = { version = "0.11.0", default-features = false, features = [ +lettre = { version = "0.11.1", default-features = false, features = [ "builder", "hostname", "pool", diff --git a/crates/kitsune-embed/Cargo.toml b/crates/kitsune-embed/Cargo.toml index 8cbec7212..2ff279788 100644 --- a/crates/kitsune-embed/Cargo.toml +++ b/crates/kitsune-embed/Cargo.toml @@ -12,7 +12,7 @@ iso8601-timestamp = "0.2.12" kitsune-db = { path = "../kitsune-db" } kitsune-http-client = { path = "../kitsune-http-client" } once_cell = "1.18.0" -scraper = { version = "0.17.1", default-features = false } +scraper = { version = "0.18.0", default-features = false } smol_str = "0.2.0" thiserror = "1.0.50" typed-builder = "0.18.0" diff --git a/crates/kitsune-http-client/Cargo.toml b/crates/kitsune-http-client/Cargo.toml index 02edbe0d8..3eb679dc9 100644 --- a/crates/kitsune-http-client/Cargo.toml +++ b/crates/kitsune-http-client/Cargo.toml @@ -5,7 +5,7 @@ edition.workspace = true [dependencies] bytes = "1.5.0" -futures-core = "0.3.28" +futures-core = "0.3.29" headers = "0.3.9" http-body = "0.4.5" hyper = { version = "0.14.27", features = [ @@ -15,12 +15,12 @@ hyper = { version = "0.14.27", features = [ "http2", "runtime", ] } -hyper-rustls = { version = "0.24.1", features = ["http2"] } +hyper-rustls = { version = "0.24.2", features = ["http2"] } kitsune-http-signatures = { path = "../kitsune-http-signatures" } kitsune-type = { path = "../kitsune-type" } pin-project-lite = "0.2.13" -serde = "1.0.189" -simd-json = "0.12.0" +serde = "1.0.190" +simd-json = "0.13.3" tower = { version = "0.4.13", features = ["util"] } tower-http = { version = "0.4.4", features = [ # Explicitly exclude `zstd` diff --git a/crates/kitsune-http-client/tests/json.rs b/crates/kitsune-http-client/tests/json.rs index 3077bb904..5dbc30aee 100644 --- a/crates/kitsune-http-client/tests/json.rs +++ b/crates/kitsune-http-client/tests/json.rs @@ -2,7 +2,7 @@ use core::convert::Infallible; use hyper::Response; use hyper::{Body, Request}; use kitsune_http_client::Client; -use simd_json::{OwnedValue, ValueAccess}; +use simd_json::{base::ValueAsScalar, OwnedValue}; use tower::service_fn; #[tokio::test] diff --git a/crates/kitsune-messaging/Cargo.toml b/crates/kitsune-messaging/Cargo.toml index 3bf927613..7737db506 100644 --- a/crates/kitsune-messaging/Cargo.toml +++ b/crates/kitsune-messaging/Cargo.toml @@ -4,9 +4,9 @@ version.workspace = true edition.workspace = true [dependencies] -ahash = "0.8.5" +ahash = "0.8.6" async-trait = "0.1.74" -futures-util = "0.3.28" +futures-util = "0.3.29" kitsune-retry-policies = { path = "../kitsune-retry-policies" } pin-project-lite = "0.2.13" redis = { version = "0.23.3", features = [ @@ -14,8 +14,8 @@ redis = { version = "0.23.3", features = [ "connection-manager", "tokio-rustls-comp", ] } -serde = "1.0.189" -simd-json = "0.12.0" +serde = "1.0.190" +simd-json = "0.13.3" tokio = { version = "1.33.0", features = ["macros", "rt", "sync"] } tokio-stream = { version = "0.1.14", features = ["sync"] } tracing = "0.1.40" diff --git a/crates/kitsune-search/Cargo.toml b/crates/kitsune-search/Cargo.toml index c4cb6230d..175f216bf 100644 --- a/crates/kitsune-search/Cargo.toml +++ b/crates/kitsune-search/Cargo.toml @@ -9,10 +9,10 @@ diesel = "2.1.3" diesel-async = "0.4.1" diesel_full_text_search = { version = "2.1.1", default-features = false } enum_dispatch = "0.3.12" -futures-util = "0.3.28" +futures-util = "0.3.29" kitsune-db = { path = "../kitsune-db" } kitsune-language = { path = "../kitsune-language" } -serde = { version = "1.0.189", features = ["derive"] } +serde = { version = "1.0.190", features = ["derive"] } speedy-uuid = { path = "../../lib/speedy-uuid" } strum = { version = "0.25.0", features = ["derive"] } thiserror = "1.0.50" diff --git a/crates/kitsune-storage/Cargo.toml b/crates/kitsune-storage/Cargo.toml index 3e4d45157..8a5ae78df 100644 --- a/crates/kitsune-storage/Cargo.toml +++ b/crates/kitsune-storage/Cargo.toml @@ -7,14 +7,14 @@ edition.workspace = true async-trait = "0.1.74" bytes = "1.5.0" enum_dispatch = "0.3.12" -futures-util = "0.3.28" +futures-util = "0.3.29" http = "0.2.9" hyper = { version = "0.14.27", features = ["stream"] } kitsune-http-client = { path = "../kitsune-http-client" } rusty-s3 = { version = "0.5.0", default-features = false } tokio = { version = "1.33.0", features = ["fs", "io-util"] } -tokio-util = { version = "0.7.9", features = ["io"] } +tokio-util = { version = "0.7.10", features = ["io"] } [dev-dependencies] -tempfile = "3.8.0" +tempfile = "3.8.1" tokio = { version = "1.33.0", features = ["macros", "rt"] } diff --git a/crates/kitsune-test/Cargo.toml b/crates/kitsune-test/Cargo.toml index 1a32e5d36..418bdf1f7 100644 --- a/crates/kitsune-test/Cargo.toml +++ b/crates/kitsune-test/Cargo.toml @@ -7,7 +7,7 @@ version.workspace = true deadpool-redis = "0.13.0" diesel = "2.1.3" diesel-async = "0.4.1" -futures-util = "0.3.28" +futures-util = "0.3.29" kitsune-db = { path = "../kitsune-db" } pin-project-lite = "0.2.13" redis = "0.23.3" diff --git a/crates/kitsune-type/Cargo.toml b/crates/kitsune-type/Cargo.toml index cdb4034e4..b15fbce78 100644 --- a/crates/kitsune-type/Cargo.toml +++ b/crates/kitsune-type/Cargo.toml @@ -5,8 +5,8 @@ edition.workspace = true [dependencies] iso8601-timestamp = "0.2.12" -serde = { version = "1.0.189", features = ["derive"] } -simd-json = "0.12.0" +serde = { version = "1.0.190", features = ["derive"] } +simd-json = "0.13.3" smol_str = { version = "0.2.0", features = ["serde"] } speedy-uuid = { path = "../../lib/speedy-uuid", features = ["serde"] } utoipa = { version = "4.0.0", features = ["chrono", "uuid"] } diff --git a/kitsune-cli/Cargo.toml b/kitsune-cli/Cargo.toml index 97e125c01..dfb0f19db 100644 --- a/kitsune-cli/Cargo.toml +++ b/kitsune-cli/Cargo.toml @@ -12,7 +12,7 @@ diesel-async = "0.4.1" dotenvy = "0.15.7" envy = "0.4.2" kitsune-db = { path = "../crates/kitsune-db" } -serde = { version = "1.0.189", features = ["derive"] } +serde = { version = "1.0.190", features = ["derive"] } speedy-uuid = { path = "../lib/speedy-uuid" } tokio = { version = "1.33.0", features = ["full"] } tracing-subscriber = "0.3.17" diff --git a/kitsune-job-runner/Cargo.toml b/kitsune-job-runner/Cargo.toml index 10995a35b..9ccc568ea 100644 --- a/kitsune-job-runner/Cargo.toml +++ b/kitsune-job-runner/Cargo.toml @@ -15,7 +15,7 @@ kitsune-observability = { path = "../crates/kitsune-observability" } kitsune-retry-policies = { path = "../crates/kitsune-retry-policies" } mimalloc = "0.1.39" tokio = { version = "1.33.0", features = ["full"] } -toml = "0.8.4" +toml = "0.8.6" tracing = "0.1.40" [features] diff --git a/kitsune/Cargo.toml b/kitsune/Cargo.toml index bab2154f1..be060951a 100644 --- a/kitsune/Cargo.toml +++ b/kitsune/Cargo.toml @@ -30,7 +30,7 @@ der = { version = "0.7.8", features = ["std"] } diesel = "2.1.3" diesel-async = "0.4.1" eyre = "0.6.8" -futures-util = "0.3.28" +futures-util = "0.3.29" headers = "0.3.9" http = "0.2.9" human-panic = "1.2.1" @@ -60,16 +60,16 @@ oxide-auth = "0.5.4" oxide-auth-async = "0.1.1" oxide-auth-axum = "0.3.0" scoped-futures = "0.1.3" -serde = { version = "1.0.189", features = ["derive"] } +serde = { version = "1.0.190", features = ["derive"] } serde_urlencoded = "0.7.1" -simd-json = "0.12.0" +simd-json = "0.13.3" speedy-uuid = { path = "../lib/speedy-uuid" } strum = { version = "0.25.0", features = ["derive", "phf"] } -tempfile = "3.8.0" +tempfile = "3.8.1" thiserror = "1.0.50" time = "0.3.30" tokio = { version = "1.33.0", features = ["full"] } -tokio-util = { version = "0.7.9", features = ["compat"] } +tokio-util = { version = "0.7.10", features = ["compat"] } tower-http = { version = "0.4.4", features = [ "catch-panic", "cors", diff --git a/kitsune/src/http/handler/nodeinfo/two_one.rs b/kitsune/src/http/handler/nodeinfo/two_one.rs index dffedd69a..ade4a1306 100644 --- a/kitsune/src/http/handler/nodeinfo/two_one.rs +++ b/kitsune/src/http/handler/nodeinfo/two_one.rs @@ -11,7 +11,7 @@ use kitsune_type::nodeinfo::two_one::{ Protocol, Services, Software, TwoOne, Usage, UsageUsers, Version, }; use scoped_futures::ScopedFutureExt; -use simd_json::{Builder, OwnedValue}; +use simd_json::{OwnedValue, ValueBuilder}; #[debug_handler(state = crate::state::Zustand)] #[utoipa::path( diff --git a/lib/athena/Cargo.toml b/lib/athena/Cargo.toml index fe610e303..652922e17 100644 --- a/lib/athena/Cargo.toml +++ b/lib/athena/Cargo.toml @@ -5,11 +5,11 @@ version.workspace = true license = "MIT" [dependencies] -ahash = "0.8.5" +ahash = "0.8.6" async-trait = "0.1.74" deadpool-redis = "0.13.0" either = { version = "1.9.0", default-features = false } -futures-util = { version = "0.3.28", default-features = false } +futures-util = { version = "0.3.29", default-features = false } iso8601-timestamp = { version = "0.2.12", features = ["diesel-pg"] } kitsune-retry-policies = { path = "../../crates/kitsune-retry-policies" } once_cell = "1.18.0" @@ -22,8 +22,8 @@ redis = { version = "0.23.3", default-features = false, features = [ "tokio-rustls-comp", ] } retry-policies = "0.2.1" -serde = { version = "1.0.189", features = ["derive"] } -simd-json = "0.12.0" +serde = { version = "1.0.190", features = ["derive"] } +simd-json = "0.13.3" smol_str = "0.2.0" speedy-uuid = { path = "../speedy-uuid", features = ["redis", "serde"] } thiserror = "1.0.50" diff --git a/lib/masto-id-convert/Cargo.toml b/lib/masto-id-convert/Cargo.toml new file mode 100644 index 000000000..dd0eed4b9 --- /dev/null +++ b/lib/masto-id-convert/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "masto-id-convert" +version.workspace = true +edition.workspace = true + +[[bench]] +name = "process" +harness = false + +[dependencies] +lexical = { version = "6.1.1", default-features = false, features = [ + "parse-integers", +] } +nanorand = { version = "0.7.0", default-features = false, features = [ + "wyrand", +] } +uuid = { version = "1.5.0", default-features = false } + +[features] +default = ["std"] +std = [] + +[dev-dependencies] +criterion = { version = "0.5.1", default-features = false } +time = "0.3.30" +uuid = { version = "1.5.0", features = ["v7"] } diff --git a/lib/masto-id-convert/README.md b/lib/masto-id-convert/README.md new file mode 100644 index 000000000..3d5bde5e9 --- /dev/null +++ b/lib/masto-id-convert/README.md @@ -0,0 +1,28 @@ +# masto-id-convert + +Convert a Mastodon snowflake ID into a UUID v7 while preserving the timestamp component. Fast. + +## How? + +The unix timestamp is preserved as-is, the 2-bytes sequence is stretched out via the WyRand PRNG algorithm. + +## Performance + +Tested inside a WSL2 installation on a Ryzen 5 3600X: + +```text +process 110368129515784116 + time: [16.675 ns 16.822 ns 17.037 ns] + change: [-1.2226% -0.3915% +0.4911%] (p = 0.37 > 0.05) +``` + +Processing a single Mastodon snowflake takes ~17ns + +## License + +`masto-id-convert` is licensed under the [MIT license](http://opensource.org/licenses/MIT). + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, +shall be licensed as above, without any additional terms or conditions. diff --git a/lib/masto-id-convert/benches/process.rs b/lib/masto-id-convert/benches/process.rs new file mode 100644 index 000000000..cc9b8fddf --- /dev/null +++ b/lib/masto-id-convert/benches/process.rs @@ -0,0 +1,14 @@ +use criterion::{black_box, criterion_group, criterion_main, Criterion}; + +fn process_bench(c: &mut Criterion) { + c.bench_function("process integer 110368129515784116", |b| { + b.iter(|| masto_id_convert::process_u64(black_box(110368129515784116))) + }); + + c.bench_function("process ASCII 110368129515784116", |b| { + b.iter(|| masto_id_convert::process(black_box("110368129515784116"))) + }); +} + +criterion_group!(benches, process_bench); +criterion_main!(benches); diff --git a/lib/masto-id-convert/examples/simple.rs b/lib/masto-id-convert/examples/simple.rs new file mode 100644 index 000000000..279108bc9 --- /dev/null +++ b/lib/masto-id-convert/examples/simple.rs @@ -0,0 +1,14 @@ +use time::OffsetDateTime; + +fn main() { + let uuid = masto_id_convert::process("110368129515784116").unwrap(); + println!("Converted UUID: {uuid}"); + println!("UUID version: {}", uuid.get_version_num()); + println!("UUID variant: {}", uuid.get_variant()); + + let (timestamp_seconds, timestamp_nanos) = uuid.get_timestamp().unwrap().to_unix(); + let timestamp_nanos = ((timestamp_seconds as i128) * 1_000_000_000) + (timestamp_nanos as i128); + let uuid_timestamp = OffsetDateTime::from_unix_timestamp_nanos(timestamp_nanos).unwrap(); + + println!("Embedded timestamp: {uuid_timestamp}"); +} diff --git a/lib/masto-id-convert/src/lib.rs b/lib/masto-id-convert/src/lib.rs new file mode 100644 index 000000000..ff71307da --- /dev/null +++ b/lib/masto-id-convert/src/lib.rs @@ -0,0 +1,91 @@ +#![doc = include_str!("../README.md")] +#![forbid(missing_docs, rust_2018_idioms)] +#![warn(clippy::all, clippy::pedantic)] +#![cfg_attr(not(feature = "std"), no_std)] + +use core::fmt; +use nanorand::{Rng, WyRand}; +use uuid::Uuid; + +macro_rules! impl_from { + ( + $(#[$top_annotation:meta])* + $vb:vis enum $name:ident { + $( + $(#[$branch_annotation:meta])* + $branch_name:ident ($from_type:ty) + ),+ + $(,)* + }) => { + $(#[$top_annotation])* + $vb enum $name { + $( + $(#[$branch_annotation])* + $branch_name($from_type), + )* + } + + $( + impl From<$from_type> for $name { + fn from(val: $from_type) -> Self { + Self::$branch_name(val) + } + } + )* + }; +} + +impl_from! { + /// Combined error type + #[derive(Debug)] + pub enum Error { + /// Number parsing error + Lexical(lexical::Error), + } +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{self:?}") + } +} + +#[cfg(feature = "std")] +impl std::error::Error for Error {} + +/// Process a Mastodon snowflake in its u64 representation into a UUID v7 identifier +#[inline] +#[must_use] +pub fn process_u64(masto_id: u64) -> Uuid { + let timestamp_ms = (masto_id >> 16) & 0xFF_FF_FF_FF_FF_FF; + let sequence_data = masto_id & 0xFF_FF; + let mut wyrand = WyRand::new_seed(sequence_data); + + let mut rand_data = [0; 10]; + wyrand.fill_bytes(&mut rand_data); + + let mut raw_uuid = [0; 16]; + let timestamp_ms_be = timestamp_ms.to_be_bytes(); + raw_uuid[..6].copy_from_slice(×tamp_ms_be[2..]); + raw_uuid[6..].copy_from_slice(&rand_data); + + raw_uuid[6] = (raw_uuid[6] & 0x0F) | 0x70; + raw_uuid[8] = (raw_uuid[8] & 0x3F) | 0x80; + + Uuid::from_bytes(raw_uuid) +} + +/// Process an ASCII-encoded Mastodon snowflake into a UUID v7 identifier +/// +/// # Errors +/// +/// - Parsing the Mastodon snowflake into a u64 failed +#[inline] +pub fn process(masto_id: T) -> Result +where + T: AsRef<[u8]>, +{ + lexical::parse(masto_id) + .map(process_u64) + .map_err(Error::from) +} diff --git a/lib/post-process/Cargo.toml b/lib/post-process/Cargo.toml index 8e7b49427..f5161304c 100644 --- a/lib/post-process/Cargo.toml +++ b/lib/post-process/Cargo.toml @@ -12,7 +12,7 @@ criterion = { version = "0.5.1", default-features = false, features = [ "async_futures", "rayon", ] } -futures = "0.3.28" +futures = "0.3.29" insta = { version = "1.34.0", features = ["glob"] } pretty_assertions = "1.4.0" diff --git a/lib/speedy-uuid/Cargo.toml b/lib/speedy-uuid/Cargo.toml index 10bf36e6f..58b9d4b18 100644 --- a/lib/speedy-uuid/Cargo.toml +++ b/lib/speedy-uuid/Cargo.toml @@ -10,7 +10,7 @@ diesel = { version = "2.1.3", features = [ "uuid", ], optional = true } redis = { version = "0.23.3", default-features = false, optional = true } -serde = { version = "1.0.189", optional = true } +serde = { version = "1.0.190", optional = true } thiserror = "1.0.50" uuid = { version = "1.5.0", features = ["fast-rng", "v7"] } uuid-simd = { version = "0.8.0", features = ["uuid"] }