diff --git a/Cargo.lock b/Cargo.lock index 84e97fbae..785336274 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -700,15 +700,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - [[package]] name = "bit-set" version = "0.5.3" @@ -1094,6 +1085,12 @@ dependencies = [ "serde", ] +[[package]] +name = "cobs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" + [[package]] name = "codemap" version = "0.1.3" @@ -1267,18 +1264,18 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.107.2" +version = "0.108.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebf72ceaf38f7d41194d0cf6748214d8ef7389167fe09aad80f87646dbfa325b" +checksum = "f75f0946f5e307e5dbf22e8bc0bd9bc5336a4f0240a4af4751c007a0cbf84917" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.107.2" +version = "0.108.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ee7fde5cd9173f00ce02c491ee9e306d64740f4b1a697946e0474f389999e13" +checksum = "a6b0a01705ef466bbc64e10af820f935f77256bcb14a40dde1e10b7a0969ce11" dependencies = [ "bumpalo", "cranelift-bforest", @@ -1291,39 +1288,40 @@ dependencies = [ "hashbrown 0.14.5", "log", "regalloc2", + "rustc-hash", "smallvec", "target-lexicon", ] [[package]] name = "cranelift-codegen-meta" -version = "0.107.2" +version = "0.108.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b49bec6a517e78d4067500dc16acb558e772491a2bcb37301127448adfb8413c" +checksum = "2cdaeff01606190dcccd13cf3d80b8d5f1f197812ba7bba1196ae08bd8e82592" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.107.2" +version = "0.108.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ead4ea497b2dc2ac31fcabd6d5d0d5dc25b3964814122e343724bdf65a53c843" +checksum = "cefa0243350ce9667f3320579c8a2c3dd3d1f9943e8ab2eb1d4ca533ccc1db57" [[package]] name = "cranelift-control" -version = "0.107.2" +version = "0.108.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81e8028c8d711ea7592648e70221f2e54acb8665f7ecd49545f021ec14c3341" +checksum = "fa46a2d3331aa33cbd399665d6ea0f431f726a55fb69fdf897035cf5fe0a3301" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.107.2" +version = "0.108.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32acd0632ba65c2566e75f64af9ef094bb8d90e58a9fbd33d920977a9d85c054" +checksum = "9e8f7cc083e6d01d656283f293ec361ce7bae05eca896f3a932d42dad1850578" dependencies = [ "serde", "serde_derive", @@ -1331,9 +1329,9 @@ dependencies = [ [[package]] name = "cranelift-frontend" -version = "0.107.2" +version = "0.108.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a395a704934aa944ba8939cac9001174b9ae5236f48bc091f89e33bb968336f6" +checksum = "8490d83b85eeec14ebf3b4c0b0ebc33600f1943514b1406a7b99b85d8b80e4c0" dependencies = [ "cranelift-codegen", "log", @@ -1343,15 +1341,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.107.2" +version = "0.108.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b325ce81c4ee7082dc894537eb342c37898e14230fe7c02ea945691db3e2dd01" +checksum = "e617871f2347ca078a31d61acaf7de961852447e6009afa5be6e4df6d5785dd4" [[package]] name = "cranelift-native" -version = "0.107.2" +version = "0.108.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea11f5ac85996fa093075d66397922d4f56085d5d84ec13043d0cd4f159c6818" +checksum = "add05ee8162778fd7b545e0935f4a5c0c95afdac003362e040ef0229227ae967" dependencies = [ "cranelift-codegen", "libc", @@ -1360,9 +1358,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.107.2" +version = "0.108.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4f175d4e299a8edabfbd64fa93c7650836cc8ad7f4879f9bd2632575a1f12d0" +checksum = "318b671ce0a174347dcbc4a5e8b8fe292864fd63fdb0c91324239245c3d4caa2" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -1370,7 +1368,7 @@ dependencies = [ "itertools 0.12.1", "log", "smallvec", - "wasmparser 0.202.0", + "wasmparser 0.207.0", "wasmtime-types", ] @@ -1921,6 +1919,12 @@ dependencies = [ "smol_str", ] +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + [[package]] name = "encode_unicode" version = "0.3.6" @@ -2505,6 +2509,7 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash 0.8.11", "allocator-api2", + "serde", ] [[package]] @@ -4415,8 +4420,8 @@ dependencies = [ "serde", "serde_json", "thiserror", - "wasm-encoder 0.208.0", - "wasmparser 0.208.0", + "wasm-encoder 0.208.1", + "wasmparser 0.208.1", "wat", ] @@ -4428,7 +4433,7 @@ dependencies = [ "color-eyre", "mrf-manifest", "serde_json", - "wasmparser 0.208.0", + "wasmparser 0.208.1", "wat", ] @@ -5207,6 +5212,17 @@ dependencies = [ "pretty_assertions", ] +[[package]] +name = "postcard" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55c51ee6c0db07e68448e336cf8ea4131a620edefebf9893e759b2d793420f8" +dependencies = [ + "cobs", + "embedded-io", + "serde", +] + [[package]] name = "postgres-protocol" version = "0.6.6" @@ -7800,27 +7816,27 @@ checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wasm-encoder" -version = "0.202.0" +version = "0.207.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd106365a7f5f7aa3c1916a98cbb3ad477f5ff96ddb130285a91c6e7429e67a" +checksum = "d996306fb3aeaee0d9157adbe2f670df0236caf19f6728b221e92d0f27b3fe17" dependencies = [ "leb128", ] [[package]] name = "wasm-encoder" -version = "0.208.0" +version = "0.208.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbc0fb39838056aeb096b2e7dd94bb2f0c2df3c9fb4d1055f2cb3c35c286ee71" +checksum = "6425e84e42f7f558478e40ecc2287912cb319f2ca68e5c0bb93c61d4fc63fa17" dependencies = [ "leb128", ] [[package]] name = "wasm-metadata" -version = "0.208.0" +version = "0.208.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0477c12795d0de6243d03e0101e6a21b24a5f2f350f2e2bf9c80da274e68d243" +checksum = "42a2c4280ad374a6db3d76d4bb61e2ec4b3b9ce5469cc4f2bbc5708047a2bbff" dependencies = [ "anyhow", "indexmap 2.2.6", @@ -7828,98 +7844,110 @@ dependencies = [ "serde_derive", "serde_json", "spdx", - "wasm-encoder 0.208.0", - "wasmparser 0.208.0", + "wasm-encoder 0.208.1", + "wasmparser 0.208.1", ] [[package]] name = "wasmparser" -version = "0.202.0" +version = "0.207.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6998515d3cf3f8b980ef7c11b29a9b1017d4cf86b99ae93b546992df9931413" +checksum = "e19bb9f8ab07616da582ef8adb24c54f1424c7ec876720b7da9db8ec0626c92c" dependencies = [ + "ahash 0.8.11", "bitflags 2.5.0", + "hashbrown 0.14.5", "indexmap 2.2.6", "semver", ] [[package]] name = "wasmparser" -version = "0.208.0" +version = "0.208.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d20bf2b2d07ec86bab7a05ae4e3a290e5b333319cd73253bc79bfedb6c59c83" +checksum = "dd921789c9dcc495f589cb37d200155dee65b4a4beeb853323b5e24e0a5f9c58" dependencies = [ "ahash 0.8.11", "bitflags 2.5.0", "hashbrown 0.14.5", "indexmap 2.2.6", "semver", + "serde", ] [[package]] name = "wasmprinter" -version = "0.202.0" +version = "0.207.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab1cc9508685eef9502e787f4d4123745f5651a1e29aec047645d3cac1e2da7a" +checksum = "9c2d8a7b4dabb460208e6b4334d9db5766e84505038b2529e69c3d07ac619115" dependencies = [ "anyhow", - "wasmparser 0.202.0", + "wasmparser 0.207.0", ] [[package]] name = "wasmtime" -version = "20.0.2" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4af5cb32045daee8476711eb12b8b71275c2dd1fc7a58cc2a11b33ce9205f6a2" +checksum = "6fe2db63de4669214120414ae6d86afb6bb011748bf942836aba2d45f011972b" dependencies = [ "addr2line", "anyhow", "async-trait", - "bincode", "bumpalo", + "cc", "cfg-if", "encoding_rs", "gimli", + "hashbrown 0.14.5", "indexmap 2.2.6", "libc", + "libm", "log", + "mach2", + "memfd", + "memoffset", "object 0.33.0", "once_cell", "paste", + "postcard", + "psm", "rayon", "rustix", "semver", "serde", "serde_derive", - "serde_json", + "smallvec", + "sptr", "target-lexicon", - "wasmparser 0.202.0", + "wasmparser 0.207.0", + "wasmtime-asm-macros", "wasmtime-component-macro", "wasmtime-component-util", "wasmtime-cranelift", "wasmtime-environ", "wasmtime-fiber", "wasmtime-jit-icache-coherence", - "wasmtime-runtime", "wasmtime-slab", + "wasmtime-versioned-export-macros", "wasmtime-winch", "windows-sys 0.52.0", ] [[package]] name = "wasmtime-asm-macros" -version = "20.0.2" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7515c4d24c8b55c0feab67e3d52a42f999fda8b9cfafbd69a82ed6bcf299d26e" +checksum = "821f87828a6508995bf1243fda9dafd1b671a49b3bf998394c7b73f0f5d9eb5f" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-component-macro" -version = "20.0.2" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "794839a710a39a12677c67ff43fec54ef00d0ca6c6f631209a7c5524522221d3" +checksum = "aab7a588beec0116e99488768395eee70a1dc53869aae111d006f8928a16ed46" dependencies = [ "anyhow", "proc-macro2", @@ -7927,20 +7955,20 @@ dependencies = [ "syn 2.0.65", "wasmtime-component-util", "wasmtime-wit-bindgen", - "wit-parser 0.202.0", + "wit-parser 0.207.0", ] [[package]] name = "wasmtime-component-util" -version = "20.0.2" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7839a1b9e15d17be1cb2a105f18be8e0bbf52bdec7a7cd6eb5d80d4c2cdf74f0" +checksum = "52cc81977f24da3071f3f4b32f40ef6d8fb4f14e12f0bc4c68163935d6694ded" [[package]] name = "wasmtime-cranelift" -version = "20.0.2" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ec2d9a4b9990bea53a5dfd689d48663dbd19a46903eaf73e2022b3d1ef20d3" +checksum = "e45cc4915c2b37b4d8b49aaab29d6e2612b393eabb01ae3a410d95e372c22d13" dependencies = [ "anyhow", "cfg-if", @@ -7955,30 +7983,29 @@ dependencies = [ "object 0.33.0", "target-lexicon", "thiserror", - "wasmparser 0.202.0", + "wasmparser 0.207.0", "wasmtime-environ", "wasmtime-versioned-export-macros", ] [[package]] name = "wasmtime-environ" -version = "20.0.2" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad72e2e3f7ea5b50fedf66dd36ba24634e4f445c370644683b433d45d88f6126" +checksum = "bba5317f774e37197d588deadb794289438866b72bc1531c593506a004d6cfe0" dependencies = [ "anyhow", - "bincode", "cranelift-entity", "gimli", "indexmap 2.2.6", "log", "object 0.33.0", + "postcard", "serde", "serde_derive", "target-lexicon", - "thiserror", - "wasm-encoder 0.202.0", - "wasmparser 0.202.0", + "wasm-encoder 0.207.0", + "wasmparser 0.207.0", "wasmprinter", "wasmtime-component-util", "wasmtime-types", @@ -7986,9 +8013,9 @@ dependencies = [ [[package]] name = "wasmtime-fiber" -version = "20.0.2" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dbdf3053e7e7ced0cd4ed76579995b62169a1a43696890584eae2de2e33bf54" +checksum = "89ecb5dd1253786c4809588b722a5990367ad0b730f53e676ea8edd2962a6834" dependencies = [ "anyhow", "cc", @@ -8001,67 +8028,40 @@ dependencies = [ [[package]] name = "wasmtime-jit-icache-coherence" -version = "20.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ede45379f3b4d395d8947006de8043801806099a240a26db553919b68e96ab15" -dependencies = [ - "cfg-if", - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "wasmtime-runtime" -version = "20.0.2" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65019d29d175c567b84173f2adf3b7a3af6d5592f8fe510dccae55d2569ec0d2" +checksum = "e6ce46bf24b027e1ede83d14ed544c736d7e939a849c4429551eb27842356c77" dependencies = [ "anyhow", - "cc", "cfg-if", - "encoding_rs", - "indexmap 2.2.6", "libc", - "log", - "mach2", - "memfd", - "memoffset", - "paste", - "psm", - "rustix", - "sptr", - "wasmtime-asm-macros", - "wasmtime-environ", - "wasmtime-fiber", - "wasmtime-slab", - "wasmtime-versioned-export-macros", "windows-sys 0.52.0", ] [[package]] name = "wasmtime-slab" -version = "20.0.2" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6585868f5c427c3e9d2a8c0c3354e6d7d4518a0d17723ab25a0c1eebf5d5b4" +checksum = "90814f57c64afa02324829c3a8f88616ce3a75f1b2ce9728d34827d21329a836" [[package]] name = "wasmtime-types" -version = "20.0.2" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84d5381ff174faded38c7b2085fbe430dff59489c87a91403354d710075750fb" +checksum = "629bdcf8b1f7590834c1ad6cd043e93e1d57e80b776adb84109eed203fb74d38" dependencies = [ "cranelift-entity", "serde", "serde_derive", - "thiserror", - "wasmparser 0.202.0", + "smallvec", + "wasmparser 0.207.0", ] [[package]] name = "wasmtime-versioned-export-macros" -version = "20.0.2" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d3b70422fdfa915c903f003b8b42554a8ae1aa0c6208429d8314ebf5721f3ac" +checksum = "89b3438cb56868e235825c7026e85fe8a6c4b5437b5786ad010948e5c6eff0d4" dependencies = [ "proc-macro2", "quote", @@ -8070,9 +8070,9 @@ dependencies = [ [[package]] name = "wasmtime-wasi" -version = "20.0.2" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08dd00241969c3be8c5dfdedbb8d9c5af6783e514ffbf8f7522036561bd1337a" +checksum = "82e7931e19286a853fb5cae7790f9be473f7ab763043c659f1fa0a2a8eada10b" dependencies = [ "anyhow", "async-trait", @@ -8100,16 +8100,16 @@ dependencies = [ [[package]] name = "wasmtime-winch" -version = "20.0.2" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "996360967b5196dec20ddcfce499ce4dc80cc925c088b0f2b376d29b96833a6a" +checksum = "dd04ad4f7bbcf7925455cec6420481b972071284e611e105cc16b847fc6415e8" dependencies = [ "anyhow", "cranelift-codegen", "gimli", "object 0.33.0", "target-lexicon", - "wasmparser 0.202.0", + "wasmparser 0.207.0", "wasmtime-cranelift", "wasmtime-environ", "winch-codegen", @@ -8117,34 +8117,34 @@ dependencies = [ [[package]] name = "wasmtime-wit-bindgen" -version = "20.0.2" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01840c0cfbbb01664c796e3f4edbd656e58f9d76db083c7e7c6bba59ea657a96" +checksum = "50c5e4fc265a4d78c334b9fcd846ffd94859bf821ee34a77bc68035526d455ee" dependencies = [ "anyhow", "heck 0.4.1", "indexmap 2.2.6", - "wit-parser 0.202.0", + "wit-parser 0.207.0", ] [[package]] name = "wast" -version = "208.0.0" +version = "208.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0450a853119b35441264ca99bd90be37d6f85f99decc4d993795ad396ed56b97" +checksum = "bc00b3f023b4e2ccd2e054e240294263db52ae962892e6523e550783c83a67f1" dependencies = [ "bumpalo", "leb128", "memchr", "unicode-width", - "wasm-encoder 0.208.0", + "wasm-encoder 0.208.1", ] [[package]] name = "wat" -version = "1.208.0" +version = "1.208.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72fd5b4d1e1fb745f2eb6e8004563ffbf0858681c11a79f4ec663ee31907080d" +checksum = "58ed38e59176550214c025ea2bd0eeefd8e86b92d0af6698d5ba95020ec2e07b" dependencies = [ "wast", ] @@ -8244,9 +8244,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "winch-codegen" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cefeb84a0f39227cf2eb665cf348e6150ebf3372d08adff03264064ab590fdf4" +checksum = "48691637c874363258ea7295497afdcfd426e5608fa36f62ab6bd0b9cac2bcb8" dependencies = [ "anyhow", "cranelift-codegen", @@ -8254,7 +8254,7 @@ dependencies = [ "regalloc2", "smallvec", "target-lexicon", - "wasmparser 0.202.0", + "wasmparser 0.207.0", "wasmtime-cranelift", "wasmtime-environ", ] @@ -8473,7 +8473,7 @@ checksum = "7076a12e69af6e1f6093bd16657d7ae61c30cfd3c5f62321046eb863b17ab1e2" dependencies = [ "anyhow", "heck 0.5.0", - "wit-parser 0.208.0", + "wit-parser 0.208.1", ] [[package]] @@ -8515,9 +8515,9 @@ dependencies = [ [[package]] name = "wit-component" -version = "0.208.0" +version = "0.208.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0397074e61e235635133f1301d1808545e4cb2701d117dc2aca128e65168ae" +checksum = "fef7dd0e47f5135dd8739ccc5b188ab8b7e27e1d64df668aa36680f0b8646db8" dependencies = [ "anyhow", "bitflags 2.5.0", @@ -8526,17 +8526,17 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder 0.208.0", + "wasm-encoder 0.208.1", "wasm-metadata", - "wasmparser 0.208.0", - "wit-parser 0.208.0", + "wasmparser 0.208.1", + "wit-parser 0.208.1", ] [[package]] name = "wit-parser" -version = "0.202.0" +version = "0.207.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744237b488352f4f27bca05a10acb79474415951c450e52ebd0da784c1df2bcc" +checksum = "78c83dab33a9618d86cfe3563cc864deffd08c17efc5db31a3b7cd1edeffe6e1" dependencies = [ "anyhow", "id-arena", @@ -8547,14 +8547,14 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", - "wasmparser 0.202.0", + "wasmparser 0.207.0", ] [[package]] name = "wit-parser" -version = "0.208.0" +version = "0.208.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27e6bf94e83a0633ae1790912fbe3a97c2fd1ea7956fc58be18aa03517b1b887" +checksum = "516417a730725fe3e6c9e2efc8d86697480f80496d32b24e62736950704c047c" dependencies = [ "anyhow", "id-arena", @@ -8565,7 +8565,7 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", - "wasmparser 0.208.0", + "wasmparser 0.208.1", ] [[package]] diff --git a/crates/kitsune-wasm-mrf/Cargo.toml b/crates/kitsune-wasm-mrf/Cargo.toml index 364a027c2..f2c3b983b 100644 --- a/crates/kitsune-wasm-mrf/Cargo.toml +++ b/crates/kitsune-wasm-mrf/Cargo.toml @@ -29,7 +29,7 @@ tokio = { version = "1.37.0", features = ["fs"] } tracing = "0.1.40" triomphe = "0.1.11" walkdir = "2.5.0" -wasmtime = { version = "20.0.2", default-features = false, features = [ +wasmtime = { version = "21.0.0", default-features = false, features = [ "addr2line", "async", "component-model", @@ -38,13 +38,13 @@ wasmtime = { version = "20.0.2", default-features = false, features = [ "pooling-allocator", "runtime", ] } -wasmtime-wasi = { version = "20.0.2", default-features = false } +wasmtime-wasi = { version = "21.0.0", default-features = false } [dev-dependencies] tempfile = "3.10.1" tokio = { version = "1.37.0", features = ["macros", "rt"] } tracing-subscriber = "0.3.18" -wat = "1.208.0" +wat = "1.208.1" [lints] workspace = true diff --git a/crates/kitsune-wasm-mrf/example-mrf/src/lib.rs b/crates/kitsune-wasm-mrf/example-mrf/src/lib.rs index cd166d156..5d463b9ba 100644 --- a/crates/kitsune-wasm-mrf/example-mrf/src/lib.rs +++ b/crates/kitsune-wasm-mrf/example-mrf/src/lib.rs @@ -1,7 +1,7 @@ #![allow(clippy::missing_safety_doc, clippy::transmute_int_to_bool, unsafe_code)] use self::{ - fep::mrf::keyvalue::{self, Bucket}, + fep::mrf::keyvalue::Bucket, wasi::logging::logging::{self, Level}, }; use rand::{distributions::Alphanumeric, Rng}; @@ -32,11 +32,14 @@ impl Guest for Mrf { // We even have a key-value store! Check this out: let key = generate_random_key(); - let bucket = Bucket::open_bucket("example-bucket").unwrap(); + let bucket = Bucket::open("example-bucket").unwrap(); - keyvalue::set(&bucket, &key, b"world").unwrap(); - assert!(keyvalue::exists(&bucket, &key).unwrap()); - keyvalue::delete(&bucket, &key).unwrap(); + bucket.set(&key, b"world").unwrap(); + + assert!(bucket.exists(&key).unwrap()); + assert_eq!(bucket.get(&key).unwrap(), Some(b"world".to_vec())); + + bucket.delete(&key).unwrap(); Ok(activity) } diff --git a/crates/kitsune-wasm-mrf/src/kv_storage/fs.rs b/crates/kitsune-wasm-mrf/src/kv_storage/fs.rs index 9ee6befc9..09242f8b1 100644 --- a/crates/kitsune-wasm-mrf/src/kv_storage/fs.rs +++ b/crates/kitsune-wasm-mrf/src/kv_storage/fs.rs @@ -1,4 +1,4 @@ -use super::{Backend, BoxError, BucketBackend}; +use super::{Backend, BucketBackend}; use color_eyre::eyre; use std::path::Path; @@ -20,7 +20,7 @@ impl FsBackend { impl Backend for FsBackend { type Bucket = FsBucketBackend; - async fn open(&self, module_name: &str, name: &str) -> Result { + async fn open(&self, module_name: &str, name: &str) -> eyre::Result { self.inner .open_tree(format!("{module_name}:{name}")) .map(|tree| FsBucketBackend { inner: tree }) @@ -33,23 +33,23 @@ pub struct FsBucketBackend { } impl BucketBackend for FsBucketBackend { - async fn exists(&self, key: &str) -> Result { + async fn exists(&self, key: &str) -> eyre::Result { self.inner.contains_key(key).map_err(Into::into) } - async fn delete(&self, key: &str) -> Result<(), BoxError> { + async fn delete(&self, key: &str) -> eyre::Result<()> { self.inner.remove(key)?; Ok(()) } - async fn get(&self, key: &str) -> Result>, BoxError> { + async fn get(&self, key: &str) -> eyre::Result>> { self.inner .get(key) .map(|maybe_val| maybe_val.map(|val| val.to_vec())) .map_err(Into::into) } - async fn set(&self, key: &str, value: &[u8]) -> Result<(), BoxError> { + async fn set(&self, key: &str, value: &[u8]) -> eyre::Result<()> { self.inner.insert(key, value)?; Ok(()) } diff --git a/crates/kitsune-wasm-mrf/src/kv_storage/mod.rs b/crates/kitsune-wasm-mrf/src/kv_storage/mod.rs index 75e7847a7..0834ecc4f 100644 --- a/crates/kitsune-wasm-mrf/src/kv_storage/mod.rs +++ b/crates/kitsune-wasm-mrf/src/kv_storage/mod.rs @@ -1,8 +1,9 @@ use crate::mrf_wit::v1::fep::mrf::keyvalue; use async_trait::async_trait; +use color_eyre::eyre; use derive_more::From; use enum_dispatch::enum_dispatch; -use std::{error::Error, future::Future}; +use std::future::Future; use wasmtime::component::Resource; pub use self::{ @@ -13,7 +14,13 @@ pub use self::{ mod fs; mod redis; -type BoxError = Box; +#[inline] +fn get_bucket<'a>( + ctx: &'a crate::ctx::Context, + rep: &Resource, +) -> &'a BucketBackendDispatch { + &ctx.kv_ctx.buckets[rep.rep() as usize] +} pub trait Backend { type Bucket: BucketBackend; @@ -22,16 +29,16 @@ pub trait Backend { &self, module_name: &str, name: &str, - ) -> impl Future> + Send; + ) -> impl Future> + Send; } #[enum_dispatch] #[allow(async_fn_in_trait)] pub trait BucketBackend { - async fn exists(&self, key: &str) -> Result; - async fn delete(&self, key: &str) -> Result<(), BoxError>; - async fn get(&self, key: &str) -> Result>, BoxError>; - async fn set(&self, key: &str, value: &[u8]) -> Result<(), BoxError>; + async fn exists(&self, key: &str) -> eyre::Result; + async fn delete(&self, key: &str) -> eyre::Result<()>; + async fn get(&self, key: &str) -> eyre::Result>>; + async fn set(&self, key: &str, value: &[u8]) -> eyre::Result<()>; } #[derive(From)] @@ -43,7 +50,7 @@ pub enum BackendDispatch { impl Backend for BackendDispatch { type Bucket = BucketBackendDispatch; - async fn open(&self, module_name: &str, name: &str) -> Result { + async fn open(&self, module_name: &str, name: &str) -> eyre::Result { match self { Self::Fs(fs) => fs.open(module_name, name).await.map(Into::into), Self::Redis(redis) => redis.open(module_name, name).await.map(Into::into), @@ -59,10 +66,10 @@ pub enum BucketBackendDispatch { #[async_trait] impl keyvalue::HostBucket for crate::ctx::Context { - async fn open_bucket( + async fn open( &mut self, name: String, - ) -> wasmtime::Result, Resource>> { + ) -> Result, Resource> { let module_name = self .kv_ctx .module_name @@ -72,41 +79,25 @@ impl keyvalue::HostBucket for crate::ctx::Context { let bucket = match self.kv_ctx.storage.open(&name, module_name).await { Ok(bucket) => bucket, Err(error) => { - error!(?error, "failed to open bucket"); - return Ok(Err(Resource::new_own(0))); + error!(?error, %module_name, %name, "failed to open bucket"); + return Err(Resource::new_own(0)); } }; let idx = self.kv_ctx.buckets.insert(bucket); - Ok(Ok(Resource::new_own(idx as u32))) - } - - fn drop(&mut self, rep: Resource) -> wasmtime::Result<()> { - self.kv_ctx.buckets.remove(rep.rep() as usize); - Ok(()) + Ok(Resource::new_own(idx as u32)) } -} -#[async_trait] -impl keyvalue::HostError for crate::ctx::Context { - fn drop(&mut self, _rep: Resource) -> wasmtime::Result<()> { - Ok(()) - } -} - -#[async_trait] -impl keyvalue::Host for crate::ctx::Context { async fn get( &mut self, bucket: Resource, key: String, - ) -> wasmtime::Result>, Resource>> { - let bucket = &self.kv_ctx.buckets[bucket.rep() as usize]; - match bucket.get(&key).await { - Ok(val) => Ok(Ok(val)), + ) -> Result>, Resource> { + match get_bucket(self, &bucket).get(&key).await { + Ok(value) => Ok(value), Err(error) => { error!(?error, %key, "failed to get key from storage"); - Ok(Err(Resource::new_own(0))) + Err(Resource::new_own(0)) } } } @@ -116,13 +107,12 @@ impl keyvalue::Host for crate::ctx::Context { bucket: Resource, key: String, value: Vec, - ) -> wasmtime::Result>> { - let bucket = &self.kv_ctx.buckets[bucket.rep() as usize]; - match bucket.set(&key, &value).await { - Ok(()) => Ok(Ok(())), + ) -> Result<(), Resource> { + match get_bucket(self, &bucket).set(&key, &value).await { + Ok(value) => Ok(value), Err(error) => { error!(?error, %key, "failed to set key in storage"); - Ok(Err(Resource::new_own(0))) + Err(Resource::new_own(0)) } } } @@ -131,13 +121,12 @@ impl keyvalue::Host for crate::ctx::Context { &mut self, bucket: Resource, key: String, - ) -> wasmtime::Result>> { - let bucket = &self.kv_ctx.buckets[bucket.rep() as usize]; - match bucket.delete(&key).await { - Ok(()) => Ok(Ok(())), + ) -> Result<(), Resource> { + match get_bucket(self, &bucket).delete(&key).await { + Ok(value) => Ok(value), Err(error) => { error!(?error, %key, "failed to delete key from storage"); - Ok(Err(Resource::new_own(0))) + Err(Resource::new_own(0)) } } } @@ -146,14 +135,28 @@ impl keyvalue::Host for crate::ctx::Context { &mut self, bucket: Resource, key: String, - ) -> wasmtime::Result>> { - let bucket = &self.kv_ctx.buckets[bucket.rep() as usize]; - match bucket.exists(&key).await { - Ok(exists) => Ok(Ok(exists)), + ) -> Result> { + match get_bucket(self, &bucket).exists(&key).await { + Ok(value) => Ok(value), Err(error) => { error!(?error, %key, "failed to check existence of key in storage"); - Ok(Err(Resource::new_own(0))) + Err(Resource::new_own(0)) } } } + + fn drop(&mut self, rep: Resource) -> wasmtime::Result<()> { + self.kv_ctx.buckets.remove(rep.rep() as usize); + Ok(()) + } +} + +#[async_trait] +impl keyvalue::HostError for crate::ctx::Context { + fn drop(&mut self, _rep: Resource) -> wasmtime::Result<()> { + Ok(()) + } } + +#[async_trait] +impl keyvalue::Host for crate::ctx::Context {} diff --git a/crates/kitsune-wasm-mrf/src/kv_storage/redis.rs b/crates/kitsune-wasm-mrf/src/kv_storage/redis.rs index 09937c08f..66bd353fe 100644 --- a/crates/kitsune-wasm-mrf/src/kv_storage/redis.rs +++ b/crates/kitsune-wasm-mrf/src/kv_storage/redis.rs @@ -1,4 +1,4 @@ -use super::BoxError; +use color_eyre::eyre; use fred::{clients::RedisPool, interfaces::HashesInterface}; use kitsune_derive::typed_builder::TypedBuilder; @@ -12,7 +12,7 @@ pub struct RedisBackend { impl super::Backend for RedisBackend { type Bucket = RedisBucketBackend; - async fn open(&self, module_name: &str, name: &str) -> Result { + async fn open(&self, module_name: &str, name: &str) -> eyre::Result { Ok(RedisBucketBackend { name: format!("{REDIS_NAMESPACE}:{module_name}:{name}"), pool: self.pool.clone(), @@ -26,19 +26,19 @@ pub struct RedisBucketBackend { } impl super::BucketBackend for RedisBucketBackend { - async fn exists(&self, key: &str) -> Result { + async fn exists(&self, key: &str) -> eyre::Result { self.pool.hexists(&self.name, key).await.map_err(Into::into) } - async fn delete(&self, key: &str) -> Result<(), BoxError> { + async fn delete(&self, key: &str) -> eyre::Result<()> { self.pool.hdel(&self.name, key).await.map_err(Into::into) } - async fn get(&self, key: &str) -> Result>, BoxError> { + async fn get(&self, key: &str) -> eyre::Result>> { self.pool.hget(&self.name, key).await.map_err(Into::into) } - async fn set(&self, key: &str, value: &[u8]) -> Result<(), BoxError> { + async fn set(&self, key: &str, value: &[u8]) -> eyre::Result<()> { self.pool .hset(&self.name, (key, value)) .await diff --git a/crates/kitsune-wasm-mrf/src/logging.rs b/crates/kitsune-wasm-mrf/src/logging.rs index 82ca56eea..152f4e49d 100644 --- a/crates/kitsune-wasm-mrf/src/logging.rs +++ b/crates/kitsune-wasm-mrf/src/logging.rs @@ -15,12 +15,7 @@ macro_rules! event_dispatch { #[async_trait] impl logging::Host for crate::ctx::Context { - async fn log( - &mut self, - level: Level, - context: String, - message: String, - ) -> wasmtime::Result<()> { + async fn log(&mut self, level: Level, context: String, message: String) { event_dispatch!(level, context, message, { Level::Trace => tracing::Level::TRACE, Level::Debug => tracing::Level::DEBUG, @@ -29,7 +24,5 @@ impl logging::Host for crate::ctx::Context { Level::Error => tracing::Level::ERROR, Level::Critical => tracing::Level::ERROR, }); - - Ok(()) } } diff --git a/crates/kitsune-wasm-mrf/tests/example_mrf.component.wasm b/crates/kitsune-wasm-mrf/tests/example_mrf.component.wasm index f976d17d4..2c3c3106b 100755 Binary files a/crates/kitsune-wasm-mrf/tests/example_mrf.component.wasm and b/crates/kitsune-wasm-mrf/tests/example_mrf.component.wasm differ diff --git a/crates/kitsune-wasm-mrf/wit/mrf.wit b/crates/kitsune-wasm-mrf/wit/mrf.wit index f365f1922..6a9d19909 100644 --- a/crates/kitsune-wasm-mrf/wit/mrf.wit +++ b/crates/kitsune-wasm-mrf/wit/mrf.wit @@ -10,22 +10,22 @@ interface keyvalue { /// Logical collection of Key-Value pairs resource bucket { /// Open or create a new bucket - open-bucket: static func(name: string) -> result; - } + open: static func(name: string) -> result; - /// Get a value from a bucket - get: func(bucket: borrow, key: string) -> result>, error>; + /// Get a value from a bucket + get: func(key: string) -> result>, error>; - /// Set the value inside a bucket - /// - /// Overwrites existing values - set: func(bucket: borrow, key: string, value: list) -> result<_, error>; + /// Set the value inside a bucket + /// + /// Overwrites existing values silently + set: func(key: string, value: list) -> result<_, error>; - /// Delete the value from a bucket - delete: func(bucket: borrow, key: string) -> result<_, error>; + /// Delete the value from a bucket + delete: func(key: string) -> result<_, error>; - /// Check if a key exists in the bucket - exists: func(bucket: borrow, key: string) -> result; + /// Check if a key exists in the bucket + exists: func(key: string) -> result; + } } interface types { diff --git a/lib/mrf-manifest/Cargo.toml b/lib/mrf-manifest/Cargo.toml index c38e9f937..6830c6c17 100644 --- a/lib/mrf-manifest/Cargo.toml +++ b/lib/mrf-manifest/Cargo.toml @@ -13,13 +13,13 @@ semver = { version = "1.0.23", features = ["serde"] } serde = { version = "1.0.202", features = ["derive"] } serde_json = { version = "1.0.117", optional = true } thiserror = { version = "1.0.61", optional = true } -wasm-encoder = { version = "0.208.0", optional = true } -wasmparser = { version = "0.208.0", optional = true } +wasm-encoder = { version = "0.208.1", optional = true } +wasmparser = { version = "0.208.1", optional = true } [dev-dependencies] serde_json = "1.0.117" insta = { version = "1.39.0", default-features = false, features = ["json"] } -wat = "1.208.0" +wat = "1.208.1" [features] decode = ["dep:leb128", "dep:serde_json", "dep:thiserror", "dep:wasmparser"] diff --git a/lib/mrf-tool/Cargo.toml b/lib/mrf-tool/Cargo.toml index b49cbb7fe..3d29787a6 100644 --- a/lib/mrf-tool/Cargo.toml +++ b/lib/mrf-tool/Cargo.toml @@ -15,11 +15,11 @@ mrf-manifest = { path = "../mrf-manifest", features = [ "serialise", ] } serde_json = "1.0.117" -wasmparser = "0.208.0" +wasmparser = "0.208.1" [lints] workspace = true [dev-dependencies] serde_json = "1.0.117" -wat = "1.208.0" +wat = "1.208.1"