diff --git a/Cargo.lock b/Cargo.lock index 9b1e9966..c842a1cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -45,9 +45,9 @@ checksum = "ec8ad6edb4840b78c5c3d88de606b22252d552b55f3a4699fbb10fc070ec3049" [[package]] name = "anyhow" -version = "1.0.65" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602" +checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" [[package]] name = "arrayvec" @@ -57,9 +57,9 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] name = "async-trait" -version = "0.1.57" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f" +checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" dependencies = [ "proc-macro2", "quote", @@ -85,9 +85,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "base64" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "bincode" @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.0" +version = "3.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" +checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" [[package]] name = "byteorder" @@ -146,7 +146,7 @@ dependencies = [ "cap-primitives", "cap-std", "io-lifetimes", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -163,7 +163,7 @@ dependencies = [ "maybe-owned", "rustix", "winapi-util", - "windows-sys", + "windows-sys 0.36.1", "winx", ] @@ -204,9 +204,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.73" +version = "1.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574" dependencies = [ "jobserver", ] @@ -219,9 +219,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.0.18" +version = "4.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335867764ed2de42325fafe6d18b8af74ba97ee0c590fa016f157535b42ab04b" +checksum = "8e67816e006b17427c9b4386915109b494fec2d929c63e3bd3561234cbf1bf1e" dependencies = [ "atty", "bitflags", @@ -290,25 +290,25 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5e1ee4c22871d24a95196ea7047d58c1d978e46c88037d3d397b3b3e0af360" +checksum = "e4d6bb61f78cc312fbdebbb8a11b5aea6c16355ee682c57b89914691f3d57d0d" dependencies = [ - "cranelift-entity 0.89.0", + "cranelift-entity 0.89.1", ] [[package]] name = "cranelift-codegen" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70f600a52d59eed56a85f33750873b3b42d61e35ca777cd792369893f9e1f9dd" +checksum = "b4f8572ccd8b99df7a8244d64feaa37f37877e47eccc245aa5e27f15dd336d7e" dependencies = [ "arrayvec", "bumpalo", "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", - "cranelift-entity 0.89.0", + "cranelift-entity 0.89.1", "cranelift-isle", "gimli", "log", @@ -319,18 +319,18 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8418218d0953d73e9b96e9d9ffec56145efa4f18988251530b5872ae4410563" +checksum = "15f2f284f49249a9fda931332f3feed56492651f47c330ffe1aa5a51f2b9d6b6" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f01be0cfd40aba59153236ab4b99062131b5bbe6f9f3d4bcb238bd2f96ff5262" +checksum = "8f6190411c55dfd88e68f506dfdbd028da0551dca40793d40811ea03cb6e0f4a" [[package]] name = "cranelift-entity" @@ -340,18 +340,18 @@ checksum = "0b65673279d75d34bf11af9660ae2dbd1c22e6d28f163f5c72f4e1dc56d56103" [[package]] name = "cranelift-entity" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddae4fec5d6859233ffa175b61d269443c473b3971a2c3e69008c8d3e83d5825" +checksum = "ed8aa1104f54509dfb386520711cd8a6a0992ae42ce2df06fdebdfff4de2c2dd" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cc3deb0df97748434cf9f7e404f1f5134f6a253fc9a6bca25c5cd6804c08d3" +checksum = "d48087600d6c055f625754b1d9cc9cab36a0d26a365cbcb388825e331e0041ff" dependencies = [ "cranelift-codegen", "log", @@ -361,18 +361,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc3bb54287de9c36ba354eb849fefb77b5e73955058745fd08f12cfdfa181866" -dependencies = [ - "rayon", -] +checksum = "eead4df80ce3c68b913d071683790692a0316a67e3518b32e273169238876f0a" [[package]] name = "cranelift-native" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8c2a4f2efdce1de1f94e74f12b3b4144e3bcafa6011338b87388325d72d2120" +checksum = "3adde571ff9c6a77320b69ac03920c5ce70fed94f5f9ac53f5c0600a69fc142e" dependencies = [ "cranelift-codegen", "libc", @@ -381,12 +378,12 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f918c37eb01f5b5ccc632e0ef3b4bf9ee03b5d4c267d3d2d3b62720a6bce0180" +checksum = "5ebe9c1a3e90365d3dfa8cf12899cd96e4da327ef37ad58e060a93705ddf5937" dependencies = [ "cranelift-codegen", - "cranelift-entity 0.89.0", + "cranelift-entity 0.89.1", "cranelift-frontend", "itertools", "log", @@ -545,9 +542,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastly-shared" -version = "0.8.7" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "238fb7af2219391cb024673302861adffd96cb3dbe4b602c2c7abef11ce5a5f9" +checksum = "6f79939bdbbab8b1de759d584f386319454f8623681400675a07f9ad35f2b158" dependencies = [ "bitflags", "http", @@ -606,14 +603,14 @@ checksum = "a267b6a9304912e018610d53fe07115d8b530b160e85db4d2d3a59f3ddde1aec" dependencies = [ "io-lifetimes", "rustix", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "futures" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c" +checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" dependencies = [ "futures-channel", "futures-core", @@ -626,9 +623,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" dependencies = [ "futures-core", "futures-sink", @@ -636,15 +633,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" [[package]] name = "futures-executor" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab" +checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" dependencies = [ "futures-core", "futures-task", @@ -653,15 +650,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" +checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" [[package]] name = "futures-macro" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" +checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" dependencies = [ "proc-macro2", "quote", @@ -670,21 +667,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" [[package]] name = "futures-task" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" [[package]] name = "futures-util" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" dependencies = [ "futures-channel", "futures-core", @@ -719,9 +716,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", "libc", @@ -741,9 +738,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" dependencies = [ "bytes", "fnv", @@ -833,9 +830,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.20" +version = "0.14.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" +checksum = "abfba89e19b959ca163c7752ba59d737c1ceea53a5d31a149c805446fc958064" dependencies = [ "bytes", "futures-channel", @@ -892,17 +889,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5d8c2ab5becd8720e30fd25f8fa5500d8dc3fceadd8378f05859bd7b46fc49" dependencies = [ "io-lifetimes", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "io-lifetimes" -version = "0.7.3" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ea37f355c05dde75b84bba2d767906ad522e97cd9e2eef2be7a4ab7fb442c06" +checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -920,7 +917,7 @@ dependencies = [ "hermit-abi 0.2.6", "io-lifetimes", "rustix", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -990,9 +987,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.135" +version = "0.2.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c" +checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" [[package]] name = "linux-raw-sys" @@ -1078,14 +1075,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" dependencies = [ "libc", "log", "wasi", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -1100,9 +1097,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" dependencies = [ "hermit-abi 0.1.19", "libc", @@ -1122,9 +1119,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" [[package]] name = "opaque-debug" @@ -1162,15 +1159,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -1350,9 +1347,9 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69025b4a161879ba90719837c06621c3d73cffa147a000aeacf458f6a9572485" +checksum = "91b2eab54204ea0117fe9a060537e0b07a4e72f7c7d182361ecc346cab2240e5" dependencies = [ "fxhash", "log", @@ -1418,9 +1415,9 @@ checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" [[package]] name = "rustix" -version = "0.35.11" +version = "0.35.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbb2fda4666def1433b1b05431ab402e42a1084285477222b72d6c564c417cef" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" dependencies = [ "bitflags", "errno", @@ -1429,7 +1426,7 @@ dependencies = [ "libc", "linux-raw-sys", "once_cell", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -1470,7 +1467,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" dependencies = [ "lazy_static", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -1529,18 +1526,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.145" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b" +checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.145" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c" +checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" dependencies = [ "proc-macro2", "quote", @@ -1549,9 +1546,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41feea4228a6f1cd09ec7a3593a682276702cd67b5273544757dae23c096f074" +checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" dependencies = [ "itoa", "ryu", @@ -1649,9 +1646,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.102" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1" +checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" dependencies = [ "proc-macro2", "quote", @@ -1670,7 +1667,7 @@ dependencies = [ "cap-std", "io-lifetimes", "rustix", - "windows-sys", + "windows-sys 0.36.1", "winx", ] @@ -2035,9 +2032,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi-cap-std-sync" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fa9ddcfc9d85e89a10c27801376ea57d2e9421ad91336326160c56044049b49" +checksum = "ea3e0d556c3f9c2481c2d15eee7ad4b0b25db206d034aa80b16ff1299e7cd679" dependencies = [ "anyhow", "async-trait", @@ -2054,14 +2051,14 @@ dependencies = [ "system-interface", "tracing", "wasi-common", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "wasi-common" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd86a0cd870709441a25d63737bd416db6cf8eb6229c0da08d29d7ab79108bbb" +checksum = "5e924b71f77144f65e173478d43be57ee9e16a9b8f7b8a41223b689051b3c176" dependencies = [ "anyhow", "bitflags", @@ -2072,14 +2069,14 @@ dependencies = [ "thiserror", "tracing", "wiggle", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "wasi-tokio" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50eae69cf1ad9de30bb7d604c5433d38d2aec1e32dac6bc89ef30ab7a0860381" +checksum = "a2ab5198e9d48ad1991c507eef9a4dca953ed0077fc1597b09e808cae74c05b5" dependencies = [ "anyhow", "cap-std", @@ -2148,9 +2145,9 @@ checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" [[package]] name = "wasm-encoder" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c64ac98d5d61192cc45c701b7e4bd0b9aff91e2edfc7a088406cfe2288581e2c" +checksum = "c5816e88e8ea7335016aa62eb0485747f786136d505a9b3890f8c400211d9b5f" dependencies = [ "leb128", ] @@ -2166,9 +2163,9 @@ dependencies = [ [[package]] name = "wasmtime" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fc5bb3329415030796cfa5530b2481ccef5c4f1e5150733ba94318ab004fe1" +checksum = "63e4f0c3cbaed050686095e5fde04f28eada1ef6196b456ffce7df2115cc2a38" dependencies = [ "anyhow", "async-trait", @@ -2192,23 +2189,23 @@ dependencies = [ "wasmtime-jit", "wasmtime-runtime", "wat", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "wasmtime-asm-macros" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db36545ff0940ad9bf4e9ab0ec2a4e1eaa5ebe2aa9227bcbc4af905375d9e482" +checksum = "41f17b9bf1ff3ed08f35dd3faa8fe0dc34693939252e47a3a056073d28fcd6d7" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-cache" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c2101b211d9db7db8bcfb2ffa69e119fa99a20266d0e5f19bb989cb6c3280d7" +checksum = "ba1bfca72e269de2b96dc77a8fe64816d9cc6c6ad416a3aba9a51f4ff6bcefc1" dependencies = [ "anyhow", "base64", @@ -2220,19 +2217,19 @@ dependencies = [ "serde", "sha2", "toml", - "windows-sys", + "windows-sys 0.36.1", "zstd", ] [[package]] name = "wasmtime-cranelift" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0409e93b5eceaa4e5f498a4bce1cffc7ebe071d14582b5437c10af4aecc23f54" +checksum = "d4d237bf7d2bcaea5e8018e088668e80b4448e002667d58c414fdcbb8f56ba0e" dependencies = [ "anyhow", "cranelift-codegen", - "cranelift-entity 0.89.0", + "cranelift-entity 0.89.1", "cranelift-frontend", "cranelift-native", "cranelift-wasm", @@ -2247,12 +2244,12 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55240389c604f68d2e1d2573d7d3740246ab9ea2fa4fe79e10ccd51faf9b9500" +checksum = "c432df5094f397e43467eca9775254850231d9047b3513a8e1f28a5778a90dfc" dependencies = [ "anyhow", - "cranelift-entity 0.89.0", + "cranelift-entity 0.89.1", "gimli", "indexmap", "log", @@ -2266,22 +2263,22 @@ dependencies = [ [[package]] name = "wasmtime-fiber" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb9b7b94f7b40d98665feca2338808cf449fa671d01be7176861f8d9aa4a012" +checksum = "331439bc204d5395b89a018d5aa11aaeb5819c733db40fe8bd1d4ce88bf85be1" dependencies = [ "cc", "cfg-if", "rustix", "wasmtime-asm-macros", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "wasmtime-jit" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc15e285b7073ee566e62ea4b6dd38b80465ade0ea8cd4cee13c7ac2e295cfca" +checksum = "f0e1f06e0ab975f0e9dd6b2db9364209272625d5348d02b0b846cf62f102e89c" dependencies = [ "addr2line", "anyhow", @@ -2300,14 +2297,14 @@ dependencies = [ "wasmtime-environ", "wasmtime-jit-debug", "wasmtime-runtime", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "wasmtime-jit-debug" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bee06d206bcf7a875eacd1e1e957c2a63f64a92934d2535dd8e15cde6d3a9ffe" +checksum = "07ca7aeb81909fc7688e1318fc247de2fb7ef2b638aa7501b45f7f6ad710f989" dependencies = [ "object", "once_cell", @@ -2316,9 +2313,9 @@ dependencies = [ [[package]] name = "wasmtime-runtime" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9969ff36cbf57f18c2d24679db57d0857ea7cc7d839534afc26ecc8003e9914b" +checksum = "16069dff65b648d121d9b5ecbeb7319035f9a5aafd370d713c90a7f23db4d823" dependencies = [ "anyhow", "cc", @@ -2337,16 +2334,16 @@ dependencies = [ "wasmtime-environ", "wasmtime-fiber", "wasmtime-jit-debug", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "wasmtime-types" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df64c737fc9b3cdf7617bcc65e8b97cb713ceb9c9c58530b20788a8a3482b5d1" +checksum = "8926344aff6324e6469aa17345bbb29ef9de4fe934bde30a05be28ebf21e0a23" dependencies = [ - "cranelift-entity 0.89.0", + "cranelift-entity 0.89.1", "serde", "thiserror", "wasmparser", @@ -2354,9 +2351,9 @@ dependencies = [ [[package]] name = "wasmtime-wasi" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb41d16dfd153d2078ea2347d311cee6c74f2a4ecc109cd9acaf860709137fdb" +checksum = "26e67b408714dc3fe9f7eaab091a45b9bbfed9f983bd16e0dc209fa4456d903f" dependencies = [ "anyhow", "wasi-cap-std-sync", @@ -2377,9 +2374,9 @@ dependencies = [ [[package]] name = "wast" -version = "47.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b98502f3978adea49551e801a6687678e6015317d7d9470a67fe813393f2a8" +checksum = "84825b5ac7164df8260c9e2b2e814075334edbe7ac426f2469b93a5eeac23cce" dependencies = [ "leb128", "memchr", @@ -2389,11 +2386,11 @@ dependencies = [ [[package]] name = "wat" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aab4e20c60429fbba9670a6cae0fff9520046ba0aa3e6d0b1cd2653bea14898" +checksum = "129da4a03ec6d2a815f42c88f641824e789d5be0d86d2f90aa8a218c7068e0be" dependencies = [ - "wast 47.0.1", + "wast 48.0.0", ] [[package]] @@ -2418,9 +2415,9 @@ dependencies = [ [[package]] name = "wiggle" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2943156975c608cab1b44d28becba4196b07f18be92ea28f1e7f3372a12d81dd" +checksum = "d55b0d7302192e47c1c2b1706790dab42cd42342ac58c4acb3d589daf56cddf0" dependencies = [ "anyhow", "async-trait", @@ -2434,9 +2431,9 @@ dependencies = [ [[package]] name = "wiggle-generate" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0321263a6b1ba1e0a97174524891a14907cee68cfa183fd5389088dffbeab668" +checksum = "e164de81eea233c6b4e430e6cba4ff3953e3594fd0068633651994a5f0750a0a" dependencies = [ "anyhow", "heck", @@ -2449,9 +2446,9 @@ dependencies = [ [[package]] name = "wiggle-macro" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa3d3794e5d68ef69f30e65f267c6bf18c920750d3ccd2a3ac04e77d95f66b96" +checksum = "829a1543aa92a51f64e38f1dfcf16adfe447aefff3a2c281cf8ddf35c9797255" dependencies = [ "proc-macro2", "quote", @@ -2496,43 +2493,100 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" dependencies = [ - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_msvc", + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", +] + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.0", + "windows_i686_gnu 0.42.0", + "windows_i686_msvc 0.42.0", + "windows_x86_64_gnu 0.42.0", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.0", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + [[package]] name = "windows_aarch64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" + [[package]] name = "windows_i686_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +[[package]] +name = "windows_i686_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" + [[package]] name = "windows_i686_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +[[package]] +name = "windows_i686_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" + [[package]] name = "windows_x86_64_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" + [[package]] name = "windows_x86_64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" + [[package]] name = "winx" version = "0.33.0" @@ -2541,7 +2595,7 @@ checksum = "b7b01e010390eb263a4518c8cebf86cb67469d1511c00b749a47b64c39e8054d" dependencies = [ "bitflags", "io-lifetimes", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] diff --git a/cli/tests/integration/async_io.rs b/cli/tests/integration/async_io.rs new file mode 100644 index 00000000..77af6f63 --- /dev/null +++ b/cli/tests/integration/async_io.rs @@ -0,0 +1,230 @@ +use crate::common::Test; +use crate::common::TestResult; +use hyper::Body; +use hyper::Request; +use hyper::Response; +use hyper::StatusCode; +use std::sync::atomic::AtomicUsize; +use std::sync::atomic::Ordering; +use std::sync::Arc; +use tokio::sync::Barrier; + +// On Windows, streaming body backpressure doesn't seem to work as expected, either +// due to the Hyper client or server too eagerly clearing the chunk buffer. This issue does +// not appear related to async I/O hostcalls; the behavior is seen within the streaming body +// implementation in general. For the time being, this test is unix-only. +// +// https://github.com/fastly/Viceroy/issues/207 tracks the broader issue. +#[cfg(target_family = "unix")] +#[tokio::test(flavor = "multi_thread")] +async fn async_io_methods() -> TestResult { + let request_count = Arc::new(AtomicUsize::new(0)); + let req_count_1 = request_count.clone(); + let req_count_2 = request_count.clone(); + let req_count_3 = request_count.clone(); + + let barrier = Arc::new(Barrier::new(3)); + let barrier_1 = barrier.clone(); + let barrier_2 = barrier.clone(); + + let test = Test::using_fixture("async_io.wasm") + .backend("Simple", "http://127.0.0.1:9000/", None) + .async_host(9000, move |req: Request| { + assert_eq!(req.headers()["Host"], "simple.org"); + let req_count_1 = req_count_1.clone(); + let barrier_1 = barrier_1.clone(); + Box::new(async move { + match req_count_1.load(Ordering::Relaxed) { + 0 => { + barrier_1.wait().await; + Response::builder() + .status(StatusCode::OK) + .body(Body::empty()) + .unwrap() + } + 1 => Response::builder() + .status(StatusCode::OK) + .body(Body::empty()) + .unwrap(), + 2 => { + barrier_1.wait().await; + Response::builder() + .status(StatusCode::OK) + .body(Body::empty()) + .unwrap() + } + 3 => { + barrier_1.wait().await; + Response::builder() + .status(StatusCode::OK) + .body(Body::empty()) + .unwrap() + } + _ => unreachable!(), + } + }) + }) + .backend("ReadBody", "http://127.0.0.1:9001/", None) + .async_host(9001, move |req: Request| { + assert_eq!(req.headers()["Host"], "readbody.org"); + let req_count_2 = req_count_2.clone(); + Box::new(async move { + match req_count_2.load(Ordering::Relaxed) { + 0 => Response::builder() + .header("Transfer-Encoding", "chunked") + .status(StatusCode::OK) + .body(Body::empty()) + .unwrap(), + 1 => Response::builder() + .header("Transfer-Encoding", "chunked") + .status(StatusCode::OK) + .body(Body::empty()) + .unwrap(), + 2 => Response::builder() + .status(StatusCode::OK) + .body(Body::empty()) + .unwrap(), + 3 => Response::builder() + .header("Transfer-Encoding", "chunked") + .status(StatusCode::OK) + .body(Body::empty()) + .unwrap(), + _ => unreachable!(), + } + }) + }) + .backend("WriteBody", "http://127.0.0.1:9002/", None) + .async_host(9002, move |req: Request| { + assert_eq!(req.headers()["Host"], "writebody.org"); + let req_count_3 = req_count_3.clone(); + let barrier_2 = barrier_2.clone(); + Box::new(async move { + match req_count_3.load(Ordering::Relaxed) { + 0 => { + barrier_2.wait().await; + Response::builder() + .status(StatusCode::OK) + .body(Body::empty()) + .unwrap() + } + 1 => { + barrier_2.wait().await; + Response::builder() + .status(StatusCode::OK) + .body(Body::empty()) + .unwrap() + } + 2 => { + barrier_2.wait().await; + Response::builder() + .status(StatusCode::OK) + .body(Body::empty()) + .unwrap() + } + 3 => { + let _body = hyper::body::to_bytes(req.into_body()).await; + Response::builder() + .status(StatusCode::OK) + .body(Body::empty()) + .unwrap() + } + _ => unreachable!(), + } + }) + }); + + // request_count is 0 here + let resp = test + .against( + Request::builder() + .header("Host", "example.org") + .body(Body::empty()) + .unwrap(), + ) + .await; + + assert_eq!(resp.status(), StatusCode::OK); + assert_eq!(resp.headers()["Simple-Ready"], "false"); + assert_eq!(resp.headers()["Read-Ready"], "false"); + assert_eq!(resp.headers()["Write-Ready"], "false"); + assert_eq!(resp.headers()["Ready-Index"], "timeout"); + + barrier.wait().await; + + request_count.store(1, Ordering::Relaxed); + let resp = test + .against( + Request::builder() + .header("Host", "example.org") + .body(Body::empty()) + .unwrap(), + ) + .await; + assert_eq!(resp.status(), StatusCode::OK); + assert_eq!(resp.headers()["Simple-Ready"], "true"); + assert_eq!(resp.headers()["Read-Ready"], "false"); + assert_eq!(resp.headers()["Write-Ready"], "false"); + assert_eq!(resp.headers()["Ready-Index"], "0"); + let temp_barrier = barrier.clone(); + let _task = tokio::task::spawn(async move { temp_barrier.wait().await }); + barrier.wait().await; + + request_count.store(2, Ordering::Relaxed); + let resp = test + .against( + Request::builder() + .header("Host", "example.org") + .body(Body::empty()) + .unwrap(), + ) + .await; + assert_eq!(resp.status(), StatusCode::OK); + assert_eq!(resp.headers()["Simple-Ready"], "false"); + assert_eq!(resp.headers()["Read-Ready"], "true"); + assert_eq!(resp.headers()["Write-Ready"], "false"); + assert_eq!(resp.headers()["Ready-Index"], "1"); + barrier.wait().await; + + request_count.store(3, Ordering::Relaxed); + let resp = test + .against( + Request::builder() + .header("Host", "example.org") + .body(Body::empty()) + .unwrap(), + ) + .await; + assert_eq!(resp.status(), StatusCode::OK); + assert_eq!(resp.headers()["Simple-Ready"], "false"); + assert_eq!(resp.headers()["Read-Ready"], "false"); + assert_eq!(resp.headers()["Write-Ready"], "true"); + assert_eq!(resp.headers()["Ready-Index"], "2"); + let temp_barrier = barrier.clone(); + let _task = tokio::task::spawn(async move { temp_barrier.wait().await }); + barrier.wait().await; + + let resp = test + .against( + Request::builder() + .header("Host", "example.org") + .header("Empty-Select-Timeout", "0") + .body(Body::empty()) + .unwrap(), + ) + .await; + assert_eq!(resp.status(), StatusCode::INTERNAL_SERVER_ERROR); + + let resp = test + .against( + Request::builder() + .header("Host", "example.org") + .header("Empty-Select-Timeout", "1") + .body(Body::empty()) + .unwrap(), + ) + .await; + assert_eq!(resp.status(), StatusCode::OK); + assert_eq!(resp.headers()["Ready-Index"], "timeout"); + + Ok(()) +} diff --git a/cli/tests/integration/common.rs b/cli/tests/integration/common.rs index 50dbc304..3e3e097d 100644 --- a/cli/tests/integration/common.rs +++ b/cli/tests/integration/common.rs @@ -3,7 +3,7 @@ use futures::stream::StreamExt; use hyper::{service, Body as HyperBody, Request, Response, Server}; -use std::{convert::Infallible, net::SocketAddr, path::PathBuf, sync::Arc}; +use std::{convert::Infallible, future::Future, net::SocketAddr, path::PathBuf, sync::Arc}; use tokio::sync::Mutex; use tracing_subscriber::filter::EnvFilter; use viceroy_lib::{ @@ -126,7 +126,17 @@ impl Test { HostFn: Fn(Request>) -> Response>, HostFn: Send + Sync + 'static, { - let service = Arc::new(service); + let service = Arc::new(TestService::Sync(Arc::new(service))); + self.hosts.push(HostSpec { port, service }); + self + } + + pub fn async_host(mut self, port: u16, service: HostFn) -> Self + where + HostFn: Fn(Request) -> AsyncResp, + HostFn: Send + Sync + 'static, + { + let service = Arc::new(TestService::Async(Arc::new(service))); self.hosts.push(HostSpec { port, service }); self } @@ -273,7 +283,7 @@ impl Test { /// The specification of a mock host, as part of a `Test` builder. struct HostSpec { port: u16, - service: Arc>) -> Response> + Send + Sync>, + service: Arc, } /// A handle to a running mock host, used to gracefully shut down the host on test completion. @@ -292,21 +302,26 @@ impl HostSpec { // we transform `service` into an async function that consumes Hyper bodies. that requires a bit // of `Arc` and `move` operations because each invocation needs to produce a distinct `Future` let async_service = Arc::new(move |req: Request| { - let (parts, body) = req.into_parts(); - let mut body = Box::new(body); // for pinning let service = service.clone(); async move { - // read out all of the bytes from the body into a vector, then re-assemble the request - let mut body_bytes = Vec::new(); - while let Some(chunk) = body.next().await { - body_bytes.extend_from_slice(&chunk.unwrap()); - } - let req = Request::from_parts(parts, body_bytes); - - // pass the request through the host function, then convert its body into the form - // that Hyper wants - let resp = service(req).map(HyperBody::from); + let resp = match &*service { + TestService::Sync(s) => { + let (parts, body) = req.into_parts(); + let mut body = Box::new(body); // for pinning + // read out all of the bytes from the body into a vector, then re-assemble the request + let mut body_bytes = Vec::new(); + while let Some(chunk) = body.next().await { + body_bytes.extend_from_slice(&chunk.unwrap()); + } + let req = Request::from_parts(parts, body_bytes); + + // pass the request through the host function, then convert its body into the form + // that Hyper wants + s(req).map(HyperBody::from) + } + TestService::Async(s) => Box::into_pin(s(req)).await.map(HyperBody::from), + }; let res: Result<_, hyper::Error> = Ok(resp); res @@ -345,8 +360,16 @@ impl HostHandle { self.terminate_signal .send(()) .expect("could not send terminate signal to mock host"); - self.task_handle - .await - .expect("mock host did not terminate cleanly") + if !self.task_handle.is_finished() { + self.task_handle.abort(); + } } } + +#[derive(Clone)] +pub enum TestService { + Sync(Arc>) -> Response> + Send + Sync>), + Async(Arc) -> AsyncResp + Send + Sync>), +} + +type AsyncResp = Box> + Send + Sync>; diff --git a/cli/tests/integration/main.rs b/cli/tests/integration/main.rs index 10790c23..60e9b2c2 100644 --- a/cli/tests/integration/main.rs +++ b/cli/tests/integration/main.rs @@ -1,3 +1,4 @@ +mod async_io; mod body; mod common; mod dictionary_lookup; diff --git a/cli/tests/trap-test/Cargo.lock b/cli/tests/trap-test/Cargo.lock index d2952ffd..9e154805 100644 --- a/cli/tests/trap-test/Cargo.lock +++ b/cli/tests/trap-test/Cargo.lock @@ -63,9 +63,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.65" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602" +checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" [[package]] name = "arrayvec" @@ -75,9 +75,9 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] name = "async-trait" -version = "0.1.57" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f" +checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" dependencies = [ "proc-macro2", "quote", @@ -103,9 +103,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "base64" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "bincode" @@ -133,9 +133,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.0" +version = "3.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" +checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" [[package]] name = "byteorder" @@ -164,7 +164,7 @@ dependencies = [ "cap-primitives", "cap-std", "io-lifetimes", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -181,7 +181,7 @@ dependencies = [ "maybe-owned", "rustix", "winapi-util", - "windows-sys", + "windows-sys 0.36.1", "winx", ] @@ -222,9 +222,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.73" +version = "1.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574" dependencies = [ "jobserver", ] @@ -293,25 +293,25 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5e1ee4c22871d24a95196ea7047d58c1d978e46c88037d3d397b3b3e0af360" +checksum = "e4d6bb61f78cc312fbdebbb8a11b5aea6c16355ee682c57b89914691f3d57d0d" dependencies = [ - "cranelift-entity 0.89.0", + "cranelift-entity 0.89.1", ] [[package]] name = "cranelift-codegen" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70f600a52d59eed56a85f33750873b3b42d61e35ca777cd792369893f9e1f9dd" +checksum = "b4f8572ccd8b99df7a8244d64feaa37f37877e47eccc245aa5e27f15dd336d7e" dependencies = [ "arrayvec", "bumpalo", "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", - "cranelift-entity 0.89.0", + "cranelift-entity 0.89.1", "cranelift-isle", "gimli", "log", @@ -322,18 +322,18 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8418218d0953d73e9b96e9d9ffec56145efa4f18988251530b5872ae4410563" +checksum = "15f2f284f49249a9fda931332f3feed56492651f47c330ffe1aa5a51f2b9d6b6" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f01be0cfd40aba59153236ab4b99062131b5bbe6f9f3d4bcb238bd2f96ff5262" +checksum = "8f6190411c55dfd88e68f506dfdbd028da0551dca40793d40811ea03cb6e0f4a" [[package]] name = "cranelift-entity" @@ -343,18 +343,18 @@ checksum = "0b65673279d75d34bf11af9660ae2dbd1c22e6d28f163f5c72f4e1dc56d56103" [[package]] name = "cranelift-entity" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddae4fec5d6859233ffa175b61d269443c473b3971a2c3e69008c8d3e83d5825" +checksum = "ed8aa1104f54509dfb386520711cd8a6a0992ae42ce2df06fdebdfff4de2c2dd" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cc3deb0df97748434cf9f7e404f1f5134f6a253fc9a6bca25c5cd6804c08d3" +checksum = "d48087600d6c055f625754b1d9cc9cab36a0d26a365cbcb388825e331e0041ff" dependencies = [ "cranelift-codegen", "log", @@ -364,18 +364,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc3bb54287de9c36ba354eb849fefb77b5e73955058745fd08f12cfdfa181866" -dependencies = [ - "rayon", -] +checksum = "eead4df80ce3c68b913d071683790692a0316a67e3518b32e273169238876f0a" [[package]] name = "cranelift-native" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8c2a4f2efdce1de1f94e74f12b3b4144e3bcafa6011338b87388325d72d2120" +checksum = "3adde571ff9c6a77320b69ac03920c5ce70fed94f5f9ac53f5c0600a69fc142e" dependencies = [ "cranelift-codegen", "libc", @@ -384,12 +381,12 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.89.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f918c37eb01f5b5ccc632e0ef3b4bf9ee03b5d4c267d3d2d3b62720a6bce0180" +checksum = "5ebe9c1a3e90365d3dfa8cf12899cd96e4da327ef37ad58e060a93705ddf5937" dependencies = [ "cranelift-codegen", - "cranelift-entity 0.89.0", + "cranelift-entity 0.89.1", "cranelift-frontend", "itertools", "log", @@ -452,9 +449,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f83d0ebf42c6eafb8d7c52f7e5f2d3003b89c7aa4fd2b79229209459a849af8" +checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" dependencies = [ "cc", "cxxbridge-flags", @@ -464,9 +461,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07d050484b55975889284352b0ffc2ecbda25c0c55978017c132b29ba0818a86" +checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" dependencies = [ "cc", "codespan-reporting", @@ -479,15 +476,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d2199b00553eda8012dfec8d3b1c75fce747cf27c169a270b3b99e3448ab78" +checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" [[package]] name = "cxxbridge-macro" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb67a6de1f602736dd7eaead0080cf3435df806c61b24b13328db128c58868f" +checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" dependencies = [ "proc-macro2", "quote", @@ -592,9 +589,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastly-shared" -version = "0.8.7" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "238fb7af2219391cb024673302861adffd96cb3dbe4b602c2c7abef11ce5a5f9" +checksum = "6f79939bdbbab8b1de759d584f386319454f8623681400675a07f9ad35f2b158" dependencies = [ "bitflags", "http", @@ -644,14 +641,14 @@ checksum = "a267b6a9304912e018610d53fe07115d8b530b160e85db4d2d3a59f3ddde1aec" dependencies = [ "io-lifetimes", "rustix", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "futures" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c" +checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" dependencies = [ "futures-channel", "futures-core", @@ -664,9 +661,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" dependencies = [ "futures-core", "futures-sink", @@ -674,15 +671,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" [[package]] name = "futures-executor" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab" +checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" dependencies = [ "futures-core", "futures-task", @@ -691,15 +688,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" +checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" [[package]] name = "futures-macro" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" +checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" dependencies = [ "proc-macro2", "quote", @@ -708,21 +705,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" [[package]] name = "futures-task" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" [[package]] name = "futures-util" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" dependencies = [ "futures-channel", "futures-core", @@ -757,9 +754,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", "libc", @@ -779,9 +776,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" dependencies = [ "bytes", "fnv", @@ -871,9 +868,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.20" +version = "0.14.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" +checksum = "abfba89e19b959ca163c7752ba59d737c1ceea53a5d31a149c805446fc958064" dependencies = [ "bytes", "futures-channel", @@ -895,9 +892,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.51" +version = "0.1.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -945,17 +942,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5d8c2ab5becd8720e30fd25f8fa5500d8dc3fceadd8378f05859bd7b46fc49" dependencies = [ "io-lifetimes", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "io-lifetimes" -version = "0.7.3" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ea37f355c05dde75b84bba2d767906ad522e97cd9e2eef2be7a4ab7fb442c06" +checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -973,7 +970,7 @@ dependencies = [ "hermit-abi 0.2.6", "io-lifetimes", "rustix", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -1043,9 +1040,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.135" +version = "0.2.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c" +checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" [[package]] name = "link-cplusplus" @@ -1140,14 +1137,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" dependencies = [ "libc", "log", "wasi", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -1171,9 +1168,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" dependencies = [ "hermit-abi 0.1.19", "libc", @@ -1193,9 +1190,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" [[package]] name = "opaque-debug" @@ -1221,15 +1218,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -1385,9 +1382,9 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69025b4a161879ba90719837c06621c3d73cffa147a000aeacf458f6a9572485" +checksum = "91b2eab54204ea0117fe9a060537e0b07a4e72f7c7d182361ecc346cab2240e5" dependencies = [ "fxhash", "log", @@ -1444,9 +1441,9 @@ checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" [[package]] name = "rustix" -version = "0.35.11" +version = "0.35.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbb2fda4666def1433b1b05431ab402e42a1084285477222b72d6c564c417cef" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" dependencies = [ "bitflags", "errno", @@ -1455,7 +1452,7 @@ dependencies = [ "libc", "linux-raw-sys", "once_cell", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -1496,7 +1493,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" dependencies = [ "lazy_static", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -1561,18 +1558,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.145" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b" +checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.145" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c" +checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" dependencies = [ "proc-macro2", "quote", @@ -1581,9 +1578,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41feea4228a6f1cd09ec7a3593a682276702cd67b5273544757dae23c096f074" +checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" dependencies = [ "itoa", "ryu", @@ -1675,9 +1672,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "syn" -version = "1.0.102" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1" +checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" dependencies = [ "proc-macro2", "quote", @@ -1696,7 +1693,7 @@ dependencies = [ "cap-std", "io-lifetimes", "rustix", - "windows-sys", + "windows-sys 0.36.1", "winx", ] @@ -2054,9 +2051,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi-cap-std-sync" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fa9ddcfc9d85e89a10c27801376ea57d2e9421ad91336326160c56044049b49" +checksum = "ea3e0d556c3f9c2481c2d15eee7ad4b0b25db206d034aa80b16ff1299e7cd679" dependencies = [ "anyhow", "async-trait", @@ -2073,14 +2070,14 @@ dependencies = [ "system-interface", "tracing", "wasi-common", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "wasi-common" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd86a0cd870709441a25d63737bd416db6cf8eb6229c0da08d29d7ab79108bbb" +checksum = "5e924b71f77144f65e173478d43be57ee9e16a9b8f7b8a41223b689051b3c176" dependencies = [ "anyhow", "bitflags", @@ -2091,14 +2088,14 @@ dependencies = [ "thiserror", "tracing", "wiggle", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "wasi-tokio" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50eae69cf1ad9de30bb7d604c5433d38d2aec1e32dac6bc89ef30ab7a0860381" +checksum = "a2ab5198e9d48ad1991c507eef9a4dca953ed0077fc1597b09e808cae74c05b5" dependencies = [ "anyhow", "cap-std", @@ -2167,9 +2164,9 @@ checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" [[package]] name = "wasm-encoder" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c64ac98d5d61192cc45c701b7e4bd0b9aff91e2edfc7a088406cfe2288581e2c" +checksum = "c5816e88e8ea7335016aa62eb0485747f786136d505a9b3890f8c400211d9b5f" dependencies = [ "leb128", ] @@ -2185,9 +2182,9 @@ dependencies = [ [[package]] name = "wasmtime" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fc5bb3329415030796cfa5530b2481ccef5c4f1e5150733ba94318ab004fe1" +checksum = "63e4f0c3cbaed050686095e5fde04f28eada1ef6196b456ffce7df2115cc2a38" dependencies = [ "anyhow", "async-trait", @@ -2211,23 +2208,23 @@ dependencies = [ "wasmtime-jit", "wasmtime-runtime", "wat", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "wasmtime-asm-macros" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db36545ff0940ad9bf4e9ab0ec2a4e1eaa5ebe2aa9227bcbc4af905375d9e482" +checksum = "41f17b9bf1ff3ed08f35dd3faa8fe0dc34693939252e47a3a056073d28fcd6d7" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-cache" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c2101b211d9db7db8bcfb2ffa69e119fa99a20266d0e5f19bb989cb6c3280d7" +checksum = "ba1bfca72e269de2b96dc77a8fe64816d9cc6c6ad416a3aba9a51f4ff6bcefc1" dependencies = [ "anyhow", "base64", @@ -2239,19 +2236,19 @@ dependencies = [ "serde", "sha2", "toml", - "windows-sys", + "windows-sys 0.36.1", "zstd", ] [[package]] name = "wasmtime-cranelift" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0409e93b5eceaa4e5f498a4bce1cffc7ebe071d14582b5437c10af4aecc23f54" +checksum = "d4d237bf7d2bcaea5e8018e088668e80b4448e002667d58c414fdcbb8f56ba0e" dependencies = [ "anyhow", "cranelift-codegen", - "cranelift-entity 0.89.0", + "cranelift-entity 0.89.1", "cranelift-frontend", "cranelift-native", "cranelift-wasm", @@ -2266,12 +2263,12 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55240389c604f68d2e1d2573d7d3740246ab9ea2fa4fe79e10ccd51faf9b9500" +checksum = "c432df5094f397e43467eca9775254850231d9047b3513a8e1f28a5778a90dfc" dependencies = [ "anyhow", - "cranelift-entity 0.89.0", + "cranelift-entity 0.89.1", "gimli", "indexmap", "log", @@ -2285,22 +2282,22 @@ dependencies = [ [[package]] name = "wasmtime-fiber" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb9b7b94f7b40d98665feca2338808cf449fa671d01be7176861f8d9aa4a012" +checksum = "331439bc204d5395b89a018d5aa11aaeb5819c733db40fe8bd1d4ce88bf85be1" dependencies = [ "cc", "cfg-if", "rustix", "wasmtime-asm-macros", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "wasmtime-jit" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc15e285b7073ee566e62ea4b6dd38b80465ade0ea8cd4cee13c7ac2e295cfca" +checksum = "f0e1f06e0ab975f0e9dd6b2db9364209272625d5348d02b0b846cf62f102e89c" dependencies = [ "addr2line", "anyhow", @@ -2319,14 +2316,14 @@ dependencies = [ "wasmtime-environ", "wasmtime-jit-debug", "wasmtime-runtime", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "wasmtime-jit-debug" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bee06d206bcf7a875eacd1e1e957c2a63f64a92934d2535dd8e15cde6d3a9ffe" +checksum = "07ca7aeb81909fc7688e1318fc247de2fb7ef2b638aa7501b45f7f6ad710f989" dependencies = [ "object", "once_cell", @@ -2335,9 +2332,9 @@ dependencies = [ [[package]] name = "wasmtime-runtime" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9969ff36cbf57f18c2d24679db57d0857ea7cc7d839534afc26ecc8003e9914b" +checksum = "16069dff65b648d121d9b5ecbeb7319035f9a5aafd370d713c90a7f23db4d823" dependencies = [ "anyhow", "cc", @@ -2356,16 +2353,16 @@ dependencies = [ "wasmtime-environ", "wasmtime-fiber", "wasmtime-jit-debug", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "wasmtime-types" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df64c737fc9b3cdf7617bcc65e8b97cb713ceb9c9c58530b20788a8a3482b5d1" +checksum = "8926344aff6324e6469aa17345bbb29ef9de4fe934bde30a05be28ebf21e0a23" dependencies = [ - "cranelift-entity 0.89.0", + "cranelift-entity 0.89.1", "serde", "thiserror", "wasmparser", @@ -2373,9 +2370,9 @@ dependencies = [ [[package]] name = "wasmtime-wasi" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb41d16dfd153d2078ea2347d311cee6c74f2a4ecc109cd9acaf860709137fdb" +checksum = "26e67b408714dc3fe9f7eaab091a45b9bbfed9f983bd16e0dc209fa4456d903f" dependencies = [ "anyhow", "wasi-cap-std-sync", @@ -2396,9 +2393,9 @@ dependencies = [ [[package]] name = "wast" -version = "47.0.1" +version = "48.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b98502f3978adea49551e801a6687678e6015317d7d9470a67fe813393f2a8" +checksum = "84825b5ac7164df8260c9e2b2e814075334edbe7ac426f2469b93a5eeac23cce" dependencies = [ "leb128", "memchr", @@ -2408,11 +2405,11 @@ dependencies = [ [[package]] name = "wat" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aab4e20c60429fbba9670a6cae0fff9520046ba0aa3e6d0b1cd2653bea14898" +checksum = "129da4a03ec6d2a815f42c88f641824e789d5be0d86d2f90aa8a218c7068e0be" dependencies = [ - "wast 47.0.1", + "wast 48.0.0", ] [[package]] @@ -2437,9 +2434,9 @@ dependencies = [ [[package]] name = "wiggle" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2943156975c608cab1b44d28becba4196b07f18be92ea28f1e7f3372a12d81dd" +checksum = "d55b0d7302192e47c1c2b1706790dab42cd42342ac58c4acb3d589daf56cddf0" dependencies = [ "anyhow", "async-trait", @@ -2453,9 +2450,9 @@ dependencies = [ [[package]] name = "wiggle-generate" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0321263a6b1ba1e0a97174524891a14907cee68cfa183fd5389088dffbeab668" +checksum = "e164de81eea233c6b4e430e6cba4ff3953e3594fd0068633651994a5f0750a0a" dependencies = [ "anyhow", "heck", @@ -2468,9 +2465,9 @@ dependencies = [ [[package]] name = "wiggle-macro" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa3d3794e5d68ef69f30e65f267c6bf18c920750d3ccd2a3ac04e77d95f66b96" +checksum = "829a1543aa92a51f64e38f1dfcf16adfe447aefff3a2c281cf8ddf35c9797255" dependencies = [ "proc-macro2", "quote", @@ -2515,43 +2512,100 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" dependencies = [ - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_msvc", + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", ] +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.0", + "windows_i686_gnu 0.42.0", + "windows_i686_msvc 0.42.0", + "windows_x86_64_gnu 0.42.0", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + [[package]] name = "windows_aarch64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" + [[package]] name = "windows_i686_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +[[package]] +name = "windows_i686_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" + [[package]] name = "windows_i686_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +[[package]] +name = "windows_i686_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" + [[package]] name = "windows_x86_64_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" + [[package]] name = "windows_x86_64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" + [[package]] name = "winx" version = "0.33.0" @@ -2560,7 +2614,7 @@ checksum = "b7b01e010390eb263a4518c8cebf86cb67469d1511c00b749a47b64c39e8054d" dependencies = [ "bitflags", "io-lifetimes", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] diff --git a/lib/compute-at-edge-abi/compute-at-edge.witx b/lib/compute-at-edge-abi/compute-at-edge.witx index 575ca97a..36319394 100644 --- a/lib/compute-at-edge-abi/compute-at-edge.witx +++ b/lib/compute-at-edge-abi/compute-at-edge.witx @@ -508,6 +508,36 @@ ) ) +(module $fastly_async_io + ;;; Blocks until one of the given objects is ready for I/O, or the optional timeout expires. + ;;; + ;;; Valid object handles includes bodies and pending requests. See the `async_item_handle` + ;;; definition for more details, including what I/O actions are associated with each handle + ;;; type. + ;;; + ;;; The timeout is specified in milliseconds, or 0 if no timeout is desired. + ;;; + ;;; Returns the _index_ (not handle!) of the first object that is ready, or u32::MAX if the + ;;; timeout expires before any objects are ready for I/O. + (@interface func (export "select") + (param $hs (list $async_item_handle)) + (param $timeout_ms u32) + (result $err (expected $ready_idx (error $fastly_status))) + ) + + ;;; Returns 1 if the given async item is "ready" for its associated I/O action, 0 otherwise. + ;;; + ;;; If an object is ready, the I/O action is guaranteed to complete without blocking. + ;;; + ;;; Valid object handles includes bodies and pending requests. See the `async_item_handle` + ;;; definition for more details, including what I/O actions are associated with each handle + ;;; type. + (@interface func (export "is_ready") + (param $handle $async_item_handle) + (result $err (expected $is_done (error $fastly_status))) + ) +) + (module $fastly_purge (@interface func (export "purge_surrogate_key") (param $surrogate_key string) diff --git a/lib/compute-at-edge-abi/typenames.witx b/lib/compute-at-edge-abi/typenames.witx index ee1aa96e..4d1a9b42 100644 --- a/lib/compute-at-edge-abi/typenames.witx +++ b/lib/compute-at-edge-abi/typenames.witx @@ -94,6 +94,19 @@ (typename $dictionary_handle (handle)) ;;; A handle to an Object Store. (typename $object_store_handle (handle)) +;;; A handle to an object supporting generic async operations. +;;; Can be either a `body_handle` or a `pending_request_handle`. +;;; +;;; Each async item has an associated I/O action: +;;; +;;; * Pending requests: awaiting the response headers / `Response` object +;;; * Normal bodies: reading bytes from the body +;;; * Streaming bodies: writing bytes to the body +;;; +;;; For writing bytes, note that there is a large host-side buffer that bytes can eagerly be written +;;; into, even before the origin itself consumes that data. +(typename $async_item_handle (handle)) + ;;; A "multi-value" cursor. (typename $multi_value_cursor u32) @@ -117,6 +130,7 @@ (typename $is_done u32) (typename $done_idx u32) (typename $inserted u32) +(typename $ready_idx u32) (typename $content_encodings (flags (@witx repr u32) diff --git a/lib/src/async_io.rs b/lib/src/async_io.rs new file mode 100644 index 00000000..ee7a8cc2 --- /dev/null +++ b/lib/src/async_io.rs @@ -0,0 +1,50 @@ +use { + crate::{ + error::Error, + session::Session, + wiggle_abi::{fastly_async_io::FastlyAsyncIo, types::AsyncItemHandle}, + }, + futures::{FutureExt, TryFutureExt}, + std::time::Duration, + tokio::time::timeout, + wiggle::GuestPtr, +}; + +#[wiggle::async_trait] +impl FastlyAsyncIo for Session { + async fn select<'a>( + &mut self, + handles: &GuestPtr<'a, [AsyncItemHandle]>, + timeout_ms: u32, + ) -> Result { + let handles = handles.as_slice()?; + if handles.len() == 0 && timeout_ms == 0 { + return Err(Error::InvalidArgument); + } + + let select_fut = self + .select_impl(handles.iter().copied().map(Into::into)) + .map_ok(|done_idx| done_idx as u32); + + if timeout_ms == 0 { + select_fut.await + } else { + timeout(Duration::from_millis(timeout_ms as u64), select_fut) + .await + .unwrap_or(Ok(u32::MAX)) + } + } + fn is_ready(&mut self, handle: AsyncItemHandle) -> Result { + if self + .async_item_mut(handle.into())? + .unwrap() + .await_ready() + .now_or_never() + .is_some() + { + Ok(1) + } else { + Ok(0) + } + } +} diff --git a/lib/src/body.rs b/lib/src/body.rs index 047cbf76..e26186f7 100644 --- a/lib/src/body.rs +++ b/lib/src/body.rs @@ -131,6 +131,16 @@ impl Body { pub async fn read_into_string(self) -> Result { Ok(String::from_utf8(self.read_into_vec().await?).expect("Body was not UTF-8")) } + + /// Block until the body has a chunk ready (or is known to be empty). + pub async fn await_ready(&mut self) { + // Attempt to read a chunk, blocking until one is available (or `None` signals end of stream) + if let Some(Ok(chunk)) = self.data().await { + // If we did get a chunk, put it back; subsequent read attempts will find this chunk without + // additional blocking. + self.chunks.push_front(chunk.into()) + } + } } impl> From for Body { diff --git a/lib/src/error.rs b/lib/src/error.rs index b3684ece..5156c77d 100644 --- a/lib/src/error.rs +++ b/lib/src/error.rs @@ -222,10 +222,12 @@ pub enum HandleError { /// A dictionary handle was not valid. #[error("Invalid dictionary handle: {0}")] InvalidDictionaryHandle(crate::wiggle_abi::types::DictionaryHandle), - /// An object-store handle was not valid. #[error("Invalid object-store handle: {0}")] InvalidObjectStoreHandle(crate::wiggle_abi::types::ObjectStoreHandle), + /// An async item handle was not valid. + #[error("Invalid async item handle: {0}")] + InvalidAsyncItemHandle(crate::wiggle_abi::types::AsyncItemHandle), } /// Errors that can occur in a worker thread running a guest module. diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 408be855..9abcf1c7 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -19,6 +19,7 @@ pub mod error; pub mod logging; pub mod session; +mod async_io; mod downstream; mod execute; mod headers; diff --git a/lib/src/linking.rs b/lib/src/linking.rs index be5bd278..55197202 100644 --- a/lib/src/linking.rs +++ b/lib/src/linking.rs @@ -90,6 +90,7 @@ pub fn link_host_functions(linker: &mut Linker) -> Result<(), Error> { wiggle_abi::fastly_object_store::add_to_linker(linker, WasmCtx::session)?; wiggle_abi::fastly_purge::add_to_linker(linker, WasmCtx::session)?; wiggle_abi::fastly_uap::add_to_linker(linker, WasmCtx::session)?; + wiggle_abi::fastly_async_io::add_to_linker(linker, WasmCtx::session)?; link_legacy_aliases(linker)?; Ok(()) } diff --git a/lib/src/session.rs b/lib/src/session.rs index 03139e8f..d8d923a6 100644 --- a/lib/src/session.rs +++ b/lib/src/session.rs @@ -3,8 +3,10 @@ mod async_item; mod downstream; +pub use async_item::AsyncItem; + use { - self::{async_item::AsyncItem, downstream::DownstreamResponse}, + self::downstream::DownstreamResponse, crate::{ body::Body, config::{Backend, Backends, Dictionaries, Dictionary, DictionaryName, Geolocation}, @@ -14,13 +16,14 @@ use { streaming_body::StreamingBody, upstream::{PendingRequest, SelectTarget, TlsConfig}, wiggle_abi::types::{ - BodyHandle, ContentEncodings, DictionaryHandle, EndpointHandle, ObjectStoreHandle, - PendingRequestHandle, RequestHandle, ResponseHandle, + self, BodyHandle, ContentEncodings, DictionaryHandle, EndpointHandle, + ObjectStoreHandle, PendingRequestHandle, RequestHandle, ResponseHandle, }, }, cranelift_entity::{entity_impl, PrimaryMap}, + futures::future::{self, FutureExt}, http::{request, response, HeaderMap, Request, Response}, - std::{collections::HashMap, net::IpAddr, path::PathBuf, sync::Arc}, + std::{collections::HashMap, future::Future, net::IpAddr, path::PathBuf, sync::Arc}, tokio::sync::oneshot::Sender, }; @@ -695,26 +698,36 @@ impl Session { .ok_or(HandleError::InvalidPendingRequestHandle(handle)) } + pub fn reinsert_pending_request( + &mut self, + handle: PendingRequestHandle, + pending_req: PendingRequest, + ) -> Result<(), HandleError> { + *self + .async_items + .get_mut(handle.into()) + .ok_or(HandleError::InvalidPendingRequestHandle(handle))? = + Some(AsyncItem::PendingReq(pending_req)); + Ok(()) + } + /// Take ownership of multiple [`PendingRequest`]s in preparation for a `select`. /// /// Returns a [`HandleError`] if any of the handles are not associated with a pending /// request in the session. pub fn prepare_select_targets( &mut self, - handles: &[PendingRequestHandle], + handles: impl IntoIterator, ) -> Result, HandleError> { // Prepare a vector of targets from the given handles; if any of the handles are invalid, // put back all the targets we've extracted so far let mut targets = vec![]; - for handle in handles.iter().copied() { - if let Ok(pending_req) = self.take_pending_request(handle) { - targets.push(SelectTarget { - handle, - pending_req, - }); + for handle in handles { + if let Ok(item) = self.take_async_item(handle) { + targets.push(SelectTarget { handle, item }); } else { self.reinsert_select_targets(targets); - return Err(HandleError::InvalidPendingRequestHandle(handle)); + return Err(HandleError::InvalidPendingRequestHandle(handle.into())); } } Ok(targets) @@ -724,8 +737,7 @@ impl Session { /// stored within each [`SelectTarget`]. pub fn reinsert_select_targets(&mut self, targets: Vec) { for target in targets { - let async_handle: AsyncItemHandle = target.handle.into(); - self.async_items[async_handle] = Some(AsyncItem::PendingReq(target.pending_req)); + self.async_items[target.handle] = Some(target.item); } } @@ -738,6 +750,73 @@ impl Session { pub fn config_path(&self) -> &Arc> { &self.config_path } + + pub fn async_item_mut( + &mut self, + handle: AsyncItemHandle, + ) -> Result, HandleError> { + self.async_items + .get_mut(handle) + .map(|ai| ai.as_mut()) + .ok_or_else(|| HandleError::InvalidAsyncItemHandle(handle.into())) + } + + pub fn take_async_item(&mut self, handle: AsyncItemHandle) -> Result { + // check that this is an async item before removing it + let _ = self.async_item_mut(handle)?; + + self.async_items + .get_mut(handle) + .and_then(|tracked| tracked.take()) + .ok_or_else(|| HandleError::InvalidAsyncItemHandle(handle.into())) + } + + pub async fn select_impl( + &mut self, + handles: impl IntoIterator, + ) -> Result { + // we have to temporarily move the async items out of the session table, + // because we need &mut borrows of all of them simultaneously. + let targets = self.prepare_select_targets(handles)?; + let mut selected = SelectedTargets::new(self, targets); + let done_index = selected.future().await; + + Ok(done_index) + } +} + +pub struct SelectedTargets<'session> { + session: &'session mut Session, + targets: Vec, +} + +impl<'session> SelectedTargets<'session> { + fn new(session: &'session mut Session, targets: Vec) -> Self { + Self { session, targets } + } + + fn future(&mut self) -> Box + Unpin + Send + Sync + '_> { + // for each target, we produce a future for checking on the "readiness" + // of the associated primary I/O operation + let mut futures = Vec::new(); + for target in &mut *self.targets { + futures.push(Box::pin(target.item.await_ready())) + } + if futures.is_empty() { + // if there are no futures, we wait forever; this waiting will always be bounded by a timeout, + // since the `select` hostcall requires a timeout when no handles are given. + Box::new(future::pending()) + } else { + Box::new(future::select_all(futures).map(|f| f.1)) + } + } +} + +impl<'session> Drop for SelectedTargets<'session> { + fn drop(&mut self) { + let targets = std::mem::replace(&mut self.targets, Vec::new()); + self.session.reinsert_select_targets(targets); + } } /// Additional Viceroy-specific metadata for requests. @@ -788,3 +867,15 @@ impl From for PendingRequestHandle { PendingRequestHandle::from(h.as_u32()) } } + +impl From for AsyncItemHandle { + fn from(h: types::AsyncItemHandle) -> AsyncItemHandle { + AsyncItemHandle::from_u32(h.into()) + } +} + +impl From for types::AsyncItemHandle { + fn from(h: AsyncItemHandle) -> types::AsyncItemHandle { + types::AsyncItemHandle::from(h.as_u32()) + } +} diff --git a/lib/src/session/async_item.rs b/lib/src/session/async_item.rs index fe0c3930..75a4c95d 100644 --- a/lib/src/session/async_item.rs +++ b/lib/src/session/async_item.rs @@ -85,4 +85,12 @@ impl AsyncItem { _ => None, } } + + pub async fn await_ready(&mut self) { + match self { + Self::StreamingBody(body) => body.await_ready().await, + Self::Body(body) => body.await_ready().await, + Self::PendingReq(req) => req.await_ready().await, + } + } } diff --git a/lib/src/streaming_body.rs b/lib/src/streaming_body.rs index 3eafe068..78c3d427 100644 --- a/lib/src/streaming_body.rs +++ b/lib/src/streaming_body.rs @@ -5,7 +5,7 @@ use tokio::sync::mpsc; // // this isn't a tremendously useful size limiter, as it controls the number of chunks that can be in // flight before applying backpressure, as opposed to the size of data in those chunks -const STREAMING_CHANNEL_SIZE: usize = 128; +const STREAMING_CHANNEL_SIZE: usize = 8; /// The "write end" of a streaming body, used for writing to the body of a streaming upstream request /// or a streaming downstream response. @@ -33,4 +33,9 @@ impl StreamingBody { .await .map_err(|_| Error::StreamingChunkSend) } + + /// Block until the body has room for writing additional chunks. + pub async fn await_ready(&mut self) { + let _ = self.sender.reserve().await; + } } diff --git a/lib/src/upstream.rs b/lib/src/upstream.rs index 2b75c4a0..1f8f8e2a 100644 --- a/lib/src/upstream.rs +++ b/lib/src/upstream.rs @@ -3,8 +3,8 @@ use crate::{ config::Backend, error::Error, headers::filter_outgoing_headers, - session::ViceroyRequestMetadata, - wiggle_abi::types::{ContentEncodings, PendingRequestHandle}, + session::{AsyncItem, AsyncItemHandle, ViceroyRequestMetadata}, + wiggle_abi::types::ContentEncodings, }; use futures::Future; use http::{uri, HeaderValue}; @@ -19,7 +19,7 @@ use std::{ use tokio::{ io::{AsyncRead, AsyncWrite, ReadBuf}, net::TcpStream, - sync::oneshot, + sync::oneshot::{self, error::TryRecvError}, }; use tokio_rustls::{client::TlsStream, TlsConnector}; use tracing::warn; @@ -272,13 +272,14 @@ pub fn send_request( } /// The type ultimately yielded by a `PendingRequest`. -pub type ResponseResult = Result, Error>; +pub type PendingRequestResult = Result, Error>; /// An asynchronous request awaiting a response. #[derive(Debug)] -pub struct PendingRequest { +pub enum PendingRequest { // NB: we use channels rather than a `JoinHandle` in order to support the `poll` API. - receiver: oneshot::Receiver, + Waiting(oneshot::Receiver), + Complete(PendingRequestResult), } impl PendingRequest { @@ -289,26 +290,44 @@ impl PendingRequest { ) -> Self { let (sender, receiver) = oneshot::channel(); tokio::task::spawn(async move { sender.send(req.await) }); - Self { receiver } + Self::Waiting(receiver) } /// Check whether a response happens to be available for this pending request. /// /// This function does _not_ block, nor does it require being in an `async` context. - pub fn poll(&mut self) -> Option { - match self.receiver.try_recv() { - Err(oneshot::error::TryRecvError::Closed) => { - panic!("Pending request sender was dropped") - } - // the request is still in flight - Err(oneshot::error::TryRecvError::Empty) => None, - Ok(res) => Some(res), + pub fn poll(&mut self) { + match self { + Self::Waiting(ref mut rx) => match rx.try_recv() { + Err(TryRecvError::Closed) => { + panic!("Pending request sender was dropped") + } + // the request is still in flight + Err(TryRecvError::Empty) => {} + Ok(res) => *self = Self::Complete(res), + }, + // the request is already completed + Self::Complete(_) => {} } } /// Block until the response is ready, and then return it. - pub async fn wait(self) -> ResponseResult { - self.receiver.await.expect("Pending request receiver error") + pub async fn wait(mut self) -> PendingRequestResult { + self.await_ready().await; + match self { + Self::Complete(res) => res, + Self::Waiting(_) => unreachable!("PendingRequest should have completed"), + } + } + + pub async fn await_ready(&mut self) { + if let Self::Waiting(rx) = self { + let res = match rx.await { + Err(_) => panic!("Pending request was unable to complete"), + Ok(res) => res, + }; + *self = Self::Complete(res); + } } } @@ -319,21 +338,8 @@ impl PendingRequest { /// the leftover futures. We have to build our own future to keep the handle-receiver association. #[derive(Debug)] pub struct SelectTarget { - pub handle: PendingRequestHandle, - pub pending_req: PendingRequest, -} - -impl Future for SelectTarget { - type Output = ResponseResult; - - fn poll( - mut self: std::pin::Pin<&mut Self>, - cx: &mut std::task::Context, - ) -> std::task::Poll { - std::pin::Pin::new(&mut self.pending_req.receiver) - .poll(cx) - .map(|res| res.expect("Pending request receiver was dropped")) - } + pub handle: AsyncItemHandle, + pub item: AsyncItem, } // Boilerplate forwarding implementations for `Connection`: diff --git a/lib/src/wiggle_abi.rs b/lib/src/wiggle_abi.rs index 92d55998..707872c3 100644 --- a/lib/src/wiggle_abi.rs +++ b/lib/src/wiggle_abi.rs @@ -65,6 +65,7 @@ wiggle::from_witx!({ witx: ["$CARGO_MANIFEST_DIR/compute-at-edge-abi/compute-at-edge.witx"], errors: { fastly_status => Error }, async: { + fastly_async_io::{select}, fastly_object_store::{insert}, fastly_http_body::{append, read, write}, fastly_http_req::{pending_req_select, pending_req_wait, send}, diff --git a/lib/src/wiggle_abi/entity.rs b/lib/src/wiggle_abi/entity.rs index e878bf65..3efa55af 100644 --- a/lib/src/wiggle_abi/entity.rs +++ b/lib/src/wiggle_abi/entity.rs @@ -3,8 +3,8 @@ //! [ref]: https://docs.rs/cranelift-entity/latest/cranelift_entity/trait.EntityRef.html use super::types::{ - BodyHandle, DictionaryHandle, EndpointHandle, ObjectStoreHandle, PendingRequestHandle, - RequestHandle, ResponseHandle, + AsyncItemHandle, BodyHandle, DictionaryHandle, EndpointHandle, ObjectStoreHandle, + PendingRequestHandle, RequestHandle, ResponseHandle, }; /// Macro which implements a 32-bit entity reference for handles generated by Wiggle. @@ -46,3 +46,4 @@ wiggle_entity!(EndpointHandle); wiggle_entity!(PendingRequestHandle); wiggle_entity!(DictionaryHandle); wiggle_entity!(ObjectStoreHandle); +wiggle_entity!(AsyncItemHandle); diff --git a/lib/src/wiggle_abi/req_impl.rs b/lib/src/wiggle_abi/req_impl.rs index 101eef10..60b93dac 100644 --- a/lib/src/wiggle_abi/req_impl.rs +++ b/lib/src/wiggle_abi/req_impl.rs @@ -4,7 +4,7 @@ use { crate::{ config::Backend, error::Error, - session::{Session, ViceroyRequestMetadata}, + session::{AsyncItem, Session, ViceroyRequestMetadata}, upstream::{self, PendingRequest}, wiggle_abi::{ fastly_http_req::FastlyHttpReq, @@ -569,17 +569,22 @@ impl FastlyHttpReq for Session { &mut self, pending_req_handle: PendingRequestHandle, ) -> Result<(u32, ResponseHandle, BodyHandle), Error> { - let pending_req = self.pending_request_mut(pending_req_handle)?; - - let outcome = match pending_req.poll() { - None => (0, INVALID_REQUEST_HANDLE.into(), INVALID_BODY_HANDLE.into()), - Some(resp) => { - // the request is done; remove it from the map - drop(self.take_pending_request(pending_req_handle)?); + let mut pending_req = self.take_pending_request(pending_req_handle)?; + pending_req.poll(); + + let outcome = match pending_req { + PendingRequest::Waiting(_) => { + // Make sure to reinsert if pending + self.reinsert_pending_request(pending_req_handle, pending_req)?; + (0, INVALID_REQUEST_HANDLE.into(), INVALID_BODY_HANDLE.into()) + } + PendingRequest::Complete(resp) => { + // the request is done so we will not reinsert it into the map let (resp_handle, resp_body_handle) = self.insert_response(resp?); (1, resp_handle, resp_body_handle) } }; + Ok(outcome) } @@ -599,26 +604,38 @@ impl FastlyHttpReq for Session { if pending_req_handles.len() == 0 { return Err(Error::InvalidArgument); } - let targets = self.prepare_select_targets(&pending_req_handles.as_slice()?)?; // perform the select operation - let (fut_result, done_index, rest) = futures::future::select_all(targets).await; - - // reinsert the other receivers before doing anything else, so they don't get dropped - self.reinsert_select_targets(rest); - - let outcome = match fut_result { - Ok(resp) => { - let (resp_handle, body_handle) = self.insert_response(resp); - (done_index as u32, resp_handle, body_handle) - } - // Unfortunately, the ABI provides no means of returning error information - // from completed `select`. - Err(_) => ( - done_index as u32, - INVALID_RESPONSE_HANDLE.into(), - INVALID_BODY_HANDLE.into(), - ), + let done_index = self + .select_impl( + pending_req_handles + .as_slice()? + .iter() + .map(|handle| handle.to_owned().into()), + ) + .await? as u32; + + let item = + self.take_async_item(pending_req_handles.get(done_index).unwrap().read()?.into())?; + + let outcome = match item { + AsyncItem::PendingReq(res) => match res { + PendingRequest::Complete(resp) => match resp { + Ok(resp) => { + let (resp_handle, body_handle) = self.insert_response(resp); + (done_index, resp_handle, body_handle) + } + // Unfortunately, the ABI provides no means of returning error information + // from completed `select`. + Err(_) => ( + done_index, + INVALID_RESPONSE_HANDLE.into(), + INVALID_BODY_HANDLE.into(), + ), + }, + _ => panic!("Pending request was not completed"), + }, + _ => panic!("AsyncItem was not a pending request"), }; Ok(outcome) diff --git a/test-fixtures/Cargo.lock b/test-fixtures/Cargo.lock index b609fb1a..7a8b79ce 100644 --- a/test-fixtures/Cargo.lock +++ b/test-fixtures/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.65" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602" +checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" [[package]] name = "bitflags" @@ -61,12 +61,13 @@ dependencies = [ [[package]] name = "fastly" -version = "0.8.7" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac81708c039cd2f95e09f3b700d36b46976de382dd47cf46e3f18a51aa70427d" +checksum = "0d14ee2f12a3191582449a2e080287eff8898fc52da61c437869d91c41b3ae2a" dependencies = [ "anyhow", "bytes 0.5.6", + "cfg-if", "fastly-macros", "fastly-shared", "fastly-sys", @@ -84,9 +85,9 @@ dependencies = [ [[package]] name = "fastly-macros" -version = "0.8.7" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99060e78d03bd1436bd4055c54cc5c62b1926e9c894b9bf00c40e8e5c276fd99" +checksum = "e3d1b2980c09148cb84bfd18591943ee449a350dc1ff1ead69edbf012f7e2eef" dependencies = [ "proc-macro2", "quote", @@ -95,9 +96,9 @@ dependencies = [ [[package]] name = "fastly-shared" -version = "0.8.7" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "238fb7af2219391cb024673302861adffd96cb3dbe4b602c2c7abef11ce5a5f9" +checksum = "6f79939bdbbab8b1de759d584f386319454f8623681400675a07f9ad35f2b158" dependencies = [ "bitflags", "http", @@ -106,9 +107,9 @@ dependencies = [ [[package]] name = "fastly-sys" -version = "0.8.7" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa50606a08d3ee623033013d063e1843c5cb8c928fce3bd0f2c8ce4eaa460d8d" +checksum = "1d01e98274a6b12c85c0eef22924871cc12c54b5322268947322463e59d09336" dependencies = [ "bitflags", "fastly-shared", @@ -174,9 +175,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.135" +version = "0.2.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c" +checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" [[package]] name = "mime" @@ -184,15 +185,6 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" -[[package]] -name = "num_threads" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" -dependencies = [ - "libc", -] - [[package]] name = "opaque-debug" version = "0.3.0" @@ -231,18 +223,18 @@ checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "serde" -version = "1.0.145" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b" +checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.145" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c" +checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" dependencies = [ "proc-macro2", "quote", @@ -251,9 +243,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41feea4228a6f1cd09ec7a3593a682276702cd67b5273544757dae23c096f074" +checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" dependencies = [ "itoa", "ryu", @@ -287,9 +279,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.102" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1" +checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" dependencies = [ "proc-macro2", "quote", @@ -330,13 +322,28 @@ dependencies = [ [[package]] name = "time" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d634a985c4d4238ec39cacaed2e7ae552fbd3c476b552c1deac3021b7d7eaf0c" +checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" dependencies = [ - "libc", - "num_threads", "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" + +[[package]] +name = "time-macros" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" +dependencies = [ + "time-core", ] [[package]] diff --git a/test-fixtures/Cargo.toml b/test-fixtures/Cargo.toml index 57b9b840..bdd23455 100644 --- a/test-fixtures/Cargo.toml +++ b/test-fixtures/Cargo.toml @@ -8,9 +8,9 @@ license = "Apache-2.0 WITH LLVM-exception" publish = false [dependencies] -fastly = "=0.8.7" -fastly-shared = "=0.8.7" -fastly-sys = "=0.8.7" +fastly = "=0.8.9" +fastly-shared = "=0.8.9" +fastly-sys = "=0.8.9" bytes = "1.0.0" http = "0.2.1" serde = "1.0.114" diff --git a/test-fixtures/src/bin/async_io.rs b/test-fixtures/src/bin/async_io.rs new file mode 100644 index 00000000..87856d38 --- /dev/null +++ b/test-fixtures/src/bin/async_io.rs @@ -0,0 +1,143 @@ +//! Tests the `async_io` hostcalls by setting up one of each kind of async item, each against +//! a distinct backend. Checks each for readiness, and then does a select with timeout against +//! all of them. + +use std::str::FromStr; + +use fastly::handle::{BodyHandle, RequestHandle, ResponseHandle}; +use fastly::http::{HeaderName, HeaderValue, Method, StatusCode, Url}; +use fastly::Error; +use fastly_shared::{CacheOverride, FastlyStatus}; + +fn is_ready(handle: u32) -> bool { + let mut ready_out: u32 = 0; + unsafe { + let status = fastly_sys::fastly_async_io::is_ready(handle, &mut ready_out); + assert_eq!(status, FastlyStatus::OK); + } + ready_out == 1 +} + +fn append_header(resp: &mut ResponseHandle, header: impl ToString, value: impl ToString) { + resp.append_header( + &HeaderName::from_str(&header.to_string()).unwrap(), + &HeaderValue::from_str(&value.to_string()).unwrap(), + ) +} + +fn test_select() -> Result<(), Error> { + let mut ds_resp = ResponseHandle::new(); + let pass = CacheOverride::pass(); + + // The "simple" case is a pending request, where the async item is awaiting the response headers + let mut simple_req = RequestHandle::new(); + simple_req.set_url(&Url::parse("http://simple.org/")?); + simple_req.set_cache_override(&pass); + let simple_pending_req = simple_req.send_async(BodyHandle::new(), "Simple")?; + let simple_pending_req_handle = simple_pending_req.as_u32(); + + // The "read body" case involves a sync `send`, followed by treating the response body as an async item + // to read from + let mut read_body_req = RequestHandle::new(); + read_body_req.set_url(&Url::parse("http://readbody.org/")?); + read_body_req.set_cache_override(&pass); + let (_read_body_resp, read_body) = read_body_req.send(BodyHandle::new(), "ReadBody")?; + let read_body_handle = unsafe { read_body.as_u32() }; + + // The "write body" case involves a `send_async_streaming` call, where the streaming body is the + // async item of interest. To test readiness, we need to ensure the body is large enough that Hyper + // won't try to buffer it, and hence we can see backpressure on streaming. We do this by including + // a large (4MB) prefix of the body _prior to_ streaming. + const INITIAL_BYTE_COUNT: usize = 4 * 1024 * 1024; + let mut write_body_req = RequestHandle::new(); + write_body_req.set_url(&Url::parse("http://writebody.org/")?); + write_body_req.set_cache_override(&pass); + write_body_req.set_method(&Method::POST); + let mut write_body_initial = BodyHandle::new(); + let initial_bytes = write_body_initial.write_bytes(&vec![0; INITIAL_BYTE_COUNT]); + assert_eq!(initial_bytes, INITIAL_BYTE_COUNT); + let (mut write_body, _write_body_pending_req) = + write_body_req.send_async_streaming(write_body_initial, "WriteBody")?; + let write_body_handle = unsafe { write_body.as_u32() }; + + // Now we attempt to stream chunks into the body until we encounter backpressure. That backpressure + // should result from the fixed channel-size, and the fact that the test server waits to read the + // body we are streaming to it. + let one_chunk = vec![0; 8 * 1024]; + while is_ready(write_body_handle) { + let nwritten = write_body.write_bytes(&one_chunk); + assert!(nwritten > 0); + } + + // Give the servers a chance to do their thing. This is needed to resolve a race between the servers + // initiating responses / reading buffers and the guest snapshotting readiness or performing `select` + // + // If this ever becomes flaky, an alternative would be to introduce an additional backend that + // responds only when the other backends have reached their steady state, via a VTC semaphore, and + // block on THAT backend here. + std::thread::sleep(std::time::Duration::from_millis(100)); + + append_header( + &mut ds_resp, + "Simple-Ready", + is_ready(simple_pending_req_handle), + ); + append_header(&mut ds_resp, "Read-Ready", is_ready(read_body_handle)); + append_header(&mut ds_resp, "Write-Ready", is_ready(write_body_handle)); + + let handles = vec![ + simple_pending_req_handle, + read_body_handle, + write_body_handle, + ]; + let mut ready_idx = 0; + unsafe { + fastly_sys::fastly_async_io::select(handles.as_ptr(), handles.len(), 20, &mut ready_idx); + }; + if ready_idx == u32::MAX { + append_header(&mut ds_resp, "Ready-Index", "timeout"); + } else { + append_header(&mut ds_resp, "Ready-Index", ready_idx); + } + + // check that handles are still available after the select, by explicitly closing one of them: + assert!(read_body.close().is_ok()); + + ds_resp.send_to_client(BodyHandle::new()); + Ok(()) +} + +fn test_empty_select(timeout: u32) { + let mut ds_resp = ResponseHandle::new(); + + let empty_handles = Vec::new(); + let mut ready_idx = 0; + + let res = unsafe { + fastly_sys::fastly_async_io::select(empty_handles.as_ptr(), 0, timeout, &mut ready_idx) + }; + + if res == FastlyStatus::OK { + if ready_idx == u32::MAX { + append_header(&mut ds_resp, "Ready-Index", "timeout"); + } else { + append_header(&mut ds_resp, "Ready-Index", ready_idx); + } + } else { + ds_resp.set_status(StatusCode::INTERNAL_SERVER_ERROR); + } + + ds_resp.send_to_client(BodyHandle::new()); +} + +fn main() -> Result<(), Error> { + let client_req = RequestHandle::from_client(); + if let Ok(Some(val)) = + client_req.get_header_value(&HeaderName::from_str("Empty-Select-Timeout").unwrap(), 1024) + { + test_empty_select(val.to_str().unwrap().parse().unwrap()); + Ok(()) + } else { + test_select() + } +}