From 57971e95c5720dfe06f7ca319ba98788251d9f58 Mon Sep 17 00:00:00 2001 From: CEbbinghaus Date: Sat, 21 Oct 2023 13:29:31 +1100 Subject: [PATCH] wrote my own database backend --- .github/workflows/build.yml | 4 +- backend/Cargo.lock | 2226 +---------------------------------- backend/Cargo.toml | 10 +- backend/src/api.rs | 58 +- backend/src/db.rs | 243 ++-- backend/src/dbo.rs | 1 - backend/src/ds.rs | 384 ++++++ backend/src/err.rs | 44 +- backend/src/main.rs | 294 +++-- backend/src/sdcard.rs | 3 +- 10 files changed, 742 insertions(+), 2525 deletions(-) create mode 100644 backend/src/ds.rs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 493d6c6..bb7377d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: - name: Download Decky CLI run: | mkdir /tmp/decky-cli - curl -L -o /tmp/decky-cli/decky "https://github.com/SteamDeckHomebrew/cli/releases/download/0.0.1-alpha.11/decky" + curl -L -o /tmp/decky-cli/decky "https://github.com/SteamDeckHomebrew/cli/releases/download/0.0.1-alpha.12/decky" chmod +x /tmp/decky-cli/decky echo "/tmp/decky-cli" >> $GITHUB_PATH @@ -41,4 +41,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: "MicroSDeck" - path: /tmp/output/*.zip \ No newline at end of file + path: /tmp/output/MicroSDeck.zip \ No newline at end of file diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 35c551b..7f0a91d 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -8,7 +8,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "617a8268e3537fe1d8c9ead925fca49ef6400927ee7bc26750e90ecee14ce4b8" dependencies = [ - "bitflags 1.3.2", + "bitflags", "bytes", "futures-core", "futures-sink", @@ -46,7 +46,7 @@ dependencies = [ "actix-utils", "ahash 0.8.3", "base64", - "bitflags 1.3.2", + "bitflags", "brotli", "bytes", "bytestring", @@ -117,7 +117,7 @@ dependencies = [ "actix-utils", "futures-core", "futures-util", - "mio 0.8.8", + "mio", "num_cpus", "socket2 0.4.9", "tokio", @@ -198,15 +198,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "addr" -version = "0.15.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a93b8a41dbe230ad5087cc721f8d41611de654542180586b315d9f4cf6b72bef" -dependencies = [ - "psl-types", -] - [[package]] name = "addr2line" version = "0.21.0" @@ -294,103 +285,10 @@ dependencies = [ ] [[package]] -name = "any_ascii" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea50b14b7a4b9343f8c627a7a53c52076482bd4bdad0a24fd3ec533ed616cc2c" - -[[package]] -name = "approx" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" -dependencies = [ - "num-traits", -] - -[[package]] -name = "arc-swap" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" - -[[package]] -name = "argon2" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2e554a8638bdc1e4eae9984845306cc95f8a9208ba8d49c3859fd958b46774d" -dependencies = [ - "base64ct", - "blake2", - "cpufeatures", - "password-hash", -] - -[[package]] -name = "arrayvec" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - -[[package]] -name = "ascii-canvas" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" -dependencies = [ - "term", -] - -[[package]] -name = "async-channel" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" -dependencies = [ - "concurrent-queue", - "event-listener", - "futures-core", -] - -[[package]] -name = "async-executor" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fa3dc5f2a8564f07759c008b9109dc0d39de92a88d5588b8a5036d286383afb" -dependencies = [ - "async-lock", - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "slab", -] - -[[package]] -name = "async-lock" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" -dependencies = [ - "event-listener", -] - -[[package]] -name = "async-recursion" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.29", -] - -[[package]] -name = "async-task" -version = "4.4.0" +name = "anyhow" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "async-trait" @@ -403,32 +301,6 @@ dependencies = [ "syn 2.0.29", ] -[[package]] -name = "async_io_stream" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" -dependencies = [ - "futures", - "pharos", - "rustc_version", -] - -[[package]] -name = "atomic" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" - -[[package]] -name = "atomic-polyfill" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ff7eb3f316534d83a8a2c3d1674ace8a5a71198eba31e2e2b597833f699b28" -dependencies = [ - "critical-section", -] - [[package]] name = "atty" version = "0.2.14" @@ -452,19 +324,20 @@ version = "0.1.0" dependencies = [ "actix-cors", "actix-web", + "anyhow", "async-trait", "chrono", "futures", "keyvalues-serde", "log", "once_cell", + "petgraph", "serde", "serde_json", "simplelog", + "slotmap", "steam-acf", - "surrealdb", "tokio", - "tokio-udev", ] [[package]] @@ -488,109 +361,12 @@ version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - -[[package]] -name = "bcrypt" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9df288bec72232f78c1ec5fe4e8f1d108aa0265476e93097593c803c8c02062a" -dependencies = [ - "base64", - "blowfish", - "getrandom", - "subtle", - "zeroize", -] - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bindgen" -version = "0.65.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" -dependencies = [ - "bitflags 1.3.2", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.29", -] - -[[package]] -name = "bit-set" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "bitflags" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" - -[[package]] -name = "bitmaps" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "703642b98a00b3b90513279a8ede3fcfa479c126c5fb46e78f3051522f021403" - -[[package]] -name = "bitvec" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest", -] - [[package]] name = "block-buffer" version = "0.10.4" @@ -600,61 +376,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "blowfish" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e412e2cd0f2b2d93e02543ceae7917b3c70331573df19ee046bcbc35e45e87d7" -dependencies = [ - "byteorder", - "cipher", -] - -[[package]] -name = "borsh" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b" -dependencies = [ - "borsh-derive", - "hashbrown 0.12.3", -] - -[[package]] -name = "borsh-derive" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7" -dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", - "proc-macro-crate", - "proc-macro2", - "syn 1.0.109", -] - -[[package]] -name = "borsh-derive-internal" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "borsh-schema-derive-internal" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "brotli" version = "3.3.4" @@ -682,40 +403,6 @@ version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" -[[package]] -name = "bytecheck" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" -dependencies = [ - "bytecheck_derive", - "ptr_meta", - "simdutf8", -] - -[[package]] -name = "bytecheck_derive" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "bytemuck" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - [[package]] name = "bytes" version = "1.4.0" @@ -731,17 +418,6 @@ dependencies = [ "bytes", ] -[[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - [[package]] name = "cc" version = "1.0.79" @@ -751,71 +427,6 @@ dependencies = [ "jobserver", ] -[[package]] -name = "cedar-policy" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740e9c6999327357726ab9170defa1229c9a91f000c40cb02b343385cd7d8cf9" -dependencies = [ - "cedar-policy-core", - "cedar-policy-validator", - "itertools", - "lalrpop-util", - "ref-cast", - "serde", - "serde_json", - "smol_str", - "thiserror", -] - -[[package]] -name = "cedar-policy-core" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c43c92ddadc29024643ef24ff0aeb665bb665750d401f6b5f4a9a44eae898ae" -dependencies = [ - "either", - "ipnet", - "itertools", - "lalrpop", - "lalrpop-util", - "lazy_static", - "regex", - "rustc_lexer", - "serde", - "serde_json", - "serde_with", - "smol_str", - "stacker", - "thiserror", -] - -[[package]] -name = "cedar-policy-validator" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf263ac64b18d94d9cd8ae4d05b65100fc21647e20eb42f7735fb54ec887afa3" -dependencies = [ - "cedar-policy-core", - "itertools", - "serde", - "serde_json", - "serde_with", - "smol_str", - "stacker", - "thiserror", - "unicode-security", -] - -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - [[package]] name = "cfg-if" version = "1.0.0" @@ -832,33 +443,11 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", - "serde", "time 0.1.45", "wasm-bindgen", "winapi", ] -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", -] - -[[package]] -name = "clang-sys" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" -dependencies = [ - "glob", - "libc", - "libloading", -] - [[package]] name = "clap" version = "2.34.0" @@ -867,28 +456,13 @@ checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "ansi_term", "atty", - "bitflags 1.3.2", - "strsim 0.8.0", + "bitflags", + "strsim", "textwrap", "unicode-width", "vec_map", ] -[[package]] -name = "concurrent-queue" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "const-oid" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" - [[package]] name = "convert_case" version = "0.4.0" @@ -931,82 +505,15 @@ dependencies = [ ] [[package]] -name = "critical-section" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6548a0ad5d2549e111e1f6a11a6c2e2d00ce6a3dafe22948d67c2b443f775e52" - -[[package]] -name = "crossbeam-utils" -version = "0.8.15" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", "typenum", ] -[[package]] -name = "darling" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 2.0.29", -] - -[[package]] -name = "darling_macro" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.29", -] - -[[package]] -name = "der" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" -dependencies = [ - "const-oid", - "pem-rfc7468", - "zeroize", -] - [[package]] name = "derive_more" version = "0.99.17" @@ -1020,18 +527,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "deunicode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1bba4f227a4a53d12b653f50ca7bf10c9119ae2aba56aff9e0338b5c98f36a" - -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - [[package]] name = "digest" version = "0.10.7" @@ -1039,76 +534,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", - "const-oid", "crypto-common", - "subtle", -] - -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "dmp" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfaa1135a34d26e5cc5b4927a8935af887d4f30a5653a797c33b9a4222beb6d9" -dependencies = [ - "urlencoding", -] - -[[package]] -name = "earcutr" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0812b44697951d35fde8fcb0da81c9de7e809e825a66bbf1ecb79d9829d4ca3d" -dependencies = [ - "itertools", - "num-traits", -] - -[[package]] -name = "echodb" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "312221c0bb46e82cd250c818404ef9dce769a4d5a62915c0249b577762eec34a" -dependencies = [ - "arc-swap", - "imbl", - "thiserror", - "tokio", -] - -[[package]] -name = "either" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" - -[[package]] -name = "ena" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c533630cf40e9caa44bd91aadc88a75d75a4c3a12b4cfde353cbed41daa1e1f1" -dependencies = [ - "log", ] [[package]] @@ -1120,54 +546,12 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "endian-type" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" - [[package]] name = "equivalent" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "errno" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - -[[package]] -name = "fastrand" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] - [[package]] name = "fixedbitset" version = "0.4.2" @@ -1184,25 +568,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "float_next_after" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf7cc16383c4b8d58b9905a8509f02926ce3058053c056376248d958c9df1e8" - -[[package]] -name = "flume" -version = "0.10.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" -dependencies = [ - "futures-core", - "futures-sink", - "nanorand", - "pin-project", - "spin 0.9.8", -] - [[package]] name = "fnv" version = "1.0.7" @@ -1218,18 +583,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fst" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab85b9b05e3978cc9a9cf8fea7f01b494e1a09ed3037e16ba39edc7a29eb61a" - -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - [[package]] name = "futures" version = "0.3.28" @@ -1255,17 +608,6 @@ dependencies = [ "futures-sink", ] -[[package]] -name = "futures-concurrency" -version = "7.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b726119e6cd29cf120724495b2085e1ed3d17821ea17b86de54576d1aa565f5e" -dependencies = [ - "bitvec", - "futures-core", - "pin-project", -] - [[package]] name = "futures-core" version = "0.3.28" @@ -1289,21 +631,6 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" -[[package]] -name = "futures-lite" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", -] - [[package]] name = "futures-macro" version = "0.3.28" @@ -1345,15 +672,6 @@ dependencies = [ "slab", ] -[[package]] -name = "fuzzy-matcher" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94" -dependencies = [ - "thread_local", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -1364,62 +682,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "geo" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d07d2288645058f3c78bc64eadd615335791cd5adb632e9865840afbc13dad" -dependencies = [ - "earcutr", - "float_next_after", - "geo-types", - "geographiclib-rs", - "log", - "num-traits", - "robust 0.2.3", - "rstar 0.10.0", - "serde", -] - -[[package]] -name = "geo" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1645cf1d7fea7dac1a66f7357f3df2677ada708b8d9db8e9b043878930095a96" -dependencies = [ - "earcutr", - "float_next_after", - "geo-types", - "geographiclib-rs", - "log", - "num-traits", - "robust 1.1.0", - "rstar 0.11.0", - "serde", -] - -[[package]] -name = "geo-types" -version = "0.7.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9705398c5c7b26132e74513f4ee7c1d7dafd786004991b375c172be2be0eecaa" -dependencies = [ - "approx", - "num-traits", - "rstar 0.10.0", - "rstar 0.11.0", - "serde", -] - -[[package]] -name = "geographiclib-rs" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea804e7bd3c6a4ca6a01edfa35231557a8a81d4d3f3e1e2b650d028c42592be" -dependencies = [ - "lazy_static", -] - [[package]] name = "getrandom" version = "0.2.10" @@ -1427,10 +689,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "wasm-bindgen", ] [[package]] @@ -1439,12 +699,6 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - [[package]] name = "h2" version = "0.3.19" @@ -1464,32 +718,11 @@ dependencies = [ "tracing", ] -[[package]] -name = "hash32" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" -dependencies = [ - "byteorder", -] - [[package]] name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.6", -] - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash 0.8.3", -] [[package]] name = "hashbrown" @@ -1497,19 +730,6 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" -[[package]] -name = "heapless" -version = "0.7.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743" -dependencies = [ - "atomic-polyfill", - "hash32", - "rustc_version", - "spin 0.9.8", - "stable_deref_trait", -] - [[package]] name = "heck" version = "0.3.3" @@ -1537,27 +757,6 @@ dependencies = [ "libc", ] -[[package]] -name = "hermit-abi" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - [[package]] name = "http" version = "0.2.9" @@ -1604,12 +803,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.4.0" @@ -1620,28 +813,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "imbl" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2806b69cd9f4664844027b64465eacb444c67c1db9c778e341adff0c25cdb0d" -dependencies = [ - "bitmaps", - "imbl-sized-chunks", - "rand_core", - "rand_xoshiro", - "version_check", -] - -[[package]] -name = "imbl-sized-chunks" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6957ea0b2541c5ca561d3ef4538044af79f8a05a1eb3a3b148936aaceaa1076" -dependencies = [ - "bitmaps", -] - [[package]] name = "indexmap" version = "1.9.3" @@ -1650,7 +821,6 @@ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown 0.12.3", - "serde", ] [[package]] @@ -1661,58 +831,13 @@ checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" dependencies = [ "equivalent", "hashbrown 0.14.0", - "serde", ] [[package]] -name = "inout" -version = "0.1.3" +name = "itoa" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" -dependencies = [ - "generic-array", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "ipnet" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" - -[[package]] -name = "is-terminal" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi 0.3.2", - "rustix", - "windows-sys", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "jobserver" @@ -1757,38 +882,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "lalrpop" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da4081d44f4611b66c6dd725e6de3169f9f63905421e8626fcb86b6a898998b8" -dependencies = [ - "ascii-canvas", - "bit-set", - "diff", - "ena", - "is-terminal", - "itertools", - "lalrpop-util", - "petgraph", - "pico-args", - "regex", - "regex-syntax", - "string_cache", - "term", - "tiny-keccak", - "unicode-xid", -] - -[[package]] -name = "lalrpop-util" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f35c735096c0293d313e8f2a641627472b83d01b937177fe76e5e2708d31e0d" -dependencies = [ - "regex", -] - [[package]] name = "language-tags" version = "0.3.2" @@ -1800,24 +893,6 @@ name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -dependencies = [ - "spin 0.5.2", -] - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - -[[package]] -name = "lexicmp" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7378d131ddf24063b32cbd7e91668d183140c4b3906270635a4d633d1068ea5d" -dependencies = [ - "any_ascii", -] [[package]] name = "libc" @@ -1825,65 +900,6 @@ version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - -[[package]] -name = "libm" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" - -[[package]] -name = "librocksdb-sys" -version = "0.11.0+8.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3386f101bcb4bd252d8e9d2fb41ec3b0862a15a62b478c355b2982efa469e3e" -dependencies = [ - "bindgen", - "bzip2-sys", - "cc", - "glob", - "libc", - "libz-sys", - "lz4-sys", - "zstd-sys", -] - -[[package]] -name = "libudev-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" -dependencies = [ - "libc", - "pkg-config", -] - -[[package]] -name = "libz-sys" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" - [[package]] name = "local-channel" version = "0.1.3" @@ -1918,34 +934,6 @@ version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" -[[package]] -name = "lru" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718e8fae447df0c7e1ba7f5189829e63fd536945c8988d61444c19039f16b670" -dependencies = [ - "hashbrown 0.13.2", -] - -[[package]] -name = "lz4-sys" -version = "1.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "md-5" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" -dependencies = [ - "digest", -] - [[package]] name = "memchr" version = "2.5.0" @@ -1958,12 +946,6 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - [[package]] name = "miniz_oxide" version = "0.7.1" @@ -1973,19 +955,6 @@ dependencies = [ "adler", ] -[[package]] -name = "mio" -version = "0.7.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" -dependencies = [ - "libc", - "log", - "miow", - "ntapi", - "winapi", -] - [[package]] name = "mio" version = "0.8.8" @@ -1998,116 +967,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi", -] - -[[package]] -name = "nanoid" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ffa00dec017b5b1a8b7cf5e2c008bfda1aa7e0697ac1508b491fdf2622fb4d8" -dependencies = [ - "rand", -] - -[[package]] -name = "nanorand" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" -dependencies = [ - "getrandom", -] - -[[package]] -name = "new_debug_unreachable" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" - -[[package]] -name = "nibble_vec" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" -dependencies = [ - "smallvec", -] - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "ntapi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" -dependencies = [ - "winapi", -] - -[[package]] -name = "num-bigint" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-bigint-dig" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" -dependencies = [ - "byteorder", - "lazy_static", - "libm", - "num-integer", - "num-iter", - "num-traits", - "rand", - "smallvec", - "zeroize", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.15" @@ -2115,7 +974,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", - "libm", ] [[package]] @@ -2152,12 +1010,6 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" -[[package]] -name = "parking" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" - [[package]] name = "parking_lot" version = "0.12.1" @@ -2176,65 +1028,17 @@ checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall", "smallvec", "windows-targets", ] -[[package]] -name = "password-hash" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" -dependencies = [ - "base64ct", - "rand_core", - "subtle", -] - [[package]] name = "paste" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" -[[package]] -name = "pbkdf2" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" -dependencies = [ - "digest", - "hmac", - "password-hash", - "sha2", -] - -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - -[[package]] -name = "pem" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b13fe415cdf3c8e44518e18a7c95a13431d9bdf6d15367d82b23c377fdd441a" -dependencies = [ - "base64", - "serde", -] - -[[package]] -name = "pem-rfc7468" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" -dependencies = [ - "base64ct", -] - [[package]] name = "percent-encoding" version = "2.3.0" @@ -2293,122 +1097,33 @@ checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", "indexmap 2.0.0", + "serde", + "serde_derive", ] [[package]] -name = "pharos" -version = "0.5.3" +name = "pin-project-lite" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" -dependencies = [ - "futures", - "rustc_version", -] +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] -name = "phf_shared" -version = "0.10.0" +name = "pin-utils" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] -name = "pico-args" -version = "0.5.0" +name = "pkg-config" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] -name = "pin-project" -version = "1.1.0" +name = "ppv-lite86" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.29", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" - -[[package]] -name = "pin-utils" -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.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - -[[package]] -name = "prettyplease" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c64d9ba0963cdcea2e1b2230fbae2bab30eb25a174be395c41e764bfb65dd62" -dependencies = [ - "proc-macro2", - "syn 2.0.29", -] - -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro-error" @@ -2443,41 +1158,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "psl-types" -version = "2.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33cb294fe86a74cbcf50d4445b37da762029549ebeea341421c7c70370f86cac" - -[[package]] -name = "psm" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" -dependencies = [ - "cc", -] - -[[package]] -name = "ptr_meta" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" -dependencies = [ - "ptr_meta_derive", -] - -[[package]] -name = "ptr_meta_derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "quote" version = "1.0.33" @@ -2487,23 +1167,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - -[[package]] -name = "radix_trie" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" -dependencies = [ - "endian-type", - "nibble_vec", - "serde", -] - [[package]] name = "rand" version = "0.8.5" @@ -2534,62 +1197,13 @@ dependencies = [ "getrandom", ] -[[package]] -name = "rand_xoshiro" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" -dependencies = [ - "rand_core", -] - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -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_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall 0.2.16", - "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.29", + "bitflags", ] [[package]] @@ -2621,220 +1235,12 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" -[[package]] -name = "rend" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581008d2099240d37fb08d77ad713bcaec2c4d89d50b5b21a8bb1996bbab68ab" -dependencies = [ - "bytecheck", -] - -[[package]] -name = "retain_mut" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c31b5c4033f8fdde8700e4657be2c497e7288f01515be52168c631e2e4d4086" - -[[package]] -name = "revision" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87eb86913082f8976b06d07a59f17df9120e6f38b882cf3fc5a45b4499e224b6" -dependencies = [ - "bincode", - "chrono", - "geo 0.26.0", - "regex", - "revision-derive", - "roaring", - "rust_decimal", - "serde", - "thiserror", - "uuid", -] - -[[package]] -name = "revision-derive" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf996fc5f61f1dbec35799b5c00c6dda12e8862e8cb782ed24e10d0292e60ed3" -dependencies = [ - "darling", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.29", -] - -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin 0.5.2", - "untrusted", - "web-sys", - "winapi", -] - -[[package]] -name = "rkyv" -version = "0.7.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" -dependencies = [ - "bitvec", - "bytecheck", - "hashbrown 0.12.3", - "ptr_meta", - "rend", - "rkyv_derive", - "seahash", - "tinyvec", - "uuid", -] - -[[package]] -name = "rkyv_derive" -version = "0.7.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "roaring" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6106b5cf8587f5834158895e9715a3c6c9716c8aefab57f1f7680917191c7873" -dependencies = [ - "bytemuck", - "byteorder", - "retain_mut", - "serde", -] - -[[package]] -name = "robust" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5864e7ef1a6b7bcf1d6ca3f655e65e724ed3b52546a0d0a663c991522f552ea" - -[[package]] -name = "robust" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf4a6aa5f6d6888f39e980649f3ad6b666acdce1d78e95b8a2cb076e687ae30" - -[[package]] -name = "rocksdb" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6f170a4041d50a0ce04b0d2e14916d6ca863ea2e422689a5b694395d299ffe" -dependencies = [ - "libc", - "librocksdb-sys", -] - -[[package]] -name = "rsa" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab43bb47d23c1a631b4b680199a45255dce26fa9ab2fa902581f624ff13e6a8" -dependencies = [ - "byteorder", - "const-oid", - "digest", - "num-bigint-dig", - "num-integer", - "num-iter", - "num-traits", - "pkcs1", - "pkcs8", - "rand_core", - "signature", - "spki", - "subtle", - "zeroize", -] - -[[package]] -name = "rstar" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f39465655a1e3d8ae79c6d9e007f4953bfc5d55297602df9dc38f9ae9f1359a" -dependencies = [ - "heapless", - "num-traits", - "smallvec", -] - -[[package]] -name = "rstar" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73111312eb7a2287d229f06c00ff35b51ddee180f017ab6dec1f69d62ac098d6" -dependencies = [ - "heapless", - "num-traits", - "smallvec", -] - -[[package]] -name = "rust-stemmers" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e46a2036019fdb888131db7a4c847a1063a7493f971ed94ea82c67eada63ca54" -dependencies = [ - "serde", - "serde_derive", -] - -[[package]] -name = "rust_decimal" -version = "1.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c4216490d5a413bc6d10fa4742bd7d4955941d062c0ef873141d6b0e7b30fd" -dependencies = [ - "arrayvec", - "borsh", - "bytes", - "num-traits", - "rand", - "rkyv", - "serde", - "serde_json", -] - [[package]] name = "rustc-demangle" version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc_lexer" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c86aae0c77166108c01305ee1a36a1e77289d7dc6ca0a3cd91ff4992de2d16a5" -dependencies = [ - "unicode-xid", -] - [[package]] name = "rustc_version" version = "0.4.0" @@ -2844,78 +1250,23 @@ dependencies = [ "semver", ] -[[package]] -name = "rustix" -version = "0.38.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac5ffa1efe7548069688cd7028f32591853cd7b5b756d41bcffd2353e4fc75b4" -dependencies = [ - "bitflags 2.4.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", -] - -[[package]] -name = "rustversion" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" - [[package]] name = "ryu" version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" -[[package]] -name = "salsa20" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" -dependencies = [ - "cipher", -] - [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "scrypt" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" -dependencies = [ - "password-hash", - "pbkdf2", - "salsa20", - "sha2", -] - -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - [[package]] name = "semver" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" -dependencies = [ - "serde", -] - -[[package]] -name = "send_wrapper" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" @@ -2943,7 +1294,6 @@ version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" dependencies = [ - "indexmap 2.0.0", "itoa", "ryu", "serde", @@ -2961,46 +1311,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_with" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ca3b16a3d82c4088f343b7480a93550b3eabe1a358569c2dfe38bbcead07237" -dependencies = [ - "base64", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.0.0", - "serde", - "serde_json", - "serde_with_macros", - "time 0.3.22", -] - -[[package]] -name = "serde_with_macros" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e6be15c453eb305019bfa438b1593c731f36a289a7853f7707ee29e870b3b3c" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.29", -] - -[[package]] -name = "sha-1" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - [[package]] name = "sha1" version = "0.10.5" @@ -3023,12 +1333,6 @@ dependencies = [ "digest", ] -[[package]] -name = "shlex" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" - [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -3038,34 +1342,6 @@ dependencies = [ "libc", ] -[[package]] -name = "signature" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" -dependencies = [ - "digest", - "rand_core", -] - -[[package]] -name = "simdutf8" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" - -[[package]] -name = "simple_asn1" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" -dependencies = [ - "num-bigint", - "num-traits", - "thiserror", - "time 0.3.22", -] - [[package]] name = "simplelog" version = "0.12.1" @@ -3075,13 +1351,7 @@ dependencies = [ "log", "termcolor", "time 0.3.22", -] - -[[package]] -name = "siphasher" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +] [[package]] name = "slab" @@ -3093,25 +1363,20 @@ dependencies = [ ] [[package]] -name = "smallvec" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" - -[[package]] -name = "smol_str" -version = "0.2.0" +name = "slotmap" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c" +checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" dependencies = [ "serde", + "version_check", ] [[package]] -name = "snap" -version = "1.1.0" +name = "smallvec" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "socket2" @@ -3133,50 +1398,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -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.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" -dependencies = [ - "base64ct", - "der", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "stacker" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce" -dependencies = [ - "cc", - "cfg-if", - "libc", - "psm", - "winapi", -] - [[package]] name = "steam-acf" version = "0.1.0" @@ -3186,43 +1407,12 @@ dependencies = [ "structopt", ] -[[package]] -name = "storekey" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43c42833834a5d23b344f71d87114e0cc9994766a5c42938f4b50e7b2aef85b2" -dependencies = [ - "byteorder", - "memchr", - "serde", - "thiserror", -] - -[[package]] -name = "string_cache" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" -dependencies = [ - "new_debug_unreachable", - "once_cell", - "parking_lot", - "phf_shared", - "precomputed-hash", -] - [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "structopt" version = "0.3.26" @@ -3247,109 +1437,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "subtle" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" - -[[package]] -name = "surrealdb" -version = "1.0.0-beta.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59d2972fcbdbfb5de50fee6ef1944cc52ceb586537496a161035bc4a32fc1a81" -dependencies = [ - "addr", - "any_ascii", - "argon2", - "async-channel", - "async-executor", - "async-recursion", - "base64", - "bcrypt", - "bincode", - "bytes", - "cedar-policy", - "chrono", - "deunicode", - "dmp", - "echodb", - "flume", - "fst", - "futures", - "futures-concurrency", - "fuzzy-matcher", - "geo 0.25.1", - "indexmap 1.9.3", - "ipnet", - "lexicmp", - "lru", - "md-5", - "nanoid", - "nom", - "once_cell", - "pbkdf2", - "pharos", - "pin-project-lite", - "radix_trie", - "rand", - "regex", - "revision", - "roaring", - "rocksdb", - "rust-stemmers", - "rust_decimal", - "scrypt", - "semver", - "serde", - "serde_json", - "sha-1", - "sha2", - "snap", - "storekey", - "surrealdb-derive", - "surrealdb-jsonwebtoken", - "thiserror", - "tokio", - "tracing", - "trice", - "ulid", - "url", - "uuid", - "wasm-bindgen-futures", - "wasmtimer", - "ws_stream_wasm", -] - -[[package]] -name = "surrealdb-derive" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aacdb4c58b9ebef0291310afcd63af0012d85610d361f3785952c61b6f1dddf4" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "surrealdb-jsonwebtoken" -version = "8.3.0-surreal.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02d4f759c65df8a8cf2d83c99db7fdd3ae5b8fff05fa7fe69a8612f29dd5f99b" -dependencies = [ - "base64", - "getrandom", - "hmac", - "pem", - "rand", - "ring", - "rsa", - "serde", - "serde_json", - "sha2", - "simple_asn1", -] - [[package]] name = "syn" version = "1.0.109" @@ -3372,23 +1459,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - -[[package]] -name = "term" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" -dependencies = [ - "dirs-next", - "rustversion", - "winapi", -] - [[package]] name = "termcolor" version = "1.1.3" @@ -3427,16 +1497,6 @@ dependencies = [ "syn 2.0.29", ] -[[package]] -name = "thread_local" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" -dependencies = [ - "cfg-if", - "once_cell", -] - [[package]] name = "time" version = "0.1.45" @@ -3477,15 +1537,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -3510,7 +1561,7 @@ dependencies = [ "backtrace", "bytes", "libc", - "mio 0.8.8", + "mio", "num_cpus", "parking_lot", "pin-project-lite", @@ -3531,18 +1582,6 @@ dependencies = [ "syn 2.0.29", ] -[[package]] -name = "tokio-udev" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246ffebae60acd93eb0056bac967cad807c7aa09916fabceac50479ad1f53e64" -dependencies = [ - "futures-core", - "mio 0.7.14", - "tokio", - "udev", -] - [[package]] name = "tokio-util" version = "0.7.8" @@ -3557,15 +1596,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - [[package]] name = "tracing" version = "0.1.37" @@ -3575,21 +1605,9 @@ dependencies = [ "cfg-if", "log", "pin-project-lite", - "tracing-attributes", "tracing-core", ] -[[package]] -name = "tracing-attributes" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.29", -] - [[package]] name = "tracing-core" version = "0.1.31" @@ -3599,17 +1617,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "trice" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61aa4cd1c1dca57255b92cb9e53d5b3ac5a22da6d8a63045337eb3da1a065d43" -dependencies = [ - "js-sys", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "typenum" version = "1.16.0" @@ -3622,28 +1629,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" -[[package]] -name = "udev" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c960764f7e816eed851a96c364745d37f9fe71a2e7dba79fbd40104530b5dd0" -dependencies = [ - "libc", - "libudev-sys", - "mio 0.8.8", - "pkg-config", -] - -[[package]] -name = "ulid" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13a3aaa69b04e5b66cc27309710a569ea23593612387d67daaf102e73aa974fd" -dependencies = [ - "rand", - "serde", -] - [[package]] name = "unicode-bidi" version = "0.3.13" @@ -3665,22 +1650,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-script" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d817255e1bed6dfd4ca47258685d14d2bdcfbc64fdc9e3819bd5848057b8ecc" - -[[package]] -name = "unicode-security" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef5756b3097992b934b06608c69f48448a0fbe804bb1e72b982f6d7983e9e63" -dependencies = [ - "unicode-normalization", - "unicode-script", -] - [[package]] name = "unicode-segmentation" version = "1.10.1" @@ -3693,18 +1662,6 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "url" version = "2.4.0" @@ -3716,30 +1673,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "urlencoding" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9" - -[[package]] -name = "uuid" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" -dependencies = [ - "atomic", - "getrandom", - "serde", - "wasm-bindgen", -] - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "vec_map" version = "0.8.2" @@ -3752,12 +1685,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "waker-fn" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" - [[package]] name = "wasi" version = "0.10.0+wasi-snapshot-preview1" @@ -3795,18 +1722,6 @@ dependencies = [ "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "wasm-bindgen-macro" version = "0.2.87" @@ -3836,29 +1751,6 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" -[[package]] -name = "wasmtimer" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f656cd8858a5164932d8a90f936700860976ec21eb00e0fe2aa8cab13f6b4cf" -dependencies = [ - "futures", - "js-sys", - "parking_lot", - "pin-utils", - "wasm-bindgen", -] - -[[package]] -name = "web-sys" -version = "0.3.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "winapi" version = "0.3.9" @@ -3965,40 +1857,6 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" -[[package]] -name = "ws_stream_wasm" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" -dependencies = [ - "async_io_stream", - "futures", - "js-sys", - "log", - "pharos", - "rustc_version", - "send_wrapper", - "thiserror", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - -[[package]] -name = "zeroize" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" - [[package]] name = "zstd" version = "0.12.4" diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 7f0a017..ede0a00 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -10,22 +10,20 @@ authors = ["Christopher-Robin Ebbinghaus "] [dependencies] actix-web = "4" actix-cors = "0.6.4" -# usdpl-back = { version = "0.9" } - -# logging log = "0.4" simplelog = "0.12" once_cell = "1.18.0" chrono = "0.4.24" -tokio-udev = "0.8.0" serde_json = "1.0" tokio = { version = "1.26.0", features = ["full"] } futures = "0.3.26" steam-acf = "0.1.0" keyvalues-serde = "0.1.0" -serde = { version = "1.0.0", features = ["derive", "rc"] } -surrealdb = { version = "^1.0.0-beta.10", default-features = false, features = ["kv-mem", "kv-rocksdb"] } async-trait = "0.1.68" +serde = { version = "1.0.145", features = ["derive", "rc"] } +petgraph = { version = "0.6.4", features = ["serde-1"] } +slotmap = { version = "1.0.6", features = ["serde"] } +anyhow = "1.0.75" # [features] # default = [] diff --git a/backend/src/api.rs b/backend/src/api.rs index a50178e..376d923 100644 --- a/backend/src/api.rs +++ b/backend/src/api.rs @@ -1,51 +1,59 @@ -use crate::{dbo::Name, err::Error, sdcard::{is_card_inserted, get_card_cid}}; +use std::{borrow::BorrowMut, sync::Arc}; + +use crate::{dbo::Name, err::Error, sdcard::{is_card_inserted, get_card_cid}, ds::Store}; use actix_web::{get, post, web, HttpResponse, HttpResponseBuilder, Responder, ResponseError, Result}; use serde::Deserialize; #[get("/ListGames")] -pub(crate) async fn list_games() -> Result { - Ok(web::Json(crate::db::list_games().await.ok())) +pub(crate) async fn list_games(datastore: web::Data>) -> Result { + Ok(web::Json(datastore.list_games())) } #[get("/ListCards")] -pub(crate) async fn list_cards() -> Result { - Ok(web::Json(crate::db::list_cards().await.ok())) +pub(crate) async fn list_cards(datastore: web::Data>) -> impl Responder { + web::Json(datastore.list_cards()) } #[get("/ListCardsWithGames")] -pub(crate) async fn list_cards_with_games() -> Result { - match crate::db::get_cards_with_games().await { - Ok(res) => Ok(web::Json(res)), - Err(err) => Err(Error::from(err).into()) - } +pub(crate) async fn list_cards_with_games(datastore: web::Data>) -> impl Responder { + web::Json(datastore.list_cards_with_games()) } #[get("/ListGamesOnCard/{card_id}")] pub(crate) async fn list_games_on_card( - card_id: web::Path + card_id: web::Path, + datastore: web::Data>, ) -> Result { - match crate::db::get_games_on_card(card_id.to_owned()).await { - Ok(res) => Ok(web::Json(res)), - Err(err) => Err(Error::from(err).into()) + + match datastore.get_games_on_card(&card_id) { + Ok(value) => Ok(web::Json(value)), + Err(err) => Err(actix_web::Error::from(err)) } } #[get("/GetCardForGame/{uid}")] pub(crate) async fn get_card_for_game( - uid: web::Path + uid: web::Path, + datastore: web::Data>, ) -> Result { - Ok(web::Json(crate::db::get_cards_for_game(uid.to_owned()).await.ok())) + match datastore.get_cards_for_game(&uid) { + Ok(value) => Ok(web::Json(value)), + Err(err) => Err(actix_web::Error::from(err)) + } } #[get("/GetGamesOnCurrentCard")] -pub(crate) async fn get_games_on_current_card() -> Result { +pub(crate) async fn get_games_on_current_card(datastore: web::Data>) -> Result { if !is_card_inserted() { return Err(Error::Error("No card is inserted".into()).into()); } let uid = get_card_cid().ok_or(Error::Error("Unable to evaluate Card Id".into()))?; - Ok(web::Json(crate::db::get_games_on_card(uid).await.ok())) + match datastore.get_games_on_card(&uid) { + Ok(value) => Ok(web::Json(value)), + Err(err) => Err(actix_web::Error::from(err)) + } } #[derive(Deserialize)] @@ -57,16 +65,10 @@ pub struct SetNameForCardBody { #[post("/SetNameForCard")] pub(crate) async fn set_name_for_card( body: web::Json, + datastore: web::Data>, ) -> Result { - match crate::db::update_sd_card_name( - body.id.to_owned(), - Name { - name: body.name.to_owned(), - }, - ) - .await - { - Err(_) => Ok(HttpResponse::InternalServerError()), - Ok(_) => Ok(HttpResponse::Ok()), + match datastore.update_card(&body.id, |card| card.name = body.name.clone()) { + Ok(value) => Ok(web::Json(value)), + Err(err) => Err(actix_web::Error::from(err)) } } diff --git a/backend/src/db.rs b/backend/src/db.rs index 7557f2c..57f73c2 100644 --- a/backend/src/db.rs +++ b/backend/src/db.rs @@ -1,140 +1,121 @@ -use std::{result::Result, sync::Arc}; -use actix_web::ResponseError; -use futures::SinkExt; -use log::info; -use serde::Deserialize; -use surrealdb::sql::{Id, Thing}; - -use crate::{dbo::*, err::Error}; - -type DynError = Box; -// #[derive(Debug)] -// struct DynError(Box); - -// impl std::fmt::Display for DynError { -// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { -// todo!() -// } +// use std::{result::Result, sync::Arc}; +// use actix_web::ResponseError; +// use futures::SinkExt; +// use log::info; +// use serde::Deserialize; +// use surrealdb::sql::{Id, Thing}; + +// use crate::{dbo::*, err::Error}; + +// type DynError = Box; + +// pub fn get_id(table: &str, id: &str) -> Thing { +// Thing::from((table.to_string(), Id::from(id))) // } -// impl ResponseError for DynError { -// fn status_code(&self) -> actix_web::http::StatusCode { -// actix_web::http::StatusCode::INTERNAL_SERVER_ERROR -// } +// pub async fn add_game(id: String, game: &Game) -> Result<(), DynError> { +// let _game: Option = crate::DB.create(("game", id.trim())).content(game).await?; +// Ok(()) +// } -// fn error_response(&self) -> actix_web::HttpResponse { -// let mut res = actix_web::HttpResponse::new(self.status_code()); -// res.set_body(actix_web::body::BoxBody::new(format!("{}",self))) -// } +// pub async fn add_sd_card(id: String, card: &MicroSDCard) -> Result<(), DynError> { +// let _card: Option = crate::DB.create(("card", id.trim())).content(card).await?; +// Ok(()) +// } + +// pub async fn update_sd_card_name(id: String, name: Name) -> Result<(), DynError> { +// let _: Option = crate::DB.update(("card", id.trim())).merge(name).await?; +// Ok(()) +// } + +// pub async fn get_game(id: String) -> Result, DynError> { +// Ok(crate::DB.select(("game", id.trim())).await?) +// } + +// pub async fn get_card(id: String) -> Result, DynError> { +// Ok(crate::DB.select(("card", id.trim())).await?) +// } + +// pub async fn list_games() -> Result, DynError> { +// Ok(crate::DB.select("game").await?) +// } + +// pub async fn list_cards() -> Result, DynError> { +// Ok(crate::DB.select("card").await?) +// } + +// pub async fn add_game_to_card(game_id: String, card_id: String) -> Result<(), DynError>{ +// // We delete the record first to make sure we are never adding a duplicate +// let _ = crate::DB +// .query("DELETE contains WHERE in=$card AND out=$game; RELATE $card->contains->$game;") +// .bind(("card", get_id("card", card_id.trim()))) +// .bind(("game", get_id("game", game_id.trim()))) +// .await?; + +// Ok(()) +// } + +// pub async fn remove_game_from_card(game_id: String, card_id: String) -> Result<(), DynError>{ +// let _ = crate::DB +// .query("DELETE contains WHERE in=$card AND out=$game;") +// .bind(("card", get_id("card", card_id.trim()))) +// .bind(("game", get_id("game", game_id.trim()))) +// .await?; + +// Ok(()) +// } + +// pub async fn remove_game(game_id: String) -> Result<(), DynError> { +// let _ = crate::DB +// .query("DELETE contains WHERE out=$game; DELETE $game;") +// .bind(("game", get_id("game", game_id.trim()))) +// .await?; + +// Ok(()) +// } + +// pub async fn remove_card(card_id: String) -> Result<(), DynError> { +// let _ = crate::DB +// .query("DELETE contains WHERE in=$card; DELETE $card;") +// .bind(("card", get_id("card", card_id.trim()))) +// .await?; + +// Ok(()) +// } + +// pub async fn get_games_on_card(card_id: String) -> Result, DynError> { +// let result: Vec>> = crate::DB +// .query("SELECT ->contains->game.* as games FROM $card") +// .bind(("card", get_id("card", card_id.trim()))) +// .await? +// .take("games")?; + +// Ok(result.iter().flat_map(|f| f.iter().filter_map(|v| v.to_owned())).collect()) // } -pub fn get_id(table: &str, id: &str) -> Thing { - Thing::from((table.to_string(), Id::from(id))) -} - -pub async fn add_game(id: String, game: &Game) -> Result<(), DynError> { - let _game: Option = crate::DB.create(("game", id.trim())).content(game).await?; - Ok(()) -} - -pub async fn add_sd_card(id: String, card: &MicroSDCard) -> Result<(), DynError> { - let _card: Option = crate::DB.create(("card", id.trim())).content(card).await?; - Ok(()) -} - -pub async fn update_sd_card_name(id: String, name: Name) -> Result<(), DynError> { - let _: Option = crate::DB.update(("card", id.trim())).merge(name).await?; - Ok(()) -} - -pub async fn get_game(id: String) -> Result, DynError> { - Ok(crate::DB.select(("game", id.trim())).await?) -} - -pub async fn get_card(id: String) -> Result, DynError> { - Ok(crate::DB.select(("card", id.trim())).await?) -} - -pub async fn list_games() -> Result, DynError> { - Ok(crate::DB.select("game").await?) -} - -pub async fn list_cards() -> Result, DynError> { - Ok(crate::DB.select("card").await?) -} - -pub async fn add_game_to_card(game_id: String, card_id: String) -> Result<(), DynError>{ - // We delete the record first to make sure we are never adding a duplicate - let _ = crate::DB - .query("DELETE contains WHERE in=$card AND out=$game; RELATE $card->contains->$game;") - .bind(("card", get_id("card", card_id.trim()))) - .bind(("game", get_id("game", game_id.trim()))) - .await?; - - Ok(()) -} - -pub async fn remove_game_from_card(game_id: String, card_id: String) -> Result<(), DynError>{ - let _ = crate::DB - .query("DELETE contains WHERE in=$card AND out=$game;") - .bind(("card", get_id("card", card_id.trim()))) - .bind(("game", get_id("game", game_id.trim()))) - .await?; - - Ok(()) -} - -pub async fn remove_game(game_id: String) -> Result<(), DynError> { - let _ = crate::DB - .query("DELETE contains WHERE out=$game; DELETE $game;") - .bind(("game", get_id("game", game_id.trim()))) - .await?; - - Ok(()) -} - -pub async fn remove_card(card_id: String) -> Result<(), DynError> { - let _ = crate::DB - .query("DELETE contains WHERE in=$card; DELETE $card;") - .bind(("card", get_id("card", card_id.trim()))) - .await?; - - Ok(()) -} - -pub async fn get_games_on_card(card_id: String) -> Result, DynError> { - let result: Vec>> = crate::DB - .query("SELECT ->contains->game.* as games FROM $card") - .bind(("card", get_id("card", card_id.trim()))) - .await? - .take("games")?; - - Ok(result.iter().flat_map(|f| f.iter().filter_map(|v| v.to_owned())).collect()) -} - -pub async fn get_cards_for_game(game_id: String) -> Result, DynError> { - let result: Vec>> = crate::DB - .query("SELECT <-contains<-card.* as cards FROM $game;") - .bind(("game", get_id("game", game_id.trim()))) - .await? - .take("cards")?; - - Ok(result.iter().flat_map(|f| f.iter().filter_map(|v| v.to_owned())).collect()) -} - -pub async fn get_cards_with_games() -> Result)>, DynError> { +// pub async fn get_cards_for_game(game_id: String) -> Result, DynError> { +// let result: Vec>> = crate::DB +// .query("SELECT <-contains<-card.* as cards FROM $game;") +// .bind(("game", get_id("game", game_id.trim()))) +// .await? +// .take("cards")?; + +// Ok(result.iter().flat_map(|f| f.iter().filter_map(|v| v.to_owned())).collect()) +// } + +// pub async fn get_cards_with_games() -> Result)>, DynError> { - let mut response = crate::DB - .query("select ->contains->game.* as games, (SELECT * FROM $parent.id)[0] as card FROM card;") - .await?; +// let mut response = crate::DB +// .query("select ->contains->game.* as games, (SELECT * FROM $parent.id)[0] as card FROM card;") +// .await?; - let card: Vec = response.take((0, "card"))?; - let games: Vec> = response.take((0, "games"))?; +// let card: Vec = response.take((0, "card"))?; +// let games: Vec> = response.take((0, "games"))?; - if games.len() != card.len() { - println!("Response: {:#?}", response); - return Err(Error::new_boxed(format!("Games and Cards did not match in count. Games: {}, Cards: {}", games.len(), card.len()).as_str())); - } +// if games.len() != card.len() { +// println!("Response: {:#?}", response); +// return Err(Error::new_boxed(format!("Games and Cards did not match in count. Games: {}, Cards: {}", games.len(), card.len()).as_str())); +// } - Ok(card.iter().map(|f| f.to_owned()).zip(games.iter().map(|f| f.to_owned())).collect()) -} +// Ok(card.iter().map(|f| f.to_owned()).zip(games.iter().map(|f| f.to_owned())).collect()) +// } \ No newline at end of file diff --git a/backend/src/dbo.rs b/backend/src/dbo.rs index 33e854c..66952a0 100644 --- a/backend/src/dbo.rs +++ b/backend/src/dbo.rs @@ -1,7 +1,6 @@ use std::sync::Arc; use serde::{Deserialize, Serialize}; -use surrealdb::sql::Thing; #[derive(Serialize, Deserialize,Debug,Clone)] diff --git a/backend/src/ds.rs b/backend/src/ds.rs new file mode 100644 index 0000000..c69fb77 --- /dev/null +++ b/backend/src/ds.rs @@ -0,0 +1,384 @@ +use slotmap::{DefaultKey, SlotMap}; +use std::{ + collections::{HashMap, HashSet}, + fs::{read_to_string, write}, + hash::*, + path::PathBuf, + sync::Mutex, +}; +// use petgraph::*; +// use petgraph::prelude::GraphMap; +use serde::{Deserialize, Serialize}; + +use crate::{ + dbo::{Game, MicroSDCard}, + err::Error, +}; + +#[derive(Serialize, Deserialize, Clone)] +enum StoreElement { + Game(Game), + Card(MicroSDCard), +} + +impl StoreElement { + fn is_game(self) -> bool { + match self { + Self::Game(_) => true, + _ => false, + } + } + + fn as_game(self) -> Option { + match self { + Self::Game(game) => Some(game.clone()), + _ => None, + } + } + + fn is_card(self) -> bool { + match self { + Self::Card(_) => true, + _ => false, + } + } + + fn as_card(self) -> Option { + match self { + Self::Card(card) => Some(card.clone()), + _ => None, + } + } +} + +// #[derive(Serialize, Deserialize)] +// struct Store { +// graph: GraphMap, +// elements: HashMap +// } + +// impl Store { +// pub fn new() -> Self { +// Store { +// graph: GraphMap::new(), +// elements: HashMap::new() +// } +// } + +// pub fn from_file(file: &PathBuf) -> Result{ +// let contents = read_to_string(file).map_err(|e| Error::from(e))?; +// serde_json::from_str(&contents).map_err(|e| Error::from(e)) +// } +// } + +// fn calculate_hash(t: &T) -> u64 { +// let mut s = std::collections::hash_map::DefaultHasher::new(); +// t.hash(&mut s); +// s.finish() +// } + +#[derive(Serialize, Deserialize)] +struct Node { + element: StoreElement, + links: HashSet, +} + +impl Node { + pub fn from_card(card: MicroSDCard) -> Self { + Node { + element: StoreElement::Card(card), + links: HashSet::new(), + } + } + pub fn from_game(game: Game) -> Self { + Node { + element: StoreElement::Game(game), + links: HashSet::new(), + } + } +} + +#[derive(Serialize, Deserialize)] +pub struct StoreData { + nodes: SlotMap, + node_ids: HashMap, +} + + +impl StoreData { + pub fn add_card(&mut self, id: String, card: MicroSDCard) { + self.node_ids + .entry(id) + .or_insert(self.nodes.insert(Node::from_card(card))); + } + + pub fn add_game(&mut self, id: String, card: Game) { + let entry = self.node_ids.entry(id); + + entry.or_insert(self.nodes.insert(Node::from_game(card))); + } + + pub fn update_card(&mut self, card_id: &String, mut func: F) -> Result<(), Error> + where + F: FnMut(&mut MicroSDCard), + { + + + let node = self + .node_ids + .get(card_id) + .ok_or(Error::Error("Card Id not present".into()))?; + + match self.nodes.get_mut(*node).unwrap().element { + StoreElement::Card(ref mut card) => { + func(card); + } + StoreElement::Game(_) => return Err(Error::Error("Expected Card, got Game".into())), + } + + Ok(()) + } + + pub fn add_game_to_card(&mut self, game_id: &String, card_id: &String) -> Result<(), Error> { + let (game_key, card_key) = match (self.node_ids.get(game_id), self.node_ids.get(card_id)) { + (Some(game_key), Some(card_key)) => (game_key, card_key), + _ => return Error::new("Either Game or Card could not be found"), + }; + + self.nodes[*game_key].links.insert(*card_key); + self.nodes[*card_key].links.insert(*game_key); + + Ok(()) + } + + pub fn remove_game(&mut self, game_id: &String) -> Result<(), Error> { + let game_key = match self.node_ids.get(game_id) { + None => return Err(Error::Error("Game Id not present".into())), + Some(key) => key, + }; + + // remove all links pointing to this game. + for key in self.nodes[*game_key].links.clone() { + self.nodes[key].links.remove(&key); + } + + self.nodes.remove(*game_key); + + self.node_ids.remove(game_id); + + Ok(()) + } + + pub fn remove_card(&mut self, card_id: &String) -> Result<(), Error> { + let card_key = match self.node_ids.get(card_id) { + None => return Err(Error::Error("Card Id not present".into())), + Some(key) => key, + }; + + // for key in &self.nodes[*card_key].links { + // self.nodes[*key].links.remove(key); + // } + + self.nodes[*card_key].links.clone().iter().for_each(|key| { self.nodes[*key].links.remove(&key); }); + + self.nodes.remove(*card_key); + + self.node_ids.remove(card_id); + + Ok(()) + } + + pub fn remove_game_from_card( + &mut self, + game_id: &String, + card_id: &String, + ) -> Result<(), Error> { + + let (game_key, card_key) = match (self.node_ids.get(game_id), self.node_ids.get(card_id)) { + (Some(game_key), Some(card_key)) => (game_key, card_key), + _ => return Error::new("Either Game or Card could not be found"), + }; + + self.nodes[*game_key].links.remove(card_key); + self.nodes[*card_key].links.remove(game_key); + + Ok(()) + } + + pub fn get_card(&self, card_id: &String) -> Result { + self.node_ids + .get(card_id) + .map_or(Error::new("Card Id not present"), |key| { + Ok(self.nodes[*key] + .element + .clone() + .as_card() + .expect("Expected card but game was returned")) + }) + } + + pub fn get_game(&self, game_id: &String) -> Result { + self.node_ids + .get(game_id) + .map_or(Error::new("Game Id not present"), |key| { + Ok(self.nodes[*key] + .element + .clone() + .as_game() + .expect("Expected game but card was returned")) + }) + } + + pub fn get_games_on_card(&self, card_id: &String) -> Result, Error> { + match self.node_ids.get(card_id) { + None => Error::new("Card Id not present"), + Some(card_key) => Ok(self.nodes[*card_key] + .links + .iter() + .filter_map(|game_key| self.nodes[*game_key].element.clone().as_game()) + .collect()), + } + } + + pub fn get_cards_for_game(&self, game_id: &String) -> Result, Error> { + match self.node_ids.get(game_id) { + None => Error::new("Game Id not present"), + Some(game_key) => Ok(self.nodes[*game_key] + .links + .iter() + .filter_map(|game_key| { + self.nodes + .get(*game_key) + .expect("element to exist") + .element + .clone() + .as_card() + }) + .collect()), + } + } + + pub fn list_cards(&self) -> Vec { + self.nodes + .iter() + .filter_map(|node| node.1.element.clone().as_card()) + .collect() + } + + pub fn list_games(&self) -> Vec { + self.nodes + .iter() + .filter_map(|node| node.1.element.clone().as_game()) + .collect() + } + + pub fn list_cards_with_games(&self) -> Vec<(MicroSDCard, Vec)> { + self.nodes + .iter() + .filter_map(|node| { + node.1.element.clone().as_card().map(|v| { + (v, { + node.1 + .links + .iter() + .filter_map(|key: &DefaultKey| self.nodes[*key].element.clone().as_game()) + .collect() + }) + }) + }) + .collect() + } +} + + +// #[derive(Serialize, Deserialize)] +pub struct Store { + data: Mutex, +} + +impl Store { + pub fn new() -> Self { + Store { + data: Mutex::new(StoreData { + nodes: SlotMap::new(), + node_ids: HashMap::new(), + }), + } + } + + pub fn read_from_file(file: &PathBuf) -> Result { + let contents = read_to_string(file).map_err(|e| Error::from(e))?; + let data: StoreData = serde_json::from_str(&contents).map_err(|e| Error::from(e))?; + Ok(Store { + data: Mutex::new(data) + }) + } + + pub fn write_to_file(&self, file: &PathBuf) -> Result<(), Error> { + write(file, serde_json::to_string(&self.data)?)?; + Ok(()) + } + + pub fn add_card(&self, id: String, card: MicroSDCard) { + self.data.lock().unwrap().add_card(id, card) + } + + pub fn add_game(&self, id: String, card: Game) { + self.data.lock().unwrap().add_game(id, card) + } + + pub fn update_card(&self, card_id: &String, func: F) -> Result<(), Error> + where + F: FnMut(&mut MicroSDCard), + { + self.data.lock().unwrap().update_card(card_id, func) + } + + pub fn add_game_to_card(&self, game_id: &String, card_id: &String) -> Result<(), Error> { + self.data.lock().unwrap().add_game_to_card(game_id, card_id) + } + + pub fn remove_game(&self, game_id: &String) -> Result<(), Error> { + self.data.lock().unwrap().remove_game(game_id) + } + + pub fn remove_card(&self, card_id: &String) -> Result<(), Error> { + self.data.lock().unwrap().remove_card(card_id) + } + + pub fn remove_game_from_card( + &self, + game_id: &String, + card_id: &String, + ) -> Result<(), Error> { + self.data.lock().unwrap().remove_game_from_card(game_id, card_id) + } + + pub fn get_card(&self, card_id: &String) -> Result { + self.data.lock().unwrap().get_card(card_id) + } + + pub fn get_game(&self, game_id: &String) -> Result { + self.data.lock().unwrap().get_game(game_id) + } + + pub fn get_games_on_card(&self, card_id: &String) -> Result, Error> { + self.data.lock().unwrap().get_games_on_card(card_id) + } + + pub fn get_cards_for_game(&self, game_id: &String) -> Result, Error> { + self.data.lock().unwrap().get_cards_for_game(game_id) + } + + pub fn list_cards(&self) -> Vec { + self.data.lock().unwrap().list_cards() + } + + pub fn list_games(&self) -> Vec { + self.data.lock().unwrap().list_games() + } + + pub fn list_cards_with_games(&self) -> Vec<(MicroSDCard, Vec)> { + self.data.lock().unwrap().list_cards_with_games() + } +} \ No newline at end of file diff --git a/backend/src/err.rs b/backend/src/err.rs index b6df29c..4aba82a 100644 --- a/backend/src/err.rs +++ b/backend/src/err.rs @@ -22,6 +22,14 @@ impl Error { pub fn new_boxed(value: &str) -> Box { Box::new(Error::Error(value.to_string())) } + + pub fn from_str(value: &str) -> Self { + Error::Error(value.to_string()) + } + + pub fn new(value: &str) -> Result { + Err(Error::Error(value.to_string())) + } } impl fmt::Display for Error { @@ -34,23 +42,29 @@ impl fmt::Display for Error { } } -impl error::Error for Error { - fn description(&self) -> &str { - // Both underlying errors already impl `Error`, so we defer to their - // implementations. - match *self { - Error::Error(ref err) => err, - } - } +// impl error::Error for Error { +// fn description(&self) -> &str { +// // Both underlying errors already impl `Error`, so we defer to their +// // implementations. +// match *self { +// Error::Error(ref err) => err, +// } +// } - fn cause(&self) -> Option<&dyn error::Error> { - return Some(self); - } -} +// fn cause(&self) -> Option<&dyn error::Error> { +// return Some(self); +// } +// } -impl From> for Error { - fn from(value: Box) -> Self { - Error::Error(value.to_string()) +// impl From> for Error { +// fn from(value: Box) -> Self { +// Error::Error(value.to_string()) +// } +// } + +impl From for Error { + fn from(e: T) -> Self { + Error::Error(e.to_string()) } } diff --git a/backend/src/main.rs b/backend/src/main.rs index 430f424..d1ed62e 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -4,47 +4,51 @@ mod api; mod db; mod dbo; +mod ds; mod env; mod err; mod log; mod sdcard; mod steam; -use crate::db::{add_game_to_card, get_cards_with_games, get_games_on_card, remove_game_from_card}; +// use crate::db::{add_game_to_card, get_cards_with_games, get_games_on_card, remove_game_from_card}; +use crate::ds::Store; use crate::log::Logger; use crate::sdcard::is_card_inserted; -use actix_cors::Cors; -use actix_web::{HttpServer, App, web}; -use env::{get_file_path_and_create_directory, get_data_dir}; -use futures::{select, FutureExt, pin_mut}; use ::log::{info, trace, warn}; +use actix_cors::Cors; +use actix_web::{web, App, HttpServer}; +use env::{get_data_dir, get_file_path_and_create_directory}; +use err::Error; use futures::executor::block_on; -use futures::{join, future}; +use futures::{future, join}; +use futures::{pin_mut, select, FutureExt}; use futures::{Future, StreamExt}; use once_cell::sync::Lazy; use sdcard::get_card_cid; -use tokio::time::{Sleep, sleep}; -use std::borrow::Borrow; +use std::borrow::{Borrow, BorrowMut}; +use std::env::VarError; use std::fs::{read, OpenOptions}; use std::ops::Deref; -use std::path::Path; +use std::path::{Path, PathBuf}; +use std::sync::{Arc, Mutex}; use std::vec; use std::{fs, time::Duration}; use steam::*; -use surrealdb::engine::local::{Db, File, Mem}; -use surrealdb::Surreal; -use tokio_udev::*; - -// Creates a new static instance of the client -static DB: Lazy> = Lazy::new(Surreal::init); - -use simplelog::{LevelFilter, WriteLogger}; - -// use usdpl_back::{core::serdes::Primitive, Instance}; - +use tokio::time::{sleep, Sleep}; +// use surrealdb::engine::local::{Db, File, Mem}; +// use surrealdb::Surreal; +// use tokio_udev::*; use crate::dbo::{Game, MicroSDCard}; +use simplelog::{LevelFilter, WriteLogger}; +// Creates a new static instance of the client +// static DB: Lazy> = Lazy::new(Surreal::init); static LOGGER: Lazy = Lazy::new(|| Logger::new().expect("Logger to be created")); +// static STORE_PATH: Lazy = +// Lazy::new(|| PathBuf::from(&std::env::var("STORE_PATH").unwrap_or(get_data_dir()))); +// static STORE: Lazy> = +// Lazy::new(|| Arc::new(&mut Store::read_from_file(&STORE_PATH).unwrap_or(Store::new()))); const PORT: u16 = 12412; // TODO replace with something unique @@ -56,10 +60,10 @@ pub fn init() -> Result<(), ::log::SetLoggerError> { ::log::set_logger(&*LOGGER).map(|()| ::log::set_max_level(LevelFilter::Trace)) } -type MainResult = Result<(), Box>; +type MainResult = Result<(), Error>; // #[actix_web::main] -async fn run_server() -> MainResult { +async fn run_server(datastore: Arc) -> MainResult { // let log_filepath = format!("/tmp/{}.log", PACKAGE_NAME); // WriteLogger::init( // #[cfg(debug_assertions)] @@ -77,7 +81,7 @@ async fn run_server() -> MainResult { info!("Starting HTTP server..."); - HttpServer::new(|| { + HttpServer::new(move || { let cors = Cors::default() .allow_any_header() .allow_any_method() @@ -86,6 +90,8 @@ async fn run_server() -> MainResult { App::new() .wrap(cors) + // .app_data(web::Data::new(api::AppState{datastore: datastore.clone()})) + .app_data(web::Data::new(datastore.clone())) .service(crate::api::list_cards) .service(crate::api::list_games) .service(crate::api::list_games_on_card) @@ -99,167 +105,136 @@ async fn run_server() -> MainResult { .map_err(|err| err.into()) } -async fn read_msd_directory() -> MainResult { +fn read_msd_directory(datastore: &Store) -> MainResult { let cid = match get_card_cid() { None => { warn!("Unable to retrieve CID from MicroSD card"); - return Ok(()); + return Error::new("Unable"); } Some(v) => v, }; - if let Ok(res) = fs::read_to_string("/run/media/mmcblk0p1/libraryfolder.vdf") { - trace!("Steam MicroSD card detected."); + let res = match fs::read_to_string("/run/media/mmcblk0p1/libraryfolder.vdf") { + Ok(value) => value, + Err(_) => return Error::new("Unable to parse library"), + }; - let library: LibraryFolder = keyvalues_serde::from_str(res.as_str())?; + trace!("Steam MicroSD card detected."); - trace!("contentid: {}", library.contentid); + let library: LibraryFolder = keyvalues_serde::from_str(res.as_str())?; - let files: Vec<_> = fs::read_dir("/run/media/mmcblk0p1/steamapps/")? - .into_iter() - .filter_map(Result::ok) - .filter(|f| f.path().extension().unwrap_or_default().eq("acf")) - .collect(); + trace!("contentid: {}", library.contentid); - trace!("Found {} Files", files.len()); + let files: Vec<_> = fs::read_dir("/run/media/mmcblk0p1/steamapps/")? + .into_iter() + .filter_map(Result::ok) + .filter(|f| f.path().extension().unwrap_or_default().eq("acf")) + .collect(); - let games: Vec = files - .iter() - .filter_map(|f| fs::read_to_string(f.path()).ok()) - .filter_map(|s| keyvalues_serde::from_str(s.as_str()).ok()) - .collect(); + trace!("Found {} Files", files.len()); - trace!("Retrieved {} Games", games.len()); + let games: Vec = files + .iter() + .filter_map(|f| fs::read_to_string(f.path()).ok()) + .filter_map(|s| keyvalues_serde::from_str(s.as_str()).ok()) + .collect(); - for game in games.iter() { - trace!("Found App \"{}\"", game.name); - } + trace!("Retrieved {} Games", games.len()); - match db::get_card(cid.clone()).await { - Ok(None) => { - db::add_sd_card( - cid.clone(), - &MicroSDCard { - uid: cid.clone(), - libid: library.contentid.clone(), - name: library.label, - }, - ) - .await?; - info!("Wrote MicroSD card {} to Database", library.contentid); - } - Ok(Some(_)) => trace!("MicroSD card {} already in Database", library.contentid), - Err(err) => warn!( - "Unable to write card {} to Database:\n{}", - library.contentid, err - ), - } + for game in games.iter() { + trace!("Found App \"{}\"", game.name); + } - // Remove any games that are linked to the card in the database but on the card - futures::future::try_join_all( - get_games_on_card(cid.clone()).await? - .iter() - .filter(|v| !games.iter().any(|g| g.appid == v.uid)) - .map(|v| remove_game_from_card(v.uid.clone(), cid.clone())), - ) - .await?; - - for game in games.iter() { - match db::get_game(game.appid.clone()).await { - Ok(None) => { - db::add_game( - game.appid.clone(), - &Game { - uid: game.appid.clone(), - name: game.name.clone(), - size: game.size_on_disk, - }, - ) - .await?; - info!( - "Wrote Game {} with id {} to Database", - game.name, game.appid - ); - } - Ok(Some(_)) => trace!( - "Game {} with id {} already in Database", - game.name, game.appid - ), - Err(err) => warn!( - "Unable to write Game {} with id {} to Database:\n{}", - game.name, game.appid, err - ), - } - - add_game_to_card(game.appid.clone(), cid.clone()) - .await - .unwrap_or_else(|err| panic!("Query to work {:#?}", err)); - } + datastore.add_card( + cid.clone(), + MicroSDCard { + uid: cid.clone(), + libid: library.contentid.clone(), + name: library.label, + }, + ); + + // Remove any games that are linked to the card in the database but on the card + + datastore.get_games_on_card(&cid).expect("games to be retrieved") + .iter() + .filter(|v| !games.iter().any(|g| g.appid == v.uid)) + .for_each(|v| datastore.remove_game_from_card(&v.uid, &cid).expect("game and card to be unlinked")); + + for game in games.iter() { + datastore.add_game( + game.appid.clone(), + Game { + uid: game.appid.clone(), + name: game.name.clone(), + size: game.size_on_disk, + }, + ); + + datastore.add_game_to_card(&game.appid, &cid).expect("game to be added") } Ok(()) } -async fn run_monitor() -> MainResult { - let monitor = MonitorBuilder::new()?.match_subsystem("mmc")?; +// async fn run_monitor() -> MainResult { +// let monitor = MonitorBuilder::new()?.match_subsystem("mmc")?; - let mut socket = AsyncMonitorSocket::new(monitor.listen()?)?; +// let mut socket = AsyncMonitorSocket::new(monitor.listen()?)?; - info!("Now listening for Device Events..."); - while let Some(Ok(event)) = socket.next().await { - if event.event_type() != EventType::Bind { - continue; - } +// info!("Now listening for Device Events..."); +// while let Some(Ok(event)) = socket.next().await { +// if event.event_type() != EventType::Bind { +// continue; +// } - info!( - "Device {} was Bound", - event.devpath().to_str().unwrap_or("UNKNOWN") - ); +// info!( +// "Device {} was Bound", +// event.devpath().to_str().unwrap_or("UNKNOWN") +// ); - read_msd_directory().await?; - } - Ok(()) -} +// read_msd_directory().await?; +// } +// Ok(()) +// } -async fn start_watch() -> MainResult { +async fn start_watch(datastore: Arc) -> MainResult { loop { sleep(Duration::from_secs(5)).await; if is_card_inserted() { - read_msd_directory().await?; + read_msd_directory(datastore.borrow())?; } - - } } -async fn setup_db() { - // let ds = Datastore::new("/var/etc/Database.file").await?; - // match DB.connect::(()).await { - - // let file = match std::env::var("DECKY_PLUGIN_RUNTIME_DIR") { - // Err(_) => { - // if cfg!(debug_assertions) { - // Path::new("/tmp").join("MicroSDeck").join("data.db") - // } else { - // panic!("Unable to proceed"); - // } - // } - // Ok(loc) => Path::new(loc.as_str()).join("data.db"), - // }; - - let file = get_file_path_and_create_directory("data.db", &get_data_dir).expect("Data Directory to exist"); - - match DB.connect::(file.as_str()).await { - Err(_) => panic!("Unable to construct Database"), - Ok(_) => { - DB.use_ns("") - .use_db("") - .await - .expect("Namespace and Database to be avaliable"); - } - } -} +// async fn setup_db() { +// // let ds = Datastore::new("/var/etc/Database.file").await?; +// // match DB.connect::(()).await { + +// // let file = match std::env::var("DECKY_PLUGIN_RUNTIME_DIR") { +// // Err(_) => { +// // if cfg!(debug_assertions) { +// // Path::new("/tmp").join("MicroSDeck").join("data.db") +// // } else { +// // panic!("Unable to proceed"); +// // } +// // } +// // Ok(loc) => Path::new(loc.as_str()).join("data.db"), +// // }; + +// let file = get_file_path_and_create_directory("data.db", &get_data_dir).expect("Data Directory to exist"); + +// match DB.connect::(file.as_str()).await { +// Err(_) => panic!("Unable to construct Database"), +// Ok(_) => { +// DB.use_ns("") +// .use_db("") +// .await +// .expect("Namespace and Database to be avaliable"); +// } +// } +// } #[tokio::main] async fn main() { @@ -267,6 +242,9 @@ async fn main() { std::env::set_var("RUST_BACKTRACE", "1"); } + let store_path = PathBuf::from(&std::env::var("STORE_PATH").unwrap_or(get_data_dir())); + let store = Arc::new(Store::read_from_file(&store_path).unwrap_or(Store::new())); + match init() { Err(err) => { eprintln!("Unable to Initialize:\n{}", err); @@ -282,7 +260,7 @@ async fn main() { info!("Starting Program..."); - setup_db().await; + // setup_db().await; // if is_card_inserted() { // // Try reading the directory when we launch the app. That way we ensure that if a car is currently inserted we still detect it @@ -291,19 +269,23 @@ async fn main() { info!("Database Started..."); - let server_future = run_server().fuse(); + let server_future = run_server(store.clone()).fuse(); - let monitor_future = run_monitor().fuse(); + // let monitor_future = run_monitor().fuse(); - let watch_future = start_watch().fuse(); + let watch_future = start_watch(store.clone()).fuse(); - pin_mut!(server_future, monitor_future, watch_future); + pin_mut!(server_future, watch_future); // monitor_future + // result = monitor_future => result.expect("Monitor Exited..."), select! { result = server_future => result.expect("Server Exited..."), - result = monitor_future => result.expect("Monitor Exited..."), result = watch_future => result.expect("Watch Exited..."), }; + info!("Saving Database"); + store.write_to_file(&store_path) + .expect("Saving Datatbase to succeed"); + info!("Exiting..."); } diff --git a/backend/src/sdcard.rs b/backend/src/sdcard.rs index a555320..243ff27 100644 --- a/backend/src/sdcard.rs +++ b/backend/src/sdcard.rs @@ -1,11 +1,10 @@ use std::{path::Path, fs::read_to_string}; -// Based on https://www.cameramemoryspeed.com/sd-memory-card-faq/reading-sd-card-cid-serial-psn-internal-numbers/ - pub fn is_card_inserted() -> bool { std::fs::metadata("/sys/block/mmcblk0").is_ok() } +// Based on https://www.cameramemoryspeed.com/sd-memory-card-faq/reading-sd-card-cid-serial-psn-internal-numbers/ pub fn get_card_cid() -> Option { read_to_string("/sys/block/mmcblk0/device/cid").ok() }