diff --git a/Cargo.lock b/Cargo.lock index 4b944ca7..3603a1e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -367,6 +367,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + [[package]] name = "chrono" version = "0.4.31" @@ -655,29 +661,29 @@ dependencies = [ [[package]] name = "fluvio" -version = "0.21.7" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.5#b500708703b0c8900675af56f4fa03e3ae49664c" +version = "0.22.2" +source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.8#919aa365b25a6193efb55961d5e84dc2ee804100" dependencies = [ "anyhow", "async-channel", "async-lock", "async-rwlock", "async-trait", - "base64 0.21.7", + "base64 0.22.0", "bytes", "cfg-if", "chrono", "derive_builder", "dirs", "event-listener 3.1.0", - "fluvio-compression 0.3.2 (git+https://github.com/infinyon/fluvio.git?tag=v0.11.5)", + "fluvio-compression", "fluvio-future", - "fluvio-protocol 0.10.10", + "fluvio-protocol", "fluvio-sc-schema", - "fluvio-smartmodule 0.7.3 (git+https://github.com/infinyon/fluvio.git?tag=v0.11.5)", + "fluvio-smartmodule", "fluvio-socket", - "fluvio-spu-schema 0.14.5", - "fluvio-types 0.4.5", + "fluvio-spu-schema", + "fluvio-types", "futures-util", "once_cell", "pin-project", @@ -700,7 +706,7 @@ dependencies = [ "flate2", "fluvio", "fluvio-future", - "fluvio-spu-schema 0.14.6", + "fluvio-spu-schema", "node-bindgen", "serde", "serde_json", @@ -710,7 +716,7 @@ dependencies = [ [[package]] name = "fluvio-compression" version = "0.3.2" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.5#b500708703b0c8900675af56f4fa03e3ae49664c" +source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.8#919aa365b25a6193efb55961d5e84dc2ee804100" dependencies = [ "bytes", "flate2", @@ -721,31 +727,22 @@ dependencies = [ "zstd", ] -[[package]] -name = "fluvio-compression" -version = "0.3.2" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.6#db1a58d7e468a53235c0cabb388ccfc9249c7419" -dependencies = [ - "serde", - "thiserror", -] - [[package]] name = "fluvio-controlplane-metadata" -version = "0.25.1" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.5#b500708703b0c8900675af56f4fa03e3ae49664c" +version = "0.28.1" +source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.8#919aa365b25a6193efb55961d5e84dc2ee804100" dependencies = [ "anyhow", "async-trait", - "base64 0.21.7", + "base64 0.22.0", "bytes", "bytesize", "derive_builder", "flate2", "fluvio-future", - "fluvio-protocol 0.10.10", + "fluvio-protocol", "fluvio-stream-model", - "fluvio-types 0.4.5", + "fluvio-types", "flv-util", "humantime-serde", "lenient_semver", @@ -787,17 +784,17 @@ dependencies = [ [[package]] name = "fluvio-protocol" -version = "0.10.10" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.5#b500708703b0c8900675af56f4fa03e3ae49664c" +version = "0.10.13" +source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.8#919aa365b25a6193efb55961d5e84dc2ee804100" dependencies = [ "bytes", "content_inspector", "crc32c", "eyre", - "fluvio-compression 0.3.2 (git+https://github.com/infinyon/fluvio.git?tag=v0.11.5)", + "fluvio-compression", "fluvio-future", - "fluvio-protocol-derive 0.5.4 (git+https://github.com/infinyon/fluvio.git?tag=v0.11.5)", - "fluvio-types 0.4.5", + "fluvio-protocol-derive", + "fluvio-types", "flv-util", "once_cell", "semver", @@ -806,40 +803,10 @@ dependencies = [ "tracing", ] -[[package]] -name = "fluvio-protocol" -version = "0.10.12" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.6#db1a58d7e468a53235c0cabb388ccfc9249c7419" -dependencies = [ - "bytes", - "content_inspector", - "crc32c", - "eyre", - "fluvio-compression 0.3.2 (git+https://github.com/infinyon/fluvio.git?tag=v0.11.6)", - "fluvio-protocol-derive 0.5.4 (git+https://github.com/infinyon/fluvio.git?tag=v0.11.6)", - "fluvio-types 0.4.6", - "flv-util", - "once_cell", - "semver", - "thiserror", - "tracing", -] - -[[package]] -name = "fluvio-protocol-derive" -version = "0.5.4" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.5#b500708703b0c8900675af56f4fa03e3ae49664c" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "tracing", -] - [[package]] name = "fluvio-protocol-derive" version = "0.5.4" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.6#db1a58d7e468a53235c0cabb388ccfc9249c7419" +source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.8#919aa365b25a6193efb55961d5e84dc2ee804100" dependencies = [ "proc-macro2", "quote", @@ -849,15 +816,15 @@ dependencies = [ [[package]] name = "fluvio-sc-schema" -version = "0.21.2" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.5#b500708703b0c8900675af56f4fa03e3ae49664c" +version = "0.24.0" +source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.8#919aa365b25a6193efb55961d5e84dc2ee804100" dependencies = [ "anyhow", "fluvio-controlplane-metadata", - "fluvio-protocol 0.10.10", + "fluvio-protocol", "fluvio-socket", "fluvio-stream-model", - "fluvio-types 0.4.5", + "fluvio-types", "paste", "serde", "static_assertions", @@ -868,41 +835,19 @@ dependencies = [ [[package]] name = "fluvio-smartmodule" version = "0.7.3" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.5#b500708703b0c8900675af56f4fa03e3ae49664c" +source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.8#919aa365b25a6193efb55961d5e84dc2ee804100" dependencies = [ "eyre", - "fluvio-protocol 0.10.10", - "fluvio-smartmodule-derive 0.6.2 (git+https://github.com/infinyon/fluvio.git?tag=v0.11.5)", + "fluvio-protocol", + "fluvio-smartmodule-derive", "thiserror", "tracing", ] -[[package]] -name = "fluvio-smartmodule" -version = "0.7.3" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.6#db1a58d7e468a53235c0cabb388ccfc9249c7419" -dependencies = [ - "eyre", - "fluvio-protocol 0.10.12", - "fluvio-smartmodule-derive 0.6.2 (git+https://github.com/infinyon/fluvio.git?tag=v0.11.6)", - "thiserror", - "tracing", -] - -[[package]] -name = "fluvio-smartmodule-derive" -version = "0.6.2" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.5#b500708703b0c8900675af56f4fa03e3ae49664c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.37", -] - [[package]] name = "fluvio-smartmodule-derive" -version = "0.6.2" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.6#db1a58d7e468a53235c0cabb388ccfc9249c7419" +version = "0.6.3" +source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.8#919aa365b25a6193efb55961d5e84dc2ee804100" dependencies = [ "proc-macro2", "quote", @@ -911,8 +856,8 @@ dependencies = [ [[package]] name = "fluvio-socket" -version = "0.14.7" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.5#b500708703b0c8900675af56f4fa03e3ae49664c" +version = "0.14.8" +source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.8#919aa365b25a6193efb55961d5e84dc2ee804100" dependencies = [ "async-channel", "async-lock", @@ -922,7 +867,7 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "fluvio-future", - "fluvio-protocol 0.10.10", + "fluvio-protocol", "futures-util", "nix", "once_cell", @@ -936,34 +881,17 @@ dependencies = [ [[package]] name = "fluvio-spu-schema" -version = "0.14.5" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.5#b500708703b0c8900675af56f4fa03e3ae49664c" +version = "0.14.7" +source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.8#919aa365b25a6193efb55961d5e84dc2ee804100" dependencies = [ "bytes", "derive_builder", "educe", "flate2", "fluvio-future", - "fluvio-protocol 0.10.10", - "fluvio-smartmodule 0.7.3 (git+https://github.com/infinyon/fluvio.git?tag=v0.11.5)", - "fluvio-types 0.4.5", - "serde", - "static_assertions", - "tracing", -] - -[[package]] -name = "fluvio-spu-schema" -version = "0.14.6" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.6#db1a58d7e468a53235c0cabb388ccfc9249c7419" -dependencies = [ - "bytes", - "derive_builder", - "educe", - "flate2", - "fluvio-protocol 0.10.12", - "fluvio-smartmodule 0.7.3 (git+https://github.com/infinyon/fluvio.git?tag=v0.11.6)", - "fluvio-types 0.4.6", + "fluvio-protocol", + "fluvio-smartmodule", + "fluvio-types", "serde", "static_assertions", "tracing", @@ -971,8 +899,8 @@ dependencies = [ [[package]] name = "fluvio-stream-model" -version = "0.11.1" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.5#b500708703b0c8900675af56f4fa03e3ae49664c" +version = "0.11.2" +source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.8#919aa365b25a6193efb55961d5e84dc2ee804100" dependencies = [ "async-rwlock", "event-listener 3.1.0", @@ -982,21 +910,12 @@ dependencies = [ "tracing", ] -[[package]] -name = "fluvio-types" -version = "0.4.5" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.5#b500708703b0c8900675af56f4fa03e3ae49664c" -dependencies = [ - "event-listener 3.1.0", - "thiserror", - "tracing", -] - [[package]] name = "fluvio-types" version = "0.4.6" -source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.6#db1a58d7e468a53235c0cabb388ccfc9249c7419" +source = "git+https://github.com/infinyon/fluvio.git?tag=v0.11.8#919aa365b25a6193efb55961d5e84dc2ee804100" dependencies = [ + "event-listener 3.1.0", "serde", "thiserror", "toml", @@ -1401,9 +1320,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.148" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "linux-raw-sys" @@ -1489,12 +1408,13 @@ dependencies = [ [[package]] name = "nix" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" +checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" dependencies = [ "bitflags 2.4.0", "cfg-if", + "cfg_aliases", "libc", ] diff --git a/Cargo.toml b/Cargo.toml index 76efd67e..24dc2936 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,8 +21,8 @@ serde_json = "1.0" node-bindgen = "6.0" flate2 = "1.0" fluvio-future = { version = "0.6.2", features = ["tls", "task", "io"] } -fluvio = { features = ["admin"], git = "https://github.com/infinyon/fluvio.git", tag = "v0.11.5" } -fluvio-spu-schema = { git = "https://github.com/infinyon/fluvio.git", tag = "v0.11.6" } +fluvio = { features = ["admin"], git = "https://github.com/infinyon/fluvio.git", tag = "v0.11.8" } +fluvio-spu-schema = { git = "https://github.com/infinyon/fluvio.git", tag = "v0.11.8" } [build-dependencies] node-bindgen = { version = "6.0", default-features = false, features = ["build"] } diff --git a/fixtures/server-logs-filter/.gitignore b/fixtures/server-logs-filter/.gitignore new file mode 100644 index 00000000..8999f2f0 --- /dev/null +++ b/fixtures/server-logs-filter/.gitignore @@ -0,0 +1,3 @@ +/target +/.hub +.DS_Store diff --git a/fixtures/server-logs-filter/Cargo.lock b/fixtures/server-logs-filter/Cargo.lock new file mode 100644 index 00000000..f7962e75 --- /dev/null +++ b/fixtures/server-logs-filter/Cargo.lock @@ -0,0 +1,395 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bytes" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" + +[[package]] +name = "content_inspector" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7bda66e858c683005a53a9a60c69a4aca7eeaa45d124526e389f7aec8e62f38" +dependencies = [ + "memchr", +] + +[[package]] +name = "crc32c" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89254598aa9b9fa608de44b3ae54c810f0f06d755e24c50177f1f8f31ff50ce2" +dependencies = [ + "rustc_version", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "eyre" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" +dependencies = [ + "indenter", + "once_cell", +] + +[[package]] +name = "fluvio-compression" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ce571ac15ddb28dae8e24570ad88c7c75089976f726c920ac89929ae20a7f63" +dependencies = [ + "serde", + "thiserror", +] + +[[package]] +name = "fluvio-protocol" +version = "0.10.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dafcbc8ac07d590f3991bbd46b226d2f43d49b3b00e385b5d5f8ad94ade86dbc" +dependencies = [ + "bytes", + "content_inspector", + "crc32c", + "eyre", + "fluvio-compression", + "fluvio-protocol-derive", + "fluvio-types", + "flv-util", + "once_cell", + "semver", + "thiserror", + "tracing", +] + +[[package]] +name = "fluvio-protocol-derive" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13a9820c3b6b95ee62deaa0b724f783bfb1a54f2ce00331274f1eec879f14ca0" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "tracing", +] + +[[package]] +name = "fluvio-smartmodule" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "672cb73a24db6ed149a6d0e27e5d0f19ac1e430bd3770cc83c7764029a09105e" +dependencies = [ + "eyre", + "fluvio-protocol", + "fluvio-smartmodule-derive", + "thiserror", + "tracing", +] + +[[package]] +name = "fluvio-smartmodule-derive" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c36cb221d72fb3b4bdc9b53d448859a979b5f87660d41f7155994bb2f33d0c70" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.65", +] + +[[package]] +name = "fluvio-types" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6274f015746dff62bff57ed4a7b0f175b93a6a4bc7abda7431e7d74724b59506" +dependencies = [ + "serde", + "thiserror", + "toml", + "tracing", +] + +[[package]] +name = "flv-util" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de89447c8b4aecfa4c0614d1a7be1c6ab4a0266b59bb2713fd746901f28d124e" +dependencies = [ + "log", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "memchr" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "proc-macro2" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "serde" +version = "1.0.202" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.202" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.65", +] + +[[package]] +name = "serde_json" +version = "1.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +dependencies = [ + "serde", +] + +[[package]] +name = "server-logs-filter" +version = "0.1.0" +dependencies = [ + "fluvio-smartmodule", + "once_cell", + "serde", + "serde_json", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2863d96a84c6439701d7a38f9de935ec562c8832cc55d1dde0f513b52fad106" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.65", +] + +[[package]] +name = "toml" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.65", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "winnow" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d" +dependencies = [ + "memchr", +] diff --git a/fixtures/server-logs-filter/Cargo.toml b/fixtures/server-logs-filter/Cargo.toml new file mode 100644 index 00000000..8483e73d --- /dev/null +++ b/fixtures/server-logs-filter/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "server-logs-filter" +version = "0.1.0" +authors = ["Alan Chen "] +edition = "2021" + +[lib] +crate-type = ['cdylib'] + +[dependencies] +fluvio-smartmodule = "0.7.3" +serde = { version = "1", features = ["derive"] } +serde_json = "1.0.117" +once_cell = "1.13.0" + +[profile.release-lto] +inherits = "release" +lto = true +strip = "symbols" diff --git a/fixtures/server-logs-filter/README.md b/fixtures/server-logs-filter/README.md new file mode 100644 index 00000000..9cfadb61 --- /dev/null +++ b/fixtures/server-logs-filter/README.md @@ -0,0 +1,54 @@ +# Fluvio SmartModules + +This repository is a [`cargo-generate`] template for getting started +with writing Fluvio SmartModules. To use it, run the following: + +``` +$ cargo install cargo-generate +$ cargo generate --git https://github.com/infinyon/fluvio-smartmodule-template +``` + +> **Note**: To compile a SmartModule, you will need to install the `wasm32-wasi` +> target by running `rustup target add wasm32-wasi`, or `rustup target add wasm32-unknown-unknown` if using the --nowasi flags + +## About SmartModules + +Fluvio SmartModules are custom plugins that can be used to manipulate +streaming data in a topic. SmartModules are written in Rust and compiled +to WebAssembly. To use a SmartModule, you simply provide the `.wasm` file +to the Fluvio consumer, which uploads it to the Streaming Processing Unit +(SPU) where it runs your SmartModule code on each record before sending +it to the consumer. + +Below are the various types of SmartModules and examples of how to use them. + +### Filtering + +Filters are functions that are given a reference to each record in the +stream as it is processed, and must return true or false to determine +whether the record should be kept (true) or discarded (false). + +```rust +use fluvio_smartmodule::{smartmodule, SimpleRecord}; + +#[smartmodule(filter)] +pub fn my_filter(record: &SimpleRecord) -> bool { + let value = String::from_utf8_lossy(record.value.as_ref()); + value.contains('z') +} +``` + +This filter will keep only records whose data contains the letter `z`. + +## Using SmartModules with the Fluvio CLI + +Make sure to follow the [Fluvio getting started] guide, then create a new +topic to send data to. + +[Fluvio getting started]: https://www.fluvio.io/docs/getting-started/ + +```bash +$ fluvio topic create smartmodule-test +$ cargo build --release +$ fluvio consume smartmodule-test -B --filter="target/wasm32-wasi/release-lto/server-logs-filter" +``` diff --git a/fixtures/server-logs-filter/SmartModule.toml b/fixtures/server-logs-filter/SmartModule.toml new file mode 100644 index 00000000..d5836795 --- /dev/null +++ b/fixtures/server-logs-filter/SmartModule.toml @@ -0,0 +1,10 @@ +[package] +name = "server-logs-filter" +group = "local" +version = "0.1.0" +apiVersion = "0.1.0" +description = "" +license = "Apache-2.0" +visibility = "private" + +[[params]] diff --git a/fixtures/server-logs-filter/rust-toolchain.toml b/fixtures/server-logs-filter/rust-toolchain.toml new file mode 100644 index 00000000..688bd594 --- /dev/null +++ b/fixtures/server-logs-filter/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "stable" +targets = ["wasm32-unknown-unknown", "wasm32-wasi"] diff --git a/fixtures/server-logs-filter/src/lib.rs b/fixtures/server-logs-filter/src/lib.rs new file mode 100644 index 00000000..a8350822 --- /dev/null +++ b/fixtures/server-logs-filter/src/lib.rs @@ -0,0 +1,19 @@ + +use serde::{Deserialize, Serialize}; + + +use fluvio_smartmodule::{smartmodule, Result, SmartModuleRecord}; + +#[derive(Deserialize, Serialize)] +struct LogRecord { + level: String, + message: String, +} + +#[smartmodule(filter)] +pub fn filter(record: &SmartModuleRecord) -> Result { + let strrec = std::str::from_utf8(record.value.as_ref())?; + let logrec: LogRecord = serde_json::from_str(strrec)?; + Ok(logrec.level != "debug") +} + diff --git a/fixtures/server_logs_filter.wasm b/fixtures/server_logs_filter.wasm index f69b7a52..0ea8a667 100755 Binary files a/fixtures/server_logs_filter.wasm and b/fixtures/server_logs_filter.wasm differ diff --git a/fixtures/server_logs_filter.wasm.gz b/fixtures/server_logs_filter.wasm.gz index 3ad0ddb0..2710fe27 100644 Binary files a/fixtures/server_logs_filter.wasm.gz and b/fixtures/server_logs_filter.wasm.gz differ diff --git a/package-lock.json b/package-lock.json index 212ffaed..68bed992 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@fluvio/client", - "version": "0.14.7", + "version": "0.14.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@fluvio/client", - "version": "0.14.7", + "version": "0.14.8", "hasInstallScript": true, "license": "Apache-2.0", "devDependencies": { @@ -3992,9 +3992,9 @@ } }, "node_modules/typescript": { - "version": "5.4.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz", - "integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "dev": true, "bin": { "tsc": "bin/tsc", diff --git a/package.json b/package.json index b792503b..91ad55a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fluvio/client", - "version": "0.14.7", + "version": "0.14.8", "description": "Node.js binding for Fluvio distributed stream", "keywords": [ "fluvio", diff --git a/src/admin.rs b/src/admin.rs index 2e15faf4..11654150 100644 --- a/src/admin.rs +++ b/src/admin.rs @@ -229,16 +229,15 @@ impl TryIntoJs for ReplicaStatusWrapper { pub struct PartitionResolutionWrapper(PartitionResolution); -impl ToString for PartitionResolutionWrapper { - fn to_string(&self) -> String { +impl std::fmt::Display for PartitionResolutionWrapper { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let status = match self.0 { PartitionResolution::Offline => "Offline", PartitionResolution::Online => "Online", PartitionResolution::LeaderOffline => "LeaderOffline", PartitionResolution::ElectionLeaderFound => "ElectionLeaderFound", }; - - status.to_string() + f.write_str(status) } } @@ -370,7 +369,11 @@ impl JSValue<'_> for PartitionWrap { let id = must_property!("id", u32, js_obj); let replicas = must_property!("replicas", Vec, js_obj); - Ok(Self(PartitionMap { id, replicas })) + Ok(Self(PartitionMap { + id, + replicas, + ..Default::default() + })) } else { Err(NjError::Other("partition map must be json".to_owned())) } diff --git a/src/consumer/mod.rs b/src/consumer/mod.rs index 8bf9b277..0b5d0e58 100644 --- a/src/consumer/mod.rs +++ b/src/consumer/mod.rs @@ -109,6 +109,7 @@ impl PartitionConsumerJS { offset: OffsetWrapper, cb: F, ) -> Result<()> { + #[allow(deprecated)] let mut stream = client.stream(offset.0).await?; debug!("Waiting for stream"); @@ -133,6 +134,7 @@ impl PartitionConsumerJS { .as_ref() .ok_or_else(|| FluvioErrorJS::new(CLIENT_NOT_FOUND_ERROR_MSG.to_string()))?; + #[allow(deprecated)] let stream = client .stream(offset.0) .await @@ -153,6 +155,7 @@ impl PartitionConsumerJS { .inner .as_ref() .ok_or_else(|| FluvioErrorJS::new(CLIENT_NOT_FOUND_ERROR_MSG.to_string()))?; + #[allow(deprecated)] let stream = client .stream_with_config(offset.0, config) .await diff --git a/src/fluvio.rs b/src/fluvio.rs index 41e59a3b..36e059f7 100644 --- a/src/fluvio.rs +++ b/src/fluvio.rs @@ -6,7 +6,7 @@ use crate::error::FluvioErrorJS; use tracing::debug; -use fluvio::{Fluvio}; +use fluvio::Fluvio; use node_bindgen::derive::node_bindgen; use node_bindgen::core::TryIntoJs; @@ -65,6 +65,7 @@ impl FluvioJS { partition: u32, ) -> Result { if let Some(client) = &mut self.inner { + #[allow(deprecated)] Ok(PartitionConsumerJS::from( client.partition_consumer(topic, partition).await?, ))