From b0404f4285ff7acce92b2f33dda9d0f7cf4b002d Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 1 Mar 2022 18:49:08 +0000 Subject: [PATCH] PDK with a single value (#11) * Back to attempt with single value * Go back to known_key stub approach * Update to new `RCow` * Lots of fixes and cleaning up * Fix metronome plugin See https://github.com/rodrimati1992/abi_stable_crates/issues/75 --- Cargo.lock | 9 +- Cargo.toml | 5 +- plugins/connectors/metronome/Cargo.lock | 1791 +++++++++-------- plugins/connectors/metronome/Cargo.toml | 8 +- plugins/connectors/metronome/src/connector.rs | 18 +- src/codec/binflux.rs | 8 +- src/codec/csv.rs | 10 +- src/codec/syslog.rs | 6 +- src/config.rs | 60 +- src/connectors.rs | 89 +- src/connectors/impls.rs | 4 +- src/connectors/impls/bench.rs | 48 +- src/connectors/impls/file.rs | 33 +- src/connectors/impls/metrics.rs | 30 +- src/connectors/impls/tcp.rs | 25 +- src/connectors/impls/tcp/server.rs | 52 +- src/connectors/prelude.rs | 7 +- src/connectors/sink.rs | 136 +- src/connectors/sink/channel_sink.rs | 30 +- src/connectors/sink/concurrency_cap.rs | 8 +- src/connectors/sink/single_stream_sink.rs | 28 +- src/connectors/source.rs | 169 +- src/connectors/source/channel_source.rs | 4 +- src/connectors/utils/reconnect.rs | 6 +- src/pdk/connectors.rs | 17 +- src/pdk/mod.rs | 6 +- src/pipeline.rs | 4 +- src/preprocessor/lines.rs | 4 +- src/system.rs | 7 +- src/system/manager.rs | 8 +- tests/script.rs | 4 +- tremor-cli/Cargo.toml | 2 + tremor-cli/src/test/unit.rs | 6 +- tremor-common/Cargo.toml | 2 +- tremor-pipeline/Cargo.toml | 4 +- tremor-pipeline/src/event.rs | 31 +- tremor-pipeline/src/executable_graph.rs | 2 +- tremor-pipeline/src/lib.rs | 84 +- tremor-pipeline/src/metrics.rs | 12 +- tremor-pipeline/src/op/debug/history.rs | 4 +- tremor-pipeline/src/op/generic/batch.rs | 4 +- tremor-pipeline/src/op/qos/backpressure.rs | 4 +- tremor-pipeline/src/op/qos/percentile.rs | 4 +- tremor-pipeline/src/op/qos/rr.rs | 8 +- tremor-pipeline/src/op/qos/wal.rs | 6 +- tremor-pipeline/src/op/trickle/operator.rs | 12 +- tremor-pipeline/src/op/trickle/script.rs | 2 +- tremor-pipeline/src/op/trickle/select.rs | 8 +- .../src/op/trickle/simple_select.rs | 2 +- tremor-pipeline/src/pdk.rs | 127 -- tremor-script/Cargo.toml | 2 +- tremor-script/src/ast/query.rs | 9 +- tremor-script/src/ast/to_static.rs | 4 +- .../src/ast/visitors/impls/const_folder.rs | 6 +- tremor-script/src/interpreter.rs | 53 +- tremor-script/src/interpreter/expr.rs | 20 +- tremor-script/src/interpreter/imut_expr.rs | 7 +- tremor-script/src/lib.rs | 2 - tremor-script/src/pdk.rs | 86 - tremor-script/src/registry/custom_fn.rs | 3 +- tremor-script/src/srs.rs | 32 +- tremor-script/src/std_lib/binary.rs | 4 +- tremor-script/src/std_lib/record.rs | 10 +- tremor-script/src/std_lib/win.rs | 6 +- tremor-script/src/tilde.rs | 40 +- tremor-script/src/utils.rs | 8 +- tremor-value/Cargo.toml | 2 +- tremor-value/src/known_key.rs | 219 +- tremor-value/src/lib.rs | 12 +- tremor-value/src/macros.rs | 6 +- tremor-value/src/pdk.rs | 141 -- tremor-value/src/serde/value/de.rs | 26 +- tremor-value/src/serde/value/se.rs | 14 +- tremor-value/src/value.rs | 66 +- tremor-value/src/value/cmp.rs | 14 +- tremor-value/src/value/from.rs | 95 +- tremor-value/src/value/serialize.rs | 10 +- 77 files changed, 1981 insertions(+), 1874 deletions(-) delete mode 100644 tremor-pipeline/src/pdk.rs delete mode 100644 tremor-script/src/pdk.rs delete mode 100644 tremor-value/src/pdk.rs diff --git a/Cargo.lock b/Cargo.lock index e9fda0ece0..c4a9676217 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,7 +5,7 @@ version = 3 [[package]] name = "abi_stable" version = "0.10.4" -source = "git+https://github.com/rodrimati1992/abi_stable_crates.git?branch=0_11#f7486afbf5cd4478e877625c49ef27c1ad18e4e4" +source = "git+https://github.com/marioortizmanero/abi_stable_crates.git?branch=ok_or#a45b5537270dd192cbce760a4be6697a0feec6d4" dependencies = [ "abi_stable_derive", "abi_stable_shared", @@ -24,7 +24,7 @@ dependencies = [ [[package]] name = "abi_stable_derive" version = "0.10.3" -source = "git+https://github.com/rodrimati1992/abi_stable_crates.git?branch=0_11#f7486afbf5cd4478e877625c49ef27c1ad18e4e4" +source = "git+https://github.com/marioortizmanero/abi_stable_crates.git?branch=ok_or#a45b5537270dd192cbce760a4be6697a0feec6d4" dependencies = [ "abi_stable_shared", "as_derive_utils", @@ -39,7 +39,7 @@ dependencies = [ [[package]] name = "abi_stable_shared" version = "0.10.3" -source = "git+https://github.com/rodrimati1992/abi_stable_crates.git?branch=0_11#f7486afbf5cd4478e877625c49ef27c1ad18e4e4" +source = "git+https://github.com/marioortizmanero/abi_stable_crates.git?branch=ok_or#a45b5537270dd192cbce760a4be6697a0feec6d4" dependencies = [ "core_extensions", ] @@ -223,7 +223,7 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "as_derive_utils" version = "0.10.3" -source = "git+https://github.com/rodrimati1992/abi_stable_crates.git?branch=0_11#f7486afbf5cd4478e877625c49ef27c1ad18e4e4" +source = "git+https://github.com/marioortizmanero/abi_stable_crates.git?branch=ok_or#a45b5537270dd192cbce760a4be6697a0feec6d4" dependencies = [ "core_extensions", "proc-macro2", @@ -6410,6 +6410,7 @@ dependencies = [ name = "tremor-cli" version = "0.11.4" dependencies = [ + "abi_stable", "anyhow", "async-std", "clap 3.1.5", diff --git a/Cargo.toml b/Cargo.toml index d509b38ea0..92b2e01529 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -244,9 +244,8 @@ es-integration = [] [patch.crates-io] rust-bert = { git = 'https://github.com/mfelsche/rust-bert.git', rev = '1140989' } rust_tokenizers = { git = 'https://github.com/mfelsche/rust-tokenizers.git', rev = '5a7860d' } -# FIXME: update to crates.io when this is added to a new version: -# https://github.com/rodrimati1992/abi_stable_crates/pull/68 -abi_stable = { git = "https://github.com/rodrimati1992/abi_stable_crates.git", branch = "0_11" } +# FIXME: update to v0.11 when it's released +abi_stable = { git = "https://github.com/marioortizmanero/abi_stable_crates.git", branch = "ok_or" } # FIXME: update to crates.io when this is added to a new version: # https://github.com/simd-lite/simd-json-derive/pull/9 simd-json-derive = { git = "https://github.com/marioortizmanero/simd-json-derive.git", branch = "abi-stable" } diff --git a/plugins/connectors/metronome/Cargo.lock b/plugins/connectors/metronome/Cargo.lock index 7cfd3e59ae..5e33f5ca8f 100644 --- a/plugins/connectors/metronome/Cargo.lock +++ b/plugins/connectors/metronome/Cargo.lock @@ -4,29 +4,27 @@ version = 3 [[package]] name = "abi_stable" -version = "0.10.3" -source = "git+https://github.com/marioortizmanero/abi_stable_crates.git?branch=rvec-append#1946b2b79b4074882a6812f1c0dd28b66eeffdcf" +version = "0.10.4" +source = "git+https://github.com/marioortizmanero/abi_stable_crates.git?branch=ok_or#a45b5537270dd192cbce760a4be6697a0feec6d4" dependencies = [ "abi_stable_derive", "abi_stable_shared", "core_extensions", - "crossbeam-channel", "generational-arena", "libloading", "lock_api", - "parking_lot", + "parking_lot 0.11.2", "paste", "repr_offset", "rustc_version 0.4.0", "serde", "serde_derive", - "serde_json", ] [[package]] name = "abi_stable_derive" version = "0.10.3" -source = "git+https://github.com/marioortizmanero/abi_stable_crates.git?branch=rvec-append#1946b2b79b4074882a6812f1c0dd28b66eeffdcf" +source = "git+https://github.com/marioortizmanero/abi_stable_crates.git?branch=ok_or#a45b5537270dd192cbce760a4be6697a0feec6d4" dependencies = [ "abi_stable_shared", "as_derive_utils", @@ -41,7 +39,7 @@ dependencies = [ [[package]] name = "abi_stable_shared" version = "0.10.3" -source = "git+https://github.com/marioortizmanero/abi_stable_crates.git?branch=rvec-append#1946b2b79b4074882a6812f1c0dd28b66eeffdcf" +source = "git+https://github.com/marioortizmanero/abi_stable_crates.git?branch=ok_or#a45b5537270dd192cbce760a4be6697a0feec6d4" dependencies = [ "core_extensions", ] @@ -127,7 +125,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.3", + "getrandom 0.2.5", "once_cell", "version_check", ] @@ -143,22 +141,23 @@ dependencies = [ [[package]] name = "amq-protocol" -version = "6.1.0" +version = "7.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3b51c409a2b30e48826a593d56a26a43f37bf3df682821e55cd108e24de9ce7" +checksum = "acc7cad07d1b4533fcb46f0819a6126fa201fd0385469aba75e405424f3fe009" dependencies = [ "amq-protocol-tcp", "amq-protocol-types", "amq-protocol-uri", "cookie-factory", "nom 7.1.0", + "serde", ] [[package]] name = "amq-protocol-tcp" -version = "6.1.0" +version = "7.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9797cd3a8f1491e4828818341aea5e1378029ec89dc2422cd85d62715f913080" +checksum = "5d8b20aba8c35a0b885e1e978eff456ced925730a4e012e63e4ff89a1deb602b" dependencies = [ "amq-protocol-uri", "tcp-stream", @@ -167,9 +166,9 @@ dependencies = [ [[package]] name = "amq-protocol-types" -version = "6.1.0" +version = "7.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "028cb766932137535fe8a320245e385bac379506d7e9e3d0375be069bb6fb0de" +checksum = "e245e0e9083b6a6db5f8c10013074cb382266eb9e2a37204d19c651b8d3b8114" dependencies = [ "cookie-factory", "nom 7.1.0", @@ -179,28 +178,29 @@ dependencies = [ [[package]] name = "amq-protocol-uri" -version = "6.1.0" +version = "7.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b08059afa9495f674408891c5eaee50c5eca3532598c90532c1856990b91da96" +checksum = "56987108bf48d2eb500cae8896cd9291564eedd8744776ecc5c3338a8b2ca5f8" dependencies = [ + "amq-protocol-types", "percent-encoding", "url", ] [[package]] name = "ansi_term" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ "winapi", ] [[package]] name = "anyhow" -version = "1.0.47" +version = "1.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d9ff5d688f1c13395289f67db01d4826b46dd694e7580accdc3e8430f2d98e" +checksum = "159bb86af3a200e19a068f4224eae4c8bb2d0fa054c7e5d1cacd5cef95e684cd" [[package]] name = "arc-swap" @@ -208,12 +208,6 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dabe5a181f83789739c194cbe5a897dde195078fac08568d09221fd6137a7ba8" -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - [[package]] name = "arrayvec" version = "0.5.2" @@ -223,7 +217,7 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "as_derive_utils" version = "0.10.3" -source = "git+https://github.com/marioortizmanero/abi_stable_crates.git?branch=rvec-append#1946b2b79b4074882a6812f1c0dd28b66eeffdcf" +source = "git+https://github.com/marioortizmanero/abi_stable_crates.git?branch=ok_or#a45b5537270dd192cbce760a4be6697a0feec6d4" dependencies = [ "core_extensions", "proc-macro2", @@ -281,23 +275,23 @@ dependencies = [ "futures-core", "futures-io", "once_cell", - "pin-project-lite 0.2.7", - "tokio 1.14.0", + "pin-project-lite 0.2.8", + "tokio 1.17.0", ] [[package]] name = "async-compression" -version = "0.3.8" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443ccbb270374a2b1055fc72da40e1f237809cd6bb0e97e66d264cd138473a6" +checksum = "f2bf394cfbbe876f0ac67b13b6ca819f9c9f2fb9ec67223cceb1555fbab1c31a" dependencies = [ "bytes 0.5.6", "flate2", "futures-core", "futures-io", "memchr", - "pin-project-lite 0.2.7", - "tokio 1.14.0", + "pin-project-lite 0.2.8", + "tokio 1.17.0", "xz2", ] @@ -327,8 +321,9 @@ dependencies = [ [[package]] name = "async-ffi" -version = "0.3.1" -source = "git+https://github.com/oxalica/async-ffi?branch=master#e464f80e408f59c0c7410093afa8cf973017f1f6" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e73758d044aab514155e8888ed142d408498712c6f82f24e3ee0650d5943b0" dependencies = [ "abi_stable", ] @@ -346,9 +341,9 @@ dependencies = [ [[package]] name = "async-global-executor" -version = "2.0.2" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9586ec52317f36de58453159d48351bc244bc24ced3effc1fce22f3d48664af6" +checksum = "c026b7e44f1316b567ee750fea85103f87fcb80792b860e979f221259796ca0a" dependencies = [ "async-channel", "async-executor", @@ -359,7 +354,18 @@ dependencies = [ "num_cpus", "once_cell", "tokio 0.3.7", - "tokio 1.14.0", + "tokio 1.17.0", +] + +[[package]] +name = "async-global-executor-trait" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33dd14c5a15affd2abcff50d84efd4009ada28a860f01c14f9d654f3e81b3f75" +dependencies = [ + "async-global-executor", + "async-trait", + "executor-trait", ] [[package]] @@ -375,7 +381,7 @@ dependencies = [ "http-types", "httparse", "log", - "pin-project 1.0.8", + "pin-project", ] [[package]] @@ -392,16 +398,16 @@ dependencies = [ "parking", "polling", "slab", - "socket2 0.4.2", + "socket2 0.4.4", "waker-fn", "winapi", ] [[package]] name = "async-lock" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6a8ea61bf9947a1007c5cada31e647dbc77b103c679858150003ba697ea798b" +checksum = "e97a171d191782fba31bb902b14ad94e24a68145032b7eedf871ab0bc0d077b6" dependencies = [ "event-listener", ] @@ -454,24 +460,26 @@ dependencies = [ ] [[package]] -name = "async-session" -version = "2.0.1" +name = "async-reactor-trait" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345022a2eed092cd105cc1b26fd61c341e100bd5fcbbd792df4baf31c2cc631f" +checksum = "7a6012d170ad00de56c9ee354aef2e358359deb1ec504254e0e5a3774771de0e" dependencies = [ - "anyhow", - "async-std", + "async-io", "async-trait", - "base64 0.12.3", - "bincode", - "blake3", - "chrono", - "hmac 0.8.1", - "kv-log-macro", - "rand 0.7.3", - "serde", - "serde_json", - "sha2", + "futures-core", + "reactor-trait", +] + +[[package]] +name = "async-rustls" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c86f33abd5a4f3e2d6d9251a9e0c6a7e52eb1113caf893dae8429bf4a53f378" +dependencies = [ + "futures-lite", + "rustls 0.19.1", + "webpki 0.21.4", ] [[package]] @@ -511,7 +519,7 @@ dependencies = [ "memchr", "num_cpus", "once_cell", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.8", "pin-utils", "slab", "wasm-bindgen-futures", @@ -519,9 +527,9 @@ dependencies = [ [[package]] name = "async-std-resolver" -version = "0.20.3" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed4e2c3da14d8ad45acb1e3191db7a918e9505b6f155b218e70a7c9a1a48c638" +checksum = "dbf3e776afdf3a2477ef4854b85ba0dff3bd85792f685fb3c68948b4d304e4f0" dependencies = [ "async-std", "async-trait", @@ -554,22 +562,9 @@ dependencies = [ [[package]] name = "async-task" -version = "4.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0" - -[[package]] -name = "async-tls" -version = "0.10.0" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d85a97c4a0ecce878efd3f945f119c78a646d8975340bca0398f9bb05c30cc52" -dependencies = [ - "futures-core", - "futures-io", - "rustls 0.18.1", - "webpki 0.21.4", - "webpki-roots 0.20.0", -] +checksum = "677d306121baf53310a3fd342d88dc0824f6bbeace68347593658525565abee8" [[package]] name = "async-tls" @@ -586,9 +581,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.51" +version = "0.1.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e" +checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3" dependencies = [ "proc-macro2", "quote", @@ -604,8 +599,8 @@ dependencies = [ "futures-io", "futures-util", "log", - "pin-project 1.0.8", - "tokio 1.14.0", + "pin-project", + "tokio 1.17.0", "tokio-rustls 0.22.0", "tungstenite 0.11.1", "webpki-roots 0.20.0", @@ -618,11 +613,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5682ea0913e5c20780fe5785abacb85a411e7437bf52a1bedb93ddb3972cb8dd" dependencies = [ "async-std", - "async-tls 0.11.0", + "async-tls", "futures-io", "futures-util", "log", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.8", "tungstenite 0.16.0", ] @@ -675,15 +670,42 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "aws-config" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2d5596c84d0f2e569ec211af64cc219492d56d4aec2d16a7a4d0622d61ec82d" +dependencies = [ + "aws-http", + "aws-sdk-sso", + "aws-sdk-sts", + "aws-smithy-async", + "aws-smithy-client", + "aws-smithy-http", + "aws-smithy-http-tower", + "aws-smithy-json", + "aws-smithy-types", + "aws-types", + "bytes 1.1.0", + "hex", + "http", + "hyper", + "ring", + "tokio 1.17.0", + "tower", + "tracing", + "zeroize", +] [[package]] name = "aws-endpoint" -version = "0.2.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d3862993d16ce409bbc9beb16744e1e906130c8071ca75e84d967f7ea590eeb" +checksum = "d0990fe9d60185efea41850b10a205f4a9abe71499ec70298b11d2d830130167" dependencies = [ "aws-smithy-http", "aws-types", @@ -694,72 +716,93 @@ dependencies = [ [[package]] name = "aws-http" -version = "0.2.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21902b7009bb5290acab8a297d8c3287b990bdf1c57bb72f331dfaa171854416" +checksum = "6794b0b27fb74ef2696c41e1be08e916993ef043bbeda7ec554c4f50c3b81506" dependencies = [ "aws-smithy-http", "aws-smithy-types", "aws-types", "http", "lazy_static", + "percent-encoding", "tracing", ] [[package]] -name = "aws-hyper" -version = "0.2.0" +name = "aws-sdk-s3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be61f82810771f547ed72fe9db7e087f555ce1612908ea23b58977272eb2da1" +checksum = "986a15277ad7adf67c32059359d60584426b4fa0c30ef34d153bbe47a83cbad7" dependencies = [ "aws-endpoint", "aws-http", "aws-sig-auth", + "aws-sigv4", + "aws-smithy-async", "aws-smithy-client", + "aws-smithy-eventstream", "aws-smithy-http", "aws-smithy-http-tower", "aws-smithy-types", + "aws-smithy-xml", + "aws-types", "bytes 1.1.0", - "fastrand", "http", - "http-body", - "hyper", - "hyper-rustls 0.22.1", - "pin-project 1.0.8", - "tokio 1.14.0", + "md5", + "tokio-stream", "tower", - "tracing", ] [[package]] -name = "aws-sdk-s3" -version = "0.2.0" +name = "aws-sdk-sso" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd39e7e35ae6abe15a7fbe9bf8048ce2e7780026c287f8d43dc5e73b8c0074a" +checksum = "6e4ce01b97e0ae8a2abd82b4aa13780fb1ddf7b6134e2da719ee1a16c2da3540" +dependencies = [ + "aws-endpoint", + "aws-http", + "aws-sig-auth", + "aws-smithy-async", + "aws-smithy-client", + "aws-smithy-http", + "aws-smithy-http-tower", + "aws-smithy-json", + "aws-smithy-types", + "aws-types", + "bytes 1.1.0", + "http", + "tokio-stream", + "tower", +] + +[[package]] +name = "aws-sdk-sts" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9c36263a8813bd5791fdba2f817178032cccd63d4c834ab52192e7020d9c371" dependencies = [ "aws-endpoint", "aws-http", - "aws-hyper", "aws-sig-auth", - "aws-sigv4", "aws-smithy-async", "aws-smithy-client", - "aws-smithy-eventstream", "aws-smithy-http", + "aws-smithy-http-tower", + "aws-smithy-query", "aws-smithy-types", "aws-smithy-xml", "aws-types", "bytes 1.1.0", "http", - "md5", "tower", ] [[package]] name = "aws-sig-auth" -version = "0.2.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a16b8c9818854a3a3bba85e970f59d7f09ca0985ff10c9031bb03c95b291323" +checksum = "3fa501148ae6b5e0de5eeb8c4cf87fa3403d9a00077e543ad64011da781f73a6" dependencies = [ "aws-sigv4", "aws-smithy-eventstream", @@ -772,11 +815,12 @@ dependencies = [ [[package]] name = "aws-sigv4" -version = "0.2.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7f531763d106b1f050421d8256ce5d585e75e861d466fe8920157a004d28bf0" +checksum = "51d371fb688d909e5b866ff1f297bbec4621eed4f9fcdac566fcc33541f0c6a6" dependencies = [ "aws-smithy-eventstream", + "aws-smithy-http", "bytes 1.1.0", "form_urlencoded", "hex", @@ -785,25 +829,27 @@ dependencies = [ "percent-encoding", "regex", "ring", - "time 0.3.6", + "time 0.3.7", "tracing", ] [[package]] name = "aws-smithy-async" -version = "0.32.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "969717af8b7eb7424b67fce3f3c8539b0cf72322f909a30d7ea9e8c5ed2bf929" +checksum = "8ec4efb4a27ced592009787f4f03925f348a5b4a55e6a617e6819788d6cd5ed8" dependencies = [ - "pin-project-lite 0.2.7", - "tokio 1.14.0", + "futures-util", + "pin-project-lite 0.2.8", + "tokio 1.17.0", + "tokio-stream", ] [[package]] name = "aws-smithy-client" -version = "0.32.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ffd13190653d37833cf403f7b2963bdd903166933db231a13bdc48ba3fd237" +checksum = "dad1857eb59d562e82f05c02fbcb9f46c1089301c86770a9798c9e64e5a4677a" dependencies = [ "aws-smithy-async", "aws-smithy-http", @@ -816,18 +862,18 @@ dependencies = [ "hyper", "hyper-rustls 0.22.1", "lazy_static", - "pin-project 1.0.8", - "pin-project-lite 0.2.7", - "tokio 1.14.0", + "pin-project", + "pin-project-lite 0.2.8", + "tokio 1.17.0", "tower", "tracing", ] [[package]] name = "aws-smithy-eventstream" -version = "0.32.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1c450819c3918ad7ee8c768a0304edf1f2c53645e0f6b73368bdbbcf540dad" +checksum = "f972226c639e0dc1eca2cb0220c1b5799e2bfc62eda37845b662c5d0cb972371" dependencies = [ "aws-smithy-types", "bytes 1.1.0", @@ -836,9 +882,9 @@ dependencies = [ [[package]] name = "aws-smithy-http" -version = "0.32.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4b5992632c561f03699f25d1deda4c73b70be7c9acc0fc3626b270d3cb9a987" +checksum = "12c787e24b757634453a60ff05948aa1b450f5b3a7a2094f22acff8a5022635b" dependencies = [ "aws-smithy-eventstream", "aws-smithy-types", @@ -849,44 +895,63 @@ dependencies = [ "http-body", "hyper", "percent-encoding", - "pin-project 1.0.8", - "tokio 1.14.0", - "tokio-util", + "pin-project", + "tokio 1.17.0", + "tokio-util 0.6.9", "tracing", ] [[package]] name = "aws-smithy-http-tower" -version = "0.32.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaff953c819ed72da79b302ce7ca4464881af23eadc7e5762e9244c90ae6b708" +checksum = "64f80a2c56fc09fc9a2da3c63f286ec2a89465433219f8165e14e522283a5eb8" dependencies = [ "aws-smithy-http", "bytes 1.1.0", "http", "http-body", - "pin-project 1.0.8", + "pin-project", "tower", "tracing", ] +[[package]] +name = "aws-smithy-json" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b59d67d8baecb7485eeb75eb7f262777d5727cd368b16757207c9c1bdf506bd8" +dependencies = [ + "aws-smithy-types", +] + +[[package]] +name = "aws-smithy-query" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b804b3302b20ec701104fbd59058ab09e5d4a03387b37c9a1fb990615f6c81e" +dependencies = [ + "aws-smithy-types", + "urlencoding", +] + [[package]] name = "aws-smithy-types" -version = "0.32.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6371c45cde03dc11814f63496366367dacd19af6bfc089c27582bad0c7384fab" +checksum = "dfed653678d1059bed597054c65ce44892aa79cd94444e386d7611843db9f0a2" dependencies = [ - "itoa 0.4.8", + "itoa 1.0.1", "num-integer", "ryu", - "time 0.3.6", + "time 0.3.7", ] [[package]] name = "aws-smithy-xml" -version = "0.32.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167c7e63beace20d29d94143c5a6dd6f4d24142c97ef6c36d8bc7fbf9475c93b" +checksum = "7aa6c9de6c3f875faabcaaad1fb1f4ef241683bfc22795f731719e3568c3ca9f" dependencies = [ "thiserror", "xmlparser", @@ -894,11 +959,12 @@ dependencies = [ [[package]] name = "aws-types" -version = "0.2.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3d5fa5c7fba8b0e9b743ba3da17a14c9f2e882f775d5ed198b602fb331b670" +checksum = "b111a0d144e1c570675358d2fae7eb5ddf9010d9db63142fe3bb80353ff65f38" dependencies = [ "aws-smithy-async", + "aws-smithy-client", "aws-smithy-types", "rustc_version 0.4.0", "tracing", @@ -907,9 +973,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "321629d8ba6513061f26707241fa9bc89524ff1cd7a915a97ef0c62c666ce1b6" +checksum = "5e121dee8023ce33ab248d9ce1493df03c3b38a659b240096fcbd7048ff9c31f" dependencies = [ "addr2line", "cc", @@ -964,18 +1030,9 @@ dependencies = [ [[package]] name = "bimap" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50ae17cabbc8a38a1e3e4c1a6a664e9a09672dc14d0896fa8d865d3a5a446b07" - -[[package]] -name = "bincode" -version = "1.3.3" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] +checksum = "bc0455254eb5c6964c4545d8bac815e1a1be4f3afe0ae695ea539c12d728d44b" [[package]] name = "bindgen" @@ -1021,21 +1078,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "blake3" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b64485778c4f16a6a5a9d335e80d449ac6c70cdd6a06d2af18a6f6f775a125b3" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if 0.1.10", - "constant_time_eq", - "crypto-mac 0.8.0", - "digest", -] - [[package]] name = "block-buffer" version = "0.9.0" @@ -1046,20 +1088,22 @@ dependencies = [ ] [[package]] -name = "block-modes" -version = "0.8.1" +name = "block-buffer" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb03d1bed155d89dce0f845b7899b18a9a163e148fd004e1c28421a783e2d8e" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" dependencies = [ - "block-padding", - "cipher 0.3.0", + "generic-array", ] [[package]] name = "block-padding" -version = "0.2.1" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" +checksum = "5808df4b2412175c4db3afb115c83d8d0cd26ca4f30a042026cddef8580e526a" +dependencies = [ + "generic-array", +] [[package]] name = "blocking" @@ -1089,9 +1133,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.8.0" +version = "3.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c" +checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" [[package]] name = "byteorder" @@ -1123,15 +1167,24 @@ dependencies = [ [[package]] name = "cache-padded" -version = "1.1.1" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" + +[[package]] +name = "cbc" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba" +checksum = "a2c68b1d4a461fc5641967e1b255c976579a87ef000c043850ca1aff89faa128" +dependencies = [ + "cipher 0.4.3", +] [[package]] name = "cc" -version = "1.0.72" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" dependencies = [ "jobserver", ] @@ -1171,16 +1224,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "ciborium" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de6836a1b6197d8acdaac74a01af077a26aa6953d2e9251eef061c646b0d432c" -dependencies = [ - "half", - "serde", -] - [[package]] name = "cidr-utils" version = "0.5.5" @@ -1205,18 +1248,19 @@ dependencies = [ [[package]] name = "cipher" -version = "0.3.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" dependencies = [ - "generic-array", + "crypto-common", + "inout", ] [[package]] name = "clang-sys" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa66045b9cb23c2e9c1520732030608b02ee07e5cfaa5a521ec15ded7fa24c90" +checksum = "4cc00842eed744b858222c4c9faf7243aafc6d33f92f96935263ef4d8a41ce21" dependencies = [ "glob", "libc", @@ -1225,9 +1269,9 @@ dependencies = [ [[package]] name = "clap" -version = "2.33.3" +version = "2.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "ansi_term", "atty", @@ -1240,9 +1284,9 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.46" +version = "0.1.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7b858541263efe664aead4a5209a4ae5c5d2811167d4ed4ee0944503f8d2089" +checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a" dependencies = [ "cc", ] @@ -1275,28 +1319,11 @@ dependencies = [ "cache-padded", ] -[[package]] -name = "config" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b076e143e1d9538dde65da30f8481c2a6c44040edb8e02b9bf1351edb92ce3" -dependencies = [ - "lazy_static", - "nom 5.1.2", - "serde", -] - [[package]] name = "const_fn" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7" - -[[package]] -name = "constant_time_eq" -version = "0.1.5" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" [[package]] name = "cookie" @@ -1309,8 +1336,8 @@ dependencies = [ "hkdf", "hmac 0.10.1", "percent-encoding", - "rand 0.8.4", - "sha2", + "rand 0.8.5", + "sha2 0.9.9", "time 0.2.27", "version_check", ] @@ -1323,9 +1350,9 @@ checksum = "396de984970346b0d9e93d1415082923c679e5ae5c3ee3dcbd104f5610af126b" [[package]] name = "core-foundation" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ "core-foundation-sys", "libc", @@ -1369,9 +1396,9 @@ checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" [[package]] name = "crc32fast" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ "cfg-if 1.0.0", ] @@ -1389,9 +1416,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" +checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -1399,9 +1426,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.5" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" +checksum = "c00d6d2ea26e8b151d99093005cb442fb9a37aeaca582a03ec70946f49ab5ed9" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -1410,21 +1437,11 @@ dependencies = [ "scopeguard", ] -[[package]] -name = "crossbeam-queue" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b979d76c9fcb84dffc80a73f7290da0f83e4c95773494674cb44b76d13a7a110" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", -] - [[package]] name = "crossbeam-utils" -version = "0.8.5" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" +checksum = "b5e5bed1f1c269533fa816a0a5492b3545209a205ca1a54842be180eb63a16a6" dependencies = [ "cfg-if 1.0.0", "lazy_static", @@ -1437,13 +1454,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "crypto-mac" -version = "0.8.0" +name = "crypto-common" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" dependencies = [ "generic-array", - "subtle", + "typenum", ] [[package]] @@ -1456,16 +1473,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array", - "subtle", -] - [[package]] name = "csv" version = "1.1.6" @@ -1511,9 +1518,40 @@ dependencies = [ name = "ctr" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" +checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" +dependencies = [ + "cipher 0.2.5", +] + +[[package]] +name = "curl" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7de97b894edd5b5bcceef8b78d7da9b75b1d2f2f9a910569d0bde3dd31d84939" +dependencies = [ + "curl-sys", + "libc", + "openssl-probe", + "openssl-sys", + "schannel", + "socket2 0.4.4", + "winapi", +] + +[[package]] +name = "curl-sys" +version = "0.4.52+curl-7.81.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14b8c2d1023ea5fded5b7b892e4b8e95f70038a421126a056761a84246a28971" dependencies = [ - "cipher 0.2.5", + "cc", + "libc", + "libnghttp2-sys", + "libz-sys", + "openssl-sys", + "pkg-config", + "vcpkg", + "winapi", ] [[package]] @@ -1523,7 +1561,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" dependencies = [ "byteorder", - "digest", + "digest 0.9.0", "rand_core 0.5.1", "subtle", "zeroize", @@ -1531,9 +1569,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "757c0ded2af11d8e739c4daea1ac623dd1624b06c844cf3f5a39f1bdbd99bb12" +checksum = "d0d720b8683f8dd83c65155f0530560cba68cd2bf395f6513a483caee57ff7f4" dependencies = [ "darling_core", "darling_macro", @@ -1541,9 +1579,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c34d8efb62d0c2d7f60ece80f75e5c63c1588ba68032740494b0b9a996466e3" +checksum = "7a340f241d2ceed1deb47ae36c4144b2707ec7dd0b649f894cb39bb595986324" dependencies = [ "fnv", "ident_case", @@ -1555,9 +1593,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade7bff147130fe5e6d39f089c6bd49ec0250f35d70b2eebf72afdfc919f15cc" +checksum = "72c41b3b7352feb3211a0d743dc5700a4e3b60f51bd2b368892d1e0f9a95f44b" dependencies = [ "darling_core", "quote", @@ -1580,20 +1618,6 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" -[[package]] -name = "deadpool" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d126179d86aee4556e54f5f3c6bf6d9884e7cc52cef82f77ee6f90a7747616d" -dependencies = [ - "async-trait", - "config", - "crossbeam-queue", - "num_cpus", - "serde", - "tokio 1.14.0", -] - [[package]] name = "debug-helper" version = "0.3.12" @@ -1613,13 +1637,11 @@ dependencies = [ [[package]] name = "des" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac41dd49fb554432020d52c875fc290e110113f864c6b1b525cd62c7e7747a5d" +checksum = "ffdd80ce8ce993de27e9f063a444a4d53ce8e8db4c1f00cc03af5ad5a9867a1e" dependencies = [ - "byteorder", - "cipher 0.3.0", - "opaque-debug", + "cipher 0.4.3", ] [[package]] @@ -1637,6 +1659,17 @@ dependencies = [ "generic-array", ] +[[package]] +name = "digest" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +dependencies = [ + "block-buffer 0.10.2", + "crypto-common", + "subtle", +] + [[package]] name = "dirs-next" version = "2.0.0" @@ -1706,15 +1739,15 @@ checksum = "ee2626afccd7561a06cf1367e2950c4718ea04565e20fb5029b6c7d8ad09abcf" [[package]] name = "easy-parallel" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd4afd79212583ff429b913ad6605242ed7eec277e950b1438f300748f948f4" +checksum = "6907e25393cdcc1f4f3f513d9aac1e840eb1cc341a0fccb01171f7d14d10b946" [[package]] name = "ed25519" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74e1069e39f1454367eb2de793ed062fac4c35c2934b76a81d90dd9abcd28816" +checksum = "eed12bbf7b5312f8da1c2722bc06d8c6b12c2d86a7fb35a194c7f3e6fc2bbe39" dependencies = [ "signature", ] @@ -1727,7 +1760,7 @@ checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek", "ed25519", - "sha2", + "sha2 0.9.9", "zeroize", ] @@ -1771,20 +1804,20 @@ dependencies = [ [[package]] name = "encoding_rs" -version = "0.8.29" +version = "0.8.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a74ea89a0a1b98f6332de42c95baff457ada66d1cb4030f9ff151b2041a1c746" +checksum = "7896dc8abb250ffdda33912550faa54c88ec8b998dec0b2c55ab224921ce11df" dependencies = [ "cfg-if 1.0.0", ] [[package]] name = "enum-as-inner" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595" +checksum = "570d109b813e904becc80d8d5da38376818a143348413f7149f1340fe04754d4" dependencies = [ - "heck", + "heck 0.4.0", "proc-macro2", "quote", "syn", @@ -1815,9 +1848,18 @@ dependencies = [ [[package]] name = "event-listener" -version = "2.5.1" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71" + +[[package]] +name = "executor-trait" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" +checksum = "1a1052dd43212a7777ec6a69b117da52f5e52f07aec47d00c1a2b33b85d06b08" +dependencies = [ + "async-trait", +] [[package]] name = "fallible-iterator" @@ -1827,29 +1869,13 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" -version = "1.5.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b394ed3d285a429378d3b384b9eb1285267e7df4b166df24b7a6939a04dc392e" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" dependencies = [ "instant", ] -[[package]] -name = "femme" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2af1a24f391a5a94d756db5092c6576aad494b88a71a5a36b20c67b63e0df034" -dependencies = [ - "cfg-if 0.1.10", - "js-sys", - "log", - "serde", - "serde_derive", - "serde_json", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "file-mode" version = "0.1.2" @@ -1867,9 +1893,9 @@ checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" [[package]] name = "fixedbitset" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "398ea4fabe40b9b0d885340a2a991a44c8a645624075ad966d21f88688e2b69e" +checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e" [[package]] name = "flate2" @@ -1892,6 +1918,29 @@ dependencies = [ "num-traits", ] +[[package]] +name = "flume" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bebadab126f8120d410b677ed95eee4ba6eb7c6dd8e34a5ec88a08050e26132" +dependencies = [ + "futures-core", + "futures-sink", + "spinning_top", +] + +[[package]] +name = "flume" +version = "0.10.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b279436a715a9de95dcd26b151db590a71961cc06e54918b24fe0dd5b7d3fc4" +dependencies = [ + "futures-core", + "futures-sink", + "pin-project", + "spin 0.9.2", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1920,9 +1969,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.19" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28560757fe2bb34e79f907794bb6b22ae8b0e5c669b638a1132f2592b19035b4" +checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" dependencies = [ "futures-channel", "futures-core", @@ -1935,9 +1984,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.19" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b" +checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" dependencies = [ "futures-core", "futures-sink", @@ -1945,15 +1994,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.19" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7" +checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" [[package]] name = "futures-executor" -version = "0.3.19" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29d6d2ff5bb10fb95c85b8ce46538a2e5f5e7fdc755623a7d4529ab8a4ed9d2a" +checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" dependencies = [ "futures-core", "futures-task", @@ -1962,9 +2011,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.19" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f9d34af5a1aac6fb380f735fe510746c38067c5bf16c7fd250280503c971b2" +checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" [[package]] name = "futures-lite" @@ -1977,15 +2026,15 @@ dependencies = [ "futures-io", "memchr", "parking", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.8", "waker-fn", ] [[package]] name = "futures-macro" -version = "0.3.19" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbd947adfffb0efc70599b3ddcf7b5597bb5fa9e245eb99f62b3a5f7bb8bd3c" +checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" dependencies = [ "proc-macro2", "quote", @@ -1994,27 +2043,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.19" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3055baccb68d74ff6480350f8d6eb8fcfa3aa11bdc1a1ae3afdd0514617d508" +checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" [[package]] name = "futures-task" -version = "0.3.19" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ee7c6485c30167ce4dfb83ac568a849fe53274c831081476ee13e0dce1aad72" - -[[package]] -name = "futures-timer" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" +checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" [[package]] name = "futures-util" -version = "0.3.19" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164" +checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" dependencies = [ "futures-channel", "futures-core", @@ -2023,23 +2066,11 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.8", "pin-utils", "slab", ] -[[package]] -name = "futures_codec" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce54d63f8b0c75023ed920d46fd71d0cbbb830b0ee012726b5b4f506fb6dea5b" -dependencies = [ - "bytes 0.5.6", - "futures", - "memchr", - "pin-project 0.4.28", -] - [[package]] name = "fxhash" version = "0.2.1" @@ -2071,9 +2102,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.4" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" dependencies = [ "typenum", "version_check", @@ -2092,9 +2123,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77" dependencies = [ "cfg-if 1.0.0", "libc", @@ -2125,15 +2156,14 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "gloo-timers" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f" +checksum = "4d12a7f4e95cfe710f1d624fb1210b7d961a5fb05c4fd942f4feab06e61f590e" dependencies = [ "futures-channel", "futures-core", "js-sys", "wasm-bindgen", - "web-sys", ] [[package]] @@ -2173,9 +2203,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c9de88456263e249e241fcd211d3954e2c9b0ef7ccfc235a444eb367cae3689" +checksum = "d9f1f717ddc7b2ba36df7e871fd88db79326551d3d6f1fc406fbfd28b582ff8e" dependencies = [ "bytes 1.1.0", "fnv", @@ -2185,17 +2215,11 @@ dependencies = [ "http", "indexmap", "slab", - "tokio 1.14.0", - "tokio-util", + "tokio 1.17.0", + "tokio-util 0.6.9", "tracing", ] -[[package]] -name = "half" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" - [[package]] name = "halfbrown" version = "0.1.12" @@ -2203,7 +2227,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ed39577259d319b81a15176a32673271be2786cb463889703c58c90fe83c825" dependencies = [ "fxhash", - "hashbrown", + "hashbrown 0.11.2", "serde", ] @@ -2212,6 +2236,15 @@ name = "hashbrown" version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c21d40587b92fa6a6c6e3c1bdbf87d75511db5672f9c93175574b3a00df1758" dependencies = [ "ahash", "serde", @@ -2219,9 +2252,9 @@ dependencies = [ [[package]] name = "hdrhistogram" -version = "7.4.0" +version = "7.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6490be71f07a5f62b564bc58e36953f675833df11c7e4a0647bee7a07ca1ec5e" +checksum = "31672b7011be2c4f7456c4ddbcb40e7e9a4a9fad8efe49a6ebaf5f307d0109c0" dependencies = [ "base64 0.13.0", "byteorder", @@ -2240,6 +2273,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -2261,38 +2300,27 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51ab2f639c231793c5f6114bdb9bbe50a7dbbfcd7c7c6bd8475dec2d991e964f" dependencies = [ - "digest", + "digest 0.9.0", "hmac 0.10.1", ] -[[package]] -name = "hmac" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" -dependencies = [ - "crypto-mac 0.8.0", - "digest", -] - [[package]] name = "hmac" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" dependencies = [ - "crypto-mac 0.10.1", - "digest", + "crypto-mac", + "digest 0.9.0", ] [[package]] name = "hmac" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "crypto-mac 0.11.1", - "digest", + "digest 0.10.3", ] [[package]] @@ -2325,7 +2353,7 @@ checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" dependencies = [ "bytes 1.1.0", "http", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.8", ] [[package]] @@ -2334,17 +2362,13 @@ version = "6.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea880b03c18a7e981d7fb3608b8904a98425d53c440758fcebf7d934aa56547c" dependencies = [ - "async-h1", "async-std", - "async-tls 0.10.0", "async-trait", "cfg-if 1.0.0", "dashmap", - "deadpool", - "futures", "http-types", + "isahc", "log", - "rustls 0.18.1", ] [[package]] @@ -2360,20 +2384,20 @@ dependencies = [ "cookie", "futures-lite", "infer", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.8", "rand 0.7.3", "serde", "serde_json", "serde_qs", - "serde_urlencoded 0.7.0", + "serde_urlencoded 0.7.1", "url", ] [[package]] name = "httparse" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" +checksum = "9100414882e15fb7feccb4897e5f0ff0ff1ca7d1a86a23208ada4d7a18e6c6c4" [[package]] name = "httpdate" @@ -2389,9 +2413,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.15" +version = "0.14.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436ec0091e4f20e655156a30a0df3770fe2900aa301e548e08446ec794b6953c" +checksum = "043f0e083e9901b6cc658a77d1eb86f4fc650bbb977a4337dd63192826aa85dd" dependencies = [ "bytes 1.1.0", "futures-channel", @@ -2402,10 +2426,10 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 0.4.8", - "pin-project-lite 0.2.7", - "socket2 0.4.2", - "tokio 1.14.0", + "itoa 1.0.1", + "pin-project-lite 0.2.8", + "socket2 0.4.4", + "tokio 1.17.0", "tower-service", "tracing", "want", @@ -2423,7 +2447,7 @@ dependencies = [ "log", "rustls 0.19.1", "rustls-native-certs 0.5.0", - "tokio 1.14.0", + "tokio 1.17.0", "tokio-rustls 0.22.0", "webpki 0.21.4", ] @@ -2436,9 +2460,9 @@ checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" dependencies = [ "http", "hyper", - "rustls 0.20.2", - "tokio 1.14.0", - "tokio-rustls 0.23.1", + "rustls 0.20.4", + "tokio 1.17.0", + "tokio-rustls 0.23.2", ] [[package]] @@ -2448,8 +2472,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ "hyper", - "pin-project-lite 0.2.7", - "tokio 1.14.0", + "pin-project-lite 0.2.8", + "tokio 1.17.0", "tokio-io-timeout", ] @@ -2472,12 +2496,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" +checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.11.2", "serde", ] @@ -2487,6 +2511,16 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64e9829a50b42bb782c1df523f78d332fe371b10c661e78b7a3c34b0198e9fac" +[[package]] +name = "inout" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1f03d4ab4d5dc9ec2d219f86c15d2a15fc08239d1cd3b2d6a19717c0a2f443" +dependencies = [ + "block-padding", + "generic-array", +] + [[package]] name = "input_buffer" version = "0.3.1" @@ -2523,11 +2557,34 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" +[[package]] +name = "isahc" +version = "0.9.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2948a0ce43e2c2ef11d7edf6816508998d99e13badd1150be0914205df9388a" +dependencies = [ + "bytes 0.5.6", + "crossbeam-utils", + "curl", + "curl-sys", + "flume 0.9.2", + "futures-lite", + "http", + "log", + "once_cell", + "slab", + "sluice", + "tracing", + "tracing-futures", + "url", + "waker-fn", +] + [[package]] name = "itertools" -version = "0.10.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" dependencies = [ "either", ] @@ -2555,9 +2612,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.55" +version = "0.3.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" +checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04" dependencies = [ "wasm-bindgen", ] @@ -2588,7 +2645,7 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6cb1d4856e6c1b02aea6b85073b45daa15af1ba17f1750f8ca8772068915da0" dependencies = [ - "rand 0.8.4", + "rand 0.8.5", "siphasher", ] @@ -2603,9 +2660,9 @@ dependencies = [ [[package]] name = "lalrpop" -version = "0.19.6" +version = "0.19.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15174f1c529af5bf1283c3bc0058266b483a67156f79589fab2a25e23cf8988" +checksum = "852b75a095da6b69da8c5557731c3afd06525d4f655a4fc1c799e2ec8bc4dce4" dependencies = [ "ascii-canvas", "atty", @@ -2626,28 +2683,33 @@ dependencies = [ [[package]] name = "lalrpop-util" -version = "0.19.6" +version = "0.19.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e58cce361efcc90ba8a0a5f982c741ff86b603495bb15a998412e957dcd278" +checksum = "d6d265705249fe209280676d8f68887859fa42e1d34f342fc05bd47726a5e188" dependencies = [ "regex", ] [[package]] name = "lapin" -version = "1.9.0" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef0a8c145a248b1536cfa06890d480cda7982add59f77973ac7b03db47f349b5" +checksum = "bf0ed57ec20c679e1a88af72b412ca05c0d5bb7f21a86d48b325d166792c6ea6" dependencies = [ "amq-protocol", - "async-task", - "crossbeam-channel", + "async-global-executor-trait", + "async-reactor-trait", + "async-trait", + "executor-trait", + "flume 0.10.11", "futures-core", - "log", - "mio", - "parking_lot", + "futures-io", + "parking_lot 0.12.0", "pinky-swear", + "reactor-trait", "serde", + "tracing", + "waker-fn", ] [[package]] @@ -2668,20 +2730,7 @@ version = "6.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34e981f88d060a67815388470172638f1af16b3a12e581cb75142f190161bf9" dependencies = [ - "lexical-core 0.8.2", -] - -[[package]] -name = "lexical-core" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" -dependencies = [ - "arrayvec", - "bitflags", - "cfg-if 1.0.0", - "ryu", - "static_assertions", + "lexical-core", ] [[package]] @@ -2750,15 +2799,15 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.107" +version = "0.2.119" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219" +checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4" [[package]] name = "libflate" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16364af76ebb39b5869bb32c81fa93573267cd8c62bb3474e28d78fac3fb141e" +checksum = "d2d57e534717ac3e0b8dc459fe338bdfb4e29d7eea8fd0926ba649ddd3f4765f" dependencies = [ "adler32", "crc32fast", @@ -2776,14 +2825,24 @@ dependencies = [ [[package]] name = "libloading" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afe203d669ec979b7128619bae5a63b7b42e9203c1b29146079ee05e2f604b52" +checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" dependencies = [ "cfg-if 1.0.0", "winapi", ] +[[package]] +name = "libnghttp2-sys" +version = "0.1.7+1.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57ed28aba195b38d5ff02b9170cbff627e336a20925e43b4945390401c5dc93f" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "libz-sys" version = "1.1.3" @@ -2804,9 +2863,9 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] name = "lock_api" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" +checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" dependencies = [ "scopeguard", ] @@ -2843,7 +2902,7 @@ dependencies = [ "libc", "log", "log-mdc", - "parking_lot", + "parking_lot 0.11.2", "regex", "serde", "serde-value", @@ -2857,11 +2916,11 @@ dependencies = [ [[package]] name = "lru" -version = "0.7.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c748cfe47cb8da225c37595b3108bea1c198c84aaae8ea0ba76d01dda9fc803" +checksum = "fcb87f3080f6d1d69e8c564c0fcfde1d7aa8cc451ce40cae89479111f03bc0eb" dependencies = [ - "hashbrown", + "hashbrown 0.11.2", ] [[package]] @@ -2928,13 +2987,11 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "md-5" -version = "0.9.1" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15" +checksum = "658646b21e0b72f7866c7038ab086d3d5e1cd6271f060fd37defb241949d0582" dependencies = [ - "block-buffer", - "digest", - "opaque-debug", + "digest 0.10.3", ] [[package]] @@ -2951,9 +3008,9 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "memoffset" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ "autocfg", ] @@ -2980,9 +3037,9 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" [[package]] name = "mime_guess" -version = "2.0.3" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" dependencies = [ "mime", "unicase", @@ -3006,9 +3063,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.7.14" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" +checksum = "ba272f85fa0b41fc91872be579b3bbe0f56b792aa361a380eb669469f68dafb2" dependencies = [ "libc", "log", @@ -3050,7 +3107,7 @@ dependencies = [ "nkeys", "nuid", "once_cell", - "parking_lot", + "parking_lot 0.11.2", "regex", "rustls 0.19.1", "rustls-native-certs 0.5.0", @@ -3093,7 +3150,6 @@ version = "5.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" dependencies = [ - "lexical-core 0.7.6", "memchr", "version_check", ] @@ -3111,21 +3167,21 @@ dependencies = [ [[package]] name = "ntapi" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" dependencies = [ "winapi", ] [[package]] name = "nuid" -version = "0.3.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7000c9392b545c4ba43e8abc086bf7d01cd2948690934c16980170b0549a2bd3" +checksum = "20c1bb65186718d348306bf1afdeb20d9ab45b2ab80fb793c0fdcf59ffbb4f38" dependencies = [ "lazy_static", - "rand 0.8.4", + "rand 0.8.5", ] [[package]] @@ -3171,9 +3227,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" dependencies = [ "hermit-abi", "libc", @@ -3181,19 +3237,18 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9bd055fb730c4f8f4f57d45d35cd6b3f0980535b056dc7ff119cee6a66ed6f" +checksum = "720d3ea1055e4e4574c0c0b0f8c3fd4f24c4cdaf465948206dea090b57b526ad" dependencies = [ - "derivative", "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486ea01961c4a818096de679a8b740b26d9033146ac5291b1c98557658f8cdd9" +checksum = "0d992b768490d7fe0d8586d9b5745f6c49f557da6d81dc982b1d167ad4edbb21" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3203,9 +3258,9 @@ dependencies = [ [[package]] name = "num_threads" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71a1eb3a36534514077c1e079ada2fb170ef30c47d203aa6916138cf882ecd52" +checksum = "97ba99ba6393e2c3734791401b66902d981cb03bf190af674ca69949b6d5fb15" dependencies = [ "libc", ] @@ -3221,9 +3276,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" +checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" [[package]] name = "onig" @@ -3256,19 +3311,49 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl-probe" -version = "0.1.4" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" +checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] [[package]] name = "ordered-float" -version = "2.8.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97c9d06878b3a851e8026ef94bf7fef9ba93062cd412601da4d9cf369b1cc62d" +checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" dependencies = [ "num-traits", ] +[[package]] +name = "p12" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4873306de53fe82e7e484df31e1e947d61514b6ea2ed6cd7b45d63006fd9224" +dependencies = [ + "cbc", + "cipher 0.4.3", + "des", + "getrandom 0.2.5", + "hmac 0.12.1", + "lazy_static", + "rc2", + "sha1 0.10.1", + "yasna", +] + [[package]] name = "parking" version = "2.0.0" @@ -3283,21 +3368,44 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core", + "parking_lot_core 0.8.5", +] + +[[package]] +name = "parking_lot" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.1", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if 1.0.0", + "instant", + "libc", + "redox_syscall 0.2.11", + "smallvec", + "winapi", ] [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954" dependencies = [ "cfg-if 1.0.0", - "instant", "libc", - "redox_syscall 0.2.10", + "redox_syscall 0.2.11", "smallvec", - "winapi", + "windows-sys", ] [[package]] @@ -3345,26 +3453,17 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f" dependencies = [ - "fixedbitset 0.4.0", + "fixedbitset 0.4.1", "indexmap", ] [[package]] name = "phf" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fc3db1018c4b59d7d582a739436478b6035138b6aecbce989fc91c3e98409f" -dependencies = [ - "phf_shared 0.10.0", -] - -[[package]] -name = "phf_shared" -version = "0.8.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" dependencies = [ - "siphasher", + "phf_shared", ] [[package]] @@ -3384,38 +3483,18 @@ checksum = "db8bcd96cb740d03149cbad5518db9fd87126a10ab519c011893b1754134c468" [[package]] name = "pin-project" -version = "0.4.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "918192b5c59119d51e0cd221f4d49dde9112824ba717369e903c97d076083d0f" -dependencies = [ - "pin-project-internal 0.4.28", -] - -[[package]] -name = "pin-project" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" -dependencies = [ - "pin-project-internal 1.0.8", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.28" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be26700300be6d9d23264c73211d8190e755b6b5ca7a1b28230025511b52a5e" +checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" dependencies = [ - "proc-macro2", - "quote", - "syn", + "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" +checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" dependencies = [ "proc-macro2", "quote", @@ -3430,9 +3509,9 @@ checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" +checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" [[package]] name = "pin-utils" @@ -3442,36 +3521,21 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pinky-swear" -version = "4.4.0" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bf8cda6f8e1500338634e4e3ce90ac59eb7929a1e088b6946c742be1cc44dc1" +checksum = "d894b67aa7a4bf295db5e85349078c604edaa6fa5c8721e8eca3c7729a27f2ac" dependencies = [ "doc-comment", - "parking_lot", + "flume 0.10.11", + "parking_lot 0.12.0", "tracing", ] -[[package]] -name = "pkcs-12" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6345e5ee413553f694ac3118cb4a7f85093117ee7b84ce67fde6fd1ff48ef5ff" -dependencies = [ - "block-modes", - "des", - "getrandom 0.2.3", - "hmac 0.11.0", - "lazy_static", - "rc2", - "sha-1", - "yasna", -] - [[package]] name = "pkg-config" -version = "0.3.22" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12295df4f294471248581bc09bef3c38a5e46f1e36d6a37353621a0c6c357e1f" +checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" [[package]] name = "polling" @@ -3513,25 +3577,25 @@ dependencies = [ "fallible-iterator", "futures", "log", - "tokio 1.14.0", + "tokio 1.17.0", "tokio-postgres", ] [[package]] name = "postgres-protocol" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b145e6a4ed52cb316a27787fc20fe8a25221cb476479f61e4e0327c15b98d91a" +checksum = "79ec03bce71f18b4a27c4c64c6ba2ddf74686d69b91d8714fb32ead3adaed713" dependencies = [ "base64 0.13.0", "byteorder", "bytes 1.1.0", "fallible-iterator", - "hmac 0.11.0", + "hmac 0.12.1", "md-5", "memchr", - "rand 0.8.4", - "sha2", + "rand 0.8.5", + "sha2 0.10.2", "stringprep", ] @@ -3551,9 +3615,9 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] name = "precomputed-hash" @@ -3563,9 +3627,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "proc-macro-crate" -version = "1.1.0" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebace6889caf889b4d3f76becee12e90353f2b8c7d875534a71e5742f8f6f83" +checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" dependencies = [ "thiserror", "toml", @@ -3579,9 +3643,9 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" -version = "1.0.32" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43" +checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" dependencies = [ "unicode-xid", ] @@ -3603,7 +3667,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603" dependencies = [ "bytes 1.1.0", - "heck", + "heck 0.3.3", "itertools", "log", "multimap", @@ -3611,7 +3675,7 @@ dependencies = [ "prost", "prost-types", "tempfile", - "which 4.2.2", + "which 4.2.4", ] [[package]] @@ -3645,9 +3709,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.10" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" +checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" dependencies = [ "proc-macro2", ] @@ -3671,19 +3735,18 @@ dependencies = [ "libc", "rand_chacha 0.2.2", "rand_core 0.5.1", - "rand_hc 0.2.0", + "rand_hc", ] [[package]] name = "rand" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha 0.3.1", "rand_core 0.6.3", - "rand_hc 0.3.1", ] [[package]] @@ -3721,7 +3784,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.3", + "getrandom 0.2.5", ] [[package]] @@ -3733,30 +3796,19 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rand_hc" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" -dependencies = [ - "rand_core 0.6.3", -] - [[package]] name = "rc2" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48f197c283075d1345c20d5ad172526a7837882cdc998b1fcd2b2f3cfff1cb94" +checksum = "62c64daa8e9438b84aaae55010a93f396f8e60e3911590fcba770d04643fc1dd" dependencies = [ - "cipher 0.3.0", - "opaque-debug", + "cipher 0.4.3", ] [[package]] name = "rdkafka" version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1de127f294f2dba488ed46760b129d5ecbeabbd337ccbf3739cb29d50db2161c" +source = "git+https://github.com/fede1024/rust-rdkafka?rev=7a2355f03c9aee8d4544e89bc4b0b0b6b96826e0#7a2355f03c9aee8d4544e89bc4b0b0b6b96826e0" dependencies = [ "futures", "libc", @@ -3771,8 +3823,7 @@ dependencies = [ [[package]] name = "rdkafka-sys" version = "4.2.0+1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e542c6863b04ce0fa0c5719bc6b7b348cf8dd21af1bb03c9db5f9805b2a6473" +source = "git+https://github.com/fede1024/rust-rdkafka?rev=7a2355f03c9aee8d4544e89bc4b0b0b6b96826e0#7a2355f03c9aee8d4544e89bc4b0b0b6b96826e0" dependencies = [ "cmake", "libc", @@ -3781,6 +3832,17 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "reactor-trait" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "438a4293e4d097556730f4711998189416232f009c137389e0f961d2bc0ddc58" +dependencies = [ + "async-trait", + "futures-core", + "futures-io", +] + [[package]] name = "redox_syscall" version = "0.1.57" @@ -3789,9 +3851,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +checksum = "8380fe0152551244f0747b1bf41737e0f8a74f97a14ccefd1148187271634f3c" dependencies = [ "bitflags", ] @@ -3802,8 +3864,8 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" dependencies = [ - "getrandom 0.2.3", - "redox_syscall 0.2.10", + "getrandom 0.2.5", + "redox_syscall 0.2.11", ] [[package]] @@ -3871,16 +3933,16 @@ dependencies = [ "mime", "mime_guess", "percent-encoding", - "pin-project-lite 0.2.7", - "rustls 0.20.2", + "pin-project-lite 0.2.8", + "rustls 0.20.4", "rustls-native-certs 0.6.1", "rustls-pemfile", "serde", "serde_json", - "serde_urlencoded 0.7.0", - "tokio 1.14.0", - "tokio-rustls 0.23.1", - "tokio-util", + "serde_urlencoded 0.7.1", + "tokio 1.17.0", + "tokio-rustls 0.23.2", + "tokio-util 0.6.9", "url", "wasm-bindgen", "wasm-bindgen-futures", @@ -3908,7 +3970,7 @@ dependencies = [ "cc", "libc", "once_cell", - "spin", + "spin 0.5.2", "untrusted", "web-sys", "winapi", @@ -3916,9 +3978,9 @@ dependencies = [ [[package]] name = "rle-decode-fast" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac" +checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422" [[package]] name = "rmp" @@ -3932,9 +3994,9 @@ dependencies = [ [[package]] name = "rmp-serde" -version = "0.15.5" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723ecff9ad04f4ad92fe1c8ca6c20d2196d9286e9c60727c4cb5511629260e9d" +checksum = "f3eedffbfcc6a428f230c04baf8f59bd73c1781361e4286111fe900849aaddaf" dependencies = [ "byteorder", "rmp", @@ -3974,7 +4036,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.4", + "semver 1.0.6", ] [[package]] @@ -4005,9 +4067,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.20.2" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d37e5e2290f3e040b594b1a9e04377c2c671f1a1cfd9bfdef82106ac1c113f84" +checksum = "4fbfeb8d0ddb84706bc597a5574ab8912817c52a397f819e5b614e2265206921" dependencies = [ "log", "ring", @@ -4017,14 +4079,14 @@ dependencies = [ [[package]] name = "rustls-connector" -version = "0.13.1" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ffaf21b0bac725875490d079bb503cf88684618310c2dff167640fa006217cb" +checksum = "9c6a18f8d10f71bce9bca6eaeb80429460e652f3bcf0381f0c5f8954abf7b3b8" dependencies = [ "log", - "rustls 0.19.1", - "rustls-native-certs 0.5.0", - "webpki 0.21.4", + "rustls 0.20.4", + "rustls-native-certs 0.6.1", + "webpki 0.22.0", ] [[package]] @@ -4062,15 +4124,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088" +checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" [[package]] name = "ryu" -version = "1.0.5" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" [[package]] name = "same-file" @@ -4119,9 +4181,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.4.2" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525bc1abfda2e1998d152c45cf13e696f76d0a4972310b22fac1658b05df7c87" +checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" dependencies = [ "bitflags", "core-foundation", @@ -4132,9 +4194,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.4.2" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9dd14d83160b528b7bfd66439110573efcfbe281b17fc2ca9f39f550d619c7e" +checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" dependencies = [ "core-foundation-sys", "libc", @@ -4151,9 +4213,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012" +checksum = "a4a3381e03edd24287172047536f20cabde766e2cd3e65e6b00fb3af51c4f38d" [[package]] name = "semver-parser" @@ -4163,9 +4225,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.130" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" +checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" dependencies = [ "serde_derive", ] @@ -4182,9 +4244,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.130" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" +checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" dependencies = [ "proc-macro2", "quote", @@ -4193,11 +4255,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.71" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063bf466a64011ac24040a49009724ee60a57da1b437617ceb32e53ad61bfb19" +checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" dependencies = [ - "itoa 0.4.8", + "itoa 1.0.1", "ryu", "serde", ] @@ -4227,21 +4289,21 @@ dependencies = [ [[package]] name = "serde_urlencoded" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 0.4.8", + "itoa 1.0.1", "ryu", "serde", ] [[package]] name = "serde_with" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad6056b4cb69b6e43e3a0f055def223380baecc99da683884f205bf347f7c4b3" +checksum = "ec1e6ec4d8950e5b1e894eac0d360742f3b1407a6078a604a731c4b3f49cefbc" dependencies = [ "rustversion", "serde", @@ -4262,21 +4324,21 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.8.21" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8c608a35705a5d3cdc9fbe403147647ff34b921f8e833e49306df898f9b20af" +checksum = "a4a521f2940385c165a24ee286aa8599633d162077a54bdcae2a6fd5a7bfa7a0" dependencies = [ - "dtoa", "indexmap", + "ryu", "serde", "yaml-rust", ] [[package]] name = "serenity" -version = "0.10.9" +version = "0.10.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6275d443266aedf2be507a245ddc23db0c07b1b99774e16f3c879e96a78b067a" +checksum = "dde86919535c6047e055d512641c5241320c01cb8fee54f1e5ba77c939a0ec23" dependencies = [ "async-trait", "async-tungstenite 0.11.0", @@ -4290,7 +4352,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "tokio 1.14.0", + "tokio 1.17.0", "tracing", "typemap_rev", "url", @@ -4302,32 +4364,63 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ - "block-buffer", + "block-buffer 0.9.0", "cfg-if 1.0.0", "cpufeatures", - "digest", + "digest 0.9.0", "opaque-debug", ] [[package]] name = "sha1" -version = "0.6.0" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770" +dependencies = [ + "sha1_smol", +] + +[[package]] +name = "sha1" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c77f4e7f65455545c2153c1253d25056825e77ee2533f0e41deb65a93a34852f" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.3", +] + +[[package]] +name = "sha1_smol" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" +checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" [[package]] name = "sha2" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ - "block-buffer", + "block-buffer 0.9.0", "cfg-if 1.0.0", "cpufeatures", - "digest", + "digest 0.9.0", "opaque-debug", ] +[[package]] +name = "sha2" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.3", +] + [[package]] name = "shlex" version = "0.1.1" @@ -4336,9 +4429,9 @@ checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" [[package]] name = "signal-hook" -version = "0.3.10" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c98891d737e271a2954825ef19e46bd16bdb98e2746f2eec4f7a4ef7946efd1" +checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d" dependencies = [ "libc", "signal-hook-registry", @@ -4367,9 +4460,9 @@ dependencies = [ [[package]] name = "signature" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" +checksum = "f054c6c1a6e95179d6f23ed974060dcefb2d9388bb7256900badad682c499de4" [[package]] name = "simd-json" @@ -4387,7 +4480,7 @@ dependencies = [ [[package]] name = "simd-json-derive" version = "0.2.3-alpha.0" -source = "git+https://github.com/marioortizmanero/simd-json-derive.git?branch=abi-stable#9ed3dd1ba61925c0d72940cc67c6fb6a0110555c" +source = "git+https://github.com/marioortizmanero/simd-json-derive.git?branch=abi-stable#4519e1a591c610ea0b764280f4b99b258d845f1c" dependencies = [ "abi_stable", "chrono", @@ -4401,7 +4494,7 @@ dependencies = [ [[package]] name = "simd-json-derive-int" version = "0.2.2-alpha.0" -source = "git+https://github.com/marioortizmanero/simd-json-derive.git?branch=abi-stable#9ed3dd1ba61925c0d72940cc67c6fb6a0110555c" +source = "git+https://github.com/marioortizmanero/simd-json-derive.git?branch=abi-stable#4519e1a591c610ea0b764280f4b99b258d845f1c" dependencies = [ "proc-macro2", "quote", @@ -4437,9 +4530,9 @@ dependencies = [ [[package]] name = "siphasher" -version = "0.3.7" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "533494a8f9b724d33625ab53c6c4800f7cc445895924a8ef649222dcb76e938b" +checksum = "a86232ab60fa71287d7f2ddae4a7073f6b7aac33631c3015abb556f08c6d0a3e" [[package]] name = "sketches-ddsketch" @@ -4466,14 +4559,25 @@ dependencies = [ "fxhash", "libc", "log", - "parking_lot", + "parking_lot 0.11.2", +] + +[[package]] +name = "sluice" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d7400c0eff44aa2fcb5e31a5f24ba9716ed90138769e4977a2ba6014ae63eb5" +dependencies = [ + "async-channel", + "futures-core", + "futures-io", ] [[package]] name = "smallvec" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" +checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" [[package]] name = "smol" @@ -4512,9 +4616,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" +checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" dependencies = [ "libc", "winapi", @@ -4527,15 +4631,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] -name = "sse-codec" -version = "0.3.2" +name = "spin" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a59f811350c44b4a037aabeb72dc6a9591fc22aa95a036db9a96297c58085a" +checksum = "511254be0c5bcf062b019a6c89c01a664aa359ded62f78aa72c6fc137c0590e5" dependencies = [ - "bytes 0.5.6", - "futures-io", - "futures_codec", - "memchr", + "lock_api", +] + +[[package]] +name = "spinning_top" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75adad84ee84b521fb2cca2d4fd0f1dab1d8d026bda3c5bea4ca63b5f9f9293c" +dependencies = [ + "lock_api", ] [[package]] @@ -4592,7 +4702,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "sha1", + "sha1 0.6.1", "syn", ] @@ -4604,14 +4714,14 @@ checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" [[package]] name = "string_cache" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "923f0f39b6267d37d23ce71ae7235602134b250ace715dd2c90421998ddac0c6" +checksum = "33994d0838dc2d152d17a62adf608a869b5e846b65b389af7f3dbc1de45c5b26" dependencies = [ "lazy_static", "new_debug_unreachable", - "parking_lot", - "phf_shared 0.8.0", + "parking_lot 0.11.2", + "phf_shared", "precomputed-hash", ] @@ -4672,31 +4782,18 @@ dependencies = [ "cfg-if 1.0.0", "encoding_rs", "futures-util", - "getrandom 0.2.3", + "getrandom 0.2.5", "http-client", "http-types", "log", "mime_guess", "once_cell", - "pin-project-lite 0.2.7", - "rustls 0.18.1", + "pin-project-lite 0.2.8", "serde", "serde_json", "web-sys", ] -[[package]] -name = "surf-sse" -version = "1.0.0" -source = "git+https://github.com/dak-x/surf-sse?tag=2.0#c7a7d5d989c3cbde1922f52cee4824f771caf9b0" -dependencies = [ - "futures-core", - "futures-timer", - "log", - "sse-codec", - "surf", -] - [[package]] name = "sval" version = "1.0.0-alpha.5" @@ -4705,9 +4802,9 @@ checksum = "45f6ee7c7b87caf59549e9fe45d6a69c75c8019e79e212a835c5da0e92f0ba08" [[package]] name = "syn" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966" +checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b" dependencies = [ "proc-macro2", "quote", @@ -4738,26 +4835,26 @@ dependencies = [ [[package]] name = "tcp-stream" -version = "0.20.8" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12669e6606f91cd87e01c3d3411236ea10cf570e9f262d1aaefbe8b7502ca3fb" +checksum = "8348c444d4227fb8ca9f7a17995b15b41640ec446a2782d91fc82b100a73a657" dependencies = [ "cfg-if 1.0.0", - "mio", - "pkcs-12", + "p12", "rustls-connector", + "rustls-pemfile", ] [[package]] name = "tempfile" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ "cfg-if 1.0.0", + "fastrand", "libc", - "rand 0.8.4", - "redox_syscall 0.2.10", + "redox_syscall 0.2.11", "remove_dir_all", "winapi", ] @@ -4775,9 +4872,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ "winapi-util", ] @@ -4829,22 +4926,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c459573f0dd2cc734b539047f57489ea875af8ee950860ded20cf93a79a1dee0" dependencies = [ "async-h1", - "async-session", "async-sse", "async-std", "async-trait", - "femme", "futures-util", "http-client", "http-types", "kv-log-macro", "log", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.8", "route-recognizer", "serde", "serde_json", ] +[[package]] +name = "tide-rustls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a85b568b611840ba794ae749d4fa8b345b9f71a9c02b82cf0c28ff076fde6b7" +dependencies = [ + "async-dup", + "async-h1", + "async-rustls", + "async-std", + "rustls 0.19.1", + "tide", +] + [[package]] name = "time" version = "0.1.43" @@ -4872,9 +4981,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8d54b9298e05179c335de2b9645d061255bcd5155f843b3e328d2cfe0a5b413" +checksum = "004cbc98f30fa233c61a38bc77e96a9106e65c88f2d3bef182ae952027e5753d" dependencies = [ "libc", "num_threads", @@ -4935,42 +5044,42 @@ checksum = "46409491c9375a693ce7032101970a54f8a2010efb77e13f70788f0d84489e39" dependencies = [ "autocfg", "num_cpus", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.8", "slab", ] [[package]] name = "tokio" -version = "1.14.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144" +checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" dependencies = [ - "autocfg", "bytes 1.1.0", "libc", "memchr", "mio", "num_cpus", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.8", + "socket2 0.4.4", "tokio-macros", "winapi", ] [[package]] name = "tokio-io-timeout" -version = "1.1.1" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90c49f106be240de154571dd31fbe48acb10ba6c6dd6f6517ad603abffa42de9" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" dependencies = [ - "pin-project-lite 0.2.7", - "tokio 1.14.0", + "pin-project-lite 0.2.8", + "tokio 1.17.0", ] [[package]] name = "tokio-macros" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9efc1aba077437943f7515666aa2b882dfabfbfdf89c819ea75a8d6e9eaba5e" +checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" dependencies = [ "proc-macro2", "quote", @@ -4989,15 +5098,15 @@ dependencies = [ "fallible-iterator", "futures", "log", - "parking_lot", + "parking_lot 0.11.2", "percent-encoding", "phf", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.8", "postgres-protocol", "postgres-types", - "socket2 0.4.2", - "tokio 1.14.0", - "tokio-util", + "socket2 0.4.4", + "tokio 1.17.0", + "tokio-util 0.6.9", ] [[package]] @@ -5007,18 +5116,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" dependencies = [ "rustls 0.19.1", - "tokio 1.14.0", + "tokio 1.17.0", "webpki 0.21.4", ] [[package]] name = "tokio-rustls" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4baa378e417d780beff82bf54ceb0d195193ea6a00c14e22359e7f39456b5689" +checksum = "a27d5f2b839802bd8267fa19b0530f5a08b9c08cd417976be2a65d130fe1c11b" dependencies = [ - "rustls 0.20.2", - "tokio 1.14.0", + "rustls 0.20.4", + "tokio 1.17.0", "webpki 0.22.0", ] @@ -5029,8 +5138,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3" dependencies = [ "futures-core", - "pin-project-lite 0.2.7", - "tokio 1.14.0", + "pin-project-lite 0.2.8", + "tokio 1.17.0", ] [[package]] @@ -5043,8 +5152,22 @@ dependencies = [ "futures-core", "futures-sink", "log", - "pin-project-lite 0.2.7", - "tokio 1.14.0", + "pin-project-lite 0.2.8", + "tokio 1.17.0", +] + +[[package]] +name = "tokio-util" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64910e1b9c1901aaf5375561e35b9c057d95ff41a44ede043a03e09279eabaf1" +dependencies = [ + "bytes 1.1.0", + "futures-core", + "futures-sink", + "log", + "pin-project-lite 0.2.8", + "tokio 1.17.0", ] [[package]] @@ -5074,13 +5197,13 @@ dependencies = [ "hyper", "hyper-timeout", "percent-encoding", - "pin-project 1.0.8", + "pin-project", "prost", "prost-derive", - "tokio 1.14.0", + "tokio 1.17.0", "tokio-rustls 0.22.0", "tokio-stream", - "tokio-util", + "tokio-util 0.6.9", "tower", "tower-layer", "tower-service", @@ -5102,20 +5225,19 @@ dependencies = [ [[package]] name = "tower" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5651b5f6860a99bd1adb59dbfe1db8beb433e73709d9032b413a77e2fb7c066a" +checksum = "9a89fd63ad6adf737582df5db40d286574513c69a11dac5214dc3b5603d6713e" dependencies = [ "futures-core", "futures-util", "indexmap", - "pin-project 1.0.8", - "pin-project-lite 0.2.7", - "rand 0.8.4", + "pin-project", + "pin-project-lite 0.2.8", + "rand 0.8.5", "slab", - "tokio 1.14.0", - "tokio-stream", - "tokio-util", + "tokio 1.17.0", + "tokio-util 0.7.0", "tower-layer", "tower-service", "tracing", @@ -5135,22 +5257,22 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.29" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" +checksum = "f6c650a8ef0cd2dd93736f033d21cbd1224c5a967aa0c258d00fcf7dafef9b9f" dependencies = [ "cfg-if 1.0.0", "log", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.8", "tracing-attributes", "tracing-core", ] [[package]] name = "tracing-attributes" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e" +checksum = "8276d9a4a3a558d7b7ad5303ad50b53d58264641b82914b7ada36bd762e7a716" dependencies = [ "proc-macro2", "quote", @@ -5159,9 +5281,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4" +checksum = "03cfcb51380632a72d3111cb8d3447a8d908e577d31beeac006f836383d29a23" dependencies = [ "lazy_static", ] @@ -5172,7 +5294,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" dependencies = [ - "pin-project 1.0.8", + "pin-project", "tracing", ] @@ -5189,7 +5311,7 @@ dependencies = [ "abi_stable", "async-std", "beef", - "rand 0.8.4", + "rand 0.8.5", "serde", "url", ] @@ -5268,9 +5390,10 @@ dependencies = [ "async-nats", "async-std", "async-std-resolver", - "async-tls 0.11.0", + "async-tls", "async-trait", "async-tungstenite 0.16.1", + "aws-config", "aws-sdk-s3", "aws-types", "base64 0.13.0", @@ -5279,7 +5402,6 @@ dependencies = [ "byteorder", "bytes 1.1.0", "chrono", - "ciborium", "cron", "csv", "either", @@ -5293,7 +5415,7 @@ dependencies = [ "gouth", "grok", "halfbrown", - "hashbrown", + "hashbrown 0.12.0", "hdrhistogram", "hex", "hostname", @@ -5308,19 +5430,19 @@ dependencies = [ "lz4", "mapr", "memchr", - "pin-project-lite 0.2.7", + "pin-project-lite 0.2.8", "port_scanner", "postgres", "postgres-protocol", "qwal", - "rand 0.8.4", + "rand 0.8.5", "rdkafka", "rdkafka-sys", "regex", "reqwest", "rmp-serde", "rustls 0.19.1", - "rustls-native-certs 0.5.0", + "rustls-native-certs 0.6.1", "serde", "serde_derive", "serde_yaml", @@ -5331,9 +5453,9 @@ dependencies = [ "smol", "snap", "surf", - "surf-sse", "syslog_loose", "tide", + "tide-rustls", "tokio-postgres", "tonic", "tremor-common", @@ -5344,6 +5466,7 @@ dependencies = [ "tremor-value", "tungstenite 0.16.0", "url", + "uuid", "value-trait", "walkdir", "xz2", @@ -5378,7 +5501,7 @@ dependencies = [ "lazy_static", "matches", "percent-encoding", - "rand 0.8.4", + "rand 0.8.5", "regex", "serde", "serde_derive", @@ -5413,9 +5536,9 @@ dependencies = [ [[package]] name = "trust-dns-proto" -version = "0.20.3" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0d7f5db438199a6e2609debe3f69f808d074e0a2888ee0bccb45fe234d03f4" +checksum = "ca94d4e9feb6a181c690c4040d7a24ef34018d8313ac5044a61d21222ae24e31" dependencies = [ "async-trait", "cfg-if 1.0.0", @@ -5428,7 +5551,7 @@ dependencies = [ "ipnet", "lazy_static", "log", - "rand 0.8.4", + "rand 0.8.5", "smallvec", "thiserror", "tinyvec", @@ -5437,9 +5560,9 @@ dependencies = [ [[package]] name = "trust-dns-resolver" -version = "0.20.3" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ad17b608a64bd0735e67bde16b0636f8aa8591f831a25d18443ed00a699770" +checksum = "ecae383baad9995efaa34ce8e57d12c3f305e545887472a492b838f4b5cfb77a" dependencies = [ "cfg-if 1.0.0", "futures-util", @@ -5447,7 +5570,7 @@ dependencies = [ "lazy_static", "log", "lru-cache", - "parking_lot", + "parking_lot 0.11.2", "resolv-conf", "smallvec", "thiserror", @@ -5506,8 +5629,8 @@ dependencies = [ "http", "httparse", "log", - "rand 0.8.4", - "rustls 0.20.2", + "rand 0.8.5", + "rustls 0.20.4", "sha-1", "thiserror", "url", @@ -5537,9 +5660,9 @@ checksum = "ed5b74f0a24b5454580a79abb6994393b09adf0ab8070f15827cb666255de155" [[package]] name = "typenum" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "unicase" @@ -5567,9 +5690,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" +checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" [[package]] name = "unicode-width" @@ -5621,6 +5744,12 @@ dependencies = [ "serde", ] +[[package]] +name = "urlencoding" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a1f0175e03a0973cf4afd476bef05c26e228520400eb1fd473ad417b1c00ffb" + [[package]] name = "utf-8" version = "0.7.6" @@ -5633,6 +5762,15 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372" +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom 0.2.5", +] + [[package]] name = "value-bag" version = "1.0.0-alpha.8" @@ -5646,9 +5784,9 @@ dependencies = [ [[package]] name = "value-trait" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0393efdd7d82f856a927b0fcafa80bca45911f5c89ef6b9d80197bebc284f72e" +checksum = "23ba0ca16d76436ca217263f891e6cbe67e32faa8e20eda061c59e8fd7c6d34c" dependencies = [ "abi_stable", "float-cmp", @@ -5671,9 +5809,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "void" @@ -5743,21 +5881,19 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm-bindgen" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" +checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" dependencies = [ "cfg-if 1.0.0", - "serde", - "serde_json", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" +checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" dependencies = [ "bumpalo", "lazy_static", @@ -5770,9 +5906,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.28" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39" +checksum = "2eb6ec270a31b1d3c7e266b999739109abce8b6c87e4b31fcfcd788b65267395" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -5782,9 +5918,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" +checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5792,9 +5928,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" +checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" dependencies = [ "proc-macro2", "quote", @@ -5805,15 +5941,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" +checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" [[package]] name = "web-sys" -version = "0.3.55" +version = "0.3.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" +checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb" dependencies = [ "js-sys", "wasm-bindgen", @@ -5895,9 +6031,9 @@ dependencies = [ [[package]] name = "which" -version = "4.2.2" +version = "4.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea187a8ef279bc014ec368c27a920da2024d2a711109bfbe3440585d5cf27ad9" +checksum = "2a5a7e487e921cf220206864a94a89b6c6905bfc19f1057fa26a4cb360e5c1d2" dependencies = [ "either", "lazy_static", @@ -5955,6 +6091,49 @@ dependencies = [ "chrono", ] +[[package]] +name = "windows-sys" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3df6e476185f92a12c072be4a189a0210dcdcf512a1891d6dff9edb874deadc6" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5" + +[[package]] +name = "windows_i686_gnu" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615" + +[[package]] +name = "windows_i686_msvc" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" + [[package]] name = "winreg" version = "0.6.2" @@ -5999,24 +6178,24 @@ dependencies = [ [[package]] name = "yasna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e262a29d0e61ccf2b6190d7050d4b237535fc76ce4c1210d9caa316f71dffa75" +checksum = "346d34a236c9d3e5f3b9b74563f238f955bbd05fa0b8b4efa53c130c43982f4c" [[package]] name = "zeroize" -version = "1.4.3" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d68d9dcec5f9b43a30d38c49f91dfedfaac384cb8f085faca366c26207dd1619" +checksum = "50344758e2f40e3a1fcfc8f6f91aa57b5f8ebd8d27919fe6451f15aaaf9ee608" dependencies = [ "zeroize_derive", ] [[package]] name = "zeroize_derive" -version = "1.2.2" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65f1a51723ec88c66d5d1fe80c841f17f63587d6691901d66be9bec6c3b51f73" +checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17" dependencies = [ "proc-macro2", "quote", @@ -6026,18 +6205,18 @@ dependencies = [ [[package]] name = "zstd" -version = "0.9.0+zstd.1.5.0" +version = "0.10.0+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07749a5dc2cb6b36661290245e350f15ec3bbb304e493db54a1d354480522ccd" +checksum = "3b1365becbe415f3f0fcd024e2f7b45bacfb5bdd055f0dc113571394114e7bdd" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "4.1.1+zstd.1.5.0" +version = "4.1.4+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c91c90f2c593b003603e5e0493c837088df4469da25aafff8bce42ba48caf079" +checksum = "2f7cd17c9af1a4d6c24beb1cc54b17e2ef7b593dc92f19e9d9acad8b182bbaee" dependencies = [ "libc", "zstd-sys", @@ -6045,9 +6224,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "1.6.1+zstd.1.5.0" +version = "1.6.3+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "615120c7a2431d16cf1cf979e7fc31ba7a5b5e5707b29c8a99e5dbf8a8392a33" +checksum = "fc49afa5c8d634e75761feda8c592051e7eeb4683ba827211eb0d731d3402ea8" dependencies = [ "cc", "libc", diff --git a/plugins/connectors/metronome/Cargo.toml b/plugins/connectors/metronome/Cargo.toml index 7e44512202..e49ec04977 100644 --- a/plugins/connectors/metronome/Cargo.toml +++ b/plugins/connectors/metronome/Cargo.toml @@ -22,14 +22,12 @@ tremor-value = { version = "0.3.2", path = "../../../tremor-value" } tremor-runtime = { version = "0.11.4", path = "../../../" } abi_stable = { version = "0.10", default-features = false } -# FIXME: clean up after new release -async-ffi = { version = "0.3", features = ["abi_stable"], git = "https://github.com/oxalica/async-ffi", branch = "master" } +async-ffi = { version = "0.4", features = ["abi_stable"] } serde = { version = "1.0", features = ["derive"] } [patch.crates-io] -# FIXME: update to crates.io when this is added to a new version: -# https://github.com/rodrimati1992/abi_stable_crates/pull/70 -abi_stable = { git = "https://github.com/marioortizmanero/abi_stable_crates.git", branch = "rvec-append" } +# FIXME: update to v0.11 when released +abi_stable = { git = "https://github.com/marioortizmanero/abi_stable_crates.git", branch = "ok_or" } # FIXME: update to crates.io when this is added to a new version: # https://github.com/simd-lite/simd-json-derive/pull/9 simd-json-derive = { git = "https://github.com/marioortizmanero/simd-json-derive.git", branch = "abi-stable" } diff --git a/plugins/connectors/metronome/src/connector.rs b/plugins/connectors/metronome/src/connector.rs index 90468ed045..e644695e5f 100644 --- a/plugins/connectors/metronome/src/connector.rs +++ b/plugins/connectors/metronome/src/connector.rs @@ -4,7 +4,7 @@ use tremor_common::time::nanotime; use tremor_pipeline::DEFAULT_STREAM_ID; use tremor_runtime::{connectors::prelude::*, pdk::RResult, ttry, utils::hostname}; use tremor_script::{EventOriginUri, EventPayload}; -use tremor_value::{literal, pdk::PdkValue}; +use tremor_value::literal; use std::{ future, @@ -16,11 +16,11 @@ use abi_stable::{ std_types::{ ROption::{self, RNone, RSome}, RResult::{RErr, ROk}, - RString, + RStr, RString, }, type_level::downcasting::TD_Opaque, }; -use async_ffi::{BorrowingFfiFuture, FfiFuture, FutureExt}; +use async_ffi::{BorrowingFfiFuture, FutureExt}; use serde::Deserialize; #[derive(Deserialize, Debug, Clone)] @@ -105,13 +105,13 @@ impl RawSource for Metronome { /// Configures and exports the metronome as a connector trait object #[sabi_extern_fn] -pub fn from_config( - _id: RString, - raw_config: ROption>, -) -> FfiFuture> { +pub fn from_config<'a>( + _id: RStr<'a>, + config: &'a ConnectorConfig, +) -> BorrowingFfiFuture<'a, RResult> { async move { - if let RSome(raw_config) = raw_config { - let config = ttry!(Config::new(&raw_config.into())); + if let RSome(raw_config) = &config.config { + let config = ttry!(Config::new(raw_config)); let origin_uri = EventOriginUri { scheme: RString::from("tremor-metronome"), diff --git a/src/codec/binflux.rs b/src/codec/binflux.rs index 96aaa7a1de..305d7c44bb 100644 --- a/src/codec/binflux.rs +++ b/src/codec/binflux.rs @@ -20,6 +20,8 @@ use std::io::{Cursor, Write}; use std::str; use tremor_value::{literal, Object, Value}; +use abi_stable::std_types::{RCowStr, Tuple2}; + const TYPE_I64: u8 = 0; const TYPE_F64: u8 = 1; const TYPE_STRING: u8 = 2; @@ -59,7 +61,7 @@ impl BInflux { .chain_err(|| ErrorKind::InvalidBInfluxData("too many tags".into()))?, )?; - for (k, v) in tags { + for Tuple2(k, v) in tags { if let Some(v) = v.as_str() { write_str(&mut res, k)?; write_str(&mut res, v)?; @@ -74,7 +76,7 @@ impl BInflux { u16::try_from(fields.len()) .chain_err(|| ErrorKind::InvalidBInfluxData("too many fields".into()))?, )?; - for (k, v) in fields { + for Tuple2(k, v) in fields { write_str(&mut res, k)?; if let Some(v) = v.as_i64() { res.write_u8(TYPE_I64)?; @@ -106,7 +108,7 @@ impl BInflux { } pub fn decode(data: &[u8]) -> Result { - fn read_string<'event>(c: &mut Cursor<&'event [u8]>) -> Result> { + fn read_string<'event>(c: &mut Cursor<&'event [u8]>) -> Result> { let l = c.read_u16::()? as usize; #[allow(clippy::cast_possible_truncation)] let p = c.position() as usize; diff --git a/src/codec/csv.rs b/src/codec/csv.rs index 9fed8dfdc4..25b1b3d31a 100644 --- a/src/codec/csv.rs +++ b/src/codec/csv.rs @@ -12,7 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. use crate::codec::prelude::*; -use beef::Cow; + +use abi_stable::{ + rvec, + std_types::{RCowStr, RString}, +}; #[derive(Clone)] pub struct Csv {} @@ -37,9 +41,9 @@ impl Codec for Csv { None => return Ok(None), }?; - let mut fields = vec![]; + let mut fields = rvec![]; for field in record.iter() { - fields.push(Value::String(Cow::from(field.to_string()))); + fields.push(Value::String(RCowStr::Owned(RString::from(field)))); } Ok(Some(Value::Array(fields))) diff --git a/src/codec/syslog.rs b/src/codec/syslog.rs index 2d7e2fb5ca..2fed82c4c2 100644 --- a/src/codec/syslog.rs +++ b/src/codec/syslog.rs @@ -17,6 +17,8 @@ use chrono::{DateTime, Datelike, Offset, TimeZone, Utc}; use syslog_loose::{IncompleteDate, ProcId, Protocol, SyslogFacility, SyslogSeverity}; use tremor_value::Value; +use abi_stable::std_types::Tuple2; + const DEFAULT_PRI: i32 = 13; pub trait Now: Send + Sync + Clone { @@ -59,7 +61,7 @@ where )) })?; let mut elem = String::with_capacity(16); - for (id, params) in sd.iter() { + for Tuple2(id, params) in sd.iter() { elem.push('['); elem.push_str(&id.to_string()); let params = params.as_array().ok_or_else(|| { @@ -73,7 +75,7 @@ where "Invalid structured data: param's key value pair not an object", )) })?; - for (k, v) in kv_map { + for Tuple2(k, v) in kv_map { let value = v.as_str().ok_or_else(|| { Error::from(ErrorKind::InvalidSyslogData( "Invalid structured data: param's key value pair not an object", diff --git a/src/config.rs b/src/config.rs index 57ef44c3f4..8374f58c5c 100644 --- a/src/config.rs +++ b/src/config.rs @@ -22,10 +22,20 @@ use tremor_script::{ }; use tremor_value::prelude::*; +use abi_stable::{ + std_types::{ + ROption::{self, RNone}, + RString, RVec, Tuple2, + }, + StableAbi, +}; + pub(crate) type Id = String; +pub(crate) type IdSabi = RString; /// Reconnect strategies for controlling if and how to reconnect -#[derive(Clone, Debug, Serialize, Deserialize)] +#[repr(C)] +#[derive(Clone, Debug, Serialize, Deserialize, StableAbi)] #[serde(rename_all = "lowercase", deny_unknown_fields)] pub enum Reconnect { /// No reconnection @@ -38,7 +48,7 @@ pub enum Reconnect { #[serde(default = "default_growth_rate")] growth_rate: f64, /// maximum number of retries to execute - max_retries: Option, + max_retries: ROption, /// Randomize the growth rate #[serde(default = "default_randomized")] randomized: bool, @@ -81,10 +91,11 @@ impl Default for PauseBehaviour { */ /// Codec name and configuration -#[derive(Clone, Debug, Default)] +#[repr(C)] +#[derive(Clone, Debug, Default, StableAbi)] pub struct NameWithConfig { - pub(crate) name: String, - pub(crate) config: Option>, + pub(crate) name: RString, + pub(crate) config: ROption>, } impl NameWithConfig { @@ -93,8 +104,8 @@ impl NameWithConfig { Ok(Self::from(name)) } else if let Some(name) = value.get_str("name") { Ok(Self { - name: name.to_string(), - config: value.get("config").map(Value::clone_static), + name: name.to_string().into(), + config: value.get("config").map(Value::clone_static).into(), }) } else { Err(format!("Invalid codec: {}", value).into()) @@ -105,16 +116,16 @@ impl NameWithConfig { impl From<&str> for NameWithConfig { fn from(name: &str) -> Self { Self { - name: name.to_string(), - config: None, + name: name.to_string().into(), + config: RNone, } } } impl From<&String> for NameWithConfig { fn from(name: &String) -> Self { Self { - name: name.clone(), - config: None, + name: name.clone().into(), + config: RNone, } } } @@ -128,32 +139,33 @@ pub(crate) type Postprocessor = NameWithConfig; /// Connector configuration - only the parts applicable to all connectors /// Specific parts are catched in the `config` map. -#[derive(Clone, Debug, Default)] +#[repr(C)] +#[derive(Clone, Debug, Default, StableAbi)] pub struct Connector { /// Connector identifier - pub id: Id, + pub id: IdSabi, /// Connector type pub connector_type: ConnectorType, /// Codec in force for connector - pub codec: Option, + pub codec: ROption, /// Configuration map pub config: tremor_pipeline::ConfigMap, // TODO: interceptors or configurable processors /// Preprocessor chain configuration - pub preprocessors: Option>, + pub preprocessors: ROption>, // TODO: interceptors or configurable processors /// Postprocessor chain configuration - pub postprocessors: Option>, + pub postprocessors: ROption>, pub(crate) reconnect: Reconnect, //pub(crate) on_pause: PauseBehaviour, - pub(crate) metrics_interval_s: Option, + pub(crate) metrics_interval_s: ROption, } impl Connector { @@ -196,9 +208,9 @@ impl Connector { .or_else(|_| validate_type(&defn, "metrics_interval_s", ValueType::I64))?; Ok(Connector { - id, + id: id.into(), connector_type, - config: config, + config: config.into(), preprocessors: defn .get_array("preprocessors") .map(|o| { @@ -206,7 +218,8 @@ impl Connector { .map(Preprocessor::from_value) .collect::>() }) - .transpose()?, + .transpose()? + .into(), postprocessors: defn .get_array("postprocessors") .map(|o| { @@ -214,15 +227,16 @@ impl Connector { .map(Preprocessor::from_value) .collect::>() }) - .transpose()?, + .transpose()? + .into(), reconnect: defn .get("reconnect") .cloned() .map(tremor_value::structurize) .transpose()? .unwrap_or_default(), - metrics_interval_s: defn.get_u64("metrics_interval_s"), - codec: defn.get("codec").map(Codec::from_value).transpose()?, + metrics_interval_s: defn.get_u64("metrics_interval_s").into(), + codec: defn.get("codec").map(Codec::from_value).transpose()?.into(), }) } } diff --git a/src/connectors.rs b/src/connectors.rs index 751337f6c2..3b50b1491c 100644 --- a/src/connectors.rs +++ b/src/connectors.rs @@ -31,7 +31,7 @@ use self::metrics::{SinkReporter, SourceReporter}; use self::sink::{SinkAddr, SinkContext, SinkMsg}; use self::source::{SourceAddr, SourceContext, SourceMsg}; use self::utils::quiescence::QuiescenceBeacon; -use crate::config::Connector as ConnectorConfig; +pub use crate::config::Connector as ConnectorConfig; use crate::errors::{Error, Kind as ErrorKind, Result}; use crate::instance::InstanceState; use crate::pipeline; @@ -280,9 +280,9 @@ pub struct ConnectorContext { /// type of the connector connector_type: ConnectorType, /// The Quiescence Beacon - pub quiescence_beacon: BoxedQuiescenceBeacon, + quiescence_beacon: BoxedQuiescenceBeacon, /// Notifier - pub notifier: reconnect::BoxedConnectionLostNotifier, + notifier: reconnect::BoxedConnectionLostNotifier, } impl Display for ConnectorContext { @@ -378,8 +378,7 @@ pub async fn spawn( let builder = known_connectors .get(&config.connector_type) .ok_or_else(|| ErrorKind::UnknownConnectorType(config.connector_type.to_string()))?; - let connector_config = config.config.clone().into(); - let connector = builder.from_config()(alias.clone().into(), connector_config).await; + let connector = builder.from_config()(alias.as_str().into(), &config).await; let connector = Result::from(connector.map_err(Error::from))?; let connector = Connector(connector); @@ -407,13 +406,11 @@ async fn connector_task( let source_metrics_reporter = SourceReporter::new( alias.clone(), METRICS_CHANNEL.tx(), - config.metrics_interval_s, + config.metrics_interval_s.into(), ); let default_codec = connector.codec_requirements(); - if connector.codec_requirements() == CodecReq::Structured - && (config.codec.is_some() || config.codec_map.is_some()) - { + if connector.codec_requirements() == CodecReq::Structured && (config.codec.is_some()) { return Err(format!( "[Connector::{}] is a structured connector and can't be configured with a codec", alias @@ -433,7 +430,7 @@ async fn connector_task( let sink_metrics_reporter = SinkReporter::new( alias.clone(), METRICS_CHANNEL.tx(), - config.metrics_interval_s, + config.metrics_interval_s.into(), ); let sink_builder = sink::builder(&config, default_codec, qsize, sink_metrics_reporter)?; let sink_ctx = SinkContext { @@ -465,11 +462,11 @@ async fn connector_task( alias: alias.clone().into(), connector_type: config.connector_type.clone(), quiescence_beacon: quiescence_beacon.clone(), - notifier: notifier, + notifier, }; let send_addr = connector_addr.clone(); - let mut connector_state = InstanceState::Initialized; + let mut connector_state = InstanceState::Initializing; let mut drainage = None; let mut start_sender: Option>> = None; @@ -681,19 +678,23 @@ async fn connector_task( } } // ugly extra check - if new == Connectivity::Disconnected && !will_retry && start_sender.is_some() { - if let Some(start_sender) = start_sender.take() { - ctx.log_err( - start_sender - .send(ConnectorResult::err(&ctx, "Connect failed.")) - .await, - "Error sending start response", - ) + if new == Connectivity::Disconnected && !will_retry { + // if we weren't able to connect and gave up retrying, we are failed. That's life. + connector_state = InstanceState::Failed; + if start_sender.is_some() { + if let Some(start_sender) = start_sender.take() { + ctx.log_err( + start_sender + .send(ConnectorResult::err(&ctx, "Connect failed.")) + .await, + "Error sending start response", + ) + } } } connectivity = new; } - Msg::Start(sender) if connector_state == InstanceState::Initialized => { + Msg::Start(sender) if connector_state == InstanceState::Initializing => { info!("[Connector::{}] Starting...", &connector_addr.alias); start_sender = Some(sender); @@ -920,7 +921,8 @@ async fn connector_task( // TODO: inform registry that this instance is gone now Ok(()) }); - Ok(send_addr)} + Ok(send_addr) +} #[derive(Debug, PartialEq)] enum DrainState { @@ -1011,14 +1013,14 @@ const OUT_PORTS_REF: &'static [Cow<'static, str>; 2] = &OUT_PORTS; #[abi_stable::sabi_trait] pub trait RawConnector: Send { /// Valid input ports for the connector, by default this is `in` - fn input_ports(&self) -> RVec> { + fn input_ports(&self) -> RVec> { IN_PORTS_REF .into_iter() .map(|port| conv_cow_str_inv(port.clone())) .collect() } /// Valid output ports for the connector, by default this is `out` and `err` - fn output_ports(&self) -> RVec> { + fn output_ports(&self) -> RVec> { OUT_PORTS_REF .into_iter() .map(|port| conv_cow_str_inv(port.clone())) @@ -1147,14 +1149,12 @@ pub type BoxedRawConnector = RawConnector_TO<'static, RBox<()>>; /// /// Note that it may hurt performance in some parts of the connector interface, /// so some of the functionality may not be fully wrapped. -pub struct Connector(pub BoxedRawConnector); +pub(crate) struct Connector(pub BoxedRawConnector); impl Connector { - /// Wrapper for [`BoxedRawConnector::input_ports`] #[inline] pub fn input_ports(&self) -> Vec> { self.0.input_ports().into_iter().map(conv_cow_str).collect() } - /// Wrapper for [`BoxedRawConnector::output_ports`] #[inline] pub fn output_ports(&self) -> Vec> { self.0 @@ -1164,19 +1164,16 @@ impl Connector { .collect() } - /// Wrapper for [`BoxedRawConnector::is_valid_input_port`] #[inline] pub fn is_valid_input_port(&self, port: &str) -> bool { self.0.is_valid_input_port(port.into()) } - /// Wrapper for [`BoxedRawConnector::is_valid_output_port`] #[inline] pub fn is_valid_output_port(&self, port: &str) -> bool { self.0.is_valid_output_port(port.into()) } - /// Wrapper for [`BoxedRawConnector::create_source`] #[inline] pub async fn create_source( &mut self, @@ -1188,16 +1185,12 @@ impl Connector { .create_source(source_context.clone(), builder.qsize()) .await { - ROk(RSome(raw_source)) => { - let wrapper = Source(raw_source); - builder.spawn(wrapper, source_context).map(Some) - } + ROk(RSome(source)) => builder.spawn(source, source_context).map(Some), ROk(RNone) => Ok(None), RErr(err) => Err(err.into()), } } - /// Wrapper for [`BoxedRawConnector::create_sink`] #[inline] pub async fn create_sink( &mut self, @@ -1212,16 +1205,12 @@ impl Connector { .create_sink(sink_context.clone(), builder.qsize(), reply_tx) .await { - ROk(RSome(raw_sink)) => { - let wrapper = Sink(raw_sink); - builder.spawn(wrapper, sink_context).map(Some) - } + ROk(RSome(sink)) => builder.spawn(sink, sink_context).map(Some), ROk(RNone) => Ok(None), RErr(err) => Err(err.into()), } } - /// Wrapper for [`BoxedRawConnector::connect`] #[inline] pub async fn connect(&mut self, ctx: &ConnectorContext, attempt: &Attempt) -> Result { self.0 @@ -1231,7 +1220,6 @@ impl Connector { .into() // RResult -> Result } - /// Wrapper for [`BoxedRawConnector::on_start`] #[inline] pub async fn on_start(&mut self, ctx: &ConnectorContext) -> Result<()> { self.0 @@ -1241,7 +1229,6 @@ impl Connector { .into() // RResult -> Result } - /// Wrapper for [`BoxedRawConnector::on_pause`] #[inline] pub async fn on_pause(&mut self, ctx: &ConnectorContext) -> Result<()> { self.0 @@ -1251,7 +1238,6 @@ impl Connector { .into() // RResult -> Result } - /// Wrapper for [`BoxedRawConnector::on_resume`] #[inline] pub async fn on_resume(&mut self, ctx: &ConnectorContext) -> Result<()> { self.0 @@ -1261,7 +1247,6 @@ impl Connector { .into() // RResult -> Result } - /// Wrapper for [`BoxedRawConnector::on_drain`] #[inline] pub async fn on_drain(&mut self, ctx: &ConnectorContext) -> Result<()> { self.0 @@ -1271,7 +1256,6 @@ impl Connector { .into() // RResult -> Result } - /// Wrapper for [`BoxedRawConnector::on_stop`] #[inline] pub async fn on_stop(&mut self, ctx: &ConnectorContext) -> Result<()> { self.0 @@ -1281,7 +1265,6 @@ impl Connector { .into() // RResult -> Result } - /// Wrapper for [`BoxedRawConnector::codec_requirements`] #[inline] pub fn codec_requirements(&self) -> CodecReq { self.0.codec_requirements() @@ -1293,15 +1276,15 @@ impl Connector { #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Default, StableAbi)] pub struct ConnectorType(RString); -impl From for RString { +impl From for String { fn from(ct: ConnectorType) -> Self { - ct.0 + ct.0.into() } } -impl From for String { +impl From for RString { fn from(ct: ConnectorType) -> Self { - ct.0.into() + ct.0 } } @@ -1359,11 +1342,11 @@ pub fn debug_connector_types() -> Vec { #[cfg(not(tarpaulin_include))] pub async fn register_builtin_connector_types(world: &World, debug: bool) -> Result<()> { for builder in builtin_connector_types() { - world.register_connector_type(builder).await?; + world.register_builtin_connector_type(builder).await?; } if debug { for builder in debug_connector_types() { - world.register_connector_type(builder).await?; + world.register_builtin_connector_type(builder).await?; } } @@ -1376,7 +1359,7 @@ pub async fn register_builtin_connector_types(world: &World, debug: bool) -> Res log::info!("Dynamically loading plugins in directory '{}'", path); for plugin in pdk::find_recursively(&path) { log::info!("Found and loaded plugin '{}'", plugin.connector_type()()); - world.register_connector_type(plugin).await?; + world.register_builtin_connector_type(plugin).await?; } } diff --git a/src/connectors/impls.rs b/src/connectors/impls.rs index 8e904c35de..72b2a79bf9 100644 --- a/src/connectors/impls.rs +++ b/src/connectors/impls.rs @@ -30,7 +30,7 @@ pub(crate) mod bench; // pub(crate) mod exit; /// file connector implementation pub(crate) mod file; -// +// // /// HTTP // pub(crate) mod http; // /// Kafka consumer and producer @@ -51,7 +51,7 @@ pub(crate) mod metrics; pub(crate) mod tcp; // /// udp connector impls // pub(crate) mod udp; -// +// // /// Unix Domain socket impls // #[cfg(unix)] // pub(crate) mod unix_socket; diff --git a/src/connectors/impls/bench.rs b/src/connectors/impls/bench.rs index adae345e49..41bb2e8971 100644 --- a/src/connectors/impls/bench.rs +++ b/src/connectors/impls/bench.rs @@ -39,8 +39,6 @@ use abi_stable::{ }; use async_ffi::{BorrowingFfiFuture, FfiFuture, FutureExt}; use std::future; -use tremor_pipeline::pdk::PdkEvent; -use tremor_value::pdk::PdkValue; #[derive(Deserialize, Debug, Clone)] #[serde(deny_unknown_fields)] @@ -98,13 +96,13 @@ fn connector_type() -> ConnectorType { } #[sabi_extern_fn] -pub fn from_config( - alias: RString, - config: ConnectorConfig, -) -> FfiFuture> { +pub fn from_config<'a>( + alias: RStr<'a>, + config: &'a ConnectorConfig, +) -> BorrowingFfiFuture<'a, RResult> { async move { - if let RSome(config) = config.config { - let config: Config = ttry!(Config::new(&config.into())); + if let RSome(config) = &config.config { + let config: Config = ttry!(Config::new(config)); let mut source_data_file = ttry!(file::open(&config.source)); let mut data = vec![]; let ext = file::extension(&config.source); @@ -121,15 +119,15 @@ pub fn from_config( port: RNone, path: rvec![RString::from(config.source.clone())], }; - let elements: Vec> = if let Some(chunk_size) = config.chunk_size { + let elements: RVec> = if let Some(chunk_size) = config.chunk_size { // split into sized chunks ttry!(data .chunks(chunk_size) - .map(|e| -> Result> { + .map(|e| -> Result> { if config.base64 { - Ok(base64::decode(e)?) + Ok(RVec::from(base64::decode(e)?)) } else { - Ok(e.to_vec()) + Ok(RVec::from(e)) } }) .collect::>()) @@ -137,11 +135,11 @@ pub fn from_config( // split into lines ttry!(BufReader::new(data.as_slice()) .lines() - .map(|e| -> Result> { + .map(|e| -> Result> { if config.base64 { - Ok(base64::decode(&e?.as_bytes())?) + Ok(RVec::from(base64::decode(&e?.as_bytes())?)) } else { - Ok(e?.as_bytes().to_vec()) + Ok(RVec::from(e?.as_bytes())) } }) .collect::>()) @@ -167,12 +165,12 @@ pub fn from_config( #[derive(Clone, Default)] struct Acc { - elements: Vec>, + elements: RVec>, count: usize, iterations: usize, } impl Acc { - fn next(&mut self) -> Vec { + fn next(&mut self) -> RVec { // actually safe because we only get element from a slot < elements.len() let next = unsafe { self.elements @@ -195,7 +193,7 @@ pub struct Bench { impl RawConnector for Bench { fn create_source( &mut self, - _ctx: SourceContext, + _source_context: SourceContext, _qsize: usize, ) -> BorrowingFfiFuture<'_, RResult>> { let s = Blaster { @@ -215,7 +213,7 @@ impl RawConnector for Bench { fn create_sink( &mut self, - _ctx: SinkContext, + _sink_context: SinkContext, _qsize: usize, reply_tx: BoxedContraflowSender, ) -> BorrowingFfiFuture<'_, RResult>> { @@ -276,7 +274,7 @@ impl RawSource for Blaster { ROk(SourceReply::Data { origin_uri: self.origin_uri.clone(), - data: self.acc.next().into(), + data: self.acc.next(), meta: RNone, stream: DEFAULT_STREAM_ID, port: RNone, @@ -339,7 +337,7 @@ impl RawSink for Blackhole { fn on_event<'a>( &'a mut self, _input: RStr<'a>, - event: PdkEvent, + event: Event, ctx: &'a SinkContext, event_serializer: &'a mut MutEventSerializer, _start: u64, @@ -356,17 +354,11 @@ impl RawSink for Blackhole { // ALLOW: This is on purpose, we use blackhole for benchmarking, so we want it to terminate the process when done process::exit(0); }; - // Restoring the event back to a non-pdk one for access to its full - // functionality - let event = Event::from(event); for value in event.value_iter() { if now_ns > self.warmup { let delta_ns = now_ns - event.ingest_ns; // FIXME: use the buffer - // TODO: try to find a way around cloning the value reference to turn it into a PdkValue - if let ROk(bufs) = - event_serializer.serialize(&value.clone().into(), event.ingest_ns) - { + if let ROk(bufs) = event_serializer.serialize(value, event.ingest_ns) { self.bytes += bufs.iter().map(RVec::len).sum::(); } else { error!("failed to encode"); diff --git a/src/connectors/impls/file.rs b/src/connectors/impls/file.rs index c123dd4d3c..d7421c2e01 100644 --- a/src/connectors/impls/file.rs +++ b/src/connectors/impls/file.rs @@ -23,7 +23,10 @@ use async_std::{ use futures::{AsyncRead, AsyncReadExt, AsyncWriteExt}; use tremor_common::asy::file; -use crate::{pdk::utils::conv_cow_str_inv, ttry}; +use crate::{ + pdk::{utils::conv_cow_str_inv, RError}, + ttry, +}; use abi_stable::{ prefix_type::PrefixTypeTrait, rtry, rvec, sabi_extern_fn, @@ -36,8 +39,6 @@ use abi_stable::{ }; use async_ffi::{BorrowingFfiFuture, FfiFuture, FutureExt}; use std::future; -use tremor_pipeline::pdk::PdkEvent; -use tremor_value::pdk::PdkValue; const URL_SCHEME: &str = "tremor-file"; @@ -57,13 +58,13 @@ fn connector_type() -> ConnectorType { } #[sabi_extern_fn] -pub fn from_config( - alias: RString, - config: ConnectorConfig, -) -> FfiFuture> { +pub fn from_config<'a>( + alias: RStr<'a>, + config: &'a ConnectorConfig, +) -> BorrowingFfiFuture<'a, RResult> { async move { - if let RSome(raw_config) = config.config { - let config = ttry!(Config::new(&raw_config.into())); + if let RSome(raw_config) = &config.config { + let config = ttry!(Config::new(&raw_config)); let file = File { config }; ROk(BoxedRawConnector::from_value(file, TD_Opaque)) } else { @@ -301,13 +302,13 @@ impl RawSource for FileSource { SourceReply::EndStream { origin_uri: self.origin_uri.clone(), stream: DEFAULT_STREAM_ID, - meta: RSome(self.meta.clone().into()), + meta: RSome(self.meta.clone()), } } else { SourceReply::Data { origin_uri: self.origin_uri.clone(), stream: DEFAULT_STREAM_ID, - meta: RSome(self.meta.clone().into()), + meta: RSome(self.meta.clone()), // ALLOW: with the read above we ensure that this access is valid, unless async_std is broken data: RVec::from(&self.buf[0..bytes_read]), port: RSome(conv_cow_str_inv(OUT)), @@ -382,34 +383,32 @@ impl RawSink for FileSink { fn on_event<'a>( &'a mut self, _input: RStr<'a>, - event: PdkEvent, + event: Event, ctx: &'a SinkContext, serializer: &'a mut MutEventSerializer, _start: u64, ) -> BorrowingFfiFuture<'a, RResult> { async move { - let event: Event = event.into(); let file = ttry!(self .file .as_mut() .ok_or_else(|| Error::from("No file available."))); let ingest_ns = event.ingest_ns; for value in event.value_iter() { - // TODO: try to find a way around cloning the value reference to turn it into a PdkValue - let data = rtry!(serializer.serialize(&value.clone().into(), ingest_ns)); + let data = rtry!(serializer.serialize(value, ingest_ns)); for chunk in data { if let Err(e) = file.write_all(chunk.as_slice()).await { error!("{} Error writing to file: {}", &ctx, &e); self.file = None; rtry!(ctx.notifier().notify().await); - return RErr(Error::from(e).into()); + return RErr(RError::new(e)); } } if let Err(e) = file.flush().await { error!("{} Error flushing file: {}", &ctx, &e); self.file = None; rtry!(ctx.notifier().notify().await); - return RErr(Error::from(e).into()); + return RErr(RError::new(e)); } } ROk(SinkReply::NONE) diff --git a/src/connectors/impls/metrics.rs b/src/connectors/impls/metrics.rs index 84f0d60417..133396b469 100644 --- a/src/connectors/impls/metrics.rs +++ b/src/connectors/impls/metrics.rs @@ -22,8 +22,9 @@ use crate::pdk::RError; use crate::ttry; use abi_stable::{ prefix_type::PrefixTypeTrait, - rvec, sabi_extern_fn, + rstr, rvec, sabi_extern_fn, std_types::{ + RCow, RCowStr, ROption::{self, RNone, RSome}, RResult::{RErr, ROk}, RStr, RString, @@ -32,13 +33,11 @@ use abi_stable::{ }; use async_ffi::{BorrowingFfiFuture, FfiFuture, FutureExt}; use std::future; -use tremor_pipeline::pdk::PdkEvent; -use tremor_value::pdk::PdkValue; -const MEASUREMENT: Cow<'static, str> = Cow::const_str("measurement"); -const TAGS: Cow<'static, str> = Cow::const_str("tags"); -const FIELDS: Cow<'static, str> = Cow::const_str("fields"); -const TIMESTAMP: Cow<'static, str> = Cow::const_str("timestamp"); +const MEASUREMENT: RCowStr<'static> = RCow::Borrowed(rstr!("measurement")); +const TAGS: RCowStr<'static> = RCow::Borrowed(rstr!("tags")); +const FIELDS: RCowStr<'static> = RCow::Borrowed(rstr!("fields")); +const TIMESTAMP: RCowStr<'static> = RCow::Borrowed(rstr!("timestamp")); /// Note that since it's a built-in plugin, `#[export_root_module]` can't be /// used or it would conflict with other plugins. @@ -55,10 +54,10 @@ fn connector_type() -> ConnectorType { "metrics".into() } #[sabi_extern_fn] -pub fn from_config( - _alias: RString, - _raw_config: ROption>, -) -> FfiFuture> { +pub fn from_config<'a>( + _alias: RStr<'a>, + _raw_config: &'a ConnectorConfig, +) -> BorrowingFfiFuture<'a, RResult> { let connector = BoxedRawConnector::from_value(MetricsConnector::new(), TD_Opaque); future::ready(ROk(connector)).into_ffi() } @@ -151,7 +150,7 @@ impl RawSource for MetricsSource { ) -> BorrowingFfiFuture<'a, RResult> { let reply = match self.rx.try_recv() { Ok(msg) => ROk(SourceReply::Structured { - payload: msg.payload.into(), + payload: msg.payload, origin_uri: msg.origin_uri.unwrap_or_else(|| self.origin_uri.clone()), stream: DEFAULT_STREAM_ID, port: RNone, @@ -214,14 +213,11 @@ impl RawSink for MetricsSink { fn on_event<'a>( &'a mut self, _input: RStr<'a>, - event: PdkEvent, + event: Event, _ctx: &'a SinkContext, _serializer: &'a mut MutEventSerializer, _start: u64, ) -> BorrowingFfiFuture<'a, RResult> { - // Conversion to use the full functionality of `Event` - let event = Event::from(event); - async move { // verify event format for (value, _meta) in event.value_meta_iter() { @@ -233,7 +229,7 @@ impl RawSink for MetricsSink { origin_uri, data, .. } = event; - let metrics_msg = MetricsMsg::new(data, origin_uri); + let metrics_msg = MetricsMsg::new(data, origin_uri.into()); let ack_or_fail = match self.tx.try_broadcast(metrics_msg) { Err(TrySendError::Closed(_)) => { // channel is closed diff --git a/src/connectors/impls/tcp.rs b/src/connectors/impls/tcp.rs index 4e3b0d960f..6e2a5bb824 100644 --- a/src/connectors/impls/tcp.rs +++ b/src/connectors/impls/tcp.rs @@ -79,13 +79,12 @@ impl TcpReader>> { } } -/* TODO: add back impl TcpReader>> { fn tls_client( stream: ReadHalf>, underlying_stream: TcpStream, buffer: Vec, - url: TremorUrl, + alias: String, origin_uri: EventOriginUri, meta: Value<'static>, ) -> Self { @@ -93,13 +92,12 @@ impl TcpReader>> { wrapped_stream: stream, underlying_stream, buffer, - url, + alias, origin_uri, meta, } } } -*/ #[async_trait::async_trait] impl StreamReader for TcpReader @@ -113,8 +111,8 @@ where trace!("[Connector::{}] Stream {stream} EOF", &self.alias); return Ok(SourceReply::EndStream { origin_uri: self.origin_uri.clone(), - meta: RSome(self.meta.clone().into()), - stream: stream, + meta: RSome(self.meta.clone()), + stream, }); } debug!("[Connector::{}] Read {} bytes", &self.alias, bytes_read); @@ -122,7 +120,7 @@ where Ok(SourceReply::Data { origin_uri: self.origin_uri.clone(), stream, - meta: RSome(self.meta.clone().into()), + meta: RSome(self.meta.clone()), // ALLOW: we know bytes_read is smaller than or equal buf_size data: RVec::from(&self.buffer[0..bytes_read]), port: RNone, @@ -168,19 +166,6 @@ impl TcpWriter>> { } } } -/* TODO: add back -impl TcpWriter>> { - fn tls_client( - tls_stream: WriteHalf>, - underlying_stream: TcpStream, - ) -> Self { - Self { - wrapped_stream: tls_stream, - underlying_stream, - } - } -} -*/ #[async_trait::async_trait] impl StreamWriter for TcpWriter diff --git a/src/connectors/impls/tcp/server.rs b/src/connectors/impls/tcp/server.rs index b162df83c5..3a715784b0 100644 --- a/src/connectors/impls/tcp/server.rs +++ b/src/connectors/impls/tcp/server.rs @@ -17,6 +17,7 @@ use crate::connectors::sink::channel_sink::ChannelSinkMsg; use crate::connectors::utils::tls::{load_server_config, TLSServerConfig}; use crate::errors::{Error, ErrorKind}; use crate::ttry; +use async_std::channel::{bounded, Receiver, Sender, TryRecvError}; use async_std::net::TcpListener; use async_std::task::{self, JoinHandle}; use async_tls::TlsAcceptor; @@ -27,6 +28,7 @@ use std::future; use std::net::SocketAddr; use std::sync::Arc; +use crate::pdk::RError; use abi_stable::{ export_root_module, prefix_type::PrefixTypeTrait, @@ -42,7 +44,7 @@ use async_ffi::{BorrowingFfiFuture, FfiFuture, FutureExt}; const URL_SCHEME: &str = "tremor-tcp-server"; -#[derive(Deserialize, Debug)] +#[derive(Deserialize, Debug, Clone)] #[serde(deny_unknown_fields)] pub struct Config { // kept as a str, so it is re-resolved upon each connect @@ -95,28 +97,31 @@ pub fn connector_type() -> ConnectorType { } #[sabi_extern_fn] -pub fn from_config( - id: TremorUrl, - raw_config: ConnectorConfig, -) -> FfiFuture> { +pub fn from_config<'a>( + id: RStr<'a>, + raw_config: &'a ConnectorConfig, +) -> BorrowingFfiFuture<'a, RResult> { async move { - if let Some(raw_config) = &raw_config.config { - let config = Config::new(raw_config)?; + if let RSome(raw_config) = &raw_config.config { + let config = ttry!(Config::new(raw_config)); let tls_server_config = if let Some(tls_config) = config.tls.as_ref() { - Some(load_server_config(tls_config)?) + Some(ttry!(load_server_config(tls_config))) } else { None }; let (sink_tx, sink_rx) = bounded(crate::QSIZE.load(Ordering::Relaxed)); - Ok(Box::new(TcpServer { - config, - tls_server_config, - sink_tx, - sink_rx, - })) + ROk(BoxedRawConnector::from_value( + TcpServer { + config, + tls_server_config, + sink_tx, + sink_rx, + }, + TD_Opaque, + )) } else { - Err(ErrorKind::MissingConfiguration(id.to_string()).into()) + RErr(ErrorKind::MissingConfiguration(id.to_string()).into()) } } .into_ffi() @@ -161,7 +166,7 @@ impl RawConnector for TcpServer { // we use this constructor as we need the sink channel already when creating the source let sink = ChannelSink::from_channel_no_meta( resolve_connection_meta, - builder.reply_tx(), + reply_tx, self.sink_tx.clone(), self.sink_rx.clone(), ); @@ -247,9 +252,9 @@ impl RawSource for TcpServerSource { // Async allows us to read in one thread and write in another concurrently - see its documentation // So we don't need no BiLock like we would when using `.split()` let origin_uri = EventOriginUri { - scheme: URL_SCHEME.to_string(), - host: peer_addr.ip().to_string(), - port: Some(peer_addr.port()), + scheme: RString::from(URL_SCHEME), + host: RString::from(peer_addr.ip().to_string()), + port: RSome(peer_addr.port()), path: path.clone(), // captures server port }; @@ -270,7 +275,7 @@ impl RawSource for TcpServerSource { tls_read_stream, stream.clone(), vec![0; buf_size], - ctx.alias.clone(), + ctx.alias.clone().into(), origin_uri.clone(), meta, ); @@ -293,7 +298,7 @@ impl RawSource for TcpServerSource { let tcp_reader = TcpReader::new( stream.clone(), vec![0; buf_size], - ctx.alias.clone(), + ctx.alias.clone().into(), origin_uri.clone(), meta, ); @@ -310,12 +315,13 @@ impl RawSource for TcpServerSource { // notify connector task about disconnect // of the listening socket - ctx.notifier().notify().await?; + Result::from(ctx.notifier().notify().await.map_err(Error::from))?; Ok(()) })); ROk(true) - }.into_ffi() + } + .into_ffi() } fn pull_data<'a>( diff --git a/src/connectors/prelude.rs b/src/connectors/prelude.rs index 4858e9b2a8..a760de7520 100644 --- a/src/connectors/prelude.rs +++ b/src/connectors/prelude.rs @@ -15,11 +15,11 @@ pub use crate::connectors::quiescence::QuiescenceBeacon; pub use crate::connectors::sink::{ AsyncSinkReply, ChannelSink, ChannelSinkRuntime, ContraflowData, EventSerializer, - SingleStreamSink, SingleStreamSinkRuntime, Sink, SinkAck, SinkAddr, SinkContext, - SinkManagerBuilder, SinkMeta, SinkReply, StreamWriter, + SingleStreamSink, SingleStreamSinkRuntime, SinkAck, SinkAddr, SinkContext, SinkManagerBuilder, + SinkMeta, SinkReply, StreamWriter, }; pub use crate::connectors::source::{ - ChannelSource, ChannelSourceRuntime, Source, SourceAddr, SourceContext, SourceManagerBuilder, + ChannelSource, ChannelSourceRuntime, SourceAddr, SourceContext, SourceManagerBuilder, SourceReply, SourceReplySender, StreamReader, DEFAULT_POLL_INTERVAL, }; pub use crate::connectors::utils::reconnect::{Attempt, ConnectionLostNotifier}; @@ -53,6 +53,7 @@ pub(crate) fn default_buf_size() -> usize { pub use crate::connectors::ConnectorConfig; /// For the PDK +pub(crate) use crate::connectors::{sink::Sink, source::Source, Connector}; pub use crate::{ connectors::{ quiescence::BoxedQuiescenceBeacon, diff --git a/src/connectors/sink.rs b/src/connectors/sink.rs index cadbbcdef8..2484bf17c5 100644 --- a/src/connectors/sink.rs +++ b/src/connectors/sink.rs @@ -58,15 +58,12 @@ use crate::errors::Error; use crate::pdk::{RError, RResult}; use abi_stable::{ rvec, - std_types::{RBox, RResult::ROk, RStr, RString, RVec, SendRBoxError}, + std_types::{RBox, ROption::RSome, RResult::ROk, RStr, RString, RVec, SendRBoxError}, type_level::downcasting::TD_Opaque, RMut, StableAbi, }; use async_ffi::{BorrowingFfiFuture, FutureExt}; use std::future; -use tremor_pipeline::{pdk::PdkEvent, pdk::PdkOpMeta}; -use tremor_script::pdk::PdkEventPayload; -use tremor_value::pdk::PdkValue; /// Result for a sink function that may provide insights or response. /// @@ -185,11 +182,10 @@ pub type BoxedRawSink = RawSink_TO<'static, RBox<()>>; #[abi_stable::sabi_trait] pub trait RawSink: Send { /// called when receiving an event - /// FIXME: Why are we returning a Vec but the elements don't allow to correlate what was acked fn on_event<'a>( &'a mut self, input: RStr<'a>, - event: PdkEvent, + event: Event, ctx: &'a SinkContext, serializer: &'a mut MutEventSerializer, start: u64, @@ -197,7 +193,7 @@ pub trait RawSink: Send { /// called when receiving a signal fn on_signal<'a>( &'a mut self, - _signal: PdkEvent, + _signal: Event, _ctx: &'a SinkContext, _serializer: &'a mut MutEventSerializer, ) -> BorrowingFfiFuture<'a, RResult> { @@ -223,8 +219,12 @@ pub trait RawSink: Send { /// } /// ``` /// - fn metrics(&mut self, _timestamp: u64, _ctx: &SinkContext) -> RVec { - rvec![] + fn metrics( + &mut self, + _timestamp: u64, + _ctx: &SinkContext, + ) -> BorrowingFfiFuture<'_, RVec> { + future::ready(rvec![]).into_ffi() } // lifecycle stuff @@ -291,9 +291,8 @@ pub trait RawSink: Send { /// /// Just like `Connector`, this wraps the FFI dynamic sink with `abi_stable` /// types so that it's easier to use with `std`. -pub struct Sink(pub BoxedRawSink); +pub(crate) struct Sink(pub BoxedRawSink); impl Sink { - /// Wrapper for [`BoxedRawSink::on_event`] #[inline] pub async fn on_event( &mut self, @@ -305,7 +304,7 @@ impl Sink { ) -> Result { let mut serializer = MutEventSerializer::from_ptr(serializer, TD_Opaque); self.0 - .on_event(input.into(), event.into(), ctx, &mut serializer, start) + .on_event(input.into(), event, ctx, &mut serializer, start) .await .map_err(Into::into) // RBoxError -> Box .into() // RResult -> Result @@ -319,48 +318,58 @@ impl Sink { ) -> Result { let mut serializer = MutEventSerializer::from_ptr(serializer, TD_Opaque); self.0 - .on_signal(signal.into(), ctx, &mut serializer) + .on_signal(signal, ctx, &mut serializer) .await .map_err(Into::into) // RBoxError -> Box .into() // RResult -> Result } #[inline] - pub fn metrics(&mut self, timestamp: u64) -> Vec { - self.0 - .metrics(timestamp) - .into_iter() - .map(Into::into) - .collect() + pub async fn metrics(&mut self, timestamp: u64, ctx: &SinkContext) -> Vec { + self.0.metrics(timestamp, ctx).await.into() } #[inline] pub async fn on_start(&mut self, ctx: &SinkContext) -> Result<()> { - self.0.on_start(ctx).await.map_err(Into::into).into() + self.0 + .on_start(ctx) + .await + .map_err(Into::into) // RBoxError -> Box + .into() // RResult -> Result } - /// Wrapper for [`BoxedRawSink::connect`] #[inline] pub async fn connect(&mut self, ctx: &SinkContext, attempt: &Attempt) -> Result { self.0 .connect(ctx, attempt) .await - .map_err(Into::into) - .into() + .map_err(Into::into) // RBoxError -> Box + .into() // RResult -> Result } - /// Wrapper for [`BoxedRawSink::on_pause`] #[inline] pub async fn on_pause(&mut self, ctx: &SinkContext) -> Result<()> { - self.0.on_pause(ctx).await.map_err(Into::into).into() + self.0 + .on_pause(ctx) + .await + .map_err(Into::into) // RBoxError -> Box + .into() // RResult -> Result } #[inline] pub async fn on_resume(&mut self, ctx: &SinkContext) -> Result<()> { - self.0.on_resume(ctx).await.map_err(Into::into).into() + self.0 + .on_resume(ctx) + .await + .map_err(Into::into) // RBoxError -> Box + .into() // RResult -> Result } #[inline] pub async fn on_stop(&mut self, ctx: &SinkContext) -> Result<()> { - self.0.on_stop(ctx).await.map_err(Into::into).into() + self.0 + .on_stop(ctx) + .await + .map_err(Into::into) // RBoxError -> Box + .into() // RResult -> Result } #[inline] @@ -368,16 +377,16 @@ impl Sink { self.0 .on_connection_lost(ctx) .await - .map_err(Into::into) - .into() + .map_err(Into::into) // RBoxError -> Box + .into() // RResult -> Result } #[inline] pub async fn on_connection_established(&mut self, ctx: &SinkContext) -> Result<()> { self.0 .on_connection_established(ctx) .await - .map_err(Into::into) - .into() + .map_err(Into::into) // RBoxError -> Box + .into() // RResult -> Result } #[inline] @@ -409,7 +418,7 @@ pub trait StreamWriter: Send + Sync { pub struct SinkContext { /// the connector unique identifier pub uid: u64, - /// the connector alias + /// the connector url pub(crate) alias: RString, /// the connector type pub(crate) connector_type: ConnectorType, @@ -539,7 +548,7 @@ impl SinkManagerBuilder { } /// spawn your specific sink - pub fn spawn(self, sink: Sink, ctx: SinkContext) -> Result { + pub fn spawn(self, sink: BoxedRawSink, ctx: SinkContext) -> Result { let qsize = self.qsize; let name = format!("{}-sink", ctx.alias); let (sink_tx, sink_rx) = bounded(qsize); @@ -558,13 +567,7 @@ pub trait ContraflowSenderOpaque: Send { } impl ContraflowSenderOpaque for Sender { fn send(&self, reply: AsyncSinkReply) -> BorrowingFfiFuture<'_, RResult<()>> { - async move { - self.send(reply) - .await - .map_err(|e| RError::new(Error::from(e))) - .into() - } - .into_ffi() + async move { self.send(reply).await.map_err(RError::new).into() }.into_ffi() } } /// Alias for the FFI-safe contraflow sender, boxed @@ -582,9 +585,9 @@ pub(crate) fn builder( // resolve codec and processors let postprocessor_configs = config.postprocessors.clone().unwrap_or_default(); let serializer = EventSerializer::build( - config.codec.clone(), + config.codec.clone().into(), connector_default_codec, - postprocessor_configs, + postprocessor_configs.into(), )?; // the incoming channels for events are all bounded, so we can safely be unbounded here // TODO: actually we could have lots of CB events not bound to events here @@ -650,15 +653,12 @@ impl EventSerializer { } // This is kept separate so that conversions are done only once later on - // FIXME: use a `try` block when they are stabilized fn serialize_for_stream_inner( &mut self, - value: &PdkValue, + value: &Value, ingest_ns: u64, stream_id: u64, ) -> Result>> { - // FIXME: super ugly clone here - let value: &Value = &value.clone().into(); if stream_id == DEFAULT_STREAM_ID { postprocess( &mut self.postprocessors, @@ -700,7 +700,7 @@ pub trait EventSerializerOpaque: Send { /// /// # Errors /// * if serialization failed (codec or postprocessors) - fn serialize(&mut self, value: &PdkValue, ingest_ns: u64) -> RResult>>; + fn serialize(&mut self, value: &Value, ingest_ns: u64) -> RResult>>; /// serialize event for a certain stream /// @@ -708,7 +708,7 @@ pub trait EventSerializerOpaque: Send { /// * if serialization failed (codec or postprocessors) fn serialize_for_stream( &mut self, - value: &PdkValue, + value: &Value, ingest_ns: u64, stream_id: u64, ) -> RResult>>; @@ -722,13 +722,13 @@ impl EventSerializerOpaque for EventSerializer { self.streams.clear(); } - fn serialize(&mut self, value: &PdkValue, ingest_ns: u64) -> RResult>> { - self.serialize_for_stream(value.into(), ingest_ns, DEFAULT_STREAM_ID) + fn serialize(&mut self, value: &Value, ingest_ns: u64) -> RResult>> { + self.serialize_for_stream(value, ingest_ns, DEFAULT_STREAM_ID) } fn serialize_for_stream( &mut self, - value: &PdkValue, + value: &Value, ingest_ns: u64, stream_id: u64, ) -> RResult>> { @@ -774,7 +774,7 @@ pub(crate) struct SinkManager { impl SinkManager { fn new( - sink: Sink, + sink: BoxedRawSink, ctx: SinkContext, builder: SinkManagerBuilder, rx: Receiver, @@ -786,7 +786,7 @@ impl SinkManager { .. } = builder; Self { - sink, + sink: Sink(sink), ctx, rx, reply_rx: reply_channel.1, @@ -1002,7 +1002,7 @@ impl SinkManager { SinkMsg::Signal { signal } => { // special treatment match signal.kind { - Some(SignalKind::Drain(source_uid)) => { + RSome(SignalKind::Drain(source_uid)) => { debug!( "[Sink::{}] Drain signal received from {}", &self.ctx.alias, source_uid @@ -1028,7 +1028,7 @@ impl SinkManager { .into_cb(CbAction::Drained(source_uid)); send_contraflow(&self.pipelines, &self.ctx.alias, cf).await; } - Some(SignalKind::Start(source_uid)) => { + RSome(SignalKind::Start(source_uid)) => { debug!( "[Sink::{}] Received Start signal from {}", &self.ctx.alias, source_uid @@ -1074,14 +1074,14 @@ impl SinkManager { AsyncSinkReply::Ack(data, duration) => Event::cb_ack_with_timing( data.ingest_ns, data.event_id, - data.op_meta.into(), + data.op_meta, duration, ), AsyncSinkReply::Fail(data) => { - Event::cb_fail(data.ingest_ns, data.event_id, data.op_meta.into()) + Event::cb_fail(data.ingest_ns, data.event_id, data.op_meta) } AsyncSinkReply::CB(data, cb) => { - Event::insight(cb, data.event_id, data.ingest_ns, data.op_meta.into()) + Event::insight(cb, data.event_id, data.ingest_ns, data.op_meta) } }; send_contraflow(&self.pipelines, &self.ctx.alias, cf).await; @@ -1100,26 +1100,26 @@ impl SinkManager { pub struct ContraflowData { event_id: EventId, ingest_ns: u64, - op_meta: PdkOpMeta, + op_meta: OpMeta, } impl ContraflowData { fn into_ack(self, duration: u64) -> Event { - Event::cb_ack_with_timing(self.ingest_ns, self.event_id, self.op_meta.into(), duration) + Event::cb_ack_with_timing(self.ingest_ns, self.event_id, self.op_meta, duration) } fn into_fail(self) -> Event { - Event::cb_fail(self.ingest_ns, self.event_id, self.op_meta.into()) + Event::cb_fail(self.ingest_ns, self.event_id, self.op_meta) } fn cb(&self, cb: CbAction) -> Event { Event::insight( cb, self.event_id.clone(), self.ingest_ns, - self.op_meta.clone().into(), + self.op_meta.clone(), ) } fn into_cb(self, cb: CbAction) -> Event { - Event::insight(cb, self.event_id, self.ingest_ns, self.op_meta.into()) + Event::insight(cb, self.event_id, self.ingest_ns, self.op_meta) } } @@ -1128,17 +1128,17 @@ impl From<&Event> for ContraflowData { ContraflowData { event_id: event.id.clone(), ingest_ns: event.ingest_ns, - op_meta: event.op_meta.clone().into(), // TODO: mem::swap here? + op_meta: event.op_meta.clone(), } } } -impl From<&PdkEvent> for ContraflowData { - fn from(event: &PdkEvent) -> Self { +impl From for ContraflowData { + fn from(event: Event) -> Self { ContraflowData { - event_id: event.id.clone(), + event_id: event.id, ingest_ns: event.ingest_ns, - op_meta: event.op_meta.clone(), // TODO: mem::swap here? + op_meta: event.op_meta, } } } diff --git a/src/connectors/sink/channel_sink.rs b/src/connectors/sink/channel_sink.rs index 8ede3473a3..86f08ff97c 100644 --- a/src/connectors/sink/channel_sink.rs +++ b/src/connectors/sink/channel_sink.rs @@ -42,7 +42,6 @@ use abi_stable::{ }; use async_ffi::{BorrowingFfiFuture, FutureExt}; use std::future; -use tremor_pipeline::pdk::PdkEvent; /// Behavioral trait for defining if a Channel Sink needs metadata or not pub trait SinkMetaBehaviour: Send + Sync { @@ -164,7 +163,9 @@ where F: Fn(&Value<'_>) -> Option, B: SinkMetaBehaviour, { - /// constructor + /// constructor of a ChannelSink that is sending the event metadata to the StreamWriter + /// in case it needs it in the write. + /// This costs a clone. pub fn new( resolver: F, reply_tx: BoxedContraflowSender, @@ -321,12 +322,9 @@ where } let error = match writer.on_done(stream).await { Err(e) => RSome(e), - Ok(StreamDone::ConnectorClosed) => ctx - .notifier() - .notify() - .await - .err() - .map(|e| ErrorKind::PluginError(e).into()), + Ok(StreamDone::ConnectorClosed) => { + ctx.notifier().notify().await.err().map(Error::from) + } Ok(_) => RNone, }; if let RSome(e) = error { @@ -351,7 +349,7 @@ fn get_sink_meta<'lt, 'value>( meta: &'lt Value<'value>, ctx: &SinkContext, ) -> Option<&'lt Value<'value>> { - meta.get(ctx.connector_type().to_string().as_str()) + meta.get(ctx.connector_type.to_string().as_str()) } impl RawSink for ChannelSink @@ -364,15 +362,12 @@ where fn on_event<'a>( &'a mut self, _input: RStr<'a>, - event: PdkEvent, + event: Event, ctx: &'a SinkContext, serializer: &'a mut MutEventSerializer, start: u64, ) -> BorrowingFfiFuture<'a, RResult> { async move { - // Conversion to use the full functionality of `Event` - let event = Event::from(event); - // clean up // make sure channels for the given event are added to avoid stupid errors // due to channels not yet handled @@ -390,6 +385,7 @@ where trace!("{} on_event stream_ids: {:?}", &ctx, stream_ids); let contraflow_utils = if event.transactional { + // FIXME: avoid downcasting? let reply_tx = self .reply_tx .obj @@ -421,11 +417,7 @@ where for (stream_id, sender) in streams { trace!("{} Send to stream {}.", &ctx, stream_id); - let data = rtry!(serializer.serialize_for_stream( - &value.clone().into(), - ingest_ns, - *stream_id - )); + let data = rtry!(serializer.serialize_for_stream(value, ingest_ns, *stream_id)); let meta = if B::NEEDS_META { Some(meta.clone_static()) } else { @@ -462,7 +454,7 @@ where fn on_signal<'a>( &'a mut self, - signal: PdkEvent, + signal: Event, _ctx: &'a SinkContext, serializer: &'a mut MutEventSerializer, ) -> BorrowingFfiFuture<'a, RResult> { diff --git a/src/connectors/sink/concurrency_cap.rs b/src/connectors/sink/concurrency_cap.rs index 91a94aee16..6fdd5656e7 100644 --- a/src/connectors/sink/concurrency_cap.rs +++ b/src/connectors/sink/concurrency_cap.rs @@ -29,8 +29,7 @@ pub(crate) struct ConcurrencyCap { } impl ConcurrencyCap { - /// constructor - pub fn new(max: usize, reply_tx: Sender) -> Self { + pub(crate) fn new(max: usize, reply_tx: Sender) -> Self { Self { cap: max, reply_tx, @@ -45,7 +44,7 @@ impl ConcurrencyCap { /// increment the counter and return a guard for safely counting down /// wrapped inside an enum to check whether we exceeded the maximum or not - pub async fn inc_for(&self, event: &Event) -> Result { + pub(crate) async fn inc_for(&self, event: &Event) -> Result { let num = self.counter.fetch_add(1, Ordering::AcqRel); let guard = CounterGuard(num, self.clone(), ContraflowData::from(event)); if num == self.cap { @@ -75,8 +74,7 @@ impl ConcurrencyCap { pub(crate) struct CounterGuard(usize, ConcurrencyCap, ContraflowData); impl CounterGuard { - /// slot number - pub fn num(&self) -> usize { + pub(crate) fn num(&self) -> usize { self.0 } } diff --git a/src/connectors/sink/single_stream_sink.rs b/src/connectors/sink/single_stream_sink.rs index 1be8c399cd..52d6ccfce1 100644 --- a/src/connectors/sink/single_stream_sink.rs +++ b/src/connectors/sink/single_stream_sink.rs @@ -40,7 +40,7 @@ use abi_stable::{ }, }; use async_ffi::{BorrowingFfiFuture, FutureExt}; -use tremor_pipeline::{pdk::PdkEvent, Event}; +use tremor_pipeline::Event; /// simple Sink implementation that is handling only a single stream pub struct SingleStreamSink @@ -105,8 +105,12 @@ pub struct SingleStreamSinkRuntime { } impl SingleStreamSinkRuntime { - pub fn register_stream_writer(&self, stream: u64, ctx: &ConnectorContext, mut writer: W) - where + pub(crate) fn register_stream_writer( + &self, + stream: u64, + ctx: &ConnectorContext, + mut writer: W, + ) where W: StreamWriter + 'static, { let ctx = ctx.clone(); @@ -143,12 +147,9 @@ impl SingleStreamSinkRuntime { } let error = match writer.on_done(stream).await { Err(e) => RSome(e), - Ok(StreamDone::ConnectorClosed) => ctx - .notifier - .notify() - .await - .err() - .map(|e| ErrorKind::PluginError(e).into()), + Ok(StreamDone::ConnectorClosed) => { + ctx.notifier.notify().await.err().map(Error::from) + } Ok(_) => RNone, }; if let RSome(e) = error { @@ -168,14 +169,11 @@ where fn on_event<'a>( &'a mut self, _input: RStr<'a>, - event: PdkEvent, + event: Event, ctx: &'a SinkContext, serializer: &'a mut MutEventSerializer, start: u64, ) -> BorrowingFfiFuture<'a, RResult> { - // Conversion to use the full functionality of `Event` - let event = Event::from(event); - async move { let ingest_ns = event.ingest_ns; let contraflow = if event.transactional { @@ -188,7 +186,7 @@ where { // handle first couple of items (if batched) for (value, meta) in value_meta_iter { - let data = rtry!(serializer.serialize(&value.clone().into(), ingest_ns)); + let data = rtry!(serializer.serialize(value, ingest_ns)); let meta = if B::NEEDS_META { Some(meta.clone_static()) } else { @@ -206,7 +204,7 @@ where } } // handle last item - let data = rtry!(serializer.serialize(&last_value.clone().into(), ingest_ns)); + let data = rtry!(serializer.serialize(last_value, ingest_ns)); let meta = if B::NEEDS_META { Some(last_meta.clone_static()) } else { diff --git a/src/connectors/source.rs b/src/connectors/source.rs index 97434febe4..f839c450fe 100644 --- a/src/connectors/source.rs +++ b/src/connectors/source.rs @@ -118,27 +118,27 @@ pub enum SourceReply { /// the data data: RVec, /// metadata associated with this data - meta: ROption>, + meta: ROption>, /// stream id of the data stream: u64, /// Port to send to, defaults to `out` - port: ROption>, + port: ROption>, }, /// an already structured event payload Structured { origin_uri: EventOriginUri, - payload: PdkEventPayload, + payload: EventPayload, stream: u64, /// Port to send to, defaults to `out` - port: ROption>, + port: ROption>, }, /// a bunch of separated `Vec` with optional metadata /// for when the source knows where boundaries are, maybe because it receives chunks already BatchData { origin_uri: EventOriginUri, - batch_data: RVec, ROption>>>, + batch_data: RVec, ROption>>>, /// Port to send to, defaults to `out` - port: ROption>, + port: ROption>, stream: u64, }, /// A stream is closed @@ -149,7 +149,7 @@ pub enum SourceReply { EndStream { origin_uri: EventOriginUri, stream: u64, - meta: ROption>, + meta: ROption>, }, /// Stream Failed, resources related to that stream should be cleaned up StreamFail(u64), @@ -167,7 +167,13 @@ pub type BoxedRawSource = RawSource_TO<'static, RBox<()>>; #[abi_stable::sabi_trait] pub trait RawSource: Send { /// Pulls an event from the source if one exists - /// `idgen` is passed in so the source can inspect what event id it would get if it was producing 1 event from the pulled data + /// the `pull_id` identifies the number of the call to `pull_data` and is passed in so + /// sources can keep track of which event stems from which call of `pull_data` and so can + /// form a connection between source-specific units and events when receiving `ack`/`fail` notifications. + /// + /// `pull_id` can be modified, but users need to beware that it needs to remain unique per event stream. The modified `pull_id` + /// will be used in the `EventId` and will be passed backl into the `ack`/`fail` methods. This allows sources to encode + /// information into the `pull_id` to keep track of internal state. fn pull_data<'a>( &'a mut self, pull_id: &'a mut u64, @@ -187,7 +193,7 @@ pub trait RawSource: Send { } /// Pulls custom metrics from the source - fn metrics(&mut self, _timestamp: u64, _ctx: &SourceContext) -> RVec { + fn metrics(&mut self, _timestamp: u64, _ctx: &SourceContext) -> RVec { rvec![] } @@ -295,7 +301,7 @@ pub trait RawSource: Send { /// /// Just like `Connector`, this wraps the FFI dynamic source with `abi_stable` /// types so that it's easier to use with `std`. -pub struct Source(pub BoxedRawSource); +pub(crate) struct Source(pub BoxedRawSource); impl Source { #[inline] pub async fn pull_data( @@ -323,22 +329,20 @@ impl Source { .into() // RResult -> Result } - /// Pulls custom metrics from the source #[inline] - pub fn metrics(&mut self, timestamp: u64) -> Vec { - self.0 - .metrics(timestamp) - .into_iter() - .map(Into::into) - .collect() + pub fn metrics(&mut self, timestamp: u64, ctx: &SourceContext) -> Vec { + self.0.metrics(timestamp, ctx).into() } #[inline] pub async fn on_start(&mut self, ctx: &SourceContext) -> Result<()> { - self.0.on_start(ctx).await.map_err(Into::into).into() + self.0 + .on_start(ctx) + .await + .map_err(Into::into) // RBoxError -> Box + .into() // RResult -> Result } - /// Wrapper for [`BoxedRawSource::connect`] pub async fn connect(&mut self, ctx: &SourceContext, attempt: &Attempt) -> Result { self.0 .connect(ctx, attempt) @@ -347,27 +351,46 @@ impl Source { .into() // RResult -> Result } - /// Wrapper for [`BoxedRawSource::on_pause`] #[inline] pub async fn on_pause(&mut self, ctx: &SourceContext) -> Result<()> { - self.0.on_pause(ctx).await.map_err(Into::into).into() + self.0 + .on_pause(ctx) + .await + .map_err(Into::into) // RBoxError -> Box + .into() // RResult -> Result } #[inline] pub async fn on_resume(&mut self, ctx: &SourceContext) -> Result<()> { - self.0.on_resume(ctx).await.map_err(Into::into).into() + self.0 + .on_resume(ctx) + .await + .map_err(Into::into) // RBoxError -> Box + .into() // RResult -> Result } #[inline] pub async fn on_stop(&mut self, ctx: &SourceContext) -> Result<()> { - self.0.on_stop(ctx).await.map_err(Into::into).into() + self.0 + .on_stop(ctx) + .await + .map_err(Into::into) // RBoxError -> Box + .into() // RResult -> Result } #[inline] pub async fn on_cb_close(&mut self, ctx: &SourceContext) -> Result<()> { - self.0.on_cb_close(ctx).await.map_err(Into::into).into() + self.0 + .on_cb_close(ctx) + .await + .map_err(Into::into) // RBoxError -> Box + .into() // RResult -> Result } #[inline] pub async fn on_cb_open(&mut self, ctx: &SourceContext) -> Result<()> { - self.0.on_cb_open(ctx).await.map_err(Into::into).into() + self.0 + .on_cb_open(ctx) + .await + .map_err(Into::into) // RBoxError -> Box + .into() // RResult -> Result } #[inline] @@ -375,16 +398,16 @@ impl Source { self.0 .ack(stream_id, pull_id, ctx) .await - .map_err(Into::into) - .into() + .map_err(Into::into) // RBoxError -> Box + .into() // RResult -> Result } #[inline] pub async fn fail(&mut self, stream_id: u64, pull_id: u64, ctx: &SourceContext) -> Result<()> { self.0 .fail(stream_id, pull_id, ctx) .await - .map_err(Into::into) - .into() + .map_err(Into::into) // RBoxError -> Box + .into() // RResult -> Result } #[inline] @@ -392,16 +415,16 @@ impl Source { self.0 .on_connection_lost(ctx) .await - .map_err(Into::into) - .into() + .map_err(Into::into) // RBoxError -> Box + .into() // RResult -> Result } #[inline] pub async fn on_connection_established(&mut self, ctx: &SourceContext) -> Result<()> { self.0 .on_connection_established(ctx) .await - .map_err(Into::into) - .into() + .map_err(Into::into) // RBoxError -> Box + .into() // RResult -> Result } #[inline] @@ -501,7 +524,7 @@ impl SourceManagerBuilder { self.qsize } - pub fn spawn(self, source: Source, ctx: SourceContext) -> Result { + pub fn spawn(self, source: BoxedRawSource, ctx: SourceContext) -> Result { // We use a unbounded channel for counterflow, while an unbounded channel seems dangerous // there is soundness to this. // The unbounded channel ensures that on counterflow we never have to block, or in other @@ -523,7 +546,7 @@ impl SourceManagerBuilder { // the pipeline is waiting for the source to process contraflow and the source waits for // the pipeline to process forward flow. - let name = format!("{}-src", ctx.alias()); // connector source + let name = format!("{}-src", ctx.alias); let (source_tx, source_rx) = unbounded(); let source_addr = SourceAddr { addr: source_tx }; let manager = SourceManager::new(source, ctx, self, source_rx, source_addr.clone()); @@ -557,16 +580,18 @@ pub fn builder( CodecConfig::from("null") } } - CodecReq::Required => config - .codec - .clone() - .ok_or_else(|| format!("Missing codec for connector {}", config.connector_type))?, + CodecReq::Required => Result::from(config.codec.clone().ok_or_else(|| { + Error::from(format!( + "Missing codec for connector {}", + config.connector_type + )) + }))?, CodecReq::Optional(opt) => config .codec .clone() .unwrap_or_else(|| CodecConfig::from(opt.as_str())), }; - let streams = Streams::new(connector_uid, codec_config, preprocessor_configs)?; + let streams = Streams::new(connector_uid, codec_config, preprocessor_configs.into())?; Ok(SourceManagerBuilder { qsize, @@ -673,18 +698,11 @@ enum SourceState { // FIXME: make prettier or avoid duplication in pdk mod? It's a bit out of place // for now. -fn conv_cow_str(cow: RCow) -> beef::Cow { - let cow: std::borrow::Cow = cow.into(); +fn conv_cow_str<'a>(cow: RCowStr<'a>) -> beef::Cow<'a, str> { + let cow: std::borrow::Cow<'a, str> = cow.into(); cow.into() } -/// control flow enum -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -enum Control { - Continue, - Terminate, -} - /// entity driving the source task /// and keeping the source state around pub(crate) struct SourceManager { @@ -712,9 +730,16 @@ pub(crate) struct SourceManager { cb_open_received: bool, } +/// control flow enum +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum Control { + Continue, + Terminate, +} + impl SourceManager { fn new( - source: Source, + source: BoxedRawSource, ctx: SourceContext, builder: SourceManagerBuilder, rx: Receiver, @@ -729,7 +754,7 @@ impl SourceManager { let is_asynchronous = source.asynchronous(); Self { - source, + source: Source(source), ctx, rx, addr, @@ -943,9 +968,9 @@ impl SourceManager { Ok(Control::Continue) } SourceMsg::Cb(CbAction::Fail, id) => { - if let Some((stream_id, pull_id)) = id.get_min_by_source(self.ctx.uid) { + if let Some((stream_id, id)) = id.get_min_by_source(self.ctx.uid) { self.ctx.log_err( - self.source.fail(stream_id, pull_id, &self.ctx).await, + self.source.fail(stream_id, id, &self.ctx).await, "fail failed", ); } @@ -1138,16 +1163,15 @@ impl SourceManager { let mut ingest_ns = nanotime(); let stream_state = self.streams.get_or_create_stream(stream, &self.ctx)?; // we fail if we cannot create a stream (due to misconfigured codec, preprocessors, ...) (should not happen) let port: Option> = port.map(conv_cow_str).into(); - let meta: Option = meta.map(Value::from).into(); let results = build_events( &self.ctx.alias, stream_state, &mut ingest_ns, pull_id, - origin_uri.into(), + origin_uri, port.as_ref(), data.into(), - &meta.unwrap_or_else(Value::object), + &meta.unwrap_or_else(Value::object).into(), self.is_transactional, ); if results.is_empty() { @@ -1175,21 +1199,20 @@ impl SourceManager { } => { let mut ingest_ns = nanotime(); let stream_state = self.streams.get_or_create_stream(stream, &self.ctx)?; // we only error here due to misconfigured codec etc - let alias = &self.ctx.alias; + let connector_url = &self.ctx.alias; let port: Option> = port.map(conv_cow_str).into(); let mut results = Vec::with_capacity(batch_data.len()); // assuming 1:1 mapping for Tuple2(data, meta) in batch_data { - let meta: Value<'static> = meta.map(Value::from).unwrap_or_else(Value::object); let mut events = build_events( - alias, + connector_url, stream_state, &mut ingest_ns, pull_id, - origin_uri.clone().into(), // TODO: use split_last on batch_data to avoid last clone + origin_uri.clone(), // TODO: use split_last on batch_data to avoid last clone port.as_ref(), data.into(), - &meta, + &meta.unwrap_or_else(Value::object).into(), self.is_transactional, ); results.append(&mut events); @@ -1223,14 +1246,13 @@ impl SourceManager { stream_state, pull_id, ingest_ns, - EventPayload::from(payload), - origin_uri.into(), + payload, + origin_uri, self.is_transactional, ); - let port: Cow<'static, str> = port.map(conv_cow_str).unwrap_or(OUT); - - let error = self.route_events(vec![(port, event)]).await; + let port: ROption> = port.map(conv_cow_str); + let error = self.route_events(vec![(port.unwrap_or(OUT), event)]).await; if error { self.ctx.log_err( self.source.fail(stream, pull_id, &self.ctx).await, @@ -1243,7 +1265,7 @@ impl SourceManager { meta, stream: stream_id, } => { - debug!("{} Ending stream {}", &self.ctx, stream_id); + debug!("[Source::{}] Ending stream {}", &self.ctx.alias, stream_id); let mut ingest_ns = nanotime(); if let Some(mut stream_state) = self.streams.end_stream(stream_id) { let results = build_last_events( @@ -1251,9 +1273,9 @@ impl SourceManager { &mut stream_state, &mut ingest_ns, pull_id, - origin_uri.into(), + origin_uri, None, - &meta.map(Into::into).unwrap_or_else(Value::object), + &meta.unwrap_or_else(Value::object), self.is_transactional, ); if results.is_empty() { @@ -1262,7 +1284,10 @@ impl SourceManager { .on_no_events(pull_id, stream_id, &self.ctx) .await { - error!("{} Error on no events callback: {}", &self.ctx, e); + error!( + "[Source::{}] Error on no events callback: {}", + &self.ctx.alias, e + ); } } else { let error = self.route_events(results).await; @@ -1345,7 +1370,7 @@ impl SourceManager { // FIXME: change reply from true/false to something descriptive like enum {Stop Continue} or the rust controlflow thingy if self.control_plane().await? == Control::Terminate { // source has been stopped, lets stop running here - debug!("{} Terminating source task...", &self.ctx); + debug!("[Source::{}] Terminating source task...", self.ctx.alias); return Ok(()); } @@ -1529,7 +1554,7 @@ fn build_event( id: stream_state.idgen.next_with_pull_id(pull_id), data: payload, ingest_ns, - origin_uri: Some(origin_uri), + origin_uri: RSome(origin_uri), transactional: is_transactional, ..Event::default() } diff --git a/src/connectors/source/channel_source.rs b/src/connectors/source/channel_source.rs index d040c8b2f5..b14a85286c 100644 --- a/src/connectors/source/channel_source.rs +++ b/src/connectors/source/channel_source.rs @@ -17,7 +17,7 @@ use crate::connectors::source::{ }; use crate::connectors::Context; use crate::errors::{Error, Result}; -use crate::pdk::RResult; +use crate::pdk::{RError, RResult}; use abi_stable::std_types::{RErr, ROk}; use async_ffi::{BorrowingFfiFuture, FutureExt}; use async_std::channel::{bounded, Receiver, Sender, TryRecvError}; @@ -121,7 +121,7 @@ impl RawSource for ChannelSource { // TODO: configure pull interval in connector config? ROk(SourceReply::Empty(DEFAULT_POLL_INTERVAL)) } - Err(e) => RErr(Error::from(e).into()), + Err(e) => RErr(RError::new(e)), }) .into_ffi() } diff --git a/src/connectors/utils/reconnect.rs b/src/connectors/utils/reconnect.rs index b5523068e5..5dc3581056 100644 --- a/src/connectors/utils/reconnect.rs +++ b/src/connectors/utils/reconnect.rs @@ -230,11 +230,7 @@ impl ConnectionLostNotifierOpaque for ConnectionLostNotifier { self.0 .send(Msg::ConnectionLost) .await - .map_err(|e| { - // First converting to our own error type, and then to abi_stable's - let e: crate::errors::Error = e.into(); - RError::new(e) - }) + .map_err(RError::new) .into() } .into_ffi() diff --git a/src/pdk/connectors.rs b/src/pdk/connectors.rs index cdf814446d..94c959b3a3 100644 --- a/src/pdk/connectors.rs +++ b/src/pdk/connectors.rs @@ -1,9 +1,9 @@ use crate::{ + config::Connector as ConnectorConfig, connectors::{BoxedRawConnector, ConnectorType}, pdk::RResult, - config::Connector as ConnectorConfig, }; -use tremor_value::pdk::PdkValue; +use tremor_value::Value; use std::fmt; @@ -12,10 +12,10 @@ use abi_stable::{ library::RootModule, package_version_strings, sabi_types::VersionStrings, - std_types::{ROption, RString}, + std_types::{ROption, RStr, RString}, StableAbi, }; -use async_ffi::FfiFuture; +use async_ffi::BorrowingFfiFuture; /// This type represents a connector plugin that has been loaded with /// `abi_stable`. It serves as a builder, making it possible to construct a @@ -36,10 +36,11 @@ pub struct ConnectorMod { /// # Errors /// * If the config is invalid for the connector #[sabi(last_prefix_field)] - pub from_config: extern "C" fn( - alias: RString, - config: ConnectorConfig, - ) -> FfiFuture>, + pub from_config: for<'a> extern "C" fn( + alias: RStr<'a>, + config: &'a ConnectorConfig, + ) + -> BorrowingFfiFuture<'a, RResult>, } // Marking `MinMod` as the main module in this plugin. Note that `MinMod_Ref` is diff --git a/src/pdk/mod.rs b/src/pdk/mod.rs index ef3654ce5f..452588683b 100644 --- a/src/pdk/mod.rs +++ b/src/pdk/mod.rs @@ -72,16 +72,16 @@ pub fn find_recursively(base_dir: &str) -> Vec { } pub mod utils { - use abi_stable::std_types::RCow; + use abi_stable::std_types::RCowStr; // FIXME: clean up after creation of `tremor-pdk`, this is repeated in other // crates. - pub fn conv_cow_str(cow: RCow) -> beef::Cow { + pub fn conv_cow_str(cow: RCowStr) -> beef::Cow { let cow: std::borrow::Cow = cow.into(); cow.into() } - pub fn conv_cow_str_inv(cow: beef::Cow) -> RCow { + pub fn conv_cow_str_inv(cow: beef::Cow) -> RCowStr { let cow: std::borrow::Cow = cow.into(); cow.into() } diff --git a/src/pipeline.rs b/src/pipeline.rs index 3f6ffb005f..b0ad4e62c9 100644 --- a/src/pipeline.rs +++ b/src/pipeline.rs @@ -28,6 +28,8 @@ use tremor_pipeline::errors::ErrorKind as PipelineErrorKind; use tremor_pipeline::{CbAction, Event, ExecutableGraph, SignalKind}; use tremor_script::ast::DeployEndpoint; +use abi_stable::std_types::ROption::RSome; + const TICK_MS: u64 = 100; type Inputs = halfbrown::HashMap; type Dests = halfbrown::HashMap, Vec<(DeployEndpoint, OutputTarget)>>; @@ -294,7 +296,7 @@ impl OutputTarget { Self::Pipeline(addr) => { // Each pipeline has their own ticks, we don't // want to propagate them - if signal.kind != Some(SignalKind::Tick) { + if signal.kind != RSome(SignalKind::Tick) { addr.send(Box::new(Msg::Signal(signal))).await?; } } diff --git a/src/preprocessor/lines.rs b/src/preprocessor/lines.rs index 0fdd90f5b7..b2edafd329 100644 --- a/src/preprocessor/lines.rs +++ b/src/preprocessor/lines.rs @@ -20,6 +20,8 @@ use crate::errors::{Kind as ErrorKind, Result}; use memchr::memchr_iter; use tremor_pipeline::{ConfigImpl, ConfigMap}; +use abi_stable::std_types::RSome; + const DEFAULT_SEPARATOR: u8 = b'\n'; const INITIAL_LINES_PER_CHUNK: usize = 64; @@ -56,7 +58,7 @@ impl Default for Lines { impl Lines { pub fn from_config(config: &ConfigMap) -> Result { - if let Some(raw_config) = config { + if let RSome(raw_config) = config { let config = Config::new(raw_config)?; let separator = { if config.separator.len() != 1 { diff --git a/src/system.rs b/src/system.rs index 6bd53cf2a3..1219304b00 100644 --- a/src/system.rs +++ b/src/system.rs @@ -106,10 +106,13 @@ impl World { /// /// # Errors /// * If the system is unavailable - pub(crate) async fn register_builtin_connector_type(&self, builder: ConnectorMod_Ref) -> Result<()> { + pub(crate) async fn register_builtin_connector_type( + &self, + builder: ConnectorMod_Ref, + ) -> Result<()> { self.system .send(manager::Msg::RegisterConnectorType { - connector_type: builder.connector_type(), + connector_type: builder.connector_type()(), builder, }) .await?; diff --git a/src/system/manager.rs b/src/system/manager.rs index bef30bbec5..f3b73b092b 100644 --- a/src/system/manager.rs +++ b/src/system/manager.rs @@ -13,7 +13,7 @@ // limitations under the License. use super::flow::{Flow, FlowId}; -use crate::connectors::{ConnectorBuilder, ConnectorType, KnownConnectors}; +use crate::connectors::{ConnectorType, KnownConnectors}; use crate::errors::{Kind as ErrorKind, Result}; use crate::system::DEFAULT_GRACEFUL_SHUTDOWN_TIMEOUT; use async_std::channel::{bounded, Sender}; @@ -23,6 +23,8 @@ use hashbrown::{hash_map::Entry, HashMap}; use tremor_common::ids::{ConnectorIdGen, OperatorIdGen}; use tremor_script::srs::DeployFlow; +use crate::pdk::connectors::ConnectorMod_Ref; + pub(crate) type Channel = Sender; /// This is control plane @@ -40,7 +42,7 @@ pub(crate) enum Msg { /// the type of connector connector_type: ConnectorType, /// the builder - builder: Box, + builder: ConnectorMod_Ref, }, GetFlows(Sender>>), GetFlow(FlowId, Sender>), @@ -87,7 +89,7 @@ impl Manager { { error!( "FIXME: error on duplicate connectors: {}", - old.connector_type() + old.connector_type()() ); } } diff --git a/tests/script.rs b/tests/script.rs index 637ea6364d..ddd012b68c 100644 --- a/tests/script.rs +++ b/tests/script.rs @@ -23,7 +23,7 @@ use tremor_script::prelude::*; use tremor_script::utils::*; use tremor_script::{AggrType, EventContext, Return, Script}; -use abi_stable::std_types::{RSome, RVec}; +use abi_stable::{rvec, std_types::RSome}; macro_rules! test_cases { ($($file:ident),* ,) => { @@ -57,7 +57,7 @@ macro_rules! test_cases { for (id, mut json) in in_json.into_iter().enumerate() { let uri = EventOriginUri{ host: "test".into(), - path: RVec::from(vec!["snot".into()]), + path: rvec!["snot".into()], port: RSome(23), scheme: "snot".into(), }; diff --git a/tremor-cli/Cargo.toml b/tremor-cli/Cargo.toml index 625b36fb68..aac66f7b70 100644 --- a/tremor-cli/Cargo.toml +++ b/tremor-cli/Cargo.toml @@ -20,6 +20,8 @@ matches = "0.1" pretty_assertions = "1.0.0" [dependencies] +# plugin system +abi_stable = { version = "0.10", default_features = false, features = ["rust_latest_stable"] } anyhow = "1" async-std = { version = "1.10", features = ["unstable"] } clap = { version = "3", features = ["color", "derive"] } diff --git a/tremor-cli/src/test/unit.rs b/tremor-cli/src/test/unit.rs index ca1dd5be93..0f6cc1c594 100644 --- a/tremor-cli/src/test/unit.rs +++ b/tremor-cli/src/test/unit.rs @@ -31,6 +31,8 @@ use tremor_script::interpreter::{AggrType, Env, ExecOpts, LocalStack}; use tremor_script::prelude::*; use tremor_script::Value; +use abi_stable::std_types::RVec; + use super::TestConfig; const EXEC_OPTS: ExecOpts = ExecOpts { result_needed: true, @@ -153,7 +155,7 @@ fn eval_suite_tests( let mut info = hh.to_string(); let success = if let Some(success) = value.as_bool() { success - } else if let Some([expected, got]) = value.as_array().map(Vec::as_slice) { + } else if let Some([expected, got]) = value.as_array().map(RVec::as_slice) { info.push_str(&format!("{} != {}", expected, got)); false } else { @@ -179,7 +181,7 @@ fn eval_suite_tests( tremor_script::Script::highlight_script_with_range_indent( " ", script, extent, &mut hh, )?; - if let Some([expected, got]) = value.as_array().map(Vec::as_slice) { + if let Some([expected, got]) = value.as_array().map(RVec::as_slice) { println!(" | {} != {}", expected, got); } hh.finalize()?; diff --git a/tremor-common/Cargo.toml b/tremor-common/Cargo.toml index d6f44ac6f4..67c57eb312 100644 --- a/tremor-common/Cargo.toml +++ b/tremor-common/Cargo.toml @@ -9,7 +9,7 @@ readme = "README.md" version = "0.11.4" [dependencies] -abi_stable = { version = "0.10.3", default_features = false, features = ["rust_latest_stable"] } +abi_stable = { version = "0.10", default_features = false, features = ["rust_latest_stable"] } async-std = "1" rand = {version = "0.8", features = ["small_rng"]} beef = { version = "0.5", features = ["impl_serde"] } diff --git a/tremor-pipeline/Cargo.toml b/tremor-pipeline/Cargo.toml index 7e1bf64765..5da0a59ca8 100644 --- a/tremor-pipeline/Cargo.toml +++ b/tremor-pipeline/Cargo.toml @@ -7,9 +7,7 @@ name = "tremor-pipeline" version = "0.11.4" [dependencies] -# FIXME: update to crates.io when this is added to a new version: -# https://github.com/rodrimati1992/abi_stable_crates/pull/68 -abi_stable = { version = "0.10.3", default_features = false, features = ["rust_latest_stable"] } +abi_stable = { version = "0.10", default_features = false, features = ["rust_latest_stable"] } async-broadcast = "0.3" async-std = { version = "1.10.0", features = ["attributes"] } beef = { version = "0.5", features = ["impl_serde"] } diff --git a/tremor-pipeline/src/event.rs b/tremor-pipeline/src/event.rs index 71d963289c..e303a2009b 100644 --- a/tremor-pipeline/src/event.rs +++ b/tremor-pipeline/src/event.rs @@ -18,9 +18,24 @@ use tremor_common::time::nanotime; use tremor_script::prelude::*; use tremor_script::{literal, EventOriginUri, EventPayload, Value}; +use abi_stable::{ + std_types::{ + ROption::{self, RSome}, + RVec, + }, + StableAbi, +}; + /// A tremor event +#[repr(C)] #[derive( - Debug, Clone, PartialEq, Default, simd_json_derive::Serialize, simd_json_derive::Deserialize, + Debug, + Clone, + PartialEq, + Default, + simd_json_derive::Serialize, + simd_json_derive::Deserialize, + StableAbi, )] pub struct Event { /// The event ID @@ -30,9 +45,9 @@ pub struct Event { /// Nanoseconds at when the event was ingested pub ingest_ns: u64, /// URI to identify the origin of the event - pub origin_uri: Option, + pub origin_uri: ROption, /// The kind of the event - pub kind: Option, + pub kind: ROption, /// If this event is batched (containing multiple events itself) pub is_batch: bool, @@ -50,7 +65,7 @@ impl Event { pub fn signal_tick() -> Self { Self { ingest_ns: nanotime(), - kind: Some(SignalKind::Tick), + kind: RSome(SignalKind::Tick), ..Self::default() } } @@ -60,7 +75,7 @@ impl Event { pub fn signal_drain(uid: u64) -> Self { Self { ingest_ns: nanotime(), - kind: Some(SignalKind::Drain(uid)), + kind: RSome(SignalKind::Drain(uid)), ..Self::default() } } @@ -70,7 +85,7 @@ impl Event { pub fn signal_start(uid: u64) -> Self { Self { ingest_ns: nanotime(), - kind: Some(SignalKind::Start(uid)), + kind: RSome(SignalKind::Start(uid)), ..Self::default() } } @@ -262,7 +277,7 @@ impl Event { /// normally 1, but for batched events possibly > 1 pub fn len(&self) -> usize { if self.is_batch { - self.data.suffix().value().as_array().map_or(0, Vec::len) + self.data.suffix().value().as_array().map_or(0, RVec::len) } else { 1 } @@ -277,7 +292,7 @@ impl Event { .suffix() .value() .as_array() - .map_or(true, Vec::is_empty) + .map_or(true, RVec::is_empty) } /// Extracts the `$correlation` metadata into a `Vec` of `Option>`. diff --git a/tremor-pipeline/src/executable_graph.rs b/tremor-pipeline/src/executable_graph.rs index e56f9059bd..2e96c4219d 100644 --- a/tremor-pipeline/src/executable_graph.rs +++ b/tremor-pipeline/src/executable_graph.rs @@ -60,7 +60,7 @@ impl NodeConfig { Ok(NodeConfig { id: id.to_string(), kind: NodeKind::Operator, - config, + config: config.into(), ..NodeConfig::default() }) } diff --git a/tremor-pipeline/src/lib.rs b/tremor-pipeline/src/lib.rs index b416d55756..92d28ffc83 100644 --- a/tremor-pipeline/src/lib.rs +++ b/tremor-pipeline/src/lib.rs @@ -37,16 +37,19 @@ use halfbrown::HashMap; use lazy_static::lazy_static; use op::trickle::window; use petgraph::graph::{self, NodeIndex}; -use simd_json::OwnedValue; use std::cmp::Ordering; -use std::collections::{BTreeMap, HashSet}; +use std::collections::HashSet; use std::fmt::Display; use std::iter::Iterator; use std::str::FromStr; use std::{fmt, sync::Mutex}; use tremor_script::{ast::Helper, prelude::*}; -use abi_stable::{std_types::RVec, StableAbi}; +use abi_stable::{ + rstr, + std_types::{RCow, RCowStr, RHashMap, ROption, RVec, Tuple2}, + StableAbi, +}; /// Pipeline Errors pub mod errors; @@ -56,13 +59,17 @@ mod executable_graph; /// Common metrics related code - metrics message formats etc /// Placed here because we need it here and in tremor-runtime, but also depend on tremor-value inside of it pub mod metrics; -/// Types specific to the Plugin Development Kit -pub mod pdk; #[macro_use] mod macros; pub(crate) mod op; +const COUNT: RCowStr<'static> = RCow::Borrowed(rstr!("count")); +const MEASUREMENT: RCowStr<'static> = RCow::Borrowed(rstr!("measurement")); +const TAGS: RCowStr<'static> = RCow::Borrowed(rstr!("tags")); +const FIELDS: RCowStr<'static> = RCow::Borrowed(rstr!("fields")); +const TIMESTAMP: RCowStr<'static> = RCow::Borrowed(rstr!("timestamp")); + /// Tools to turn tremor query into pipelines pub mod query; pub use crate::event::{Event, ValueIter, ValueMetaIter}; @@ -76,7 +83,7 @@ pub(crate) type ExecPortIndexMap = HashMap<(usize, Cow<'static, str>), Vec<(usize, Cow<'static, str>)>>; /// A configuration map -pub type ConfigMap = Option>; +pub type ConfigMap = ROption>; /// A lookup function to used to look up operators pub type NodeLookupFn = fn( @@ -198,25 +205,40 @@ where } /// Operator metadata -#[derive( - Clone, Debug, Default, PartialEq, simd_json_derive::Serialize, simd_json_derive::Deserialize, -)] +#[repr(C)] +#[derive(Clone, Debug, Default, PartialEq, simd_json_derive::Serialize, StableAbi)] // TODO: optimization: - use two Vecs, one for operator ids, one for operator metadata (Values) // - make it possible to trace operators with and without metadata // - insert with bisect (numbers of operators tracked will be low single digit numbers most of the time) -pub struct OpMeta(BTreeMap, OwnedValue>); +// TODO: restore BTreeMap? This was switched to RHashMap for the PDK +pub struct OpMeta(RHashMap, Value<'static>>); +// TODO: avoid this custom implementation? +impl<'input> simd_json_derive::Deserialize<'input> for OpMeta { + #[inline] + fn from_tape(tape: &mut simd_json_derive::Tape<'input>) -> simd_json::Result { + let x: RHashMap, Value<'input>> = + simd_json_derive::Deserialize::from_tape(tape)?; + let x: RHashMap, Value<'static>> = x + .into_iter() + .map(|Tuple2(k, v)| (k, v.into_static())) + .collect(); + Ok(Self(x)) + } +} + +#[allow(warnings)] impl OpMeta { /// inserts a value - pub fn insert(&mut self, key: u64, value: V) -> Option + pub fn insert(&mut self, key: u64, value: V) -> Option> where - OwnedValue: From, + Value<'static>: From, { - self.0.insert(PrimStr(key), OwnedValue::from(value)) + self.0.insert(PrimStr(key), Value::from(value)).into() } /// reads a value - pub fn get(&mut self, key: u64) -> Option<&OwnedValue> { - self.0.get(&PrimStr(key)) + pub fn get(&mut self, key: u64) -> Option<&Value<'static>> { + self.0.get(&PrimStr(key)).into() } /// checks existance of a key #[must_use] @@ -226,7 +248,7 @@ impl OpMeta { /// Merges two op meta maps, overwriting values with `other` on duplicates pub fn merge(&mut self, mut other: Self) { - self.0.append(&mut other.0); + self.0.extend(&mut other.0.into_iter()); } } @@ -915,6 +937,36 @@ fn operator(uid: u64, node: &NodeConfig) -> Result> factory(node)?.from_node(uid, node) } +/// Takes a name, tags and creates a influx codec compatible Value +#[must_use] +pub fn influx_value( + metric_name: Cow<'static, str>, + tags: HashMap, Value<'static>>, + count: u64, + timestamp: u64, +) -> Value<'static> { + // TODO: avoid duplication once tremor_pdk is done + pub fn conv_cow(cow: beef::Cow) -> RCowStr { + let cow: std::borrow::Cow = cow.into(); + cow.into() + } + + let metric_name = conv_cow(metric_name); + let tags = tags + .into_iter() + .map(|(k, v)| (conv_cow(k), v)) + .collect::>(); + + literal!({ + MEASUREMENT: metric_name, + TAGS: tags, + FIELDS: { + COUNT: count + }, + TIMESTAMP: timestamp + }) +} + #[derive(Debug, Default)] struct Connection { from: Cow<'static, str>, diff --git a/tremor-pipeline/src/metrics.rs b/tremor-pipeline/src/metrics.rs index 88f33a5693..4c831e4fa6 100644 --- a/tremor-pipeline/src/metrics.rs +++ b/tremor-pipeline/src/metrics.rs @@ -16,11 +16,13 @@ use beef::Cow; use halfbrown::HashMap; use tremor_value::{literal, Value}; -const COUNT: Cow<'static, str> = Cow::const_str("count"); -const MEASUREMENT: Cow<'static, str> = Cow::const_str("measurement"); -const TAGS: Cow<'static, str> = Cow::const_str("tags"); -const FIELDS: Cow<'static, str> = Cow::const_str("fields"); -const TIMESTAMP: Cow<'static, str> = Cow::const_str("timestamp"); +use abi_stable::{rstr, std_types::RCowStr}; + +const COUNT: RCowStr<'static> = RCowStr::Borrowed(rstr!("count")); +const MEASUREMENT: RCowStr<'static> = RCowStr::Borrowed(rstr!("measurement")); +const TAGS: RCowStr<'static> = RCowStr::Borrowed(rstr!("tags")); +const FIELDS: RCowStr<'static> = RCowStr::Borrowed(rstr!("fields")); +const TIMESTAMP: RCowStr<'static> = RCowStr::Borrowed(rstr!("timestamp")); /// Generate an influx-compatible metrics value based on a count #[must_use] diff --git a/tremor-pipeline/src/op/debug/history.rs b/tremor-pipeline/src/op/debug/history.rs index e47d4b745c..88d502a487 100644 --- a/tremor-pipeline/src/op/debug/history.rs +++ b/tremor-pipeline/src/op/debug/history.rs @@ -16,6 +16,8 @@ use crate::op::prelude::*; use crate::ConfigImpl; use tremor_script::prelude::*; +use abi_stable::std_types::ROption::RSome; + #[derive(Debug, Clone, Deserialize)] #[serde(deny_unknown_fields)] pub struct Config { @@ -28,7 +30,7 @@ pub struct Config { impl ConfigImpl for Config {} op!(EventHistoryFactory(_uid, node) { -if let Some(map) = &node.config { +if let RSome(map) = &node.config { let config: Config = Config::new(map)?; Ok(Box::new(History { config, diff --git a/tremor-pipeline/src/op/generic/batch.rs b/tremor-pipeline/src/op/generic/batch.rs index ae82454add..3beea9a235 100644 --- a/tremor-pipeline/src/op/generic/batch.rs +++ b/tremor-pipeline/src/op/generic/batch.rs @@ -16,6 +16,8 @@ use crate::{op::prelude::*, EventId, EventIdGenerator}; use std::mem::swap; use tremor_script::prelude::*; +use abi_stable::std_types::ROption::RSome; + #[derive(Debug, Clone, Deserialize, Serialize)] #[serde(deny_unknown_fields)] pub struct Config { @@ -49,7 +51,7 @@ pub fn empty() -> EventPayload { } op!(BatchFactory(uid, node) { -if let Some(map) = &node.config { +if let RSome(map) = &node.config { let config: Config = Config::new(map)?; let max_delay_ns = config.timeout; let mut idgen = EventIdGenerator::new(uid); diff --git a/tremor-pipeline/src/op/qos/backpressure.rs b/tremor-pipeline/src/op/qos/backpressure.rs index 598db6f1a1..beb10554c2 100644 --- a/tremor-pipeline/src/op/qos/backpressure.rs +++ b/tremor-pipeline/src/op/qos/backpressure.rs @@ -30,6 +30,8 @@ use crate::op::prelude::*; use beef::Cow; use tremor_script::prelude::*; +use abi_stable::std_types::ROption::RSome; + const OVERFLOW: Cow<'static, str> = Cow::const_str("overflow"); #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)] @@ -116,7 +118,7 @@ pub fn next_backoff(steps: &[u64], current: u64) -> u64 { } op!(BackpressureFactory(_uid, node) { - if let Some(map) = &node.config { + if let RSome(map) = &node.config { let config: Config = Config::new(map)?; Ok(Box::new(Backpressure::from(config))) } else { diff --git a/tremor-pipeline/src/op/qos/percentile.rs b/tremor-pipeline/src/op/qos/percentile.rs index 0d7528954e..c2ce1c406f 100644 --- a/tremor-pipeline/src/op/qos/percentile.rs +++ b/tremor-pipeline/src/op/qos/percentile.rs @@ -30,6 +30,8 @@ use crate::op::prelude::*; use beef::Cow; use tremor_script::prelude::*; +use abi_stable::std_types::ROption::RSome; + const OVERFLOW: Cow<'static, str> = Cow::const_str("overflow"); #[derive(Debug, Clone, Deserialize)] @@ -74,7 +76,7 @@ fn d_step_down() -> f64 { } op!(PercentileFactory(_uid, node) { - if let Some(map) = &node.config { + if let RSome(map) = &node.config { let config: Config = Config::new(map)?; Ok(Box::new(Percentile::from(config))) } else { diff --git a/tremor-pipeline/src/op/qos/rr.rs b/tremor-pipeline/src/op/qos/rr.rs index 15528645d4..7e295ce403 100644 --- a/tremor-pipeline/src/op/qos/rr.rs +++ b/tremor-pipeline/src/op/qos/rr.rs @@ -29,6 +29,8 @@ use crate::op::prelude::*; use beef::Cow; use tremor_script::prelude::*; +use abi_stable::std_types::ROption::{RNone, RSome}; + #[derive(Debug, Clone, Deserialize)] #[serde(deny_unknown_fields)] pub struct Config { @@ -76,7 +78,7 @@ fn d_outputs() -> Vec { } op!(RoundRobinFactory(_uid, node) { -if let Some(map) = &node.config { +if let RSome(map) = &node.config { let config: Config = Config::new(map)?; if config.outputs.is_empty() { error!("No outputs supplied for round robin operators"); @@ -130,7 +132,7 @@ impl Operator for RoundRobin { ) -> Result { if self.first && self.outputs.iter().any(|o| o.open) { let mut e = Event::cb_restore(signal.ingest_ns); - e.origin_uri = None; + e.origin_uri = RNone; self.first = false; Ok(EventAndInsights { @@ -155,7 +157,7 @@ impl Operator for RoundRobin { if let Some(o) = insight .op_meta .get(uid) - .and_then(OwnedValue::as_usize) + .and_then(Value::as_usize) .and_then(|id| outputs.get_mut(id)) { if insight.cb == CbAction::Close { diff --git a/tremor-pipeline/src/op/qos/wal.rs b/tremor-pipeline/src/op/qos/wal.rs index 855e97efd1..f06a06e758 100644 --- a/tremor-pipeline/src/op/qos/wal.rs +++ b/tremor-pipeline/src/op/qos/wal.rs @@ -182,7 +182,7 @@ pub struct Wal { } op!(WalFactory(_uid, node) { - let map = node.config.as_ref().ok_or_else(|| ErrorKind::MissingOpConfig(node.id.clone()))?; + let map = Result::from(node.config.as_ref().ok_or_else(|| ErrorKind::MissingOpConfig(node.id.clone()).into()))?; let config: Config = Config::new(map)?; if config.max_elements.or(config.max_bytes).is_none() { @@ -400,12 +400,12 @@ impl Operator for Wal { let insights = if self.full && !now_full { warn!("WAL not full any more. {} elements.", self.cnt); let mut e = Event::cb_restore(signal.ingest_ns); - e.origin_uri = self.origin_uri.clone(); + e.origin_uri = self.origin_uri.clone().into(); vec![e] } else if !self.full && now_full { warn!("WAL full. {} elements.", self.cnt); let mut e = Event::cb_trigger(signal.ingest_ns); - e.origin_uri = self.origin_uri.clone(); + e.origin_uri = self.origin_uri.clone().into(); vec![e] } else { vec![] diff --git a/tremor-pipeline/src/op/trickle/operator.rs b/tremor-pipeline/src/op/trickle/operator.rs index 7cdd079d83..e4ecf52eac 100644 --- a/tremor-pipeline/src/op/trickle/operator.rs +++ b/tremor-pipeline/src/op/trickle/operator.rs @@ -19,6 +19,12 @@ use tremor_script::{ prelude::*, srs, }; + +use abi_stable::std_types::{ + RHashMap, + ROption::{RNone, RSome}, +}; + #[derive(Debug)] pub(crate) struct TrickleOperator { pub op: Box, @@ -31,12 +37,12 @@ fn mk_node_config(id: String, op_type: String, config: Value) -> NodeConfig { op_type, config: if config .as_object() - .map(HashMap::is_empty) + .map(RHashMap::is_empty) .unwrap_or_default() { - None + RNone } else { - Some(config.into_static()) + RSome(config.into_static()) }, ..NodeConfig::default() } diff --git a/tremor-pipeline/src/op/trickle/script.rs b/tremor-pipeline/src/op/trickle/script.rs index a03b1f225c..50ea7f17b9 100644 --- a/tremor-pipeline/src/op/trickle/script.rs +++ b/tremor-pipeline/src/op/trickle/script.rs @@ -60,7 +60,7 @@ impl Operator for Script { state: &mut Value<'static>, mut event: Event, ) -> Result { - let context = EventContext::new(event.ingest_ns, event.origin_uri.as_ref()); + let context = EventContext::new(event.ingest_ns, event.origin_uri.as_ref().into()); let port = event.data.apply_decl(&self.script, |data, decl| { let (unwind_event, event_meta) = data.parts_mut(); diff --git a/tremor-pipeline/src/op/trickle/select.rs b/tremor-pipeline/src/op/trickle/select.rs index 34b77c575f..cbfe596500 100644 --- a/tremor-pipeline/src/op/trickle/select.rs +++ b/tremor-pipeline/src/op/trickle/select.rs @@ -38,6 +38,8 @@ use tremor_script::{ Value, }; +use abi_stable::std_types::ROption::RSome; + #[derive(Debug)] pub struct Select { pub id: String, @@ -136,7 +138,7 @@ pub(crate) fn execute_select_and_having( Event { id: ctx.event_id.clone(), ingest_ns: ctx.ingest_ns, - origin_uri: ctx.origin_uri.clone(), + origin_uri: ctx.origin_uri.clone().into(), // TODO: this will ignore op_metas from all other events this one is based upon and might break operators requiring this op_meta: ctx.op_meta.clone(), is_batch: false, @@ -213,6 +215,8 @@ impl Operator for Select { transactional, .. } = event; + // FIXME: avoid this? + let origin_uri = &Option::from(origin_uri.clone()); let mut ctx = EventContext::new(ingest_ns, origin_uri.as_ref()); ctx.cardinality = groups.len(); @@ -353,7 +357,7 @@ impl Operator for Select { // if it isn't a tick or we do not have any windows, or have no // recorded groups, we can just return - if signal.kind != Some(SignalKind::Tick) || windows.is_empty() || groups.is_empty() { + if signal.kind != RSome(SignalKind::Tick) || windows.is_empty() || groups.is_empty() { return Ok(EventAndInsights::default()); } diff --git a/tremor-pipeline/src/op/trickle/simple_select.rs b/tremor-pipeline/src/op/trickle/simple_select.rs index e41b1ac760..3c8bbba715 100644 --- a/tremor-pipeline/src/op/trickle/simple_select.rs +++ b/tremor-pipeline/src/op/trickle/simple_select.rs @@ -75,7 +75,7 @@ impl Operator for SimpleSelect { // We can't have locals in the where and having clause let local_stack = LocalStack::with_size(0); - let ctx = EventContext::new(event.ingest_ns, event.origin_uri.as_ref()); + let ctx = EventContext::new(event.ingest_ns, event.origin_uri.as_ref().into()); // // Before any select processing, we filter by where clause diff --git a/tremor-pipeline/src/pdk.rs b/tremor-pipeline/src/pdk.rs deleted file mode 100644 index 58f2cf1f7d..0000000000 --- a/tremor-pipeline/src/pdk.rs +++ /dev/null @@ -1,127 +0,0 @@ -//! Similarly to [`PdkValue`], the types defined in this module are only meant -//! to be used temporarily for the plugin interface. They can be converted to -//! their original types for full functionality, and back to the PDK version in -//! order to pass them to the runtime. -//! -//! [`PdkValue`]: [`tremor_value::pdk::PdkValue`] - -use crate::{CbAction, Event, EventId, EventOriginUri, OpMeta, PrimStr, SignalKind}; - -use tremor_script::pdk::PdkEventPayload; -use tremor_value::{pdk::PdkValue, Value}; - -use abi_stable::{ - std_types::{RHashMap, ROption, Tuple2}, - StableAbi, -}; - -/// Temporary type to represent [`OpMeta`] in the PDK interface. Refer to -/// the [`crate::pdk`] top-level documentation for more information. -/// -/// [`OpMeta`]: [`crate::OpMeta`] -#[repr(C)] -#[derive(Debug, Clone, StableAbi)] -// FIXME: this used to be a binary tree map, not a hash map. Not sure if that -// was because of performance or anything similar, but `abi_stable` only has -// hash maps so it's left that way for now. -pub struct PdkOpMeta(RHashMap, PdkValue<'static>>); - -/// Easily converting the original type to the PDK one to pass it through the -/// FFI boundary. -impl From for PdkOpMeta { - fn from(original: OpMeta) -> Self { - PdkOpMeta( - original - .0 - .into_iter() - .map(|(k, v)| { - let v: Value = v.into(); - let v: PdkValue = v.into(); - (k, v) - }) - .collect(), - ) - } -} - -/// Easily converting the PDK type to the original one to access its full -/// functionality. -impl From for OpMeta { - fn from(original: PdkOpMeta) -> Self { - OpMeta( - original - .0 - .into_iter() - .map(|Tuple2(k, v)| { - let v: Value = v.into(); - let v: simd_json::OwnedValue = v.into(); - (k, v) - }) - .collect(), - ) - } -} - -/// Temporary type to represent [`Event`] in the PDK interface. Refer to -/// the [`crate::pdk`] top-level documentation for more information. -/// -/// [`Event`]: [`crate::Event`] -#[repr(C)] -#[derive(Debug, Clone, StableAbi)] -pub struct PdkEvent { - /// The event ID - pub id: EventId, - /// The event Data - pub data: PdkEventPayload, - /// Nanoseconds at when the event was ingested - pub ingest_ns: u64, - /// URI to identify the origin of the event - pub origin_uri: ROption, - /// The kind of the event - pub kind: ROption, - /// If this event is batched (containing multiple events itself) - pub is_batch: bool, - - /// Circuit breaker action - pub cb: CbAction, - /// Metadata for operators - pub op_meta: PdkOpMeta, - /// this needs transactional data - pub transactional: bool, -} - -/// Easily converting the original type to the PDK one to pass it through the -/// FFI boundary. -impl From for PdkEvent { - fn from(original: Event) -> Self { - PdkEvent { - id: original.id, - data: original.data.into(), - ingest_ns: original.ingest_ns, - origin_uri: original.origin_uri.map(Into::into).into(), - kind: original.kind.into(), - is_batch: original.is_batch, - cb: original.cb, - op_meta: original.op_meta.into(), - transactional: original.transactional, - } - } -} - -/// Easily converting the PDK type to the original one to access its full -/// functionality. -impl From for Event { - fn from(original: PdkEvent) -> Self { - Event { - id: original.id.into(), - data: original.data.into(), - ingest_ns: original.ingest_ns, - origin_uri: original.origin_uri.into(), - kind: original.kind.into(), - is_batch: original.is_batch, - cb: original.cb, - op_meta: original.op_meta.into(), - transactional: original.transactional, - } - } -} diff --git a/tremor-script/Cargo.toml b/tremor-script/Cargo.toml index e98aae58e0..ed620e6fa5 100644 --- a/tremor-script/Cargo.toml +++ b/tremor-script/Cargo.toml @@ -21,7 +21,7 @@ crate-type = ["staticlib", "cdylib", "rlib"] name = "tremor_script" [dependencies] -abi_stable = { version = "0.10.3", default_features = false, features = ["rust_latest_stable"] } +abi_stable = { version = "0.10", default_features = false, features = ["rust_latest_stable"] } atty = "0.2" base64 = "0.13" beef = { version = "0.5", features = ["impl_serde"] } diff --git a/tremor-script/src/ast/query.rs b/tremor-script/src/ast/query.rs index 53a9a31267..125de43f5a 100644 --- a/tremor-script/src/ast/query.rs +++ b/tremor-script/src/ast/query.rs @@ -34,6 +34,8 @@ use crate::{impl_expr_mid, impl_fqn}; use raw::WindowDefnRaw; use simd_json::{Builder, Mutable}; +use tremor_value::value::from::cow_beef_to_sabi; + /// A Tremor query #[derive(Clone, Debug, PartialEq, Serialize)] pub struct Query<'script> { @@ -457,7 +459,10 @@ impl<'script> CreationalWith<'script> { pub fn render(&self, meta: &NodeMetas) -> Result> { let mut res = Value::object(); for (k, v) in self.with.0.iter() { - res.insert(k.id.clone(), v.clone().try_into_lit(meta)?.clone())?; + res.insert( + cow_beef_to_sabi(k.id.clone()), + v.clone().try_into_lit(meta)?.clone(), + )?; } Ok(res) } @@ -614,7 +619,7 @@ impl<'script> DefinitioalArgs<'script> { for (k, v) in self.args.0.iter() { // FIXME: hygenic error res.insert( - k.id.clone(), + cow_beef_to_sabi(k.id.clone()), v.clone() .ok_or_else(|| Error::from(format!("missing key: {}", k)))? .try_into_lit(meta)? diff --git a/tremor-script/src/ast/to_static.rs b/tremor-script/src/ast/to_static.rs index 2809d3da7b..dd821c590b 100644 --- a/tremor-script/src/ast/to_static.rs +++ b/tremor-script/src/ast/to_static.rs @@ -28,6 +28,8 @@ use crate::CustomFn; use beef::Cow; use tremor_value::Value; +use abi_stable::std_types::RBox; + impl<'script> ImutExpr<'script> { pub(crate) fn into_static(self) -> ImutExpr<'static> { match self { @@ -177,7 +179,7 @@ impl<'script> Record<'script> { let Record { mid, fields, base } = self; let v: Value<'static> = Value::from(base).into_static(); let base = if let Value::Object(v) = v { - *v + RBox::into_inner(v) } else { // ALLOW: we know this isn't reachable as we create v above unreachable!() diff --git a/tremor-script/src/ast/visitors/impls/const_folder.rs b/tremor-script/src/ast/visitors/impls/const_folder.rs index 2370b0a09d..744e076bec 100644 --- a/tremor-script/src/ast/visitors/impls/const_folder.rs +++ b/tremor-script/src/ast/visitors/impls/const_folder.rs @@ -27,6 +27,8 @@ use simd_json::prelude::*; use simd_json_derive::Serialize; use tremor_value::KnownKey; +use tremor_value::value::from::{cow_beef_to_sabi, cow_sabi_to_beef}; + /// Walks a AST and performs constant folding on arguments pub struct ConstFolder<'run, 'script> where @@ -353,7 +355,7 @@ where StrLitElement::Expr(e) if e.is_lit() => { let value = e.try_into_lit(self.meta)?; match value { - Value::String(s) => *string = StrLitElement::Lit(s), + Value::String(s) => *string = StrLitElement::Lit(cow_sabi_to_beef(s)), // TODO: The float scenario is different in erlang and rust // We knowingly excluded float correctness in string interpolation // as we don't want to over engineer and write own format functions. @@ -408,7 +410,7 @@ where Field { name, value, .. } if name.as_str().is_some() && value.is_lit() => { let k = name.into_str().ok_or("unreachable error str and not str")?; let v = value.try_into_lit(self.meta)?; - record.base.insert(k, v); + record.base.insert(cow_beef_to_sabi(k), v); } other => record.fields.push(other), } diff --git a/tremor-script/src/interpreter.rs b/tremor-script/src/interpreter.rs index b2ef50794f..efe66e7236 100644 --- a/tremor-script/src/interpreter.rs +++ b/tremor-script/src/interpreter.rs @@ -58,6 +58,9 @@ use std::{ iter::Iterator, }; +use abi_stable::std_types::{ROption::RSome, Tuple2}; +use tremor_value::value::from::cow_beef_to_sabi; + /// constant `true` value pub const TRUE: Value<'static> = Value::Static(StaticNode::Bool(true)); /// constant `false` value @@ -210,7 +213,7 @@ pub(crate) fn val_eq<'event>(lhs: &Value<'event>, rhs: &Value<'event>) -> bool { (Object(l), Object(r)) => { if l.len() == r.len() { l.iter() - .all(|(k, lv)| r.get(k).map(|rv| val_eq(lv, rv)) == Some(true)) + .all(|Tuple2(k, lv)| r.get(k).map(|rv| val_eq(lv, rv)) == Some(true)) } else { false } @@ -726,7 +729,7 @@ where Inner: BaseExpr, { if let (Some(rep), Some(map)) = (replacement.as_object(), value.as_object_mut()) { - for (k, v) in rep { + for Tuple2(k, v) in rep { if let Some(k) = map.get_mut(k) { stry!(merge_values(outer, inner, k, v)); } else { @@ -890,6 +893,7 @@ fn patch_value<'run, 'event>( .ok_or_else(|| err_need_obj(patch_expr, &expr.target, t, env.meta))?; match const_op { Insert { cow, ident, value } => { + let cow = cow_beef_to_sabi(cow); if obj.contains_key(&cow) { let key = cow.to_string(); return error_patch_key_exists(patch_expr, ident, key, env.meta); @@ -897,6 +901,7 @@ fn patch_value<'run, 'event>( obj.insert(cow, value); } Update { cow, ident, value } => { + let cow = cow_beef_to_sabi(cow); if obj.contains_key(&cow) { obj.insert(cow, value); } else { @@ -905,12 +910,16 @@ fn patch_value<'run, 'event>( } } Upsert { cow, value } => { + let cow = cow_beef_to_sabi(cow); obj.insert(cow, value); } Erase { cow } => { + let cow = cow_beef_to_sabi(cow); obj.remove(&cow); } Copy { from, to } => { + let to = cow_beef_to_sabi(to); + let from = cow_beef_to_sabi(from); if obj.contains_key(&to) { return error_patch_key_exists(patch_expr, expr, to.to_string(), env.meta); } @@ -920,33 +929,39 @@ fn patch_value<'run, 'event>( } } Move { from, to } => { + let to = cow_beef_to_sabi(to); + let from = cow_beef_to_sabi(from); if obj.contains_key(&to) { return error_patch_key_exists(patch_expr, expr, to.to_string(), env.meta); } - if let Some(old) = obj.remove(&from) { + if let RSome(old) = obj.remove(&from) { obj.insert(to, old); } } - Merge { cow, ident, mvalue } => match obj.get_mut(&cow) { - Some(value @ Value::Object(_)) => { - stry!(merge_values(patch_expr, expr, value, &mvalue)); - } - Some(other) => { - let key = cow.to_string(); - return error_patch_merge_type_conflict( - patch_expr, ident, key, other, env.meta, - ); - } - None => { - let mut new_value = Value::object(); - stry!(merge_values(patch_expr, expr, &mut new_value, &mvalue)); - obj.insert(cow, new_value); + Merge { cow, ident, mvalue } => { + let cow = cow_beef_to_sabi(cow); + match obj.get_mut(&cow) { + Some(value @ Value::Object(_)) => { + stry!(merge_values(patch_expr, expr, value, &mvalue)); + } + Some(other) => { + let key = cow.to_string(); + return error_patch_merge_type_conflict( + patch_expr, ident, key, other, env.meta, + ); + } + None => { + let mut new_value = Value::object(); + stry!(merge_values(patch_expr, expr, &mut new_value, &mvalue)); + obj.insert(cow, new_value); + } } - }, + } MergeRecord { mvalue } => { stry!(merge_values(patch_expr, expr, target, &mvalue)); } Default { cow, expr, .. } => { + let cow = cow_beef_to_sabi(cow); if !obj.contains_key(&cow) { let default_value = stry!(expr.run(opts, env, event, state, meta, local)); obj.insert(cow, default_value.into_owned()); @@ -969,7 +984,7 @@ fn apply_default<'event>( target: &mut as ValueAccess>::Object, dflt: & as ValueAccess>::Object, ) { - for (k, v) in dflt { + for Tuple2(k, v) in dflt { if !target.contains_key(k) { target.insert(k.clone(), v.clone()); } else if let Some((target, dflt)) = target diff --git a/tremor-script/src/interpreter/expr.rs b/tremor-script/src/interpreter/expr.rs index ccd5baa334..170e910c34 100644 --- a/tremor-script/src/interpreter/expr.rs +++ b/tremor-script/src/interpreter/expr.rs @@ -36,6 +36,9 @@ use std::{ iter, }; +use abi_stable::std_types::Tuple2; +use tremor_value::value::from::cow_beef_to_sabi; + #[derive(Debug)] /// Continuation context to control program flow pub enum Cont<'run, 'event> @@ -93,7 +96,7 @@ impl<'script> Expr<'script> { state: &'run mut Value<'static>, meta: &'run mut Value<'event>, local: &'run mut LocalStack<'event>, - expr: &'run Match>, + expr: &'run Match<'event, Expr<'event>>, ) -> Result> { // use super::DUMMY_PATH as D; let target = stry!(expr.target.run(opts, env, event, state, meta, local)); @@ -228,10 +231,18 @@ impl<'script> Expr<'script> { state: &'run mut Value<'static>, meta: &'run mut Value<'event>, local: &'run mut LocalStack<'event>, - expr: &'run Comprehension<'event, Expr>, + expr: &'run Comprehension<'event, Expr<'event>>, ) -> Result> { type Bi<'v, 'r> = (usize, Box, Value<'v>)> + 'r>); - fn kv<'k, K>((k, v): (K, Value)) -> (Value<'k>, Value) + // Converting from abi_stable to std + fn tuple<'k, K>(Tuple2(k, v): Tuple2>) -> (K, Value<'k>) + where + K: 'k, + { + (k, v) + } + // Converting the keys + fn kv<'k, K>((k, v): (K, Value<'k>)) -> (Value<'k>, Value) where K: 'k, Value<'k>: From, @@ -251,7 +262,7 @@ impl<'script> Expr<'script> { |t| (t.len(), Box::new(t.clone().into_iter().enumerate().map(kv))), ) }, - |t| (t.len(), Box::new(t.clone().into_iter().map(kv))), + |t| (t.len(), Box::new(t.clone().into_iter().map(tuple).map(kv))), ); if opts.result_needed { @@ -374,6 +385,7 @@ impl<'script> Expr<'script> { } Segment::Element { expr, .. } => { let id = stry!(expr.eval_to_string(opts, env, event, state, meta, local)); + let id = cow_beef_to_sabi(id); // ALLOW: https://github.com/tremor-rs/tremor-runtime/issues/1033 let v: &mut Value<'event> = unsafe { mem::transmute(current) }; let map = stry!(v.as_object_mut().ok_or_else(|| err_need_obj( diff --git a/tremor-script/src/interpreter/imut_expr.rs b/tremor-script/src/interpreter/imut_expr.rs index 44a62a62cd..7c6317b245 100644 --- a/tremor-script/src/interpreter/imut_expr.rs +++ b/tremor-script/src/interpreter/imut_expr.rs @@ -37,6 +37,9 @@ use std::{ iter, mem, }; +use abi_stable::std_types::Tuple2; +use tremor_value::value::from::cow_beef_to_sabi; + fn owned_val<'val, T>(v: T) -> Cow<'val, Value<'val>> where T: 'val, @@ -202,7 +205,7 @@ impl<'script> ImutExpr<'script> { for field in &record.fields { let result = stry!(field.value.run(opts, env, event, state, meta, local)); let name = stry!(field.name.run(opts, env, event, state, meta, local)); - object.insert(name, result.into_owned()); + object.insert(cow_beef_to_sabi(name), result.into_owned()); } Ok(owned_val(object)) @@ -312,7 +315,7 @@ impl<'script> ImutExpr<'script> { |t| { ( t.len(), - Box::new(t.iter().map(|(k, v)| (k.clone().into(), v.clone()))), + Box::new(t.iter().map(|Tuple2(k, v)| (k.clone().into(), v.clone()))), ) }, ); diff --git a/tremor-script/src/lib.rs b/tremor-script/src/lib.rs index a5107d64af..deb4823424 100644 --- a/tremor-script/src/lib.rs +++ b/tremor-script/src/lib.rs @@ -50,8 +50,6 @@ pub mod lexer; pub(crate) mod parser; /// Support for module paths pub mod path; -/// Types for the Plugin Development Kit -pub mod pdk; /// Tremor Script Position pub mod pos; /// Prelude module with important exports diff --git a/tremor-script/src/pdk.rs b/tremor-script/src/pdk.rs deleted file mode 100644 index d41f993e0d..0000000000 --- a/tremor-script/src/pdk.rs +++ /dev/null @@ -1,86 +0,0 @@ -//! Similarly to [`PdkValue`], the types defined in this module are only meant -//! to be used temporarily for the plugin interface. They can be converted to -//! their original types for full functionality, and back to the PDK version in -//! order to pass them to the runtime. -//! -//! [`PdkValue`]: [`tremor_value::pdk::PdkValue`] - -use crate::{EventPayload, ValueAndMeta}; - -use std::pin::Pin; - -use abi_stable::{ - std_types::{RArc, RVec}, - StableAbi, -}; -use tremor_value::pdk::PdkValue; - -/// Temporary type to represent [`ValueAndMeta`] in the PDK interface. Refer to -/// the [`crate::pdk`] top-level documentation for more information. -/// -/// [`ValueAndMeta`]: [`crate::ValueAndMeta`] -#[repr(C)] -#[derive(Debug, Clone, StableAbi)] -pub struct PdkValueAndMeta<'event> { - v: PdkValue<'event>, - m: PdkValue<'event>, -} - -/// Easily converting the original type to the PDK one to pass it through the -/// FFI boundary. -impl<'event> From> for PdkValueAndMeta<'event> { - fn from(original: ValueAndMeta<'event>) -> Self { - PdkValueAndMeta { - v: original.v.into(), - m: original.m.into(), - } - } -} - -/// Easily converting the PDK type to the original one to access its full -/// functionality. -impl<'event> From> for ValueAndMeta<'event> { - fn from(original: PdkValueAndMeta<'event>) -> Self { - ValueAndMeta { - v: original.v.into(), - m: original.m.into(), - } - } -} - -/// Temporary type to represent [`EventPayload`] in the PDK interface. Refer to -/// the [`crate::pdk`] top-level documentation for more information. -/// -/// [`EventPayload`]: [`crate::EventPayload`] -#[repr(C)] -#[derive(Debug, Clone, StableAbi)] -pub struct PdkEventPayload { - /// The vector of raw input values - /// - // Note that there is no conversion for the original raw field because it's - // a self-referential type, and modifying its data would be unsound. - raw: RVec>>>, - data: PdkValueAndMeta<'static>, -} - -/// Easily converting the original type to the PDK one to pass it through the -/// FFI boundary. -impl From for PdkEventPayload { - fn from(original: EventPayload) -> Self { - PdkEventPayload { - raw: original.raw, - data: original.data.into(), - } - } -} - -/// Easily converting the PDK type to the original one to access its full -/// functionality. -impl From for EventPayload { - fn from(original: PdkEventPayload) -> Self { - EventPayload { - raw: original.raw, - data: original.data.into(), - } - } -} diff --git a/tremor-script/src/registry/custom_fn.rs b/tremor-script/src/registry/custom_fn.rs index 1c4dc79859..573d90eb3b 100644 --- a/tremor-script/src/registry/custom_fn.rs +++ b/tremor-script/src/registry/custom_fn.rs @@ -17,11 +17,12 @@ use crate::ast::{visitors::IsConstFn, Expr, Exprs, FnDecl, ImutExpr, ImutExprs, use crate::interpreter::{AggrType, Cont, Env, ExecOpts, LocalStack}; use crate::prelude::*; use crate::Value; +use abi_stable::{rstr, std_types::RCow}; use beef::Cow; //use std::mem; const RECUR_STR: &str = "recur"; pub(crate) const RECUR_PTR: Option<*const u8> = Some(RECUR_STR.as_ptr()); -pub(crate) const RECUR: Value<'static> = Value::String(Cow::const_str(RECUR_STR)); +pub(crate) const RECUR: Value<'static> = Value::String(RCow::Borrowed(rstr!(RECUR_STR))); pub(crate) const RECUR_REF: &Value<'static> = &RECUR; #[derive(Debug, Clone, PartialEq, Serialize)] diff --git a/tremor-script/src/srs.rs b/tremor-script/src/srs.rs index 6bbe97dc7a..eb2c591805 100644 --- a/tremor-script/src/srs.rs +++ b/tremor-script/src/srs.rs @@ -23,7 +23,9 @@ use std::{fmt::Debug, mem, pin::Pin}; use abi_stable::{ rvec, std_types::{RArc, RVec}, + StableAbi, }; +use tremor_value::value::from::cow_beef_to_sabi; ///! This file includes our self referential structs @@ -695,7 +697,7 @@ impl ScriptDecl { .script .consts .args - .try_insert(name.id.clone(), value.clone()); + .try_insert(cow_beef_to_sabi(name.id.clone()), value.clone()); } Ok(Self { raw, script }) @@ -719,7 +721,7 @@ impl ScriptDecl { .script .consts .args - .try_insert(name.id.clone(), value.clone()); + .try_insert(cow_beef_to_sabi(name.id.clone()), value.clone()); } Ok(()) @@ -810,17 +812,12 @@ impl Select { /// They **must** remain private. All interactions with them have to be guarded /// by the implementation logic to ensure they remain sane. /// -#[derive(Clone, Default)] +#[repr(C)] +#[derive(Clone, Default, StableAbi)] pub struct EventPayload { /// The vector of raw input values. - /// - /// Note that this is a self-referential struct, and thus the data it points - /// to cannot be modified. This makes it impossible to convert - /// `EventPayload` to `PdkEventPayload`. The only solution is to make `raw` - /// use types from `abi_stable` even if it's not really `StableAbi` nor - /// `repr(C)` (the `ValueAndMeta` type can't be `repr(C)` for now). - pub(crate) raw: RVec>>>, - pub(crate) data: ValueAndMeta<'static>, + raw: RVec>>>, + data: ValueAndMeta<'static>, } #[cfg(not(tarpaulin_include))] // this is a simple Debug implementation @@ -1149,12 +1146,19 @@ impl<'input> simd_json_derive::Deserialize<'input> for EventPayload { */ /// Combined struct for an event value and metadata +#[repr(C)] #[derive( - Clone, Debug, PartialEq, Serialize, simd_json_derive::Serialize, simd_json_derive::Deserialize, + Clone, + Debug, + PartialEq, + Serialize, + simd_json_derive::Serialize, + simd_json_derive::Deserialize, + StableAbi, )] pub struct ValueAndMeta<'event> { - pub(crate) v: Value<'event>, - pub(crate) m: Value<'event>, + v: Value<'event>, + m: Value<'event>, } impl<'event> ValueAndMeta<'event> { diff --git a/tremor-script/src/std_lib/binary.rs b/tremor-script/src/std_lib/binary.rs index bb0d3adab7..87f3863c30 100644 --- a/tremor-script/src/std_lib/binary.rs +++ b/tremor-script/src/std_lib/binary.rs @@ -16,6 +16,8 @@ use crate::prelude::*; use crate::registry::Registry; use crate::{tremor_const_fn, tremor_fn_}; +use abi_stable::std_types::RCow; + pub fn load(registry: &mut Registry) { registry .insert(tremor_const_fn! (binary|len(_context, _input: Bytes) { @@ -23,7 +25,7 @@ pub fn load(registry: &mut Registry) { })) .insert( tremor_const_fn! (binary|from_bytes(_context, _input: Array) { - _input.iter().map(|v| v.as_u8().ok_or_else(||to_runtime_error("array contains non bytes"))).collect::>>().map(beef::Cow::from).map(Value::Bytes) + _input.iter().map(|v| v.as_u8().ok_or_else(||to_runtime_error("array contains non bytes"))).collect::>>().map(RCow::from).map(Value::Bytes) }), ).insert( tremor_const_fn! (binary|into_bytes(_context, input) { diff --git a/tremor-script/src/std_lib/record.rs b/tremor-script/src/std_lib/record.rs index 73485b1e76..cb55b82727 100644 --- a/tremor-script/src/std_lib/record.rs +++ b/tremor-script/src/std_lib/record.rs @@ -17,6 +17,8 @@ use crate::registry::Registry; use crate::tremor_const_fn; use crate::Object; +use abi_stable::std_types::Tuple2; + pub fn load(registry: &mut Registry) { registry .insert(tremor_const_fn! (record|len(_context, _input: Object) { @@ -40,7 +42,7 @@ pub fn load(registry: &mut Registry) { .insert(tremor_const_fn! (record|to_array(_context, _input: Object) { Ok(Value::from( _input.iter() - .map(|(k, v)| Value::from(vec![Value::from(k.clone()), v.clone()])) + .map(|Tuple2(k, v)| Value::from(vec![Value::from(k.clone()), v.clone()])) .collect::>(), )) })) @@ -63,7 +65,7 @@ pub fn load(registry: &mut Registry) { Ok(Value::from(r?)) })).insert(tremor_const_fn!(record|extract(_context, _input: Object, _keys: Array) { let keys: Vec<_> = _keys.iter().filter_map(ValueAccess::as_str).collect(); - let r: Object =_input.iter().filter_map(|(k, v)| { + let r: Object =_input.iter().filter_map(|Tuple2(k, v)| { let k: &str = k; if keys.contains(&k) { Some((k.to_string().into(), v.clone())) @@ -74,9 +76,9 @@ pub fn load(registry: &mut Registry) { Ok(Value::from(r)) })) .insert(tremor_const_fn!(record|combine(_context, _left: Object, _right: Object) { - Ok(Value::from(_left.iter().chain(_right.iter()).map(|(k, v)| (k.clone(), v.clone())).collect::())) + Ok(Value::from(_left.iter().chain(_right.iter()).map(|Tuple2(k, v)| (k.clone(), v.clone())).collect::())) })).insert(tremor_const_fn!(record|rename(_context, _target: Object, _renameings: Object) { - Ok(Value::from(_target.iter().map(|(k, v)| if let Some(Value::String(k1)) = _renameings.get(k) { + Ok(Value::from(_target.iter().map(|Tuple2(k, v)| if let Some(Value::String(k1)) = _renameings.get(k) { (k1.clone(), v.clone()) } else { (k.clone(), v.clone()) diff --git a/tremor-script/src/std_lib/win.rs b/tremor-script/src/std_lib/win.rs index e208e82e34..0a8e6283cf 100644 --- a/tremor-script/src/std_lib/win.rs +++ b/tremor-script/src/std_lib/win.rs @@ -18,6 +18,8 @@ use crate::{prelude::*, tremor_fn}; use std::ops::RangeInclusive; +use abi_stable::std_types::RVec; + #[derive(Clone, Debug, Default)] struct First(Option>); impl TremorAggrFn for First { @@ -163,12 +165,12 @@ impl TremorAggrFn for CollectNested { // Ok(()) // } fn emit<'event>(&mut self) -> FResult> { - Ok(Value::Array(self.0.clone())) + Ok(Value::Array(self.0.clone().into())) } fn emit_and_init<'event>(&mut self) -> FResult> { let mut r = Vec::with_capacity(self.0.len()); std::mem::swap(&mut r, &mut self.0); - Ok(Value::from(r)) + Ok(Value::from(RVec::from(r))) } fn init(&mut self) { self.0 = Vec::with_capacity(self.0.len()); diff --git a/tremor-script/src/tilde.rs b/tremor-script/src/tilde.rs index c3b6b69a14..528bc3eb8d 100644 --- a/tremor-script/src/tilde.rs +++ b/tremor-script/src/tilde.rs @@ -23,11 +23,10 @@ // '{}' -> json|| => Ok({}) // Predicate for json||: "is valid json" // '{blarg' -> json|| => -use halfbrown::{hashmap, HashMap}; +use halfbrown::HashMap; use crate::prelude::*; use crate::{datetime, grok::Pattern as GrokPattern, EventContext, Object, Value}; -use beef::Cow; use cidr_utils::{ cidr::{IpCidr, Ipv4Cidr}, utils::IpCidrCombiner, @@ -35,7 +34,6 @@ use cidr_utils::{ use dissect::Pattern; use regex::Regex; use std::fmt; -use std::hash::BuildHasherDefault; use std::iter::{Iterator, Peekable}; use std::net::{IpAddr, Ipv4Addr}; use std::slice::Iter; @@ -680,19 +678,33 @@ impl std::ops::Deref for Cidr { } } -impl<'cidr> From - for HashMap, Value<'cidr>, BuildHasherDefault> -{ +impl<'cidr> From for tremor_value::value::Object<'cidr> { fn from(x: Cidr) -> Self { match x.0 { - IpCidr::V4(y) => hashmap!( - "prefix".into() => Value::from(y.get_prefix_as_u8_array().to_vec()), - "mask".into() => Value::from(y.get_mask_as_u8_array().to_vec()), - ), - IpCidr::V6(y) => hashmap!( - "prefix".into() => Value::from(y.get_prefix_as_u16_array().to_vec()), - "mask".into() => Value::from(y.get_mask_as_u16_array().to_vec()), - ), + IpCidr::V4(y) => { + let mut h = Object::with_capacity(2); + h.insert( + "prefix".into(), + Value::from(y.get_prefix_as_u8_array().to_vec()), + ); + h.insert( + "mask".into(), + Value::from(y.get_mask_as_u8_array().to_vec()), + ); + h + } + IpCidr::V6(y) => { + let mut h = Object::with_capacity(2); + h.insert( + "prefix".into(), + Value::from(y.get_prefix_as_u16_array().to_vec()), + ); + h.insert( + "mask".into(), + Value::from(y.get_mask_as_u16_array().to_vec()), + ); + h + } } } } diff --git a/tremor-script/src/utils.rs b/tremor-script/src/utils.rs index 19553199c9..db040d6d34 100644 --- a/tremor-script/src/utils.rs +++ b/tremor-script/src/utils.rs @@ -17,6 +17,8 @@ use crate::prelude::*; use crate::Value; use std::{io::prelude::*, path::Path}; +use abi_stable::std_types::Tuple2; + /// Fetches a hostname with `tremor-host.local` being the default #[must_use] pub fn hostname() -> String { @@ -61,8 +63,10 @@ fn sorted_serialize_<'v, W: Write>(j: &Value<'v>, w: &mut W) -> Result<()> { write!(w, "]")?; } Value::Object(o) => { - let mut v: Vec<(String, Value<'v>)> = - o.iter().map(|(k, v)| (k.to_string(), v.clone())).collect(); + let mut v: Vec<(String, Value<'v>)> = o + .iter() + .map(|Tuple2(k, v)| (k.to_string(), v.clone())) + .collect(); v.sort_by_key(|(k, _)| k.to_string()); let mut iter = v.into_iter(); diff --git a/tremor-value/Cargo.toml b/tremor-value/Cargo.toml index f285700e0a..204618672a 100644 --- a/tremor-value/Cargo.toml +++ b/tremor-value/Cargo.toml @@ -12,7 +12,7 @@ version = "0.3.2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -abi_stable = { version = "0.10.3", default_features = false, features = ["rust_latest_stable"] } +abi_stable = { version = "0.10", default_features = false, features = ["rust_latest_stable"] } base64 = "0.13" beef = "0.5" halfbrown = { version = "0.1", features = ["fxhash"] } diff --git a/tremor-value/src/known_key.rs b/tremor-value/src/known_key.rs index 874a1b18a8..00c14f0e44 100644 --- a/tremor-value/src/known_key.rs +++ b/tremor-value/src/known_key.rs @@ -13,18 +13,19 @@ // limitations under the License. use crate::Value; -use beef::Cow; -use halfbrown::RawEntryMut; use std::fmt; -use std::hash::{BuildHasher, Hash, Hasher}; use value_trait::{Mutable, Value as ValueTrait, ValueAccess, ValueType}; +use crate::value::from::cow_beef_to_sabi; +use abi_stable::std_types::{RCowStr, RHashMap}; + /// Well known key that can be looked up in a `Value` faster. /// It achives this by memorizing the hash. #[derive(Debug, Clone, PartialEq)] pub struct KnownKey<'key> { - key: Cow<'key, str>, - hash: u64, + key: RCowStr<'key>, + // FIXME: temporarily removed to enable PDK support + // hash: u64, } /// Error for known keys @@ -44,21 +45,30 @@ impl fmt::Display for Error { } impl std::error::Error for Error {} -impl<'key, S> From for KnownKey<'key> -where - Cow<'key, str>: From, -{ - fn from(key: S) -> Self { - let key = Cow::from(key); - let hash_builder = halfbrown::DefaultHashBuilder::default(); - let mut hasher = hash_builder.build_hasher(); - key.hash(&mut hasher); +impl<'key> From> for KnownKey<'key> { + fn from(key: RCowStr<'key>) -> Self { + // FIXME: temporarily removed to enable PDK support + // let hash_builder = halfbrown::DefaultHashBuilder::default(); + // let mut hasher = hash_builder.build_hasher(); + // key.hash(&mut hasher); Self { - hash: hasher.finish(), + // hash: hasher.finish(), key, } } } +impl<'key> From> for KnownKey<'key> { + fn from(key: beef::Cow<'key, str>) -> Self { + // FIXME: temporarily removed to enable PDK support + // let hash_builder = halfbrown::DefaultHashBuilder::default(); + // let mut hasher = hash_builder.build_hasher(); + // key.hash(&mut hasher); + Self { + // hash: hasher.finish(), + key: cow_beef_to_sabi(key), + } + } +} impl<'key> KnownKey<'key> { /// The known key @@ -82,16 +92,13 @@ impl<'key> KnownKey<'key> { /// ``` #[inline] #[must_use] - pub fn lookup<'target, 'value>( - &self, - target: &'target Value<'value>, - ) -> Option<&'target Value<'value>> + pub fn lookup<'target>(&self, target: &'target Value<'key>) -> Option<&'target Value<'key>> where - 'value: 'target, + 'key: 'target, { target.as_object().and_then(|m| self.map_lookup(m)) } - /// Looks up this key in a `HashMap<, Value<'value>>` the inner representation of an object `Value`, returns None if the + /// Looks up this key in a `HashMap<, Value<'key>>` the inner representation of an object `Value`, returns None if the /// key wasn't present. /// /// ```rust @@ -108,16 +115,18 @@ impl<'key> KnownKey<'key> { #[inline] #[must_use] - pub fn map_lookup<'target, 'value>( + pub fn map_lookup<'target>( &self, - map: &'target halfbrown::HashMap, Value<'value>>, - ) -> Option<&'target Value<'value>> + map: &'target RHashMap, Value<'key>>, + ) -> Option<&'target Value<'key>> where - 'value: 'target, + 'key: 'target, { - map.raw_entry() - .from_key_hashed_nocheck(self.hash, self.key()) - .map(|kv| kv.1) + // FIXME: temporarily removed to enable PDK support + // map.raw_entry() + // .from_key_hashed_nocheck(self.hash, self.key()) + // .map(|kv| kv.1) + map.get(self.key()) } /// Looks up this key in a `Value`, returns None if the @@ -140,18 +149,17 @@ impl<'key> KnownKey<'key> { /// assert_eq!(object["answer"], 42); /// ``` #[inline] - pub fn lookup_mut<'target, 'value>( + pub fn lookup_mut<'target>( &self, - target: &'target mut Value<'value>, - ) -> Option<&'target mut Value<'value>> + target: &'target mut Value<'key>, + ) -> Option<&'target mut Value<'key>> where - 'key: 'value, - 'value: 'target, + 'key: 'target, { target.as_object_mut().and_then(|m| self.map_lookup_mut(m)) } - /// Looks up this key in a `HashMap, Value<'value>>`, the inner representation of an object value. + /// Looks up this key in a `HashMap, Value<'key>>`, the inner representation of an object value. /// returns None if the key wasn't present. /// /// ```rust @@ -173,21 +181,22 @@ impl<'key> KnownKey<'key> { /// /// ``` #[inline] - pub fn map_lookup_mut<'target, 'value>( + pub fn map_lookup_mut<'target>( &self, - map: &'target mut halfbrown::HashMap, Value<'value>>, - ) -> Option<&'target mut Value<'value>> + map: &'target mut RHashMap, Value<'key>>, + ) -> Option<&'target mut Value<'key>> where - 'key: 'value, - 'value: 'target, + 'key: 'target, { - match map - .raw_entry_mut() - .from_key_hashed_nocheck(self.hash, &self.key) - { - RawEntryMut::Occupied(e) => Some(e.into_mut()), - RawEntryMut::Vacant(_e) => None, - } + // FIXME: temporarily removed to enable PDK support + // match map + // .raw_entry_mut() + // .from_key_hashed_nocheck(self.hash, &self.key) + // { + // RawEntryMut::Occupied(e) => Some(e.into_mut()), + // RawEntryMut::Vacant(_e) => None, + // } + map.get_mut(self.key()) } /// Looks up this key in a `Value`, inserts `with` when the key @@ -222,15 +231,14 @@ impl<'key> KnownKey<'key> { /// assert_eq!(object["also the answer"], 42); /// ``` #[inline] - pub fn lookup_or_insert_mut<'target, 'value, F>( + pub fn lookup_or_insert_mut<'target, F>( &self, - target: &'target mut Value<'value>, + target: &'target mut Value<'key>, with: F, - ) -> Result<&'target mut Value<'value>, Error> + ) -> Result<&'target mut Value<'key>, Error> where - 'key: 'value, - 'value: 'target, - F: FnOnce() -> Value<'value>, + 'key: 'target, + F: FnOnce() -> Value<'key>, { // we make use of internals here, but this is the fastest way, only requiring one match match target { @@ -239,7 +247,7 @@ impl<'key> KnownKey<'key> { } } - /// Looks up this key in a `HashMap, Value<'value>>`, the inner representation of an object `Value`. + /// Looks up this key in a `HashMap, Value<'key>>`, the inner representation of an object `Value`. /// Inserts `with` when the key when wasn't present. /// /// ```rust @@ -270,21 +278,31 @@ impl<'key> KnownKey<'key> { /// assert_eq!(object["also the answer"], 42); /// ``` #[inline] - pub fn map_lookup_or_insert_mut<'target, 'value, F>( + pub fn map_lookup_or_insert_mut<'target, F>( &self, - map: &'target mut halfbrown::HashMap, Value<'value>>, + map: &'target mut RHashMap, Value<'key>>, with: F, - ) -> &'target mut Value<'value> + ) -> &'target mut Value<'key> where - 'key: 'value, - 'value: 'target, - F: FnOnce() -> Value<'value>, + 'key: 'target, + F: FnOnce() -> Value<'key>, { - let key: &str = &self.key; - map.raw_entry_mut() - .from_key_hashed_nocheck(self.hash, key) - .or_insert_with(|| (self.key.clone(), with())) - .1 + // FIXME: temporarily removed to enable PDK support + // let key: &str = &self.key; + // map.raw_entry_mut() + // .from_key_hashed_nocheck(self.hash, key) + // .or_insert_with(|| (self.key.clone(), with())) + // .1 + // + // match map.get_mut(self.key()) { + // Some(v) => v, + // None => { + // let mut v = with(); + // map.insert(self.key, v); + // &mut v + // } + // } + map.entry(self.key.clone()).or_insert_with(with) } /// Inserts a value key into `Value`, returns None if the @@ -314,14 +332,13 @@ impl<'key> KnownKey<'key> { /// assert_eq!(object["also the answer"], 42); /// ``` #[inline] - pub fn insert<'target, 'value>( + pub fn insert<'target>( &self, - target: &'target mut Value<'value>, - value: Value<'value>, - ) -> Result>, Error> + target: &'target mut Value<'key>, + value: Value<'key>, + ) -> Result>, Error> where - 'key: 'value, - 'value: 'target, + 'key: 'target, { target .as_object_mut() @@ -358,25 +375,26 @@ impl<'key> KnownKey<'key> { /// assert_eq!(object["also the answer"], 42); /// ``` #[inline] - pub fn map_insert<'target, 'value>( + pub fn map_insert<'target>( &self, - map: &'target mut halfbrown::HashMap, Value<'value>>, - value: Value<'value>, - ) -> Option> + map: &'target mut RHashMap, Value<'key>>, + value: Value<'key>, + ) -> Option> where - 'key: 'value, - 'value: 'target, + 'key: 'target, { - match map - .raw_entry_mut() - .from_key_hashed_nocheck(self.hash, self.key()) - { - RawEntryMut::Occupied(mut e) => Some(e.insert(value)), - RawEntryMut::Vacant(e) => { - e.insert_hashed_nocheck(self.hash, self.key.clone(), value); - None - } - } + // FIXME: temporarily removed to enable PDK support + // match map + // .raw_entry_mut() + // .from_key_hashed_nocheck(self.hash, self.key()) + // { + // RawEntryMut::Occupied(mut e) => Some(e.insert(value)), + // RawEntryMut::Vacant(e) => { + // e.insert_hashed_nocheck(self.hash, self.key.clone(), value); + // None + // } + // } + map.insert(self.key.clone(), value).into() } } @@ -384,10 +402,10 @@ impl<'script> KnownKey<'script> { /// turns the key into one with static lifetime #[must_use] pub fn into_static(self) -> KnownKey<'static> { - let KnownKey { key, hash } = self; + let KnownKey { key, /*, hash*/ } = self; KnownKey { - key: Cow::owned(key.to_string()), - hash, + key: RCowStr::Owned(key.to_string().into()), + // hash, } } } @@ -396,15 +414,16 @@ impl<'script> KnownKey<'script> { mod tests { #![allow(clippy::unnecessary_operation, clippy::non_ascii_literal)] use super::*; - use beef::Cow; use value_trait::Builder; + use abi_stable::std_types::RCowStr; + #[test] fn known_key() { let mut v = Value::object(); v.try_insert("key", 1); - let key1 = KnownKey::from(Cow::from("key")); - let key2 = KnownKey::from(Cow::from("cake")); + let key1 = KnownKey::from(RCowStr::from("key")); + let key2 = KnownKey::from(RCowStr::from("cake")); assert!(key1.lookup(&Value::null()).is_none()); assert!(key2.lookup(&Value::null()).is_none()); @@ -418,8 +437,8 @@ mod tests { fn known_key_insert() { let mut v = Value::object(); v.try_insert("key", 1); - let key1 = KnownKey::from(Cow::from("key")); - let key2 = KnownKey::from(Cow::from("cake")); + let key1 = KnownKey::from(RCowStr::from("key")); + let key2 = KnownKey::from(RCowStr::from("cake")); let mut v1 = Value::null(); assert!(key1.insert(&mut v1, 2.into()).is_err()); @@ -434,8 +453,8 @@ mod tests { fn lookup_or_insert_mut() { let mut v = Value::object(); v.try_insert("key", 1); - let key1 = KnownKey::from(Cow::from("key")); - let key2 = KnownKey::from(Cow::from("cake")); + let key1 = KnownKey::from(RCowStr::from("key")); + let key2 = KnownKey::from(RCowStr::from("cake")); let mut v1 = Value::null(); assert!(key1.lookup_or_insert_mut(&mut v1, || 2.into()).is_err()); @@ -454,8 +473,8 @@ mod tests { fn known_key_map() { let mut v = Value::object_with_capacity(128); v.try_insert("key", 1); - let key1 = KnownKey::from(Cow::from("key")); - let key2 = KnownKey::from(Cow::from("cake")); + let key1 = KnownKey::from(RCowStr::from("key")); + let key2 = KnownKey::from(RCowStr::from("cake")); assert!(key1.lookup(&Value::null()).is_none()); assert!(key2.lookup(&Value::null()).is_none()); @@ -467,8 +486,8 @@ mod tests { fn known_key_insert_map() { let mut v = Value::object_with_capacity(128); v.try_insert("key", 1); - let key1 = KnownKey::from(Cow::from("key")); - let key2 = KnownKey::from(Cow::from("cake")); + let key1 = KnownKey::from(RCowStr::from("key")); + let key2 = KnownKey::from(RCowStr::from("cake")); let mut v1 = Value::null(); diff --git a/tremor-value/src/lib.rs b/tremor-value/src/lib.rs index 3847bf85d6..ae51723b99 100644 --- a/tremor-value/src/lib.rs +++ b/tremor-value/src/lib.rs @@ -34,8 +34,6 @@ extern crate serde as serde_ext; mod error; mod known_key; mod macros; -/// For the compatibility layer with the Plugin Development Kit -pub mod pdk; /// Prelude module pub mod prelude; mod serde; @@ -52,6 +50,8 @@ use simd_json::Node; use simd_json_derive::{Deserialize, Serialize, Tape}; use value_trait::Writable; +use abi_stable::std_types::RVec; + impl<'value> Serialize for Value<'value> { fn json_write(&self, writer: &mut W) -> std::io::Result<()> where @@ -80,7 +80,7 @@ impl<'input, 'tape> ValueDeser<'input, 'tape> { // Rust doesn't optimize the normal loop away here // so we write our own avoiding the length // checks during push - let mut res = Vec::with_capacity(len); + let mut res = RVec::with_capacity(len); unsafe { res.set_len(len); for i in 0..len { @@ -101,8 +101,10 @@ impl<'input, 'tape> ValueDeser<'input, 'tape> { for _ in 0..len { // ALLOW: we know the values will be OK if let Node::String(key) = self.0.next().unwrap() { - // ALLOW: we know it will parse correctly - res.insert_nocheck(key.into(), self.parse().unwrap()); + res.insert(key.into(), self.parse().unwrap()); + // FIXME: restore optimization + // // ALLOW: we know it will parse correctly + // res.insert_nocheck(key.into(), self.parse().unwrap()); } else { // ALLOW: We check against this in tape unreachable!(); diff --git a/tremor-value/src/macros.rs b/tremor-value/src/macros.rs index 771f72223b..b7c31d6bf6 100644 --- a/tremor-value/src/macros.rs +++ b/tremor-value/src/macros.rs @@ -21,7 +21,7 @@ #[doc(hidden)] macro_rules! literal_internal_vec { ($($content:tt)*) => { - vec![$($content)*] + ::abi_stable::rvec![$($content)*] }; } @@ -343,6 +343,8 @@ macro_rules! literal_internal { mod tests { use crate::Value; + use abi_stable::rvec; + #[test] fn value_macro() { let v = literal!({ "snot": "badger"}); @@ -356,6 +358,6 @@ mod tests { let v: Value = literal!([1]); assert_eq!(Value::from(vec![1_u64]), v); let v: Value = literal!([]); - assert_eq!(Value::Array(vec![]), v); + assert_eq!(Value::Array(rvec![]), v); } } diff --git a/tremor-value/src/pdk.rs b/tremor-value/src/pdk.rs deleted file mode 100644 index 3c7c9ba722..0000000000 --- a/tremor-value/src/pdk.rs +++ /dev/null @@ -1,141 +0,0 @@ -//! The `Value` type is too complex to make `#[repr(C)]` from scratch. This is -//! why this module declares `PdkValue` as the FFI-safe alternative to -//! communicate with the plugins. It's a copy from the original one, but the -//! collections have been replaced with `abi_stable`'s (e.g. `Box` for `RBox`). -//! -//! `PdkValue` is only meant to be used for the PDK interface. A plugin or the -//! runtime can convert between `PdkValue` and `Value` at a relatively small -//! cost, and use its full functionality that way. -//! -//! Although this decision might sound like a considerable performance overhead, -//! it would be even worse to try to make `Value` fully `#[repr(C)]` as it is -//! right now. The collections in `abi_stable` are much more basic than what the -//! original `Value` uses, such as `beef::Cow` or `halfbrown::HashMap`. Not only -//! are these types by themselves more efficient for Tremor's use-case, but also -//! their functionality is consierably improved, making it impossible to for -//! example implement the known-key optimization for a `Value` if we were to use -//! `RHashMap`. - -use crate::Value; - -use abi_stable::{ - std_types::{RBox, RCow, RHashMap, RVec, Tuple2}, - StableAbi, -}; -use value_trait::StaticNode; - -/// Representation of a JSON object -pub type Object<'value> = RHashMap, PdkValue<'value>>; -/// Bytes -pub type Bytes<'value> = RCow<'value, [u8]>; - -// There are no direct conversions between `beef::Cow` and `RCow`, so the type -// has to be converted to std as the intermediate. These conversions are cheap -// and they shouldn't be a performance issue. -// -// FIXME: clean up after creation of `tremor-pdk`, this is repeated in other -// crates. -fn conv_str(cow: beef::Cow) -> RCow { - let cow: std::borrow::Cow = cow.into(); - cow.into() -} -fn conv_u8(cow: beef::Cow<[u8]>) -> RCow<[u8]> { - let cow: std::borrow::Cow<[u8]> = cow.into(); - cow.into() -} -fn conv_str_inv(cow: RCow) -> beef::Cow { - let cow: std::borrow::Cow = cow.into(); - cow.into() -} -fn conv_u8_inv(cow: RCow<[u8]>) -> beef::Cow<[u8]> { - let cow: std::borrow::Cow<[u8]> = cow.into(); - cow.into() -} - -/// Temporary type to represent a [`Value`] in the PDK interface. It's meant to -/// be converted to the original `Value` whenever its full functionality is -/// needed, and then back to `PdkValue` in order to pass it through the FFI -/// boundary. -/// -/// Refer to the [`crate::pdk`] top-level documentation for more information. -/// -/// [`Value`]: [`crate::Value`] -#[repr(C)] -#[derive(Debug, Clone, StableAbi)] -pub enum PdkValue<'value> { - /// Static values - Static(StaticNode), - /// string type - String(RCow<'value, str>), - /// array type - Array(RVec>), - /// object type - Object(RBox>), - /// A binary type - Bytes(Bytes<'value>), -} - -/// Easily converting the original type to the PDK one to pass it through the -/// FFI boundary. -impl<'value> From> for PdkValue<'value> { - fn from(original: Value<'value>) -> Self { - match original { - // No conversion needed; `StaticNode` implements `StableAbi` - Value::Static(s) => PdkValue::Static(s), - // This conversion is cheap - Value::String(s) => PdkValue::String(conv_str(s)), - // This unfortunately requires iterating the array - Value::Array(a) => { - let a = a.into_iter().map(Into::into).collect(); - PdkValue::Array(a) - } - // This unfortunately requires iterating the map and a new - // allocation - Value::Object(m) => { - let m = m - .into_iter() - .map(|(k, v)| (conv_str(k), v.into())) - .collect(); - PdkValue::Object(RBox::new(m)) - } - // This conversion is cheap - Value::Bytes(b) => PdkValue::Bytes(conv_u8(b)), - } - } -} - -/// Easily converting the PDK type to the original one to access its full -/// functionality. -impl<'value> From> for Value<'value> { - fn from(original: PdkValue<'value>) -> Self { - match original { - // No conversion needed; `StaticNode` implements `StableAbi` - PdkValue::Static(s) => Value::Static(s), - // This conversion is cheap - PdkValue::String(s) => Value::String(conv_str_inv(s)), - // This unfortunately requires iterating the array - PdkValue::Array(a) => { - let a = a.into_iter().map(Into::into).collect(); - Value::Array(a) - } - // This unfortunately requires iterating the map and a new - // allocation - PdkValue::Object(m) => { - // Note that `into_inner` is only necessary for `RBox`'s case, - // because `Box` has magic that makes it possible to move - // instead of borrow when dereferencing. For more information, - // look for `DerefMove`. - // TODO: call properly after merge of: - // https://github.com/rodrimati1992/abi_stable_crates/pull/74/files - let m: RHashMap<_, _> = RBox::into_inner(m); - let m = m - .into_iter() - .map(|Tuple2(k, v)| (conv_str_inv(k), v.into())) - .collect(); - Value::Object(Box::new(m)) - } - // This conversion is cheap - PdkValue::Bytes(b) => Value::Bytes(conv_u8_inv(b)), - } - } -} diff --git a/tremor-value/src/serde/value/de.rs b/tremor-value/src/serde/value/de.rs index c9c52dcfac..06c9eea06b 100644 --- a/tremor-value/src/serde/value/de.rs +++ b/tremor-value/src/serde/value/de.rs @@ -13,7 +13,6 @@ // limitations under the License. use crate::{Error, Object, Value}; -use beef::Cow; use serde::de::{EnumAccess, IntoDeserializer, VariantAccess}; use serde_ext::de::{ self, Deserialize, DeserializeSeed, Deserializer, MapAccess, SeqAccess, Visitor, @@ -22,6 +21,8 @@ use serde_ext::forward_to_deserialize_any; use simd_json::StaticNode; use std::fmt; +use abi_stable::std_types::{map::Iter, RBox, RCowStr, RVec, Tuple2}; + impl<'de> de::Deserializer<'de> for Value<'de> { type Error = Error; @@ -42,13 +43,10 @@ impl<'de> de::Deserializer<'de> for Value<'de> { #[cfg(feature = "128bit")] Self::Static(StaticNode::U128(n)) => visitor.visit_u128(n), Value::Static(StaticNode::F64(n)) => visitor.visit_f64(n), - Value::String(s) => { - if s.is_borrowed() { - visitor.visit_borrowed_str(s.unwrap_borrowed()) - } else { - visitor.visit_string(s.into_owned()) - } - } + Value::String(s) => match s { + RCowStr::Borrowed(s) => visitor.visit_borrowed_str(s.into()), + RCowStr::Owned(s) => visitor.visit_string(s.into()), + }, Value::Array(a) => visitor.visit_seq(Array(a.iter())), Value::Object(o) => visitor.visit_map(ObjectAccess { i: o.iter(), @@ -103,8 +101,8 @@ impl<'de> de::Deserializer<'de> for Value<'de> { { let (variant, value) = match self { Value::Object(value) => { - let mut iter = value.into_iter(); - let (variant, value) = match iter.next() { + let mut iter = RBox::into_inner(value).into_iter(); + let Tuple2(variant, value) = match iter.next() { Some(v) => v, None => { // FIXME: better error @@ -135,7 +133,7 @@ impl<'de> de::Deserializer<'de> for Value<'de> { } struct EnumDeserializer<'de> { - variant: Cow<'de, str>, + variant: RCowStr<'de>, value: Option>, } @@ -261,7 +259,7 @@ impl<'de, 'value> SeqAccess<'de> for Array<'value, 'de> { } struct ObjectAccess<'de, 'value: 'de> { - i: halfbrown::Iter<'de, Cow<'value, str>, Value<'value>>, + i: Iter<'de, RCowStr<'value>, Value<'value>>, v: &'de Value<'value>, } @@ -274,7 +272,7 @@ impl<'de, 'value> MapAccess<'de> for ObjectAccess<'value, 'de> { where K: DeserializeSeed<'de>, { - if let Some((k, v)) = self.i.next() { + if let Some(Tuple2(k, v)) = self.i.next() { self.v = v; seed.deserialize(Value::String(k.clone())).map(Some) } else { @@ -531,7 +529,7 @@ impl<'de> Visitor<'de> for ValueVisitor { { let size = seq.size_hint().unwrap_or_default(); - let mut v = Vec::with_capacity(size); + let mut v = RVec::with_capacity(size); while let Some(e) = seq.next_element()? { v.push(e); } diff --git a/tremor-value/src/serde/value/se.rs b/tremor-value/src/serde/value/se.rs index c16030f1ea..c7c28f3e2d 100644 --- a/tremor-value/src/serde/value/se.rs +++ b/tremor-value/src/serde/value/se.rs @@ -18,6 +18,8 @@ use serde_ext::ser::{ }; use simd_json::{stry, StaticNode}; +use abi_stable::std_types::{RVec, Tuple2}; + type Impossible = ser::Impossible; impl<'value> Serialize for Value<'value> { @@ -45,7 +47,7 @@ impl<'value> Serialize for Value<'value> { } Value::Object(m) => { let mut map = serializer.serialize_map(Some(m.len()))?; - for (k, v) in m.iter() { + for Tuple2(k, v) in m.iter() { let k: &str = k; map.serialize_entry(k, v)?; } @@ -151,7 +153,7 @@ impl serde::Serializer for Serializer { } fn serialize_bytes(self, value: &[u8]) -> Result> { - Ok(Value::Bytes(Bytes::owned(value.to_vec()))) + Ok(Value::Bytes(Bytes::Owned(RVec::from(value)))) } #[inline] @@ -216,7 +218,7 @@ impl serde::Serializer for Serializer { fn serialize_seq(self, len: Option) -> Result { Ok(SerializeVec { - vec: Vec::with_capacity(len.unwrap_or(0)), + vec: RVec::with_capacity(len.unwrap_or(0)), }) } @@ -241,7 +243,7 @@ impl serde::Serializer for Serializer { ) -> Result { Ok(SerializeTupleVariant { name: variant.to_owned(), - vec: Vec::with_capacity(len), + vec: RVec::with_capacity(len), }) } @@ -271,12 +273,12 @@ impl serde::Serializer for Serializer { } pub struct SerializeVec { - vec: Vec>, + vec: RVec>, } pub struct SerializeTupleVariant { name: String, - vec: Vec>, + vec: RVec>, } pub enum SerializeMap { diff --git a/tremor-value/src/value.rs b/tremor-value/src/value.rs index 0a1fd021a5..1e15c4df76 100644 --- a/tremor-value/src/value.rs +++ b/tremor-value/src/value.rs @@ -21,8 +21,6 @@ mod serialize; pub mod r#static; use crate::{Error, Result}; -use beef::Cow; -use halfbrown::HashMap; use simd_json::prelude::*; use simd_json::{AlignedBuf, Deserializer, Node, StaticNode}; use std::{borrow::Borrow, convert::TryInto, fmt}; @@ -35,10 +33,15 @@ use std::{ pub use crate::serde::to_value; pub use r#static::StaticValue; +use abi_stable::{ + std_types::{RBox, RCowSlice, RCowStr, RHashMap, RVec, Tuple2}, + StableAbi, +}; + /// Representation of a JSON object -pub type Object<'value> = HashMap, Value<'value>>; +pub type Object<'value> = RHashMap, Value<'value>>; /// Bytes -pub type Bytes<'value> = Cow<'value, [u8]>; +pub type Bytes<'value> = RCowSlice<'value, u8>; /// Parses a slice of bytes into a Value dom. This function will /// rewrite the slice to de-escape strings. @@ -76,16 +79,17 @@ pub fn parse_to_value_with_buffers<'value>( /// Borrowed JSON-DOM Value, consider using the `ValueTrait` /// to access its content -#[derive(Debug, Clone)] +#[repr(C)] +#[derive(Debug, Clone, StableAbi)] pub enum Value<'value> { /// Static values Static(StaticNode), /// string type - String(Cow<'value, str>), + String(RCowStr<'value>), /// array type - Array(Vec>), + Array(RVec>), /// object type - Object(Box>), + Object(RBox>), /// A binary type Bytes(Bytes<'value>), } @@ -96,7 +100,7 @@ impl<'value> Value<'value> { /// Creates an empty array value #[must_use] pub const fn array() -> Self { - Value::Array(vec![]) + Value::Array(RVec::new()) } /// Creates an empty array value @@ -279,14 +283,14 @@ impl<'value> Value<'value> { #[must_use] pub fn into_static(self) -> Value<'static> { match self { - Self::String(s) => Value::String(Cow::owned(s.to_string())), + Self::String(s) => Value::String(RCowStr::Owned(s.to_string().into())), Self::Array(arr) => arr.into_iter().map(Value::into_static).collect(), - Self::Object(obj) => obj + Self::Object(obj) => RBox::into_inner(obj) .into_iter() - .map(|(k, v)| (Cow::owned(k.to_string()), v.into_static())) + .map(|Tuple2(k, v)| Tuple2(RCowStr::Owned(k.to_string().into()), v.into_static())) .collect(), Self::Static(s) => Value::Static(s), - Self::Bytes(b) => Value::Bytes(Cow::owned(b.to_vec())), + Self::Bytes(b) => Value::Bytes(RCowSlice::Owned(RVec::from(b.borrow()))), } } @@ -296,14 +300,16 @@ impl<'value> Value<'value> { #[must_use] pub fn clone_static(&self) -> Value<'static> { match self { - Self::String(s) => Value::String(Cow::owned(s.to_string())), + Self::String(s) => Value::String(RCowStr::Owned(s.to_string().into())), Self::Array(arr) => arr.iter().map(Value::clone_static).collect(), Self::Object(obj) => obj .iter() - .map(|(k, v)| (Cow::owned(k.to_string()), v.clone_static())) + .map(|Tuple2(k, v)| Tuple2(RCowStr::Owned(k.to_string().into()), v.clone_static())) .collect(), Self::Static(s) => Value::Static(*s), - Self::Bytes(b) => Value::Bytes(Cow::owned(b.to_vec())), + // FIXME: restore the original conversion back once fixed + // Self::Bytes(b) => Value::Bytes(RCowSlice::Owned(RVec::from(b.borrow()))), + Self::Bytes(b) => Value::Bytes(RCowSlice::Owned(RVec::from(&**b))), } } @@ -323,7 +329,7 @@ impl<'value> Value<'value> { #[must_use] pub fn get_bytes(&self, k: &Q) -> Option<&[u8]> where - Cow<'value, str>: Borrow + Hash + Eq, + RCowStr<'value>: Borrow + Hash + Eq, Q: Hash + Eq + Ord, { self.get(k).and_then(Self::as_bytes) @@ -352,7 +358,7 @@ impl<'value> Value<'value> { #[must_use] pub fn get_char(&self, k: &Q) -> Option where - Cow<'value, str>: Borrow + Hash + Eq, + RCowStr<'value>: Borrow + Hash + Eq, Q: Hash + Eq + Ord, { self.get(k).and_then(Self::as_char) @@ -368,19 +374,19 @@ impl<'value> Builder<'value> for Value<'value> { #[inline] #[must_use] fn array_with_capacity(capacity: usize) -> Self { - Self::Array(Vec::with_capacity(capacity)) + Self::Array(RVec::with_capacity(capacity)) } #[inline] #[must_use] fn object_with_capacity(capacity: usize) -> Self { - Self::Object(Box::new(Object::with_capacity(capacity))) + Self::Object(RBox::new(Object::with_capacity(capacity))) } } impl<'value> Mutable for Value<'value> { #[inline] #[must_use] - fn as_array_mut(&mut self) -> Option<&mut Vec>> { + fn as_array_mut(&mut self) -> Option<&mut RVec>> { match self { Self::Array(a) => Some(a), _ => None, @@ -388,7 +394,7 @@ impl<'value> Mutable for Value<'value> { } #[inline] #[must_use] - fn as_object_mut(&mut self) -> Option<&mut HashMap<::Key, Self>> { + fn as_object_mut(&mut self) -> Option<&mut RHashMap<::Key, Self>> { match self { Self::Object(m) => Some(m), _ => None, @@ -397,9 +403,9 @@ impl<'value> Mutable for Value<'value> { } impl<'value> ValueAccess for Value<'value> { type Target = Self; - type Key = Cow<'value, str>; - type Array = Vec; - type Object = HashMap; + type Key = RCowStr<'value>; + type Array = RVec; + type Object = RHashMap; #[inline] #[must_use] @@ -478,7 +484,7 @@ impl<'value> ValueAccess for Value<'value> { #[inline] #[must_use] - fn as_array(&self) -> Option<&Vec>> { + fn as_array(&self) -> Option<&RVec>> { match self { Self::Array(a) => Some(a), _ => None, @@ -487,7 +493,7 @@ impl<'value> ValueAccess for Value<'value> { #[inline] #[must_use] - fn as_object(&self) -> Option<&HashMap> { + fn as_object(&self) -> Option<&RHashMap> { match self { Self::Object(m) => Some(m), _ => None, @@ -604,7 +610,7 @@ impl<'de> ValueDeserializer<'de> { // Rust doesn't optimize the normal loop away here // so we write our own avoiding the length // checks during push - let mut res = Vec::with_capacity(len); + let mut res = RVec::with_capacity(len); unsafe { res.set_len(len); for i in 0..len { @@ -621,7 +627,9 @@ impl<'de> ValueDeserializer<'de> { for _ in 0..len { // We know the tape is sane if let Node::String(key) = unsafe { self.0.next_() } { - res.insert_nocheck(key.into(), self.parse()); + res.insert(key.into(), self.parse()); + // FIXME: restore optimization + // res.insert_nocheck(key.into(), self.parse()); } else { // ALLOW: we guarantee this in the tape unreachable!(); diff --git a/tremor-value/src/value/cmp.rs b/tremor-value/src/value/cmp.rs index 8a3dccb425..067b882aa2 100644 --- a/tremor-value/src/value/cmp.rs +++ b/tremor-value/src/value/cmp.rs @@ -17,6 +17,8 @@ use simd_json::prelude::*; use simd_json::BorrowedValue; use simd_json::OwnedValue; +use abi_stable::std_types::{RBox, Tuple2}; + #[allow(clippy::cast_sign_loss, clippy::default_trait_access)] impl<'value> PartialEq for Value<'value> { #[inline] @@ -92,7 +94,10 @@ impl<'value> From> for OwnedValue { Value::Static(s) => OwnedValue::from(s), Value::String(s) => OwnedValue::from(s.to_string()), Value::Array(a) => a.into_iter().collect(), - Value::Object(m) => m.into_iter().collect(), + Value::Object(m) => RBox::into_inner(m) + .into_iter() + .map(|Tuple2(key, value)| (key, value)) + .collect(), Value::Bytes(b) => OwnedValue::from(base64::encode(b)), } } @@ -106,7 +111,12 @@ impl<'value> From> for BorrowedValue<'value> { Value::Static(s) => BorrowedValue::from(s), Value::String(s) => BorrowedValue::from(s.to_string()), Value::Array(a) => a.into_iter().collect(), - Value::Object(m) => m.into_iter().collect(), + // FIXME: simd_json::BorrowedValue doesn't have abi_stable support, so + // we have to convert the tuples. + Value::Object(m) => RBox::into_inner(m) + .into_iter() + .map(|Tuple2(key, value)| (key, value)) + .collect(), Value::Bytes(b) => BorrowedValue::from(base64::encode(b)), } } diff --git a/tremor-value/src/value/from.rs b/tremor-value/src/value/from.rs index 95b3801267..e88d44849c 100644 --- a/tremor-value/src/value/from.rs +++ b/tremor-value/src/value/from.rs @@ -13,10 +13,28 @@ // limitations under the License. use super::{Object, Value}; -use beef::Cow; use simd_json::{BorrowedValue, OwnedValue, StaticNode}; use std::iter::FromIterator; +use abi_stable::std_types::{RBox, RCowStr, ROption, RStr, RString, RVec, Tuple2}; + +/// FIXME: this should be taken from `tremor_pdk` in the future +/// FIXME: at some point do a search for all the occurrences of this function +/// and try to fix them properly by using `abi_stable` types from the beginning. +/// That should give a small performance & usability boost. +#[must_use] +pub fn cow_beef_to_sabi<'a>(cow: beef::Cow<'a, str>) -> RCowStr<'a> { + let cow: std::borrow::Cow = cow.into(); + cow.into() +} + +/// FIXME: this should be taken from `tremor_pdk` in the future +#[must_use] +pub fn cow_sabi_to_beef<'a>(cow: RCowStr<'a>) -> beef::Cow<'a, str> { + let cow: std::borrow::Cow = cow.into(); + cow.into() +} + impl<'value> From for Value<'value> { #[inline] #[must_use] @@ -61,12 +79,29 @@ where s.map_or(Value::Static(StaticNode::Null), Value::from) } } +impl<'value, T> From> for Value<'value> +where + Value<'value>: From, +{ + #[inline] + #[must_use] + fn from(s: ROption) -> Self { + s.map_or(Value::Static(StaticNode::Null), Value::from) + } +} /********* str_ **********/ impl<'value> From<&'value str> for Value<'value> { #[inline] #[must_use] fn from(s: &'value str) -> Self { - Self::String(Cow::from(s)) + Self::String(RCowStr::from(s)) + } +} +impl<'value> From> for Value<'value> { + #[inline] + #[must_use] + fn from(s: RStr<'value>) -> Self { + Self::String(RCowStr::Borrowed(s)) } } @@ -82,6 +117,14 @@ impl<'value> From> for Value<'value> { #[inline] #[must_use] fn from(c: beef::Cow<'value, str>) -> Self { + Self::String(cow_beef_to_sabi(c)) + } +} + +impl<'value> From> for Value<'value> { + #[inline] + #[must_use] + fn from(c: RCowStr<'value>) -> Self { Self::String(c) } } @@ -93,6 +136,13 @@ impl<'value> From for Value<'value> { Self::String(s.into()) } } +impl<'value> From for Value<'value> { + #[inline] + #[must_use] + fn from(s: RString) -> Self { + Self::String(s.into()) + } +} /********* atoms **********/ impl<'value> From for Value<'value> { @@ -230,6 +280,16 @@ where v.into_iter().collect() } } +impl<'value, S> From> for Value<'value> +where + Value<'value>: From, +{ + #[inline] + #[must_use] + fn from(v: RVec) -> Self { + v.into_iter().collect() + } +} impl<'value, V: Into>> FromIterator for Value<'value> { #[inline] @@ -239,15 +299,29 @@ impl<'value, V: Into>> FromIterator for Value<'value> { } } -impl<'value, K: Into>, V: Into>> FromIterator<(K, V)> +impl<'value, K: Into>, V: Into>> FromIterator<(K, V)> for Value<'value> { #[inline] #[must_use] fn from_iter>(iter: I) -> Self { - Value::Object(Box::new( + Value::Object(RBox::new( + iter.into_iter() + .map(|(k, v)| (cow_beef_to_sabi(Into::into(k)), Into::into(v))) + .collect(), + )) + } +} + +impl<'value, K: Into>, V: Into>> FromIterator> + for Value<'value> +{ + #[inline] + #[must_use] + fn from_iter>>(iter: I) -> Self { + Value::Object(RBox::new( iter.into_iter() - .map(|(k, v)| (Into::into(k), Into::into(v))) + .map(|Tuple2(k, v)| (Into::into(k), Into::into(v))) .collect(), )) } @@ -257,7 +331,16 @@ impl<'value> From> for Value<'value> { #[inline] #[must_use] fn from(v: Object<'value>) -> Self { - Self::Object(Box::new(v)) + Self::Object(RBox::new(v)) + } +} +impl<'value> From, Value<'value>>> for Value<'value> { + #[inline] + #[must_use] + fn from(v: halfbrown::HashMap, Value<'value>>) -> Self { + v.into_iter() + .map(|(k, v)| Tuple2(cow_beef_to_sabi(k), v)) + .collect() } } diff --git a/tremor-value/src/value/serialize.rs b/tremor-value/src/value/serialize.rs index a213bce706..827477ae46 100644 --- a/tremor-value/src/value/serialize.rs +++ b/tremor-value/src/value/serialize.rs @@ -29,6 +29,8 @@ use value_trait::generator::{ //use util::print_dec; +use abi_stable::std_types::Tuple2; + impl<'value> Writable for Value<'value> { #[inline] fn encode(&self) -> String { @@ -75,7 +77,7 @@ trait Generator: BaseGenerator { stry!(self.write(b"{")); // We know this exists since it's not empty - let (key, value) = if let Some(v) = iter.next() { + let Tuple2(key, value) = if let Some(v) = iter.next() { v } else { // ALLOW: We check against size @@ -87,7 +89,7 @@ trait Generator: BaseGenerator { stry!(self.write_min(b": ", b':')); stry!(self.write_json(value)); - for (key, value) in iter { + for Tuple2(key, value) in iter { stry!(self.write(b",")); stry!(self.new_line()); stry!(self.write_simple_string(key)); @@ -170,7 +172,7 @@ trait FastGenerator: BaseGenerator { stry!(self.write(b"{\"")); // We know this exists since it's not empty - let (key, value) = if let Some(v) = iter.next() { + let Tuple2(key, value) = if let Some(v) = iter.next() { v } else { // ALLOW: We check against size @@ -180,7 +182,7 @@ trait FastGenerator: BaseGenerator { stry!(self.write(b"\":")); stry!(self.write_json(value)); - for (key, value) in iter { + for Tuple2(key, value) in iter { stry!(self.write(b",\"")); stry!(self.write_simple_str_content(key)); stry!(self.write(b"\":"));