From d5f5ada692c6470dfe1e326fc95ce198f91b39d2 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Tue, 17 Nov 2026 14:03:53 -0800 Subject: [PATCH] integrate renovate PRs --- .github/workflows/check-repo.yml | 4 - .github/workflows/check-workspace.yml | 1 + .github/workflows/ci-main.yml | 6 +- .github/workflows/deploy-api-docs.yml | 1 + Cargo.lock | 488 +++++++++--------- Cargo.toml | 4 +- .../getting-started/inverter/assets/index.md | 4 - .../docs/getting-started/quickstart.md | 4 +- docs/docusaurus/package.json | 2 +- docs/docusaurus/yarn.lock | 14 +- libs/atoll/Cargo.toml | 2 +- libs/cache/Cargo.toml | 12 +- libs/cache/build.rs | 67 ++- libs/cache/proto/google/protobuf/empty.proto | 52 -- libs/cache/proto/local.proto | 54 -- libs/cache/proto/remote.proto | 39 -- libs/cache/src/persistent/client.rs | 34 +- libs/cache/src/persistent/server.rs | 52 +- libs/cache/src/rpc/mod.rs | 202 +++++++- renovate.json | 3 +- 20 files changed, 553 insertions(+), 492 deletions(-) delete mode 100644 libs/cache/proto/google/protobuf/empty.proto delete mode 100644 libs/cache/proto/local.proto delete mode 100644 libs/cache/proto/remote.proto diff --git a/.github/workflows/check-repo.yml b/.github/workflows/check-repo.yml index 5575f83d4..f13fbe615 100644 --- a/.github/workflows/check-repo.yml +++ b/.github/workflows/check-repo.yml @@ -28,10 +28,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - name: Install Protoc - uses: arduino/setup-protoc@v2 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - uses: taiki-e/install-action@cargo-hack - uses: Swatinem/rust-cache@v2 with: diff --git a/.github/workflows/check-workspace.yml b/.github/workflows/check-workspace.yml index 7bdd36e97..21840094c 100644 --- a/.github/workflows/check-workspace.yml +++ b/.github/workflows/check-workspace.yml @@ -19,6 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 + # examples/release builds cache 0.7.2 or earlier, which needs protoc. - name: Install Protoc uses: arduino/setup-protoc@v2 with: diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml index ae748e0fe..fcc54fe06 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/ci-main.yml @@ -29,7 +29,7 @@ jobs: ref: dev - uses: actions/setup-node@v6 with: - node-version: latest + node-version: 26 cache: 'npm' cache-dependency-path: release-please/package-lock.json - name: Install `release-please` @@ -56,10 +56,6 @@ jobs: - uses: actions/checkout@v6 with: path: substrate - - name: Install Protoc - uses: arduino/setup-protoc@v2 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Clone `cargo-workspaces` uses: actions/checkout@v6 with: diff --git a/.github/workflows/deploy-api-docs.yml b/.github/workflows/deploy-api-docs.yml index 49eba8e09..db6744b2e 100644 --- a/.github/workflows/deploy-api-docs.yml +++ b/.github/workflows/deploy-api-docs.yml @@ -19,6 +19,7 @@ jobs: runs-on: ubuntu-latest environment: main steps: + # The `release` tag builds cache 0.7.2 or earlier, which needs protoc. - name: Install Protoc uses: arduino/setup-protoc@v2 with: diff --git a/Cargo.lock b/Cargo.lock index 02b257be5..abfb16ee6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -44,7 +44,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" dependencies = [ "anstyle", - "anstyle-parse", + "anstyle-parse 0.2.7", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse 1.0.0", "anstyle-query", "anstyle-wincon", "colorchoice", @@ -54,9 +69,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" [[package]] name = "anstyle-parse" @@ -67,13 +82,22 @@ dependencies = [ "utf8parse", ] +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + [[package]] name = "anstyle-query" version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -84,14 +108,14 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] name = "anyhow" -version = "1.0.101" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e0fee31ef5ed1ba1316088939cea399010ed7731dba877ed44aeb407a75ea" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" [[package]] name = "aph_disjoint_set" @@ -152,7 +176,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -169,7 +193,7 @@ dependencies = [ "itertools", "layir", "num", - "rand 0.9.2", + "rand 0.10.4", "rustc-hash", "serde", "slotmap", @@ -302,7 +326,7 @@ dependencies = [ "proc-macro-crate 3.4.0", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -367,6 +391,7 @@ version = "0.7.2" dependencies = [ "anyhow", "backoff", + "bytes", "clap", "crossbeam-channel", "flexbuffers", @@ -377,7 +402,7 @@ dependencies = [ "lazy_static", "once_cell", "path-absolutize", - "prost", + "postcard", "regex", "rusqlite", "serde", @@ -390,8 +415,7 @@ dependencies = [ "tokio-util", "toml", "tonic", - "tonic-prost", - "tonic-prost-build", + "tonic-build", "tracing", "tracing-subscriber", ] @@ -429,11 +453,22 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "rand_core 0.10.1", +] + [[package]] name = "chrono" -version = "0.4.43" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" dependencies = [ "iana-time-zone", "js-sys", @@ -467,9 +502,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.57" +version = "4.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6899ea499e3fb9305a65d5ebf6e3d2248c5fab291f300ad0a704fbe142eae31a" +checksum = "ac230478587d0269d8d6998b82ae69ea51509d55df66d9e92edd1f986904cd4a" dependencies = [ "clap_builder", "clap_derive", @@ -477,11 +512,11 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.57" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b12c8b680195a62a8364d16b8447b01b6c2c8f9aaf68bee653be34d4245e238" +checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d" dependencies = [ - "anstream", + "anstream 1.0.0", "anstyle", "clap_lex", "strsim", @@ -489,21 +524,30 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.55" +version = "4.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" +checksum = "895c9d8d2ac2dd8b8a29f3724a14e72aaaa6debcf8c38c82f97305c6a172767a" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.114", + "syn 3.0.10", ] [[package]] name = "clap_lex" -version = "0.7.7" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0921b3876b3a1df8a1c9f912e7f94342458022c2e84288015893d83c4d62a79" + +[[package]] +name = "cobs" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32" +checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" +dependencies = [ + "thiserror", +] [[package]] name = "codegen" @@ -522,7 +566,7 @@ dependencies = [ "scir", "snippets", "substrate", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -563,7 +607,7 @@ dependencies = [ "log", "serde", "toml", - "toml_edit 0.24.1+spec-1.1.0", + "toml_edit 0.25.0+spec-1.1.0", "windows-sys 0.61.2", ] @@ -646,6 +690,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.5.0" @@ -730,7 +783,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -743,7 +796,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -754,7 +807,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core 0.20.11", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -765,7 +818,7 @@ checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" dependencies = [ "darling_core 0.23.0", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -776,7 +829,7 @@ checksum = "ef941ded77d15ca19b40374869ac6000af1c9f2a4c0f3d4c70926287e6364a8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -797,7 +850,7 @@ dependencies = [ "darling 0.20.11", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -807,7 +860,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -829,7 +882,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.114", + "syn 2.0.119", "unicode-xid", ] @@ -875,7 +928,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -922,11 +975,23 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + [[package]] name = "ena" -version = "0.14.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" +checksum = "eabffdaee24bd1bf95c5ef7cec31260444317e72ea56c4c91750e8b7ee58d5f1" dependencies = [ "log", ] @@ -948,7 +1013,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -966,7 +1031,7 @@ version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" dependencies = [ - "anstream", + "anstream 0.6.21", "anstyle", "env_filter", "log", @@ -985,7 +1050,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -1025,12 +1090,6 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" -[[package]] -name = "fixedbitset" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" - [[package]] name = "flate2" version = "1.1.9" @@ -1078,6 +1137,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + [[package]] name = "font-kit" version = "0.14.3" @@ -1121,7 +1186,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -1181,7 +1246,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -1273,7 +1338,7 @@ dependencies = [ "proc-macro-crate 3.4.0", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -1287,18 +1352,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "getrandom" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" -dependencies = [ - "cfg-if", - "libc", - "r-efi", - "wasip2", -] - [[package]] name = "getrandom" version = "0.4.1" @@ -1308,6 +1361,7 @@ dependencies = [ "cfg-if", "libc", "r-efi", + "rand_core 0.10.1", "wasip2", "wasip3", ] @@ -1389,7 +1443,7 @@ version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ - "foldhash", + "foldhash 0.1.5", ] [[package]] @@ -1398,13 +1452,22 @@ version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "foldhash 0.2.0", +] + [[package]] name = "hashlink" -version = "0.10.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +checksum = "a596f1b20ed2cc5ecac41a164aaebc7258057060f06c0cf7a2ba3991ee7990fb" dependencies = [ - "hashbrown 0.15.5", + "hashbrown 0.17.1", ] [[package]] @@ -1603,7 +1666,7 @@ checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -1738,9 +1801,9 @@ dependencies = [ [[package]] name = "libsqlite3-sys" -version = "0.35.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "133c182a6a2c87864fe97778797e46c7e999672690dc9fa3ee8e241aa4a9c13f" +checksum = "b06e69070b7e12262b0cd90832f0a7396f142a2b330181255562decf9f0c6215" dependencies = [ "cc", "pkg-config", @@ -1772,7 +1835,7 @@ dependencies = [ "darling 0.23.0", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -1848,12 +1911,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "multimap" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084" - [[package]] name = "netgen" version = "0.2.2" @@ -1903,7 +1960,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -1949,7 +2006,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -2147,7 +2204,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -2160,17 +2217,6 @@ dependencies = [ "sha2", ] -[[package]] -name = "petgraph" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" -dependencies = [ - "fixedbitset", - "hashbrown 0.15.5", - "indexmap", -] - [[package]] name = "phf" version = "0.11.3" @@ -2226,7 +2272,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -2306,6 +2352,18 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "postcard" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" +dependencies = [ + "cobs", + "embedded-io 0.4.0", + "embedded-io 0.6.1", + "serde", +] + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -2322,7 +2380,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -2370,9 +2428,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.106" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" dependencies = [ "unicode-ident", ] @@ -2385,63 +2443,10 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", "version_check", ] -[[package]] -name = "prost" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ea70524a2f82d518bce41317d0fae74151505651af45faf1ffbd6fd33f0568" -dependencies = [ - "bytes", - "prost-derive", -] - -[[package]] -name = "prost-build" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "343d3bd7056eda839b03204e68deff7d1b13aba7af2b2fd16890697274262ee7" -dependencies = [ - "heck", - "itertools", - "log", - "multimap", - "petgraph", - "prettyplease", - "prost", - "prost-types", - "pulldown-cmark", - "pulldown-cmark-to-cmark", - "regex", - "syn 2.0.114", - "tempfile", -] - -[[package]] -name = "prost-derive" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn 2.0.114", -] - -[[package]] -name = "prost-types" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8991c4cbdb8bc5b11f0b074ffe286c30e523de90fee5ba8132f1399f23cb3dd7" -dependencies = [ - "prost", -] - [[package]] name = "psfparser" version = "0.1.5" @@ -2475,26 +2480,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "pulldown-cmark" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e8bbe1a966bd2f362681a44f6edce3c2310ac21e4d5067a6e7ec396297a6ea0" -dependencies = [ - "bitflags 2.10.0", - "memchr", - "unicase", -] - -[[package]] -name = "pulldown-cmark-to-cmark" -version = "22.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50793def1b900256624a709439404384204a5dc3a6ec580281bfaac35e882e90" -dependencies = [ - "pulldown-cmark", -] - [[package]] name = "quantus" version = "0.2.3" @@ -2514,9 +2499,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.44" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" dependencies = [ "proc-macro2", ] @@ -2540,18 +2525,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha 0.3.1", + "rand_chacha", "rand_core 0.6.4", ] [[package]] name = "rand" -version = "0.9.2" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +checksum = "8f6fa277c67e6ea590466f04c3fe82cb509f0864fe470643e5570de9514a9b11" dependencies = [ - "rand_chacha 0.9.0", - "rand_core 0.9.5", + "chacha20", + "getrandom 0.4.1", + "rand_core 0.10.1", ] [[package]] @@ -2564,16 +2550,6 @@ dependencies = [ "rand_core 0.6.4", ] -[[package]] -name = "rand_chacha" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" -dependencies = [ - "ppv-lite86", - "rand_core 0.9.5", -] - [[package]] name = "rand_core" version = "0.6.4" @@ -2585,12 +2561,9 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.9.5" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" -dependencies = [ - "getrandom 0.3.4", -] +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" [[package]] name = "redox_users" @@ -2688,11 +2661,20 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "rsqlite-vfs" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353b74f9810d5b085b6c42c9d86a5f0fdb795553235cdd48753b32e3809d18a7" +dependencies = [ + "thiserror", +] + [[package]] name = "rusqlite" -version = "0.37.0" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165ca6e57b20e1351573e3729b958bc62f0e48025386970b6e4d29e7a7e71f3f" +checksum = "a4edff0039f148731aee2fd80f76dbfeb12d204ab3d1c544838d34e02151049b" dependencies = [ "bitflags 2.10.0", "fallible-iterator", @@ -2700,6 +2682,7 @@ dependencies = [ "hashlink", "libsqlite3-sys", "smallvec", + "sqlite-wasm-rs", ] [[package]] @@ -2725,7 +2708,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74a5a6f027e892c7a035c6fddb50435a1fbf5a734ffc0c2a9fed4d0221440519" dependencies = [ "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -2766,7 +2749,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.11.0", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -2846,7 +2829,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -2891,7 +2874,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest", ] @@ -3135,6 +3118,16 @@ dependencies = [ "serde", ] +[[package]] +name = "sqlite-wasm-rs" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cd504cecbfe7eef649988840f9a6cb768d11085efec138f8e99f160632d867" +dependencies = [ + "cc", + "rsqlite-vfs", +] + [[package]] name = "strongarm" version = "0.0.0" @@ -3229,9 +3222,20 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.114" +version = "2.0.119" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" dependencies = [ "proc-macro2", "quote", @@ -3260,7 +3264,7 @@ dependencies = [ "getrandom 0.4.1", "once_cell", "rustix 1.1.3", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -3304,7 +3308,7 @@ checksum = "be35209fd0781c5401458ab66e4f98accf63553e8fae7425503e92fdd319783b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -3320,22 +3324,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.18" +version = "2.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.18" +version = "2.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 3.0.10", ] [[package]] @@ -3386,14 +3390,14 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] name = "tokio-rusqlite" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302563ae4a2127f3d2c105f4f2f0bd7cae3609371755600ebc148e0ccd8510d6" +checksum = "cef2b2b09428079c22bf68cb48170c80b4f8c9c3ae1879aabfc22a94b5eaf2a1" dependencies = [ "crossbeam-channel", "rusqlite", @@ -3426,14 +3430,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.12+spec-1.1.0" +version = "1.0.0+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" +checksum = "d1d7e18e3dd1d31e0ee5e863a8091ffec2fcc271636586042452b656a22c8ee1" dependencies = [ "indexmap", "serde_core", "serde_spanned", - "toml_datetime 0.7.5+spec-1.1.0", + "toml_datetime 1.1.3+spec-1.1.0", "toml_parser", "toml_writer", "winnow 0.7.14", @@ -3454,6 +3458,15 @@ dependencies = [ "serde_core", ] +[[package]] +name = "toml_datetime" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49" +dependencies = [ + "serde_core", +] + [[package]] name = "toml_edit" version = "0.19.15" @@ -3479,12 +3492,12 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.24.1+spec-1.1.0" +version = "0.25.0+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01f2eadbbc6b377a847be05f60791ef1058d9f696ecb51d2c07fe911d8569d8e" +checksum = "caee3f6e1c6f2025affe9191e6e6f66ade10b48f36b1a1b3cd92dfe405ffd260" dependencies = [ "indexmap", - "toml_datetime 0.7.5+spec-1.1.0", + "toml_datetime 1.1.3+spec-1.1.0", "toml_parser", "toml_writer", "winnow 0.7.14", @@ -3543,34 +3556,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn 2.0.114", -] - -[[package]] -name = "tonic-prost" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c55a2d6a14174563de34409c9f92ff981d006f56da9c6ecd40d9d4a31500b0" -dependencies = [ - "bytes", - "prost", - "tonic", -] - -[[package]] -name = "tonic-prost-build" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4556786613791cfef4ed134aa670b61a85cfcacf71543ef33e8d801abae988f" -dependencies = [ - "prettyplease", - "proc-macro2", - "prost-build", - "prost-types", - "quote", - "syn 2.0.114", - "tempfile", - "tonic-build", + "syn 2.0.119", ] [[package]] @@ -3623,7 +3609,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -3693,7 +3679,7 @@ dependencies = [ "proc-macro-crate 3.4.0", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", "type_dispatch", ] @@ -3896,7 +3882,7 @@ dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", "wasm-bindgen-shared", ] @@ -3981,7 +3967,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -4011,7 +3997,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -4022,7 +4008,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] @@ -4271,7 +4257,7 @@ dependencies = [ "heck", "indexmap", "prettyplease", - "syn 2.0.114", + "syn 2.0.119", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -4287,7 +4273,7 @@ dependencies = [ "prettyplease", "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -4366,7 +4352,7 @@ checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" dependencies = [ "proc-macro2", "quote", - "syn 2.0.114", + "syn 2.0.119", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 2ad699135..daffb19d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,8 +63,8 @@ indexmap = "2" unicase = "2" approx = "0.5" thiserror = "2" -toml = "0.9" -toml_edit = "0.24" +toml = "1.0" +toml_edit = "0.25" darling = "0.23" syn = "2" convert_case = "0.11" diff --git a/docs/docusaurus/docs/getting-started/inverter/assets/index.md b/docs/docusaurus/docs/getting-started/inverter/assets/index.md index 5b6326774..9b6d8340d 100644 --- a/docs/docusaurus/docs/getting-started/inverter/assets/index.md +++ b/docs/docusaurus/docs/getting-started/inverter/assets/index.md @@ -19,10 +19,6 @@ Substrate will call into {props.open ? "open source tools (ngspice, magic, and N ## Setup -### Protocol Buffer Compiler - -Ensure that you have the [protocol buffer compiler](https://grpc.io/docs/protoc-installation/) (`protoc`) installed. - ### Rust Ensure that you have a recent version of Rust installed. diff --git a/docs/docusaurus/docs/getting-started/quickstart.md b/docs/docusaurus/docs/getting-started/quickstart.md index 59d83383b..496362bdf 100644 --- a/docs/docusaurus/docs/getting-started/quickstart.md +++ b/docs/docusaurus/docs/getting-started/quickstart.md @@ -19,9 +19,7 @@ If you're looking for a deeper dive into how analog design and simulation work i ## Creating a Substrate project Substrate is fully integrated with the Rust ecosystem, so all you need to get started is a [recent installation of Rust](https://www.rust-lang.org/tools/install)! -Ensure that you have version 1.80.0 or beyond. - -Also ensure that you have the [protocol buffer compiler](https://grpc.io/docs/protoc-installation/) (`protoc`) installed. +Ensure that you have version 1.89.0 or beyond. Then, add the Substrate registry to your Cargo config: diff --git a/docs/docusaurus/package.json b/docs/docusaurus/package.json index dcb52f8fa..7a09a3be7 100644 --- a/docs/docusaurus/package.json +++ b/docs/docusaurus/package.json @@ -30,7 +30,7 @@ "@docusaurus/module-type-aliases": "3.9.2", "@docusaurus/tsconfig": "3.9.2", "@docusaurus/types": "3.9.2", - "prettier": "3.8.1", + "prettier": "3.10.1", "typescript": "~5.9.0" }, "browserslist": { diff --git a/docs/docusaurus/yarn.lock b/docs/docusaurus/yarn.lock index c38c72a89..ba1e25362 100644 --- a/docs/docusaurus/yarn.lock +++ b/docs/docusaurus/yarn.lock @@ -4153,9 +4153,9 @@ devlop@^1.0.0, devlop@^1.1.0: dequal "^2.0.0" diff@^8.0.0: - version "8.0.3" - resolved "https://registry.yarnpkg.com/diff/-/diff-8.0.3.tgz#c7da3d9e0e8c283bb548681f8d7174653720c2d5" - integrity sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ== + version "8.0.4" + resolved "https://registry.yarnpkg.com/diff/-/diff-8.0.4.tgz#4f5baf3188b9b2431117b962eb20ba330fadf696" + integrity sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw== dir-glob@^3.0.1: version "3.0.1" @@ -7490,10 +7490,10 @@ postcss@^8.4.21, postcss@^8.4.24, postcss@^8.4.33, postcss@^8.5.4: picocolors "^1.1.1" source-map-js "^1.2.1" -prettier@3.8.1: - version "3.8.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.8.1.tgz#edf48977cf991558f4fcbd8a3ba6015ba2a3a173" - integrity sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg== +prettier@3.10.1: + version "3.10.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.10.1.tgz#00b1c1872f9650ec22093d5bdafdca0fe6760f77" + integrity sha512-70vp3ZUYoPlFbF9uiTdXHUUCGEIp7d4+6p+8DYbkm2jP7x/3i/paXVF6dopSI3zd/CEitrZN1rc4i85xWmmXlg== pretty-error@^4.0.0: version "4.0.0" diff --git a/libs/atoll/Cargo.toml b/libs/atoll/Cargo.toml index e60eaa04d..28645f90f 100644 --- a/libs/atoll/Cargo.toml +++ b/libs/atoll/Cargo.toml @@ -13,7 +13,7 @@ grid = { version = "1.0", features = ["serde"] } ena = "0.14" tracing = "0.1" num = "0.4" -rand = "0.9" +rand = "0.10" serde = { version = "1.0.228", features = ["derive"] } indexmap = "2" rustc-hash = "2" diff --git a/libs/cache/Cargo.toml b/libs/cache/Cargo.toml index 1b44e1922..84d77c8dc 100644 --- a/libs/cache/Cargo.toml +++ b/libs/cache/Cargo.toml @@ -8,20 +8,20 @@ license = "BSD-3-Clause" [dependencies] serde = { workspace = true, features = ["derive", "rc"] } once_cell = "1" -tonic = "*" +tonic = "0.14" futures-core = "0.3" futures-util = "0.3" tokio = { version = "1", features = ["rt-multi-thread", "macros", "sync", "time", "fs", "process"] } tokio-stream = { version = "0.1", features = ["net"] } tokio-util = "0.7" -prost = "0.14" -tonic-prost = "*" -rusqlite = { version = "0.37", features = ["bundled"] } +bytes = "1" +postcard = { version = "1", default-features = false, features = ["use-std"] } +rusqlite = { version = "0.42", features = ["bundled"] } fs4 = { version = "0.12", features = ["tokio"] } thiserror = "2" toml = { workspace = true } clap = { version = "4", features = ["derive"] } -tokio-rusqlite = "0.7" +tokio-rusqlite = "0.9" sha2 = "0.10" hex = "0.4" flexbuffers = "25" @@ -33,7 +33,7 @@ regex = "1" lazy_static = "1" [build-dependencies] -tonic-prost-build = "*" +tonic-build = "0.14" [dev-dependencies] crossbeam-channel = "0.5" diff --git a/libs/cache/build.rs b/libs/cache/build.rs index 65c0a9f73..9e85d6e66 100644 --- a/libs/cache/build.rs +++ b/libs/cache/build.rs @@ -1,12 +1,59 @@ -/// Compiles protocol buffer code using [`tonic_build`]. +//! Generates the gRPC services for the cache servers. + +use tonic_build::manual::{Builder, Method, Service}; + +/// Builds a unary RPC whose messages are encoded with `crate::rpc::PostcardCodec`. +fn method(name: &str, route_name: &str, input_type: &str, output_type: &str) -> Method { + Method::builder() + .name(name) + .route_name(route_name) + .input_type(input_type) + .output_type(output_type) + .codec_path("crate::rpc::PostcardCodec") + .build() +} + fn main() { - let protos = &["proto/local.proto", "proto/remote.proto"]; - let dirs = &["proto/"]; - tonic_prost_build::configure() - .compile_protos(protos, dirs) - .unwrap_or_else(|e| panic!("Failed to compile protos: {:?}", e)); - // recompile protobufs only if any of the proto files changes. - for file in protos { - println!("cargo:rerun-if-changed={}", file); - } + let local = Service::builder() + .name("LocalCache") + .package("local") + .method(method("get", "Get", "super::GetRequest", "super::GetReply")) + .method(method( + "drop", + "Drop", + "super::DropRequest", + "crate::rpc::Empty", + )) + .method(method( + "heartbeat", + "Heartbeat", + "super::HeartbeatRequest", + "crate::rpc::Empty", + )) + .method(method( + "done", + "Done", + "super::DoneRequest", + "crate::rpc::Empty", + )) + .build(); + let remote = Service::builder() + .name("RemoteCache") + .package("remote") + .method(method("get", "Get", "super::GetRequest", "super::GetReply")) + .method(method( + "heartbeat", + "Heartbeat", + "super::HeartbeatRequest", + "crate::rpc::Empty", + )) + .method(method( + "set", + "Set", + "super::SetRequest", + "crate::rpc::Empty", + )) + .build(); + Builder::new().compile(&[local, remote]); + println!("cargo:rerun-if-changed=build.rs"); } diff --git a/libs/cache/proto/google/protobuf/empty.proto b/libs/cache/proto/google/protobuf/empty.proto deleted file mode 100644 index 5f992de94..000000000 --- a/libs/cache/proto/google/protobuf/empty.proto +++ /dev/null @@ -1,52 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "google.golang.org/protobuf/types/known/emptypb"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "EmptyProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; -option cc_enable_arenas = true; - -// A generic empty message that you can re-use to avoid defining duplicated -// empty messages in your APIs. A typical example is to use it as the request -// or the response type of an API method. For instance: -// -// service Foo { -// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -// } -// -// The JSON representation for `Empty` is empty JSON object `{}`. -message Empty {} diff --git a/libs/cache/proto/local.proto b/libs/cache/proto/local.proto deleted file mode 100644 index 8b172467d..000000000 --- a/libs/cache/proto/local.proto +++ /dev/null @@ -1,54 +0,0 @@ -syntax = "proto3"; -import "google/protobuf/empty.proto"; - -package local; - -service LocalCache { - rpc Get (GetRequest) returns (GetReply) {} - rpc Drop (DropRequest) returns (google.protobuf.Empty) {} - rpc Heartbeat (HeartbeatRequest) returns (google.protobuf.Empty) {} - rpc Done (DoneRequest) returns (google.protobuf.Empty) {} -} - -message GetRequest { - string namespace = 1; - bytes key = 2; - bool assign = 3; -} - -message GetReply { - oneof entry_status { - google.protobuf.Empty unassigned = 1; - AssignReply assign = 2; - google.protobuf.Empty loading = 3; - ReadyReply ready = 4; - } -} - -message AssignReply { - uint64 id = 1; - string path = 2; - uint64 heartbeat_interval_ms = 3; -} - -message ReadyReply { - uint64 id = 1; - string path = 2; -} - -message DropRequest { - uint64 id = 1; -} - -message HeartbeatRequest { - uint64 id = 1; -} - -message SetRequest { - uint64 id = 1; - bytes value = 2; -} - -message DoneRequest { - uint64 id = 1; -} diff --git a/libs/cache/proto/remote.proto b/libs/cache/proto/remote.proto deleted file mode 100644 index ba58ee3a4..000000000 --- a/libs/cache/proto/remote.proto +++ /dev/null @@ -1,39 +0,0 @@ -syntax = "proto3"; -import "google/protobuf/empty.proto"; - -package remote; - -service RemoteCache { - rpc Get (GetRequest) returns (GetReply) {} - rpc Heartbeat (HeartbeatRequest) returns (google.protobuf.Empty) {} - rpc Set (SetRequest) returns (google.protobuf.Empty) {} -} - -message GetRequest { - string namespace = 1; - bytes key = 2; - bool assign = 3; -} - -message GetReply { - oneof entry_status { - google.protobuf.Empty unassigned = 1; - AssignReply assign = 2; - google.protobuf.Empty loading = 3; - bytes ready = 4; - } -} - -message AssignReply { - uint64 id = 1; - uint64 heartbeat_interval_ms = 2; -} - -message HeartbeatRequest { - uint64 id = 1; -} - -message SetRequest { - uint64 id = 1; - bytes value = 2; -} diff --git a/libs/cache/src/persistent/client.rs b/libs/cache/src/persistent/client.rs index 214b2f5b6..798bfde62 100644 --- a/libs/cache/src/persistent/client.rs +++ b/libs/cache/src/persistent/client.rs @@ -817,8 +817,8 @@ impl Client { namespace: String, key: Vec, assign: bool, - ) -> Result { - let out: Result = self.inner.handle.block_on(async { + ) -> Result { + self.inner.handle.block_on(async { let mut client = self.connect_local().await?; Ok(client .get(local::GetRequest { @@ -829,8 +829,7 @@ impl Client { .await .map_err(Box::new)? .into_inner()) - }); - Ok(out?.entry_status.unwrap()) + }) } /// Issues a `Heartbeat` RPC to a local cache gRPC server. @@ -938,16 +937,16 @@ impl Client { let status = self.run_backoff_loop(|| { let status = self.get_rpc_local(namespace.clone().into_inner(), hash.clone(), true)?; - let retry = matches!(status, local::get_reply::EntryStatus::Loading(_)); + let retry = matches!(status, local::GetReply::Loading); Ok((status, retry)) })?; match status { - local::get_reply::EntryStatus::Unassigned(_) => { + local::GetReply::Unassigned => { Client::handle_unassigned(handle, key, generate_fn); } - local::get_reply::EntryStatus::Assign(local::AssignReply { + local::GetReply::Assign(local::AssignReply { id, path, heartbeat_interval_ms, @@ -961,8 +960,8 @@ impl Client { write_generated_value(self, id, path, &v)?; handle.set(v); } - local::get_reply::EntryStatus::Loading(_) => unreachable!(), - local::get_reply::EntryStatus::Ready(local::ReadyReply { id, path }) => { + local::GetReply::Loading => unreachable!(), + local::GetReply::Ready(local::ReadyReply { id, path }) => { tracing::debug!("entry is ready, reading from cache"); let mut file = std::fs::File::open(path)?; let mut buf = Vec::new(); @@ -1027,8 +1026,8 @@ impl Client { namespace: String, key: Vec, assign: bool, - ) -> Result { - let out: Result = self.inner.handle.block_on(async { + ) -> Result { + self.inner.handle.block_on(async { let mut client = self.connect_remote().await?; Ok(client .get(remote::GetRequest { @@ -1039,8 +1038,7 @@ impl Client { .await .map_err(Box::new)? .into_inner()) - }); - Ok(out?.entry_status.unwrap()) + }) } /// Issues a `Heartbeat` RPC to a remote cache gRPC server. @@ -1111,16 +1109,16 @@ impl Client { let status = self.run_backoff_loop(|| { let status = self.get_rpc_remote(namespace.clone().into_inner(), hash.clone(), true)?; - let retry = matches!(status, remote::get_reply::EntryStatus::Loading(_)); + let retry = matches!(status, remote::GetReply::Loading); Ok((status, retry)) })?; match status { - remote::get_reply::EntryStatus::Unassigned(_) => { + remote::GetReply::Unassigned => { Client::handle_unassigned(handle, key, generate_fn); } - remote::get_reply::EntryStatus::Assign(remote::AssignReply { + remote::GetReply::Assign(remote::AssignReply { id, heartbeat_interval_ms, }) => { @@ -1133,8 +1131,8 @@ impl Client { write_generated_value(self, id, &v)?; handle.set(v); } - remote::get_reply::EntryStatus::Loading(_) => unreachable!(), - remote::get_reply::EntryStatus::Ready(data) => { + remote::GetReply::Loading => unreachable!(), + remote::GetReply::Ready(data) => { tracing::debug!("entry is ready"); handle.set(Ok(deserialize_cache_data(&data)?)); } diff --git a/libs/cache/src/persistent/server.rs b/libs/cache/src/persistent/server.rs index 5dcc80ac6..75dfd8240 100644 --- a/libs/cache/src/persistent/server.rs +++ b/libs/cache/src/persistent/server.rs @@ -471,7 +471,7 @@ enum DbEntryStatus { } impl DbEntryStatus { - fn to_int(self) -> u64 { + fn to_int(self) -> i64 { match self { Self::Loading => 0, Self::Ready => 1, @@ -479,7 +479,7 @@ impl DbEntryStatus { } } - fn from_int(val: u64) -> Option { + fn from_int(val: i64) -> Option { match val { 0 => Some(Self::Loading), 1 => Some(Self::Ready), @@ -505,34 +505,28 @@ enum GetReplyStatus { } impl GetReplyStatus { - fn into_local(self, path: String) -> local::get_reply::EntryStatus { + fn into_local(self, path: String) -> local::GetReply { match self { - Self::Unassigned => local::get_reply::EntryStatus::Unassigned(()), - Self::Assign(id, heartbeat_interval) => { - local::get_reply::EntryStatus::Assign(local::AssignReply { - id: id.0, - path, - heartbeat_interval_ms: heartbeat_interval.as_millis() as u64, - }) - } - Self::Loading => local::get_reply::EntryStatus::Loading(()), - Self::ReadyLocal(id) => { - local::get_reply::EntryStatus::Ready(local::ReadyReply { id: id.0, path }) - } + Self::Unassigned => local::GetReply::Unassigned, + Self::Assign(id, heartbeat_interval) => local::GetReply::Assign(local::AssignReply { + id: id.0, + path, + heartbeat_interval_ms: heartbeat_interval.as_millis() as u64, + }), + Self::Loading => local::GetReply::Loading, + Self::ReadyLocal(id) => local::GetReply::Ready(local::ReadyReply { id: id.0, path }), Self::ReadyRemote(_) => panic!("cannot convert remote statuses to local statuses"), } } - fn into_remote(self) -> remote::get_reply::EntryStatus { + fn into_remote(self) -> remote::GetReply { match self { - Self::Unassigned => remote::get_reply::EntryStatus::Unassigned(()), - Self::Assign(id, heartbeat_interval) => { - remote::get_reply::EntryStatus::Assign(remote::AssignReply { - id: id.0, - heartbeat_interval_ms: heartbeat_interval.as_millis() as u64, - }) - } - Self::Loading => remote::get_reply::EntryStatus::Loading(()), - Self::ReadyRemote(val) => remote::get_reply::EntryStatus::Ready(val), + Self::Unassigned => remote::GetReply::Unassigned, + Self::Assign(id, heartbeat_interval) => remote::GetReply::Assign(remote::AssignReply { + id: id.0, + heartbeat_interval_ms: heartbeat_interval.as_millis() as u64, + }), + Self::Loading => remote::GetReply::Loading, + Self::ReadyRemote(val) => remote::GetReply::Ready(val), Self::ReadyLocal(_) => panic!("cannot convert local statuses to remote statuses"), } } @@ -777,9 +771,7 @@ impl LocalCache for CacheImpl { .await? .into_local(path); - Ok(Response::new(local::GetReply { - entry_status: Some(entry_status), - })) + Ok(Response::new(entry_status)) } async fn heartbeat( @@ -853,9 +845,7 @@ impl RemoteCache for CacheImpl { .await? .into_remote(); - Ok(Response::new(remote::GetReply { - entry_status: Some(entry_status), - })) + Ok(Response::new(entry_status)) } async fn heartbeat( diff --git a/libs/cache/src/rpc/mod.rs b/libs/cache/src/rpc/mod.rs index fab0870e0..d84c1ea8f 100644 --- a/libs/cache/src/rpc/mod.rs +++ b/libs/cache/src/rpc/mod.rs @@ -1,9 +1,205 @@ -//! Automatically generated utilities for RPCs. +//! Messages and gRPC services for the cache servers. + +use std::marker::PhantomData; + +use bytes::{Buf, BufMut}; +use serde::{Serialize, de::DeserializeOwned}; +use tonic::Status; +use tonic::codec::{Codec, DecodeBuf, Decoder, EncodeBuf, Encoder}; + +/// The reply of RPCs that return no data. +pub type Empty = (); pub mod local { - tonic::include_proto!("local"); + //! The local cache API, which stores values on a filesystem shared with the client. + + use serde::{Deserialize, Serialize}; + + /// Requests the status of an entry, optionally assigning the client to generate it. + #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] + pub struct GetRequest { + pub namespace: String, + pub key: Vec, + pub assign: bool, + } + + /// The status of a requested entry. + #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] + pub enum GetReply { + Unassigned, + Assign(AssignReply), + Loading, + Ready(ReadyReply), + } + + /// An assignment to generate an entry and write it to `path`. + #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] + pub struct AssignReply { + pub id: u64, + pub path: String, + pub heartbeat_interval_ms: u64, + } + + /// A handle to a ready entry stored at `path`. + #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] + pub struct ReadyReply { + pub id: u64, + pub path: String, + } + + /// Releases the handle with the given ID. + #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] + pub struct DropRequest { + pub id: u64, + } + + /// Keeps the assignment with the given ID alive. + #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] + pub struct HeartbeatRequest { + pub id: u64, + } + + /// Marks the assignment with the given ID as written. + #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] + pub struct DoneRequest { + pub id: u64, + } + + include!(concat!(env!("OUT_DIR"), "/local.LocalCache.rs")); } pub mod remote { - tonic::include_proto!("remote"); + //! The remote cache API, which sends values over the network. + + use serde::{Deserialize, Serialize}; + + /// Requests the status of an entry, optionally assigning the client to generate it. + #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] + pub struct GetRequest { + pub namespace: String, + pub key: Vec, + pub assign: bool, + } + + /// The status of a requested entry. + #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] + pub enum GetReply { + Unassigned, + Assign(AssignReply), + Loading, + /// The serialized value of the entry. + Ready(Vec), + } + + /// An assignment to generate an entry. + #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] + pub struct AssignReply { + pub id: u64, + pub heartbeat_interval_ms: u64, + } + + /// Keeps the assignment with the given ID alive. + #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] + pub struct HeartbeatRequest { + pub id: u64, + } + + /// Stores the serialized value for the assignment with the given ID. + #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] + pub struct SetRequest { + pub id: u64, + pub value: Vec, + } + + include!(concat!(env!("OUT_DIR"), "/remote.RemoteCache.rs")); +} + +/// A gRPC codec that encodes messages with [`postcard`]. +#[derive(Debug)] +pub struct PostcardCodec(PhantomData<(T, U)>); + +impl Default for PostcardCodec { + fn default() -> Self { + Self(PhantomData) + } +} + +impl Codec for PostcardCodec +where + T: Serialize + Send + 'static, + U: DeserializeOwned + Send + 'static, +{ + type Encode = T; + type Decode = U; + type Encoder = PostcardEncoder; + type Decoder = PostcardDecoder; + + fn encoder(&mut self) -> Self::Encoder { + PostcardEncoder(PhantomData) + } + + fn decoder(&mut self) -> Self::Decoder { + PostcardDecoder(PhantomData) + } +} + +/// The encoder of a [`PostcardCodec`]. +#[derive(Debug)] +pub struct PostcardEncoder(PhantomData); + +impl Encoder for PostcardEncoder { + type Item = T; + type Error = Status; + + fn encode(&mut self, item: T, buf: &mut EncodeBuf<'_>) -> Result<(), Status> { + postcard::to_io(&item, buf.writer()) + .map(|_| ()) + .map_err(|e| Status::internal(format!("failed to encode message: {e}"))) + } +} + +/// The decoder of a [`PostcardCodec`]. +#[derive(Debug)] +pub struct PostcardDecoder(PhantomData); + +impl Decoder for PostcardDecoder { + type Item = U; + type Error = Status; + + fn decode(&mut self, buf: &mut DecodeBuf<'_>) -> Result, Status> { + // Each call receives exactly one message, which is empty for `()`. + let bytes = buf.copy_to_bytes(buf.remaining()); + postcard::from_bytes(&bytes) + .map(Some) + .map_err(|e| Status::invalid_argument(format!("failed to decode message: {e}"))) + } +} + +#[cfg(test)] +mod tests { + use super::{local, remote}; + + #[test] + fn messages_round_trip() { + let reply = remote::GetReply::Ready(vec![0, 1, 255]); + let bytes = postcard::to_stdvec(&reply).unwrap(); + assert_eq!( + postcard::from_bytes::(&bytes).unwrap(), + reply + ); + + let reply = local::GetReply::Assign(local::AssignReply { + id: 7, + path: "/tmp/x".into(), + heartbeat_interval_ms: 2000, + }); + let bytes = postcard::to_stdvec(&reply).unwrap(); + assert_eq!( + postcard::from_bytes::(&bytes).unwrap(), + reply + ); + + let bytes = postcard::to_stdvec(&()).unwrap(); + postcard::from_bytes::<()>(&bytes).unwrap(); + } } diff --git a/renovate.json b/renovate.json index 3bfe036df..72db0a5b6 100644 --- a/renovate.json +++ b/renovate.json @@ -1,7 +1,8 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": [ - "config:recommended" + "config:recommended", + "group:all" ], "prHourlyLimit": 0, "dependencyDashboard": true