From dbbf53c98e5dfb8a07364ea81aba75b6665ad57d Mon Sep 17 00:00:00 2001 From: Andrew Gazelka Date: Tue, 2 Jul 2024 09:48:08 -0500 Subject: [PATCH] feat(hyperion): mongodb -> postgres (#39) --- ...1948ce4a9861ff21458e851fedbe998898c7b.json | 28 + ...ee813d845b6f336d989845fe85f24fc7e74ac.json | 15 + ...64e05efe143af12f3785f1562c4f44661bde5.json | 12 + Cargo.lock | 1044 ++++++++--------- Cargo.toml | 3 - crates/hyperion/Cargo.toml | 4 +- crates/hyperion/src/lib.rs | 23 +- crates/hyperion/src/system/ingress.rs | 6 +- .../hyperion/src/system/player_join_world.rs | 18 +- crates/hyperion/src/util/db.rs | 134 +-- crates/hyperion/src/util/player_skin.rs | 49 +- events/infection/Cargo.toml | 1 + events/infection/src/main.rs | 2 + 13 files changed, 675 insertions(+), 664 deletions(-) create mode 100644 .sqlx/query-7390a53f48245e9d1f74dd526331948ce4a9861ff21458e851fedbe998898c7b.json create mode 100644 .sqlx/query-a39613c5c58094b7d32710837e3ee813d845b6f336d989845fe85f24fc7e74ac.json create mode 100644 .sqlx/query-c64bb11d4b7848c8378efd3806064e05efe143af12f3785f1562c4f44661bde5.json diff --git a/.sqlx/query-7390a53f48245e9d1f74dd526331948ce4a9861ff21458e851fedbe998898c7b.json b/.sqlx/query-7390a53f48245e9d1f74dd526331948ce4a9861ff21458e851fedbe998898c7b.json new file mode 100644 index 00000000..9b156ec0 --- /dev/null +++ b/.sqlx/query-7390a53f48245e9d1f74dd526331948ce4a9861ff21458e851fedbe998898c7b.json @@ -0,0 +1,28 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT uuid, skin as \"skin: serde_json::Value\" FROM player_skins WHERE uuid = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "skin: serde_json::Value", + "type_info": "Jsonb" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false + ] + }, + "hash": "7390a53f48245e9d1f74dd526331948ce4a9861ff21458e851fedbe998898c7b" +} diff --git a/.sqlx/query-a39613c5c58094b7d32710837e3ee813d845b6f336d989845fe85f24fc7e74ac.json b/.sqlx/query-a39613c5c58094b7d32710837e3ee813d845b6f336d989845fe85f24fc7e74ac.json new file mode 100644 index 00000000..0039bc67 --- /dev/null +++ b/.sqlx/query-a39613c5c58094b7d32710837e3ee813d845b6f336d989845fe85f24fc7e74ac.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO player_skins (uuid, skin)\n VALUES ($1, $2)\n ON CONFLICT (uuid) DO UPDATE SET skin = EXCLUDED.skin\n ", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Jsonb" + ] + }, + "nullable": [] + }, + "hash": "a39613c5c58094b7d32710837e3ee813d845b6f336d989845fe85f24fc7e74ac" +} diff --git a/.sqlx/query-c64bb11d4b7848c8378efd3806064e05efe143af12f3785f1562c4f44661bde5.json b/.sqlx/query-c64bb11d4b7848c8378efd3806064e05efe143af12f3785f1562c4f44661bde5.json new file mode 100644 index 00000000..23acfd80 --- /dev/null +++ b/.sqlx/query-c64bb11d4b7848c8378efd3806064e05efe143af12f3785f1562c4f44661bde5.json @@ -0,0 +1,12 @@ +{ + "db_name": "PostgreSQL", + "query": "\n CREATE TABLE IF NOT EXISTS player_skins (\n uuid UUID PRIMARY KEY,\n skin JSONB NOT NULL\n )\n ", + "describe": { + "columns": [], + "parameters": { + "Left": [] + }, + "nullable": [] + }, + "hash": "c64bb11d4b7848c8378efd3806064e05efe143af12f3785f1562c4f44661bde5" +} diff --git a/Cargo.lock b/Cargo.lock index 6a478cea..fe2dde8a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -182,14 +182,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] -name = "async-trait" -version = "0.1.80" +name = "atoi" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.68", + "num-traits", ] [[package]] @@ -219,12 +217,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - [[package]] name = "base64" version = "0.21.7" @@ -237,6 +229,12 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + [[package]] name = "bevy_app" version = "0.12.1" @@ -413,6 +411,9 @@ name = "bitflags" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +dependencies = [ + "serde", +] [[package]] name = "bitvec" @@ -435,27 +436,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "bson" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a88e82b9106923b5c4d6edfca9e7db958d4e98a478ec115022e81b9b38e2c8" -dependencies = [ - "ahash", - "base64 0.13.1", - "bitvec", - "hex", - "indexmap", - "js-sys", - "once_cell", - "rand", - "serde", - "serde_bytes", - "serde_json", - "time", - "uuid", -] - [[package]] name = "bumpalo" version = "3.16.0" @@ -528,9 +508,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.103" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2755ff20a1d93490d26ba33a6f092a38a508398a5320df5d4b3014fcccce9410" +checksum = "74b6a57f98764a267ff415d50a25e6e166f3831a5071af4995296ea97d210490" [[package]] name = "cesu8" @@ -561,10 +541,7 @@ checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", - "js-sys", "num-traits", - "serde", - "wasm-bindgen", "windows-targets 0.52.5", ] @@ -625,7 +602,7 @@ dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim 0.11.1", + "strsim", "terminal_size", ] @@ -705,6 +682,12 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf0a07a401f374238ab8e2f11a104d2851bf9ce711ec69804834de8af45c7af" +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "convert_case" version = "0.4.0" @@ -736,6 +719,21 @@ dependencies = [ "libc", ] +[[package]] +name = "crc" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + [[package]] name = "crc32fast" version = "1.4.2" @@ -800,6 +798,15 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.20" @@ -822,41 +829,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "darling" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 1.0.109", -] - -[[package]] -name = "darling_macro" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" -dependencies = [ - "darling_core", - "quote", - "syn 1.0.109", -] - [[package]] name = "dashmap" version = "5.5.3" @@ -871,29 +843,14 @@ dependencies = [ ] [[package]] -name = "data-encoding" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" - -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "derivative" -version = "2.2.0" +name = "der" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "const-oid", + "pem-rfc7468", + "zeroize", ] [[package]] @@ -905,7 +862,7 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "rustc_version 0.4.0", + "rustc_version", "syn 2.0.68", ] @@ -936,6 +893,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", "subtle", ] @@ -986,6 +944,12 @@ dependencies = [ "syn 2.0.68", ] +[[package]] +name = "dotenvy" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" + [[package]] name = "downcast-rs" version = "1.2.1" @@ -997,6 +961,9 @@ name = "either" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +dependencies = [ + "serde", +] [[package]] name = "encoding_rs" @@ -1007,18 +974,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "enum-as-inner" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73" -dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -1035,6 +990,17 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if", + "home", + "windows-sys 0.48.0", +] + [[package]] name = "event-listener" version = "2.5.3" @@ -1108,7 +1074,7 @@ dependencies = [ [[package]] name = "flecs_ecs" version = "0.0.2" -source = "git+https://github.com/Indra-db/flecs-ecs-rs#44009284095f7ab90a64320ae0c23a83db736986" +source = "git+https://github.com/Indra-db/flecs-ecs-rs#f511406409a9971c3304c350056dc1f3b35f731d" dependencies = [ "compact_str", "flecs_ecs_derive", @@ -1119,7 +1085,7 @@ dependencies = [ [[package]] name = "flecs_ecs_derive" version = "0.1.0" -source = "git+https://github.com/Indra-db/flecs-ecs-rs#44009284095f7ab90a64320ae0c23a83db736986" +source = "git+https://github.com/Indra-db/flecs-ecs-rs#f511406409a9971c3304c350056dc1f3b35f731d" dependencies = [ "proc-macro2", "quote", @@ -1129,7 +1095,7 @@ dependencies = [ [[package]] name = "flecs_ecs_sys" version = "0.1.0" -source = "git+https://github.com/Indra-db/flecs-ecs-rs#44009284095f7ab90a64320ae0c23a83db736986" +source = "git+https://github.com/Indra-db/flecs-ecs-rs#f511406409a9971c3304c350056dc1f3b35f731d" dependencies = [ "bindgen", "cc", @@ -1137,6 +1103,17 @@ dependencies = [ "regex", ] +[[package]] +name = "flume" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" +dependencies = [ + "futures-core", + "futures-sink", + "spin", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1200,6 +1177,17 @@ dependencies = [ "futures-util", ] +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot", +] + [[package]] name = "futures-io" version = "0.3.30" @@ -1234,17 +1222,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "futures-macro" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.68", -] - [[package]] name = "futures-sink" version = "0.3.30" @@ -1265,7 +1242,6 @@ checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-core", "futures-io", - "futures-macro", "futures-sink", "futures-task", "memchr", @@ -1417,6 +1393,15 @@ dependencies = [ "serde", ] +[[package]] +name = "hashlink" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" +dependencies = [ + "hashbrown", +] + [[package]] name = "heapless" version = "0.8.0" @@ -1432,6 +1417,9 @@ name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +dependencies = [ + "unicode-segmentation", +] [[package]] name = "heck" @@ -1451,6 +1439,15 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + [[package]] name = "hmac" version = "0.12.1" @@ -1469,17 +1466,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "hostname" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" -dependencies = [ - "libc", - "match_cfg", - "winapi", -] - [[package]] name = "http" version = "1.1.0" @@ -1522,9 +1508,9 @@ checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "hyper" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +checksum = "c4fe55fb7a772d59a5ff1dfbff4fe0258d19b89fec4b233e75d35d5d2316badc" dependencies = [ "bytes", "futures-channel", @@ -1550,10 +1536,10 @@ dependencies = [ "http", "hyper", "hyper-util", - "rustls 0.23.10", + "rustls", "rustls-pki-types", "tokio", - "tokio-rustls 0.26.0", + "tokio-rustls", "tower-service", ] @@ -1575,9 +1561,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56" +checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" dependencies = [ "bytes", "futures-channel", @@ -1586,7 +1572,7 @@ dependencies = [ "http-body", "hyper", "pin-project-lite", - "socket2 0.5.7", + "socket2", "tokio", "tower", "tower-service", @@ -1601,11 +1587,9 @@ dependencies = [ "base64 0.22.1", "bitfield-struct 0.8.0", "bitvec", - "bson", "bumpalo", "bvh-region", "bytes", - "chrono", "dashmap", "derive_more 0.99.18", "dirs-next", @@ -1623,7 +1607,6 @@ dependencies = [ "libc", "libdeflater", "line_drawing", - "mongodb", "more-asserts", "no_denormals", "once_cell", @@ -1634,11 +1617,12 @@ dependencies = [ "rand_distr", "rayon", "reqwest", - "rustc_version 0.4.0", + "rustc_version", "serde", "serde_json", "sha2", "slotmap", + "sqlx", "tango-bench 0.5.0", "tar", "thiserror", @@ -1706,23 +1690,6 @@ dependencies = [ "cc", ] -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "0.5.0" @@ -1765,6 +1732,7 @@ dependencies = [ "anyhow", "bvh", "clap", + "dotenvy", "fastrand 2.1.0", "glam", "hyperion", @@ -1787,18 +1755,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "ipconfig" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" -dependencies = [ - "socket2 0.5.7", - "widestring", - "windows-sys 0.48.0", - "winreg 0.50.0", -] - [[package]] name = "ipnet" version = "2.9.0" @@ -1882,6 +1838,9 @@ name = "lazy_static" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +dependencies = [ + "spin", +] [[package]] name = "lazycell" @@ -1939,6 +1898,17 @@ dependencies = [ "libc", ] +[[package]] +name = "libsqlite3-sys" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + [[package]] name = "libz-ng-sys" version = "1.1.15" @@ -1958,12 +1928,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -2008,15 +1972,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "lru-cache" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" -dependencies = [ - "linked-hash-map", -] - [[package]] name = "lunar-proto" version = "0.1.0" @@ -2026,12 +1981,6 @@ dependencies = [ "prost-types", ] -[[package]] -name = "match_cfg" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" - [[package]] name = "matchers" version = "0.1.0" @@ -2041,12 +1990,6 @@ dependencies = [ "regex-automata 0.1.10", ] -[[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - [[package]] name = "md-5" version = "0.10.6" @@ -2096,53 +2039,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "mongodb" -version = "2.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef206acb1b72389b49bc9985efe7eb1f8a9bb18e5680d262fac26c07f44025f1" -dependencies = [ - "async-trait", - "base64 0.13.1", - "bitflags 1.3.2", - "bson", - "chrono", - "derivative", - "derive_more 0.99.18", - "futures-core", - "futures-executor", - "futures-io", - "futures-util", - "hex", - "hmac", - "lazy_static", - "md-5", - "pbkdf2", - "percent-encoding", - "rand", - "rustc_version_runtime", - "rustls 0.21.12", - "rustls-pemfile 1.0.4", - "serde", - "serde_bytes", - "serde_with", - "sha-1", - "sha2", - "socket2 0.4.10", - "stringprep", - "strsim 0.10.0", - "take_mut", - "thiserror", - "tokio", - "tokio-rustls 0.24.1", - "tokio-util", - "trust-dns-proto", - "trust-dns-resolver", - "typed-builder", - "uuid", - "webpki-roots", -] - [[package]] name = "more-asserts" version = "0.3.1" @@ -2205,16 +2101,47 @@ dependencies = [ ] [[package]] -name = "num-conv" -version = "0.1.0" +name = "num-bigint-dig" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "smallvec", + "zeroize", +] [[package]] -name = "num-traits" -version = "0.2.19" +name = "num-integer" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", "libm", @@ -2371,12 +2298,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] -name = "pbkdf2" -version = "0.11.0" +name = "pem-rfc7468" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" dependencies = [ - "digest", + "base64ct", ] [[package]] @@ -2431,6 +2358,27 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" version = "0.3.30" @@ -2497,12 +2445,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -2594,12 +2536,6 @@ dependencies = [ "prost", ] -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - [[package]] name = "quote" version = "1.0.36" @@ -2782,7 +2718,7 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls-pemfile 2.1.2", + "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", @@ -2795,17 +2731,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg 0.52.0", -] - -[[package]] -name = "resolv-conf" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" -dependencies = [ - "hostname", - "quick-error", + "winreg", ] [[package]] @@ -2823,6 +2749,26 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rsa" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" +dependencies = [ + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core", + "signature", + "spki", + "subtle", + "zeroize", +] + [[package]] name = "rustc-demangle" version = "0.1.24" @@ -2835,32 +2781,13 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver 0.9.0", -] - [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.23", -] - -[[package]] -name = "rustc_version_runtime" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d31b7153270ebf48bf91c65ae5b0c00e749c4cfad505f66530ac74950249582f" -dependencies = [ - "rustc_version 0.2.3", - "semver 0.9.0", + "semver", ] [[package]] @@ -2876,18 +2803,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rustls" -version = "0.21.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" -dependencies = [ - "log", - "ring", - "rustls-webpki 0.101.7", - "sct", -] - [[package]] name = "rustls" version = "0.23.10" @@ -2896,20 +2811,11 @@ checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" dependencies = [ "once_cell", "rustls-pki-types", - "rustls-webpki 0.102.4", + "rustls-webpki", "subtle", "zeroize", ] -[[package]] -name = "rustls-pemfile" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" -dependencies = [ - "base64 0.21.7", -] - [[package]] name = "rustls-pemfile" version = "2.1.2" @@ -2926,16 +2832,6 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" -[[package]] -name = "rustls-webpki" -version = "0.101.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "rustls-webpki" version = "0.102.4" @@ -3009,16 +2905,6 @@ dependencies = [ "syn 2.0.68", ] -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "security-framework" version = "2.11.0" @@ -3042,27 +2928,12 @@ dependencies = [ "libc", ] -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - [[package]] name = "semver" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - [[package]] name = "serde" version = "1.0.203" @@ -3072,15 +2943,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" -dependencies = [ - "serde", -] - [[package]] name = "serde_derive" version = "1.0.203" @@ -3094,11 +2956,10 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.119" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8eddb61f0697cc3989c5d64b452f5488e2b8a60fd7d5076a3045076ffef8cb0" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" dependencies = [ - "indexmap", "itoa", "ryu", "serde", @@ -3126,32 +2987,10 @@ dependencies = [ ] [[package]] -name = "serde_with" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" -dependencies = [ - "serde", - "serde_with_macros", -] - -[[package]] -name = "serde_with_macros" -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "sha-1" -version = "0.10.1" +name = "sha1" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -3193,6 +3032,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + [[package]] name = "simd-adler32" version = "0.3.7" @@ -3223,16 +3072,6 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" -[[package]] -name = "socket2" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "socket2" version = "0.5.7" @@ -3248,6 +3087,227 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "sqlformat" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f895e3734318cc55f1fe66258926c9b910c124d47520339efecbb6c59cec7c1f" +dependencies = [ + "nom", + "unicode_categories", +] + +[[package]] +name = "sqlx" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" +dependencies = [ + "sqlx-core", + "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", +] + +[[package]] +name = "sqlx-core" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" +dependencies = [ + "ahash", + "atoi", + "byteorder", + "bytes", + "crc", + "crossbeam-queue", + "either", + "event-listener", + "futures-channel", + "futures-core", + "futures-intrusive", + "futures-io", + "futures-util", + "hashlink", + "hex", + "indexmap", + "log", + "memchr", + "once_cell", + "paste", + "percent-encoding", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlformat", + "thiserror", + "tokio", + "tokio-stream", + "tracing", + "url", + "uuid", +] + +[[package]] +name = "sqlx-macros" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn 1.0.109", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" +dependencies = [ + "dotenvy", + "either", + "heck 0.4.1", + "hex", + "once_cell", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2", + "sqlx-core", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", + "syn 1.0.109", + "tempfile", + "tokio", + "url", +] + +[[package]] +name = "sqlx-mysql" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" +dependencies = [ + "atoi", + "base64 0.21.7", + "bitflags 2.6.0", + "byteorder", + "bytes", + "crc", + "digest", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "percent-encoding", + "rand", + "rsa", + "serde", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "uuid", + "whoami", +] + +[[package]] +name = "sqlx-postgres" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" +dependencies = [ + "atoi", + "base64 0.21.7", + "bitflags 2.6.0", + "byteorder", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "rand", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "uuid", + "whoami", +] + +[[package]] +name = "sqlx-sqlite" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa" +dependencies = [ + "atoi", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "sqlx-core", + "tracing", + "url", + "urlencoding", + "uuid", +] [[package]] name = "stable_deref_trait" @@ -3272,12 +3332,6 @@ dependencies = [ "unicode-properties", ] -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "strsim" version = "0.11.1" @@ -3349,12 +3403,6 @@ dependencies = [ "libc", ] -[[package]] -name = "take_mut" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" - [[package]] name = "tango-bench" version = "0.4.0" @@ -3465,37 +3513,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "time" -version = "0.3.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" -dependencies = [ - "deranged", - "itoa", - "num-conv", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" -dependencies = [ - "num-conv", - "time-core", -] - [[package]] name = "tinytemplate" version = "1.2.1" @@ -3535,7 +3552,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.7", + "socket2", "tokio-macros", "windows-sys 0.48.0", ] @@ -3563,22 +3580,23 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.24.1" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.21.12", + "rustls", + "rustls-pki-types", "tokio", ] [[package]] -name = "tokio-rustls" -version = "0.26.0" +name = "tokio-stream" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" dependencies = [ - "rustls 0.23.10", - "rustls-pki-types", + "futures-core", + "pin-project-lite", "tokio", ] @@ -3590,7 +3608,6 @@ checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", - "futures-io", "futures-sink", "pin-project-lite", "tokio", @@ -3674,6 +3691,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -3761,68 +3779,12 @@ dependencies = [ "cc", ] -[[package]] -name = "trust-dns-proto" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c31f240f59877c3d4bb3b3ea0ec5a6a0cff07323580ff8c7a605cd7d08b255d" -dependencies = [ - "async-trait", - "cfg-if", - "data-encoding", - "enum-as-inner", - "futures-channel", - "futures-io", - "futures-util", - "idna 0.2.3", - "ipnet", - "lazy_static", - "log", - "rand", - "smallvec", - "thiserror", - "tinyvec", - "tokio", - "url", -] - -[[package]] -name = "trust-dns-resolver" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ba72c2ea84515690c9fcef4c6c660bb9df3036ed1051686de84605b74fd558" -dependencies = [ - "cfg-if", - "futures-util", - "ipconfig", - "lazy_static", - "log", - "lru-cache", - "parking_lot", - "resolv-conf", - "smallvec", - "thiserror", - "tokio", - "trust-dns-proto", -] - [[package]] name = "try-lock" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "typed-builder" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89851716b67b937e393b3daa8423e67ddfc4bbbf1654bcf05488e95e0828db0c" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "typenum" version = "1.17.0" @@ -3856,6 +3818,18 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4259d9d4425d9f0661581b804cb85fe66a4c631cadd8f490d1c13a35d5d9291" +[[package]] +name = "unicode-segmentation" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" + +[[package]] +name = "unicode_categories" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" + [[package]] name = "untrusted" version = "0.9.0" @@ -3869,11 +3843,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", - "idna 0.5.0", + "idna", "percent-encoding", "serde", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "utf8parse" version = "0.2.2" @@ -4162,6 +4142,12 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + [[package]] name = "wasm-bindgen" version = "0.2.92" @@ -4238,12 +4224,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki-roots" -version = "0.25.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" - [[package]] name = "weezl" version = "0.1.8" @@ -4263,10 +4243,14 @@ dependencies = [ ] [[package]] -name = "widestring" -version = "1.1.0" +name = "whoami" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" +checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" +dependencies = [ + "redox_syscall 0.4.1", + "wasite", +] [[package]] name = "winapi" @@ -4494,16 +4478,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winreg" -version = "0.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "winreg" version = "0.52.0" diff --git a/Cargo.toml b/Cargo.toml index f1c7ff42..aae7af43 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,11 +40,9 @@ arrayvec = "0.7.4" base64 = "0.22.1" bitfield-struct = "0.8.0" bitvec = "1.0.1" -bson = "2.11.0" bumpalo = "3.16" bvh-region = { path = "crates/bvh-region" } bytes = "1.6.0" -chrono = "0.4.38" clap = "4.5.7" criterion = "0.5.1" dashmap = "5.5.3" @@ -62,7 +60,6 @@ kanal = "0.1.0-pre8" libc = "0.2.155" libdeflater = "1.20.0" line_drawing = "1.0.0" -mongodb = "2.8.2" more-asserts = "0.3.1" no_denormals = "0.1.2" once_cell = "1.19.0" diff --git a/crates/hyperion/Cargo.toml b/crates/hyperion/Cargo.toml index d8149720..1f7b9b20 100644 --- a/crates/hyperion/Cargo.toml +++ b/crates/hyperion/Cargo.toml @@ -63,10 +63,8 @@ flecs_ecs.workspace = true heapless.workspace = true base64.workspace = true kanal.workspace = true -mongodb.workspace = true -bson = { workspace = true, features = ["uuid-1"] } -chrono = { workspace = true, features = ["serde"] } ouroboros.workspace = true +sqlx = { version = "0.7.4", features = ["postgres", "runtime-tokio", "uuid"] } [dev-dependencies] divan.workspace = true diff --git a/crates/hyperion/src/lib.rs b/crates/hyperion/src/lib.rs index 97dee3f0..9539213a 100644 --- a/crates/hyperion/src/lib.rs +++ b/crates/hyperion/src/lib.rs @@ -26,13 +26,6 @@ clippy::future_not_send )] -pub use uuid; - -mod blocks; -mod chunk; -pub mod singleton; -pub mod util; - use std::{alloc::Allocator, cell::RefCell, fmt::Debug, net::ToSocketAddrs, sync::Arc}; use anyhow::{bail, Context}; @@ -42,6 +35,7 @@ use libc::{getrlimit, setrlimit, RLIMIT_NOFILE}; use libdeflater::CompressionLvl; use once_cell::sync::Lazy; use tracing::{error, info, instrument, warn}; +pub use uuid; use valence_protocol::CompressionThreshold; pub use valence_server; @@ -57,6 +51,11 @@ use crate::{ util::{db, db::Db}, }; +mod blocks; +mod chunk; +pub mod singleton; +pub mod util; + pub mod component; // pub mod event; pub mod event; @@ -149,7 +148,7 @@ pub fn register_components(world: &World) { world.component::(); world.component::(); - world.component::(); + world.component::(); } impl Hyperion { @@ -223,11 +222,11 @@ impl Hyperion { let tasks = AsyncRuntime::default(); - let db = tasks - .block_on(Db::new("mongodb://localhost:27017")) - .unwrap(); + let url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set"); + + let db = tasks.block_on(Db::new(&url)).unwrap(); - let skins = tasks.block_on(db::SkinCollection::new(&db)).unwrap(); + let skins = db::SkinHandler::new(db.clone()); world.set(db); world.set(skins); diff --git a/crates/hyperion/src/system/ingress.rs b/crates/hyperion/src/system/ingress.rs index c7902ccf..fb08808c 100644 --- a/crates/hyperion/src/system/ingress.rs +++ b/crates/hyperion/src/system/ingress.rs @@ -46,7 +46,7 @@ use crate::{ singleton::fd_lookup::StreamLookup, system::{chunks::ChunkChanges, joins::SendableRef}, tracing_ext::TracingExt, - util::{db::SkinCollection, mojang::MojangClient, player_skin::PlayerSkin}, + util::{db::SkinHandler, mojang::MojangClient, player_skin::PlayerSkin}, }; // pub type ThreadLocalIngressSender<'a, 'b> = SenderLocal<'a, 'b, IngressEventSet>; // pub type IngressSender<'a> = Sender<'a, IngressEventSet>; @@ -200,7 +200,7 @@ pub fn recv_data(world: &World) { &MinecraftWorld($), &AsyncRuntime($), &Comms($), - &SkinCollection($), + &SkinHandler($), &ThreadLocalBump($), &mut PacketDecoder, &mut PacketState, @@ -329,7 +329,7 @@ fn process_login( login_state: &mut PacketState, decoder: &mut PacketDecoder, comms: &Comms, - skins_collection: SkinCollection, + skins_collection: SkinHandler, packet: &PacketFrame, stream_id: &NetworkStreamRef, compose: &Compose, diff --git a/crates/hyperion/src/system/player_join_world.rs b/crates/hyperion/src/system/player_join_world.rs index 56e74906..2a180f70 100644 --- a/crates/hyperion/src/system/player_join_world.rs +++ b/crates/hyperion/src/system/player_join_world.rs @@ -1,7 +1,6 @@ use std::{borrow::Cow, collections::BTreeSet}; use anyhow::{bail, Context}; -use base64::Engine; use flecs_ecs::{ core::{Entity, IdOperations, Query, QueryAPI, World}, prelude::{EntityView, WorldRef}, @@ -31,8 +30,6 @@ use valence_registry::{ use valence_server::entity::EntityKind; use valence_text::IntoText; -pub mod list; - use crate::{ component::{blocks::MinecraftWorld, InGameName, Pose, Uuid, PLAYER_SPAWN_POSITION}, config::CONFIG, @@ -42,6 +39,8 @@ use crate::{ util::{metadata::show_all, player_skin::PlayerSkin}, }; +pub mod list; + // #[derive(Query, Debug)] // pub(crate) struct EntityQuery<'a> { // id: EntityId, @@ -413,9 +412,10 @@ pub fn player_join_world( query.iter_stage(world).each(|(uuid, name, _, skin)| { // todo: in future, do not clone - let value = base64::engine::general_purpose::STANDARD.encode(&skin.textures.bytes); - - let signature = base64::engine::general_purpose::STANDARD.encode(&skin.signature.bytes); + let PlayerSkin { + textures: value, + signature, + } = skin.clone(); let property = valence_protocol::profile::Property { name: "textures".to_string(), @@ -457,8 +457,10 @@ pub fn player_join_world( ) .unwrap(); - let textures = base64::engine::general_purpose::STANDARD.encode(&skin.textures.bytes); - let signature = base64::engine::general_purpose::STANDARD.encode(&skin.signature.bytes); + let PlayerSkin { + textures, + signature, + } = skin.clone(); // todo: in future, do not clone let property = valence_protocol::profile::Property { diff --git a/crates/hyperion/src/util/db.rs b/crates/hyperion/src/util/db.rs index b8a25e1b..812d0d3f 100644 --- a/crates/hyperion/src/util/db.rs +++ b/crates/hyperion/src/util/db.rs @@ -1,39 +1,27 @@ -//! Constructs for connecting and working with a `MongoDB` database. +//! Constructs for connecting and working with a `PostgreSQL` database. -use bson::doc; use derive_more::Deref; use flecs_ecs::macros::Component; -use mongodb::{options::ClientOptions, IndexModel}; use serde::{Deserialize, Serialize}; +use sqlx::{postgres::PgPoolOptions, Pool, Postgres}; +use tracing::info; +use uuid::Uuid; -use crate::{ - component::{Inventory, Pose}, - util::player_skin::PlayerSkin, -}; +use crate::util::player_skin::PlayerSkin; -#[derive(Serialize, Deserialize, Debug)] -struct CorePlayer { - uuid: bson::Uuid, - name_on_login: String, - health: f32, - pose: Pose, - last_login: chrono::DateTime, - inventory: Inventory, -} - -/// The document for [`SkinCollection`] -#[derive(Serialize, Deserialize, Debug)] -pub struct SkinDocument { +/// The database row for player skins +#[derive(Serialize, Deserialize, Debug, sqlx::FromRow)] +pub struct SkinRow { /// The UUID of the player. - pub uuid: bson::Uuid, + pub uuid: Uuid, /// The skin of the player. - pub skin: PlayerSkin, + pub skin: serde_json::Value, // Storing PlayerSkin as JSON } -/// A wrapper around a [`mongodb::Database`] +/// A wrapper around a `PostgreSQL` connection pool #[derive(Component, Debug, Clone, Deref)] pub struct Db { - inner: mongodb::Database, + inner: Pool, } impl Db { @@ -44,62 +32,76 @@ impl Db { /// /// #[tokio::main] /// async fn main() -> anyhow::Result<()> { - /// let db = Db::new("mongodb://localhost:27017").await?; + /// let db = Db::new("postgres://username:password@localhost/hyperion").await?; /// Ok(()) /// } /// ``` - /// - /// Also see crate level documention [here](crate::util::db). - pub async fn new(s: impl AsRef) -> anyhow::Result { - let mut client_options = ClientOptions::parse(s).await?; - - // Manually set an option. - client_options.app_name = Some("Hyperion".to_string()); - - // Get a handle to the deployment. - let client = mongodb::Client::with_options(client_options)?; - - let db = client.database("hyperion"); - - Ok(Self { inner: db }) + pub async fn new(connection_str: &str) -> anyhow::Result { + let pool = PgPoolOptions::new() + .max_connections(5) + .connect(connection_str) + .await?; + + // Initialize the database + sqlx::query!( + // language=postgresql + r#" + CREATE TABLE IF NOT EXISTS player_skins ( + uuid UUID PRIMARY KEY, + skin JSONB NOT NULL + ) + "# + ) + .execute(&pool) + .await?; + + Ok(Self { inner: pool }) } } -/// A collection of [`SkinDocument`]s. -#[derive(Component, Debug, Clone, Deref)] -pub struct SkinCollection { - inner: mongodb::Collection, +/// A handler for player skin operations +#[derive(Component, Debug, Clone)] +pub struct SkinHandler { + db: Db, } -impl SkinCollection { - /// Creates a new [`SkinCollection`] from a given [`Db`]. - pub async fn new(db: &Db) -> anyhow::Result { - let skins = db.collection::("skins"); - - let index_model = IndexModel::builder() - .keys(doc! {"uuid": 1}) - .options(None) - .build(); - - skins.create_index(index_model, None).await?; - - Ok(Self { inner: skins }) +impl SkinHandler { + /// Creates a new [`SkinHandler`] from a given [`Db`]. + #[must_use] + pub const fn new(db: Db) -> Self { + Self { db } } /// Finds a [`PlayerSkin`] by its UUID. - pub async fn find(&self, uuid: uuid::Uuid) -> anyhow::Result> { - let uuid = bson::Uuid::from_uuid_1(uuid); - let result = self.find_one(doc! {"uuid": uuid}, None).await?; - Ok(result.map(|x| x.skin)) + pub async fn find(&self, uuid: Uuid) -> anyhow::Result> { + let result = sqlx::query_as!( + SkinRow, + // language=postgresql + r#"SELECT uuid, skin as "skin: serde_json::Value" FROM player_skins WHERE uuid = $1"#, + uuid + ) + .fetch_optional(&*self.db) + .await?; + + Ok(result.map(|row| serde_json::from_value(row.skin).unwrap())) } /// Inserts a [`PlayerSkin`] into the database. - pub async fn insert(&self, uuid: uuid::Uuid, skin: PlayerSkin) -> anyhow::Result<()> { - let uuid = bson::Uuid::from_uuid_1(uuid); - - let skin = SkinDocument { uuid, skin }; - - self.insert_one(skin, None).await?; + pub async fn insert(&self, uuid: Uuid, skin: PlayerSkin) -> anyhow::Result<()> { + info!("inserting skin for {uuid}"); + + sqlx::query!( + // language=postgresql + r#" + INSERT INTO player_skins (uuid, skin) + VALUES ($1, $2) + ON CONFLICT (uuid) DO UPDATE SET skin = EXCLUDED.skin + "#, + uuid, + serde_json::to_value(skin)? as _ + ) + .execute(&*self.db) + .await?; Ok(()) } diff --git a/crates/hyperion/src/util/player_skin.rs b/crates/hyperion/src/util/player_skin.rs index 4668c6cf..95429597 100644 --- a/crates/hyperion/src/util/player_skin.rs +++ b/crates/hyperion/src/util/player_skin.rs @@ -1,24 +1,24 @@ //! Constructs for obtaining a player's skin. - use anyhow::Context; +use base64::{engine::general_purpose, Engine as _}; use flecs_ecs::macros::Component; use serde::{Deserialize, Serialize}; -use crate::util::{db::SkinCollection, mojang::MojangClient}; +use crate::util::{db::SkinHandler, mojang::MojangClient}; /// A signed player skin. #[derive(Debug, Clone, Serialize, Deserialize, Component)] pub struct PlayerSkin { /// The textures of the player skin, usually obtained from the [`MojangClient`] as a base64 string. - pub textures: bson::Binary, + pub textures: String, /// The signature of the player skin, usually obtained from the [`MojangClient`] as a base64 string. - pub signature: bson::Binary, + pub signature: String, } impl PlayerSkin { /// Creates a new [`PlayerSkin`] #[must_use] - pub const fn new(textures: bson::Binary, signature: bson::Binary) -> Self { + pub const fn new(textures: String, signature: String) -> Self { Self { textures, signature, @@ -35,17 +35,15 @@ impl PlayerSkin { pub async fn from_uuid( uuid: uuid::Uuid, mojang: &MojangClient, - skins: &SkinCollection, + skins: &SkinHandler, ) -> anyhow::Result> { if let Some(skin) = skins.find(uuid).await? { return Ok(Some(skin)); } - let json_object = mojang.data_from_uuid(&uuid).await?; let properties_array = json_object["properties"] .as_array() .with_context(|| format!("no properties on {json_object:?}"))?; - for property_object in properties_array { let name = property_object["name"] .as_str() @@ -56,42 +54,25 @@ impl PlayerSkin { let textures = property_object["value"] .as_str() .with_context(|| format!("no value on {property_object:?}"))?; - let signature_value = property_object["signature"] + let signature = property_object["signature"] .as_str() .with_context(|| format!("no signature on {property_object:?}"))?; - let textures = - bson::Binary::from_base64(textures, None).context("invalid texture value")?; - let signature = bson::Binary::from_base64(signature_value, None) + // Validate base64 encoding + general_purpose::STANDARD + .decode(textures) + .context("invalid texture value")?; + general_purpose::STANDARD + .decode(signature) .context("invalid signature value")?; let res = Self { - textures, - signature, + textures: textures.to_string(), + signature: signature.to_string(), }; - skins.insert(uuid, res.clone()).await?; - return Ok(Some(res)); } - Ok(None) } - - // /// Gets a skin from a Minecraft username. - // /// - // /// # Arguments - // /// * `username` - The Minecraft username. - // /// - // /// # Returns - // /// A `PlayerSkin` based on a Minecraft username, or `None` if not found. - // pub async fn from_username( - // username: &str, - // mojang: &MojangClient, - // ) -> anyhow::Result> { - // let json_object = mojang.response_from_username(username).await?; - // let uuid = json_object["id"].as_str().context("no id")?; - // let uuid = uuid::Uuid::parse_str(uuid).context("invalid uuid")?; - // Self::from_uuid(uuid, mojang).await - // } } diff --git a/events/infection/Cargo.toml b/events/infection/Cargo.toml index 125a5ea3..0a520f9a 100644 --- a/events/infection/Cargo.toml +++ b/events/infection/Cargo.toml @@ -17,6 +17,7 @@ clap = { workspace = true, features = ["derive"] } tracing-tracy.workspace = true bvh.workspace = true glam = { workspace = true, features = ["core-simd", "fast-math"] } +dotenvy = "0.15.7" [dev-dependencies] tokio = { workspace = true, features = ["full"] } diff --git a/events/infection/src/main.rs b/events/infection/src/main.rs index b8e85c16..ad27aaa6 100644 --- a/events/infection/src/main.rs +++ b/events/infection/src/main.rs @@ -17,6 +17,8 @@ struct Args { } fn main() { + dotenvy::dotenv().ok(); + let Args { ip, port, tracy } = Args::parse(); if tracy {