From 1eb5a00fd68e069ba018156dfab60c2760b782f6 Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Wed, 25 Feb 2026 22:02:37 +0300 Subject: [PATCH 01/30] Promote versions, promote editions --- bxes/src/rust/Cargo.lock | 660 +++++++++++------- bxes/src/rust/bxes/Cargo.toml | 12 +- bxes/src/rust/bxes/src/writer/writer_utils.rs | 2 +- .../rust/bxes/tests/test_core/random_log.rs | 85 +-- bxes/src/rust/bxes_kafka/Cargo.toml | 4 +- 5 files changed, 463 insertions(+), 300 deletions(-) diff --git a/bxes/src/rust/Cargo.lock b/bxes/src/rust/Cargo.lock index c2bd922a..5a930483 100644 --- a/bxes/src/rust/Cargo.lock +++ b/bxes/src/rust/Cargo.lock @@ -2,21 +2,6 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "addr2line" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "adler2" version = "2.0.1" @@ -31,7 +16,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", "cipher", - "cpufeatures", + "cpufeatures 0.2.17", ] [[package]] @@ -94,31 +79,16 @@ dependencies = [ ] [[package]] -name = "autocfg" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" - -[[package]] -name = "backtrace" -version = "0.3.73" +name = "anyhow" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide 0.7.4", - "object", - "rustc-demangle", -] +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" [[package]] -name = "base64ct" -version = "1.8.1" +name = "autocfg" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e050f626429857a27ddccb31e0aca21356bfa709c04041aefddac081a8f068a" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "bitflags" @@ -149,7 +119,7 @@ dependencies = [ "num", "num-derive", "num-traits", - "rand 0.8.5", + "rand 0.10.0", "tempfile", "thiserror", "uuid", @@ -168,38 +138,22 @@ dependencies = [ "uuid", ] -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - [[package]] name = "bzip2" -version = "0.4.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c" dependencies = [ - "bzip2-sys", - "libc", -] - -[[package]] -name = "bzip2-sys" -version = "0.1.13+1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225bff33b2141874fe80d71e07d6eec4f85c5c216453dd96388240f96e1acc14" -dependencies = [ - "cc", - "pkg-config", + "libbz2-rs-sys", ] [[package]] name = "cc" -version = "1.1.15" +version = "1.2.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6" +checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" dependencies = [ + "find-msvc-tools", "jobserver", "libc", "shlex", @@ -211,6 +165,17 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +[[package]] +name = "chacha20" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "rand_core 0.10.0", +] + [[package]] name = "cipher" version = "0.4.4" @@ -223,9 +188,9 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.51" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb1e43aa7fd152b1f968787f7dbcdeb306d1867ff373c69955211876c053f91a" +checksum = "75443c44cd6b379beb8c5b45d85d0773baf31cce901fe7bb252f4eff3008ef7d" dependencies = [ "cc", ] @@ -258,9 +223,9 @@ dependencies = [ [[package]] name = "constant_time_eq" -version = "0.1.5" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" [[package]] name = "cpufeatures" @@ -271,6 +236,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.5.0" @@ -280,12 +254,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - [[package]] name = "crypto-common" version = "0.1.7" @@ -296,6 +264,12 @@ dependencies = [ "typenum", ] +[[package]] +name = "deflate64" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26bf8fc351c5ed29b5c2f0cbbac1b209b74f60ecd62e675a998df72c49af5204" + [[package]] name = "deranged" version = "0.5.5" @@ -361,6 +335,12 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + [[package]] name = "flate2" version = "1.1.5" @@ -368,40 +348,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" dependencies = [ "crc32fast", - "miniz_oxide 0.8.9", + "libz-rs-sys", + "miniz_oxide", ] +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" dependencies = [ "futures-core", "futures-task", "pin-project-lite", - "pin-utils", ] [[package]] @@ -416,38 +402,52 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.15" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "libc", - "wasi", + "r-efi", + "wasip2", ] [[package]] name = "getrandom" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi", + "rand_core 0.10.0", "wasip2", + "wasip3", + "wasm-bindgen", ] [[package]] -name = "gimli" -version = "0.29.0" +name = "hashbrown" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] [[package]] name = "hashbrown" -version = "0.14.5" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hmac" @@ -458,14 +458,22 @@ dependencies = [ "digest", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "indexmap" -version = "2.4.0" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.16.1", + "serde", + "serde_core", ] [[package]] @@ -510,7 +518,7 @@ checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn", ] [[package]] @@ -539,17 +547,38 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libbz2-rs-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4a545a15244c7d945065b5d392b2d2d7f21526fba56ce51467b06ed445e8f7" + [[package]] name = "libc" version = "0.2.179" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5a2d376baa530d1238d133232d15e239abad80d05838b4b59354e5268af431f" +[[package]] +name = "libz-rs-sys" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c10501e7805cee23da17c7790e59df2870c0d4043ec6d03f67d31e2b53e77415" +dependencies = [ + "zlib-rs", +] + [[package]] name = "libz-sys" -version = "1.1.20" +version = "1.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" +checksum = "4735e9cbde5aac84a5ce588f6b23a90b9b0b528f6c5a8db8a4aff300463a0839" dependencies = [ "cc", "libc", @@ -570,19 +599,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] -name = "memchr" -version = "2.7.6" +name = "lzma-rust2" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +checksum = "47bb1e988e6fb779cf720ad431242d3f03167c1b3f2b1aae7f1a94b2495b36ae" +dependencies = [ + "sha2", +] [[package]] -name = "miniz_oxide" -version = "0.7.4" +name = "memchr" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" -dependencies = [ - "adler", -] +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "miniz_oxide" @@ -629,9 +658,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" [[package]] name = "num-derive" @@ -641,7 +670,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn", ] [[package]] @@ -686,32 +715,24 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.5.11" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +checksum = "b1207a7e20ad57b847bbddc6776b968420d38292bbfe2089accff5e19e82454c" dependencies = [ "num_enum_derive", + "rustversion", ] [[package]] name = "num_enum_derive" -version = "0.5.11" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +checksum = "ff32365de1b6743cb203b710788263c44a03de03802daf96092f2da4fe6ba4d7" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", -] - -[[package]] -name = "object" -version = "0.36.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" -dependencies = [ - "memchr", + "syn", ] [[package]] @@ -726,27 +747,14 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" -[[package]] -name = "password-hash" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" -dependencies = [ - "base64ct", - "rand_core 0.6.4", - "subtle", -] - [[package]] name = "pbkdf2" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ "digest", "hmac", - "password-hash", - "sha2", ] [[package]] @@ -755,17 +763,11 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "portable-atomic" @@ -788,6 +790,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" +[[package]] +name = "ppmd-rust" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efca4c95a19a79d1c98f791f10aebd5c1363b473244630bb7dbde1dc98455a24" + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -797,6 +805,16 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn", +] + [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -831,35 +849,25 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - [[package]] name = "rand" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_chacha 0.9.0", + "rand_chacha", "rand_core 0.9.3", ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "rand" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "bc266eb313df6c5c09c1c7b1fbe2510961e5bcd3add930c1e31f7ed9da0feff8" dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", + "chacha20", + "getrandom 0.4.1", + "rand_core 0.10.0", ] [[package]] @@ -874,27 +882,24 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.4" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ - "getrandom 0.2.15", + "getrandom 0.3.4", ] [[package]] name = "rand_core" -version = "0.9.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" -dependencies = [ - "getrandom 0.3.4", -] +checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba" [[package]] name = "rdkafka" -version = "0.36.2" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1beea247b9a7600a81d4cc33f659ce1a77e1988323d7d2809c7ed1c21f4c316d" +checksum = "d7956f9ac12b5712e50372d9749a3102f4810a8d42481c5eae3748d36d585bcf" dependencies = [ "futures-channel", "futures-util", @@ -910,9 +915,9 @@ dependencies = [ [[package]] name = "rdkafka-sys" -version = "4.7.0+2.3.0" +version = "4.10.0+2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e0d2f9ba6253f6ec72385e453294f8618e9e15c2c6aba2a5c01ccf9622d615" +checksum = "e234cf318915c1059d4921ef7f75616b5219b10b46e9f3a511a15eb4b56a3f77" dependencies = [ "cmake", "libc", @@ -950,12 +955,6 @@ version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - [[package]] name = "rustix" version = "1.1.3" @@ -976,41 +975,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] -name = "ryu" -version = "1.0.18" +name = "semver" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" [[package]] name = "serde" -version = "1.0.209" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn", ] [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" dependencies = [ "itoa", "memchr", - "ryu", "serde", + "serde_core", + "zmij", ] [[package]] @@ -1020,7 +1030,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest", ] @@ -1031,7 +1041,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest", ] @@ -1062,17 +1072,6 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" -[[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.111" @@ -1099,50 +1098,50 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn", ] [[package]] name = "time" -version = "0.3.44" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" dependencies = [ "deranged", + "js-sys", "num-conv", "powerfmt", - "serde", + "serde_core", "time-core", ] [[package]] name = "time-core" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "tokio" -version = "1.40.0" +version = "1.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" dependencies = [ - "backtrace", "pin-project-lite", ] @@ -1163,6 +1162,12 @@ dependencies = [ "winnow", ] +[[package]] +name = "typed-path" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e28f89b80c87b8fb0cf04ab448d5dd0dd0ade2f8891bae878de66a75a28600e" + [[package]] name = "typenum" version = "1.19.0" @@ -1175,6 +1180,12 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "utf8parse" version = "0.2.2" @@ -1202,7 +1213,7 @@ checksum = "39d11901c36b3650df7acb0f9ebe624f35b5ac4e1922ecd3c57f444648429594" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn", ] [[package]] @@ -1213,7 +1224,7 @@ checksum = "a1935e10c6f04d22688d07c0790f2fc0e1b1c5c2c55bc0cc87ed67656e587dd8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn", ] [[package]] @@ -1228,19 +1239,22 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - [[package]] name = "wasip2" version = "1.0.1+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" dependencies = [ - "wit-bindgen", + "wit-bindgen 0.46.0", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen 0.51.0", ] [[package]] @@ -1275,7 +1289,7 @@ dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.111", + "syn", "wasm-bindgen-shared", ] @@ -1288,6 +1302,40 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + [[package]] name = "windows-link" version = "0.2.1" @@ -1391,6 +1439,94 @@ version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + [[package]] name = "zerocopy" version = "0.8.31" @@ -1408,45 +1544,95 @@ checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] name = "zip" -version = "0.6.6" +version = "8.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +checksum = "6e499faf5c6b97a0d086f4a8733de6d47aee2252b8127962439d8d4311a73f72" dependencies = [ "aes", - "byteorder", "bzip2", "constant_time_eq", "crc32fast", - "crossbeam-utils", + "deflate64", "flate2", + "getrandom 0.4.1", "hmac", + "indexmap", + "lzma-rust2", + "memchr", "pbkdf2", + "ppmd-rust", "sha1", "time", + "typed-path", + "zeroize", + "zopfli", "zstd", ] +[[package]] +name = "zlib-rs" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40990edd51aae2c2b6907af74ffb635029d5788228222c4bb811e9351c0caad3" + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" + +[[package]] +name = "zopfli" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f05cd8797d63865425ff89b5c4a48804f35ba0ce8d125800027ad6017d2b5249" +dependencies = [ + "bumpalo", + "crc32fast", + "log", + "simd-adler32", +] + [[package]] name = "zstd" -version = "0.11.2+zstd.1.5.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" +version = "7.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" dependencies = [ - "libc", "zstd-sys", ] diff --git a/bxes/src/rust/bxes/Cargo.toml b/bxes/src/rust/bxes/Cargo.toml index f32a7c26..c91993ef 100644 --- a/bxes/src/rust/bxes/Cargo.toml +++ b/bxes/src/rust/bxes/Cargo.toml @@ -1,24 +1,24 @@ [package] name = "bxes" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] leb128 = "0.2.5" num = "0.4.3" num-derive = "0.4.2" num-traits = "0.2.19" -rand = "0.8.5" +rand = "0.10.0" tempfile = "3.24.0" variant_count = "1.2.0" -zip = "0.6.6" -thiserror = "1" +zip = "8.1.0" +thiserror = "2.0.18" [dependencies.uuid] version = "1.19.0" features = [ - "v4", # Lets you generate random UUIDs - "fast-rng", # Use a faster (but still sufficiently random) RNG + "v4", # Lets you generate random UUIDs + "fast-rng", # Use a faster (but still sufficiently random) RNG "macro-diagnostics", # Enable better diagnostics for compile-time UUIDs ] diff --git a/bxes/src/rust/bxes/src/writer/writer_utils.rs b/bxes/src/rust/bxes/src/writer/writer_utils.rs index 67bc15cc..741dc57a 100644 --- a/bxes/src/rust/bxes/src/writer/writer_utils.rs +++ b/bxes/src/rust/bxes/src/writer/writer_utils.rs @@ -743,7 +743,7 @@ pub fn compress_to_archive(log_path: &str, save_path: &str) -> Result<(), BxesWr let mut zip_writer = ZipWriter::new(file); let archive_log_name = Path::new(save_path).file_name().unwrap().to_str().unwrap(); - let options = FileOptions::default() + let options = FileOptions::<()>::default() .compression_method(zip::CompressionMethod::Deflated) .compression_level(Some(8)); diff --git a/bxes/src/rust/bxes/tests/test_core/random_log.rs b/bxes/src/rust/bxes/tests/test_core/random_log.rs index 1a448362..6d48a6fc 100644 --- a/bxes/src/rust/bxes/tests/test_core/random_log.rs +++ b/bxes/src/rust/bxes/tests/test_core/random_log.rs @@ -2,7 +2,7 @@ use std::{collections::HashMap, rc::Rc}; use bxes::read::read_utils::string_or_err; use num_traits::FromPrimitive; -use rand::{distributions::Alphanumeric, rngs::ThreadRng, Rng}; +use rand::{Rng, RngExt, distr::Alphanumeric, rngs::ThreadRng}; use uuid::Uuid; use bxes::{ @@ -11,11 +11,11 @@ use bxes::{ bxes_artifact::{BxesArtifact, BxesArtifactItem}, bxes_driver::{BxesDriver, BxesDrivers}, bxes_event_log::{BxesEvent, BxesEventLog, BxesTraceVariant}, - bxes_lifecycle::{BrafLifecycle, Lifecycle, StandardLifecycle}, + bxes_lifecycle::{BrafLifecycle, StandardLifecycle}, bxes_log_metadata::{BxesClassifier, BxesEventLogMetadata, BxesExtension, BxesGlobal, BxesGlobalKind}, bxes_value::BxesValue, software_event_type::SoftwareEventType, - type_ids::{get_type_id, TypeIds}, + type_ids::{TypeIds, get_type_id}, }, system_models::{SystemMetadata, ValueAttributeDescriptor}, }, @@ -23,7 +23,7 @@ use bxes::{ }; pub fn generate_random_bxes_write_data() -> BxesLogWriteData { - let mut rng = rand::thread_rng(); + let mut rng = rand::rng(); let log = generate_random_log(&mut rng); let system_metadata = generate_random_system_metadata(&mut rng, &log); @@ -32,7 +32,7 @@ pub fn generate_random_bxes_write_data() -> BxesLogWriteData { pub fn generate_random_system_metadata(rng: &mut ThreadRng, log: &BxesEventLog) -> SystemMetadata { let mut descriptors = HashMap::new(); - let count = rng.gen_range(50..100); + let count = rng.random_range(50..100); let mut index = 0; loop { @@ -40,16 +40,16 @@ pub fn generate_random_system_metadata(rng: &mut ThreadRng, log: &BxesEventLog) break; } - let random_variant = log.variants.get(rng.gen_range(0..log.variants.len())).unwrap(); + let random_variant = log.variants.get(rng.random_range(0..log.variants.len())).unwrap(); - let random_event = random_variant.events.get(rng.gen_range(0..random_variant.events.len())).unwrap(); + let random_event = random_variant.events.get(rng.random_range(0..random_variant.events.len())).unwrap(); if let Some(attrs) = random_event.attributes.as_ref() { if attrs.len() == 0 { continue; } - let random_attr = attrs.get(rng.gen_range(0..attrs.len())).unwrap(); + let random_attr = attrs.get(rng.random_range(0..attrs.len())).unwrap(); let key = string_or_err(&random_attr.0).ok().unwrap(); if descriptors.contains_key(&key) { continue; @@ -73,20 +73,9 @@ pub fn generate_random_system_metadata(rng: &mut ThreadRng, log: &BxesEventLog) } } -fn generate_random_value_attributes_descriptor(rng: &mut ThreadRng) -> Vec { - generate_random_list(rng, |rng| generate_random_value_attribute_descriptor(rng)) -} - -fn generate_random_value_attribute_descriptor(rng: &mut ThreadRng) -> ValueAttributeDescriptor { - ValueAttributeDescriptor { - type_id: generate_random_type_id(rng), - name: generate_random_string(rng), - } -} - pub fn generate_random_log(rng: &mut ThreadRng) -> BxesEventLog { BxesEventLog { - version: rng.gen(), + version: rng.next_u32(), metadata: generate_random_metadata(rng), variants: generate_random_variants(rng), } @@ -123,12 +112,8 @@ fn generate_random_classifiers(rng: &mut ThreadRng) -> Vec { }) } -fn generate_random_values(rng: &mut ThreadRng) -> Vec>> { - generate_random_list(rng, |rng| generate_random_bxes_value(rng)) -} - fn generate_random_list(rng: &mut ThreadRng, item_generator: impl Fn(&mut ThreadRng) -> T) -> Vec { - let count = rng.gen_range(100..500); + let count = rng.random_range(100..500); let mut vec = vec![]; for _ in 0..count { @@ -139,7 +124,7 @@ fn generate_random_list(rng: &mut ThreadRng, item_generator: impl Fn(&mut Thr } fn generate_random_variants(rng: &mut ThreadRng) -> Vec { - let variants_count = rng.gen_range(1..5); + let variants_count = rng.random_range(1..5); let mut variants = vec![]; for _ in 0..variants_count { @@ -150,17 +135,17 @@ fn generate_random_variants(rng: &mut ThreadRng) -> Vec { } fn generate_random_variant(rng: &mut ThreadRng) -> BxesTraceVariant { - let traces_count = rng.gen::(); + let traces_count = rng.random(); let mut metadata = vec![]; - let metadata_count = rng.gen_range(1..20); + let metadata_count = rng.random_range(1..20); for _ in 0..metadata_count { metadata.push(generate_random_attribute(rng)); } let mut events = vec![]; - let events_count = rng.gen_range(50..100); + let events_count = rng.random_range(50..100); for _ in 0..events_count { events.push(generate_random_event(rng)); } @@ -175,7 +160,7 @@ fn generate_random_variant(rng: &mut ThreadRng) -> BxesTraceVariant { fn generate_random_event(rng: &mut ThreadRng) -> BxesEvent { BxesEvent { name: generate_random_string_bxes_value(rng), - timestamp: rng.gen(), + timestamp: rng.random(), attributes: generate_random_attributes_option(rng), } } @@ -185,7 +170,7 @@ fn generate_random_attributes(rng: &mut ThreadRng) -> Vec<(Rc>, R } fn generate_random_attributes_option(rng: &mut ThreadRng) -> Option>, Rc>)>> { - if rng.gen_bool(0.8) { + if rng.random_bool(0.8) { Some(generate_random_attributes(rng)) } else { None @@ -201,39 +186,38 @@ fn generate_random_string_bxes_value(rng: &mut ThreadRng) -> Rc> } fn generate_random_string(rng: &mut ThreadRng) -> String { - let length = rng.gen_range(50..100); + let length = rng.random_range(50..100); rng.sample_iter(&Alphanumeric).take(length).map(char::from).collect() } fn generate_random_bxes_value(rng: &mut ThreadRng) -> Rc> { Rc::new(Box::new(match generate_random_type_id(rng) { - TypeIds::Null => BxesValue::Int32(rng.gen()), - TypeIds::I32 => BxesValue::Int32(rng.gen()), - TypeIds::I64 => BxesValue::Int64(rng.gen()), - TypeIds::U32 => BxesValue::Uint32(rng.gen()), - TypeIds::U64 => BxesValue::Uint64(rng.gen()), - TypeIds::F32 => BxesValue::Float32(rng.gen()), - TypeIds::F64 => BxesValue::Float64(rng.gen()), - TypeIds::Bool => BxesValue::Bool(rng.gen()), + TypeIds::Null => BxesValue::Int32(rng.random()), + TypeIds::I32 => BxesValue::Int32(rng.random()), + TypeIds::I64 => BxesValue::Int64(rng.random()), + TypeIds::U32 => BxesValue::Uint32(rng.random()), + TypeIds::U64 => BxesValue::Uint64(rng.random()), + TypeIds::F32 => BxesValue::Float32(rng.random()), + TypeIds::F64 => BxesValue::Float64(rng.random()), + TypeIds::Bool => BxesValue::Bool(rng.random()), TypeIds::String => BxesValue::String(Rc::new(Box::new(generate_random_string(rng)))), - TypeIds::Timestamp => BxesValue::Timestamp(rng.gen()), + TypeIds::Timestamp => BxesValue::Timestamp(rng.random()), TypeIds::BrafLifecycle => BxesValue::BrafLifecycle(generate_random_braf_lifecycle()), TypeIds::StandardLifecycle => BxesValue::StandardLifecycle(generate_random_standard_lifecycle()), TypeIds::Guid => BxesValue::Guid(Uuid::new_v4()), TypeIds::SoftwareEventType => BxesValue::SoftwareEventType(generate_random_enum::(SoftwareEventType::VARIANT_COUNT)), TypeIds::Artifact => generate_random_artifact(rng), TypeIds::Drivers => generate_random_drivers(rng), - _ => panic!("Got unknown type id"), })) } fn generate_random_type_id(rng: &mut ThreadRng) -> TypeIds { - TypeIds::from_u8(rng.gen_range(0..TypeIds::VARIANT_COUNT) as u8).unwrap() + TypeIds::from_u8(rng.random_range(0..TypeIds::VARIANT_COUNT) as u8).unwrap() } fn generate_random_drivers(rng: &mut ThreadRng) -> BxesValue { let mut drivers = vec![]; - let count = rng.gen_range(1..20); + let count = rng.random_range(1..20); for _ in 0..count { drivers.push(generate_random_driver(rng)); @@ -244,7 +228,7 @@ fn generate_random_drivers(rng: &mut ThreadRng) -> BxesValue { fn generate_random_driver(rng: &mut ThreadRng) -> BxesDriver { BxesDriver { - amount: BxesValue::Float64(rng.gen()), + amount: BxesValue::Float64(rng.random()), name: Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(generate_random_string(rng)))))), driver_type: Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(generate_random_string(rng)))))), } @@ -252,13 +236,13 @@ fn generate_random_driver(rng: &mut ThreadRng) -> BxesDriver { fn generate_random_artifact(rng: &mut ThreadRng) -> BxesValue { let mut artifacts = vec![]; - let count = rng.gen_range(1..20); + let count = rng.random_range(1..20); for _ in 0..count { artifacts.push(generate_random_artifact_item(rng)); } - return BxesValue::Artifact(BxesArtifact { items: artifacts }); + BxesValue::Artifact(BxesArtifact { items: artifacts }) } fn generate_random_artifact_item(rng: &mut ThreadRng) -> BxesArtifactItem { @@ -269,13 +253,6 @@ fn generate_random_artifact_item(rng: &mut ThreadRng) -> BxesArtifactItem { } } -fn generate_random_lifecycle(rng: &mut ThreadRng) -> Lifecycle { - match rng.gen_bool(0.5) { - true => Lifecycle::Standard(generate_random_standard_lifecycle()), - false => Lifecycle::Braf(generate_random_braf_lifecycle()), - } -} - fn generate_random_braf_lifecycle() -> BrafLifecycle { generate_random_enum::(BrafLifecycle::VARIANT_COUNT) } diff --git a/bxes/src/rust/bxes_kafka/Cargo.toml b/bxes/src/rust/bxes_kafka/Cargo.toml index 44d79711..c7409cc7 100644 --- a/bxes/src/rust/bxes_kafka/Cargo.toml +++ b/bxes/src/rust/bxes_kafka/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "bxes_kafka" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] bxes = { path = "../bxes" } -rdkafka = { version = "0.36.2", features = ["cmake-build"] } +rdkafka = { version = "0.39.0", features = ["cmake-build"] } uuid = { version = "1.19.0", features = ["v4"] } log = "0.4.29" colog = "1.4.0" From 236f274a741867edd8a900796a2e10eba9b08ddd Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Wed, 25 Feb 2026 22:08:16 +0300 Subject: [PATCH 02/30] Apply clippy suggestions --- bxes/src/rust/bxes/src/binary_rw/core.rs | 14 +++---- .../rust/bxes/src/binary_rw/cursor_stream.rs | 2 +- .../rust/bxes/src/binary_rw/file_stream.rs | 6 +-- bxes/src/rust/bxes/src/constants.rs | 12 +++--- .../bxes/src/models/domain/bxes_artifact.rs | 2 +- .../bxes/src/models/domain/bxes_driver.rs | 2 +- .../bxes/src/models/domain/bxes_event_log.rs | 8 ++-- .../src/models/domain/bxes_log_metadata.rs | 2 +- bxes/src/rust/bxes/src/models/domain/utils.rs | 7 ++-- bxes/src/rust/bxes/src/read/errors.rs | 2 +- bxes/src/rust/bxes/src/read/read_utils.rs | 4 +- .../bxes/src/read/single_file_bxes_reader.rs | 1 - bxes/src/rust/bxes/src/writer/errors.rs | 2 +- .../src/writer/multiple_file_bxes_writer.rs | 2 +- .../src/rust/bxes/src/writer/write_context.rs | 6 +-- bxes/src/rust/bxes/src/writer/writer_utils.rs | 38 ++++++++----------- .../src/consumer/bxes_kafka_consumer.rs | 12 +++--- 17 files changed, 51 insertions(+), 71 deletions(-) diff --git a/bxes/src/rust/bxes/src/binary_rw/core.rs b/bxes/src/rust/bxes/src/binary_rw/core.rs index b809d668..380c8ba6 100644 --- a/bxes/src/rust/bxes/src/binary_rw/core.rs +++ b/bxes/src/rust/bxes/src/binary_rw/core.rs @@ -30,19 +30,15 @@ macro_rules! decode { } /// Variants to describe endianness. -#[derive(PartialEq)] +#[derive(PartialEq, Default)] pub enum Endian { /// Big endian. + #[default] Big, /// Little endian. Little, } -impl Default for Endian { - fn default() -> Self { - Self::Big - } -} /// Trait for streams that can seek. pub trait SeekStream { @@ -119,7 +115,7 @@ impl<'a> BinaryReader<'a> { /// Read a character from the stream. pub fn read_char(&mut self) -> Result { - Ok(std::char::from_u32(self.read_u32()?).ok_or_else(|| BinaryError::InvalidChar)?) + std::char::from_u32(self.read_u32()?).ok_or(BinaryError::InvalidChar) } /// Read a `bool` from the stream. @@ -269,7 +265,7 @@ impl<'a> BinaryWriter<'a> { } else { self.write_usize(bytes.len())?; } - Ok(self.stream.write(&bytes.to_vec())?) + Ok(self.stream.write(bytes)?) } /// Write a character to the stream. @@ -352,7 +348,7 @@ impl<'a> BinaryWriter<'a> { pub fn write_bytes_with_value(&mut self, count: usize, fill_value: u8) -> Result { let mut buff = Vec::with_capacity(count) as Vec; buff.resize(count, fill_value); - Ok(self.write_bytes(buff)?) + self.write_bytes(buff) } /// Swap endianness to allow for reversing the writing mid stream diff --git a/bxes/src/rust/bxes/src/binary_rw/cursor_stream.rs b/bxes/src/rust/bxes/src/binary_rw/cursor_stream.rs index 7b909971..160c4c7a 100644 --- a/bxes/src/rust/bxes/src/binary_rw/cursor_stream.rs +++ b/bxes/src/rust/bxes/src/binary_rw/cursor_stream.rs @@ -2,7 +2,7 @@ use crate::binary_rw::{ core::{ReadStream, SeekStream}, error::BinaryError, }; -use std::io::{Cursor, Error, ErrorKind, Read, Seek, SeekFrom}; +use std::io::{Cursor, Read, Seek, SeekFrom}; pub struct CursorStream<'a> { cursor: Cursor<&'a [u8]>, diff --git a/bxes/src/rust/bxes/src/binary_rw/file_stream.rs b/bxes/src/rust/bxes/src/binary_rw/file_stream.rs index 075b342c..c3946ade 100644 --- a/bxes/src/rust/bxes/src/binary_rw/file_stream.rs +++ b/bxes/src/rust/bxes/src/binary_rw/file_stream.rs @@ -1,7 +1,7 @@ //https://github.com/mathias234/binary_rw/blob/master/src/stream/file.rs use std::{ fs::{File, Metadata, OpenOptions}, - io::{prelude::*, Cursor, Error, ErrorKind, Read, SeekFrom, Write}, + io::{prelude::*, Error, ErrorKind, Read, SeekFrom, Write}, path::Path, }; @@ -58,7 +58,7 @@ impl SeekStream for FileStream { } fn tell(&mut self) -> crate::binary_rw::core::Result { - Ok(self.file.seek(SeekFrom::Current(0))? as usize) + Ok(self.file.stream_position()? as usize) } fn len(&self) -> crate::binary_rw::core::Result { @@ -71,7 +71,7 @@ impl Read for FileStream { if self.tell().unwrap() + buffer.len() > self.metadata()?.len() as usize { return Err(Error::new(ErrorKind::UnexpectedEof, BinaryError::ReadPastEof)); } - Ok(self.file.read(buffer)?) + self.file.read(buffer) } } diff --git a/bxes/src/rust/bxes/src/constants.rs b/bxes/src/rust/bxes/src/constants.rs index ac20f1b3..a8717419 100644 --- a/bxes/src/rust/bxes/src/constants.rs +++ b/bxes/src/rust/bxes/src/constants.rs @@ -1,7 +1,7 @@ -pub const VALUES_FILE_NAME: &'static str = "values.bxes"; -pub const VARIANTS_FILE_NAME: &'static str = "traces.bxes"; -pub const KEY_VALUES_FILE_NAME: &'static str = "kvpair.bxes"; -pub const METADATA_FILE_NAME: &'static str = "metadata.bxes"; -pub const SYSTEM_METADATA_FILE_NAME: &'static str = "system_metadata.bxes"; +pub const VALUES_FILE_NAME: &str = "values.bxes"; +pub const VARIANTS_FILE_NAME: &str = "traces.bxes"; +pub const KEY_VALUES_FILE_NAME: &str = "kvpair.bxes"; +pub const METADATA_FILE_NAME: &str = "metadata.bxes"; +pub const SYSTEM_METADATA_FILE_NAME: &str = "system_metadata.bxes"; -pub const BXES_EXT: &'static str = "bxes"; +pub const BXES_EXT: &str = "bxes"; diff --git a/bxes/src/rust/bxes/src/models/domain/bxes_artifact.rs b/bxes/src/rust/bxes/src/models/domain/bxes_artifact.rs index a54c0fc4..bfb3a83e 100644 --- a/bxes/src/rust/bxes/src/models/domain/bxes_artifact.rs +++ b/bxes/src/rust/bxes/src/models/domain/bxes_artifact.rs @@ -24,7 +24,7 @@ impl PartialEq for BxesArtifact { } for (self_item, other_item) in self.items.iter().zip(&other.items) { - if !self_item.eq(&other_item) { + if !self_item.eq(other_item) { return false; } } diff --git a/bxes/src/rust/bxes/src/models/domain/bxes_driver.rs b/bxes/src/rust/bxes/src/models/domain/bxes_driver.rs index e2713eb2..7ee1fef8 100644 --- a/bxes/src/rust/bxes/src/models/domain/bxes_driver.rs +++ b/bxes/src/rust/bxes/src/models/domain/bxes_driver.rs @@ -29,7 +29,7 @@ impl PartialEq for BxesDrivers { } } - return true; + true } } diff --git a/bxes/src/rust/bxes/src/models/domain/bxes_event_log.rs b/bxes/src/rust/bxes/src/models/domain/bxes_event_log.rs index 87589c61..f954f221 100644 --- a/bxes/src/rust/bxes/src/models/domain/bxes_event_log.rs +++ b/bxes/src/rust/bxes/src/models/domain/bxes_event_log.rs @@ -19,12 +19,12 @@ impl PartialEq for BxesEventLog { } for (self_variant, other_variant) in self.variants.iter().zip(&other.variants) { - if !self_variant.eq(&other_variant) { + if !self_variant.eq(other_variant) { return false; } } - return true; + true } } @@ -46,12 +46,12 @@ impl PartialEq for BxesTraceVariant { } for (self_event, other_event) in self.events.iter().zip(&other.events) { - if !self_event.eq(&other_event) { + if !self_event.eq(other_event) { return false; } } - return true; + true } } diff --git a/bxes/src/rust/bxes/src/models/domain/bxes_log_metadata.rs b/bxes/src/rust/bxes/src/models/domain/bxes_log_metadata.rs index 4d480571..39015e39 100644 --- a/bxes/src/rust/bxes/src/models/domain/bxes_log_metadata.rs +++ b/bxes/src/rust/bxes/src/models/domain/bxes_log_metadata.rs @@ -1,4 +1,4 @@ -use std::{hash::Hash, rc::Rc}; +use std::rc::Rc; use num_derive::{FromPrimitive, ToPrimitive}; use variant_count::VariantCount; diff --git a/bxes/src/rust/bxes/src/models/domain/utils.rs b/bxes/src/rust/bxes/src/models/domain/utils.rs index 98d738b8..9b263f37 100644 --- a/bxes/src/rust/bxes/src/models/domain/utils.rs +++ b/bxes/src/rust/bxes/src/models/domain/utils.rs @@ -9,8 +9,8 @@ pub fn compare_list_of_attributes( return true; } - if let Some(self_attributes) = first_attributes.as_ref() { - if let Some(other_attributes) = second_attributes.as_ref() { + if let Some(self_attributes) = first_attributes.as_ref() + && let Some(other_attributes) = second_attributes.as_ref() { if self_attributes.len() != other_attributes.len() { return false; } @@ -25,9 +25,8 @@ pub fn compare_list_of_attributes( return first_set.eq(&second_set); } - } - return false; + false } pub fn attributes_equals( diff --git a/bxes/src/rust/bxes/src/read/errors.rs b/bxes/src/rust/bxes/src/read/errors.rs index 05a295c7..0098c111 100644 --- a/bxes/src/rust/bxes/src/read/errors.rs +++ b/bxes/src/rust/bxes/src/read/errors.rs @@ -33,7 +33,7 @@ impl ToString for BxesReadError { format!("Failed to read pos from stream: {}", error_message) } BxesReadError::FailedToCreateUtf8String(err) => { - format!("Failed to create string: {}", err.to_string()) + format!("Failed to create string: {}", err) } BxesReadError::FailedToParseTypeId(type_id) => { format!("Failed to parse type id: {}", type_id) diff --git a/bxes/src/rust/bxes/src/read/read_utils.rs b/bxes/src/rust/bxes/src/read/read_utils.rs index 8c65c07f..54be30d6 100644 --- a/bxes/src/rust/bxes/src/read/read_utils.rs +++ b/bxes/src/rust/bxes/src/read/read_utils.rs @@ -1,4 +1,4 @@ -use num_traits::{FromPrimitive, ToPrimitive}; +use num_traits::FromPrimitive; use std::{ fs::File, io::{Cursor, Read, Seek}, @@ -573,7 +573,7 @@ fn try_extract_archive_internal(stream: impl Read + Seek) -> Result return Err(BxesReadError::FailedToExtractArchive), }; - return Ok(temp_dir); + Ok(temp_dir) } pub fn try_open_file_stream(path: &str) -> Result { diff --git a/bxes/src/rust/bxes/src/read/single_file_bxes_reader.rs b/bxes/src/rust/bxes/src/read/single_file_bxes_reader.rs index d276aa72..9e2433d5 100644 --- a/bxes/src/rust/bxes/src/read/single_file_bxes_reader.rs +++ b/bxes/src/rust/bxes/src/read/single_file_bxes_reader.rs @@ -25,7 +25,6 @@ fn read_bxes_internal(extracted_files_dir: TempDir) -> Result>(); diff --git a/bxes/src/rust/bxes/src/writer/errors.rs b/bxes/src/rust/bxes/src/writer/errors.rs index 15615efb..e72843b1 100644 --- a/bxes/src/rust/bxes/src/writer/errors.rs +++ b/bxes/src/rust/bxes/src/writer/errors.rs @@ -1,4 +1,4 @@ -use std::{fmt::Display, rc::Rc}; +use std::rc::Rc; use crate::{binary_rw::error::BinaryError, models::domain::bxes_value::BxesValue}; diff --git a/bxes/src/rust/bxes/src/writer/multiple_file_bxes_writer.rs b/bxes/src/rust/bxes/src/writer/multiple_file_bxes_writer.rs index b6af238b..441d329d 100644 --- a/bxes/src/rust/bxes/src/writer/multiple_file_bxes_writer.rs +++ b/bxes/src/rust/bxes/src/writer/multiple_file_bxes_writer.rs @@ -18,7 +18,7 @@ type WriterFunc = dyn Fn(&BxesLogWriteData, Rc>) -> Re pub fn write_bxes_multiple_files(data: &BxesLogWriteData, directory_path: &str) -> Result<(), BxesWriteError> { let context = BxesWriteContext::empty(data.system_metadata.values_attrs.clone()); - let writer = |file_path: &'static str, action: Box| execute_with_writer(&data, directory_path, file_path, &context, action); + let writer = |file_path: &'static str, action: Box| execute_with_writer(data, directory_path, file_path, &context, action); writer( constants::SYSTEM_METADATA_FILE_NAME, diff --git a/bxes/src/rust/bxes/src/writer/write_context.rs b/bxes/src/rust/bxes/src/writer/write_context.rs index e59f0c4b..e8473213 100644 --- a/bxes/src/rust/bxes/src/writer/write_context.rs +++ b/bxes/src/rust/bxes/src/writer/write_context.rs @@ -29,11 +29,7 @@ impl<'b> BxesWriteContext<'b> { } fn create_value_attributes_set(value_attributes: Option<&Vec>) -> Option> { - if let Some(attributes) = value_attributes { - Some(attributes.iter().map(|d| d.clone()).collect()) - } else { - None - } + value_attributes.map(|attributes| attributes.iter().cloned().collect()) } pub fn new(writer: &'b mut BinaryWriter<'b>, value_attributes: Option>) -> Self { diff --git a/bxes/src/rust/bxes/src/writer/writer_utils.rs b/bxes/src/rust/bxes/src/writer/writer_utils.rs index 741dc57a..e9a7a9b2 100644 --- a/bxes/src/rust/bxes/src/writer/writer_utils.rs +++ b/bxes/src/rust/bxes/src/writer/writer_utils.rs @@ -114,8 +114,8 @@ fn try_write_event_default_attributes( for (key, value) in attributes { let should_write = if let Some(set) = context.borrow().value_attributes_set.as_ref() { let desc = ValueAttributeDescriptor { - name: string_or_err(&key).ok().unwrap().as_ref().as_ref().clone(), - type_id: get_type_id(&value), + name: string_or_err(key).ok().unwrap().as_ref().as_ref().clone(), + type_id: get_type_id(value), }; !set.contains(&desc) @@ -152,13 +152,12 @@ fn try_write_event_value_attributes(event: &BxesEvent, context: Rc>, Rc>), desc: &ValueAttributeDescriptor) -> bool { - let key = string_or_err(&attribute.0.as_ref().as_ref()).ok().unwrap(); - key.as_ref().as_ref() == &desc.name && get_type_id(&attribute.1) == desc.type_id -} - pub fn try_write_log_metadata(log: &BxesEventLog, context: Rc>) -> Result<(), BxesWriteError> { try_write_properties(context.clone(), log.metadata.properties.as_ref())?; try_write_extensions(context.clone(), log.metadata.extensions.as_ref())?; @@ -191,7 +185,7 @@ impl<'a, 'b> Write for BinaryWriterWrapper<'a, 'b> { fn write(&mut self, buf: &[u8]) -> std::io::Result { match self.writer.write_bytes(buf) { Ok(written) => Ok(written), - Err(err) => Err(std::io::Error::new(std::io::ErrorKind::Other, err.to_string())), + Err(err) => Err(std::io::Error::other(err.to_string())), } } @@ -405,7 +399,7 @@ fn execute_with_kv_pairs<'a>( action(ValueOrKeyValue::Value(&classifier.name))?; for key in &classifier.keys { - action(ValueOrKeyValue::Value(&key))?; + action(ValueOrKeyValue::Value(key))?; } } } @@ -429,10 +423,10 @@ fn execute_with_attributes_kv_pairs<'a>( action: &mut impl FnMut(ValueOrKeyValue<'a>) -> Result<(), BxesWriteError>, ) -> Result<(), BxesWriteError> { for (key, value) in attributes { - action(ValueOrKeyValue::Value(&key))?; - action(ValueOrKeyValue::Value(&value))?; + action(ValueOrKeyValue::Value(key))?; + action(ValueOrKeyValue::Value(value))?; - action(ValueOrKeyValue::KeyValue((&key, &value)))?; + action(ValueOrKeyValue::KeyValue((key, value)))?; } Ok(()) @@ -592,7 +586,7 @@ fn get_or_write_value_index(value: &Rc>, context: &mut BxesWriteC try_write_value_if_not_present(value, context)?; let index = *context.values_indices.borrow().get(value).unwrap() as u32; - return Ok(index); + Ok(index) } pub fn try_write_drivers(context: &mut BxesWriteContext, drivers: &BxesDrivers) -> Result<(), BxesWriteError> { @@ -739,7 +733,7 @@ pub fn try_open_write(path: &str) -> Result { } pub fn compress_to_archive(log_path: &str, save_path: &str) -> Result<(), BxesWriteError> { - let file = File::create(save_path).or_else(|_| Err(BxesWriteError::FailedToCreateArchive))?; + let file = File::create(save_path).map_err(|_| BxesWriteError::FailedToCreateArchive)?; let mut zip_writer = ZipWriter::new(file); let archive_log_name = Path::new(save_path).file_name().unwrap().to_str().unwrap(); @@ -748,17 +742,15 @@ pub fn compress_to_archive(log_path: &str, save_path: &str) -> Result<(), BxesWr .compression_level(Some(8)); zip_writer - .start_file(archive_log_name, options) - .or_else(|_| Err(BxesWriteError::FailedToCreateArchive))?; + .start_file(archive_log_name, options).map_err(|_| BxesWriteError::FailedToCreateArchive)?; let bytes = fs::read(log_path).unwrap(); zip_writer - .write_all(&bytes) - .or_else(|_| Err(BxesWriteError::FailedToCreateArchive))?; + .write_all(&bytes).map_err(|_| BxesWriteError::FailedToCreateArchive)?; - zip_writer.flush().or_else(|_| Err(BxesWriteError::FailedToCreateArchive))?; + zip_writer.flush().map_err(|_| BxesWriteError::FailedToCreateArchive)?; - zip_writer.finish().or_else(|_| Err(BxesWriteError::FailedToCreateArchive))?; + zip_writer.finish().map_err(|_| BxesWriteError::FailedToCreateArchive)?; Ok(()) } diff --git a/bxes/src/rust/bxes_kafka/src/consumer/bxes_kafka_consumer.rs b/bxes/src/rust/bxes_kafka/src/consumer/bxes_kafka_consumer.rs index 8fe962c3..e1442495 100644 --- a/bxes/src/rust/bxes_kafka/src/consumer/bxes_kafka_consumer.rs +++ b/bxes/src/rust/bxes_kafka/src/consumer/bxes_kafka_consumer.rs @@ -96,19 +96,17 @@ impl BxesKafkaConsumer { info!("Read bxes trace with read metadata id {}", read_metadata_id); - if !self.session_id_to_read_metadata.contains_key(&read_metadata_id) { + self.session_id_to_read_metadata.entry(read_metadata_id).or_insert_with(|| { info!("Creating new read metadata for id {}", read_metadata_id); - self - .session_id_to_read_metadata - .insert(read_metadata_id.clone(), ReadMetadata::empty()); - } + ReadMetadata::empty() + }); - let mut read_metadata = self + let read_metadata = self .session_id_to_read_metadata .get_mut(&read_metadata_id) .expect("Must be present"); - let trace = Self::parse_raw_bxes_bytes(&payload[UUID_LENGTH..], &mut read_metadata)?; + let trace = Self::parse_raw_bxes_bytes(&payload[UUID_LENGTH..], read_metadata)?; self.consumer.commit_message(&msg, CommitMode::Sync)?; From 88563772d98951f7e420a8e2981e9645f0b2e58d Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Wed, 25 Feb 2026 22:08:41 +0300 Subject: [PATCH 03/30] cargo fmt --- bxes/src/rust/bxes/src/binary_rw/core.rs | 1 - .../rust/bxes/src/binary_rw/file_stream.rs | 2 +- bxes/src/rust/bxes/src/models/domain/utils.rs | 25 ++++++++--------- bxes/src/rust/bxes/src/read/read_utils.rs | 2 +- .../src/writer/multiple_file_bxes_writer.rs | 2 +- .../src/writer/single_file_bxes_writer.rs | 2 +- bxes/src/rust/bxes/src/writer/writer_utils.rs | 27 +++++++++---------- .../src/consumer/bxes_kafka_consumer.rs | 2 +- 8 files changed, 30 insertions(+), 33 deletions(-) diff --git a/bxes/src/rust/bxes/src/binary_rw/core.rs b/bxes/src/rust/bxes/src/binary_rw/core.rs index 380c8ba6..f6c0a255 100644 --- a/bxes/src/rust/bxes/src/binary_rw/core.rs +++ b/bxes/src/rust/bxes/src/binary_rw/core.rs @@ -39,7 +39,6 @@ pub enum Endian { Little, } - /// Trait for streams that can seek. pub trait SeekStream { /// Seek to a position. diff --git a/bxes/src/rust/bxes/src/binary_rw/file_stream.rs b/bxes/src/rust/bxes/src/binary_rw/file_stream.rs index c3946ade..988966f4 100644 --- a/bxes/src/rust/bxes/src/binary_rw/file_stream.rs +++ b/bxes/src/rust/bxes/src/binary_rw/file_stream.rs @@ -1,7 +1,7 @@ //https://github.com/mathias234/binary_rw/blob/master/src/stream/file.rs use std::{ fs::{File, Metadata, OpenOptions}, - io::{prelude::*, Error, ErrorKind, Read, SeekFrom, Write}, + io::{Error, ErrorKind, Read, SeekFrom, Write, prelude::*}, path::Path, }; diff --git a/bxes/src/rust/bxes/src/models/domain/utils.rs b/bxes/src/rust/bxes/src/models/domain/utils.rs index 9b263f37..3aac7f03 100644 --- a/bxes/src/rust/bxes/src/models/domain/utils.rs +++ b/bxes/src/rust/bxes/src/models/domain/utils.rs @@ -10,21 +10,22 @@ pub fn compare_list_of_attributes( } if let Some(self_attributes) = first_attributes.as_ref() - && let Some(other_attributes) = second_attributes.as_ref() { - if self_attributes.len() != other_attributes.len() { - return false; - } + && let Some(other_attributes) = second_attributes.as_ref() + { + if self_attributes.len() != other_attributes.len() { + return false; + } - let first_set = self_attributes - .iter() - .collect::>, Rc>)>>(); + let first_set = self_attributes + .iter() + .collect::>, Rc>)>>(); - let second_set = other_attributes - .iter() - .collect::>, Rc>)>>(); + let second_set = other_attributes + .iter() + .collect::>, Rc>)>>(); - return first_set.eq(&second_set); - } + return first_set.eq(&second_set); + } false } diff --git a/bxes/src/rust/bxes/src/read/read_utils.rs b/bxes/src/rust/bxes/src/read/read_utils.rs index 54be30d6..23d92df7 100644 --- a/bxes/src/rust/bxes/src/read/read_utils.rs +++ b/bxes/src/rust/bxes/src/read/read_utils.rs @@ -23,7 +23,7 @@ use crate::{ bxes_log_metadata::{BxesClassifier, BxesEventLogMetadata, BxesExtension, BxesGlobal, BxesGlobalKind}, bxes_value::BxesValue, software_event_type::SoftwareEventType, - type_ids::{get_type_id, TypeIds}, + type_ids::{TypeIds, get_type_id}, }, system_models::{SystemMetadata, ValueAttributeDescriptor}, }, diff --git a/bxes/src/rust/bxes/src/writer/multiple_file_bxes_writer.rs b/bxes/src/rust/bxes/src/writer/multiple_file_bxes_writer.rs index 441d329d..33b78f53 100644 --- a/bxes/src/rust/bxes/src/writer/multiple_file_bxes_writer.rs +++ b/bxes/src/rust/bxes/src/writer/multiple_file_bxes_writer.rs @@ -1,7 +1,7 @@ use crate::{ binary_rw::core::{BinaryWriter, Endian}, constants, - writer::writer_utils::{try_write_system_metadata, BxesLogWriteData}, + writer::writer_utils::{BxesLogWriteData, try_write_system_metadata}, }; use std::{cell::RefCell, path::Path, rc::Rc}; diff --git a/bxes/src/rust/bxes/src/writer/single_file_bxes_writer.rs b/bxes/src/rust/bxes/src/writer/single_file_bxes_writer.rs index 7c3b72ff..12df25c1 100644 --- a/bxes/src/rust/bxes/src/writer/single_file_bxes_writer.rs +++ b/bxes/src/rust/bxes/src/writer/single_file_bxes_writer.rs @@ -3,7 +3,7 @@ use tempfile::NamedTempFile; use crate::{ binary_rw::core::{BinaryWriter, Endian}, - writer::writer_utils::{try_write_system_metadata, BxesLogWriteData}, + writer::writer_utils::{BxesLogWriteData, try_write_system_metadata}, }; use super::{ diff --git a/bxes/src/rust/bxes/src/writer/writer_utils.rs b/bxes/src/rust/bxes/src/writer/writer_utils.rs index e9a7a9b2..eb4d41be 100644 --- a/bxes/src/rust/bxes/src/writer/writer_utils.rs +++ b/bxes/src/rust/bxes/src/writer/writer_utils.rs @@ -8,7 +8,7 @@ use std::{ }; use num_traits::ToPrimitive; -use zip::{write::FileOptions, ZipWriter}; +use zip::{ZipWriter, write::FileOptions}; use crate::{ binary_rw::{ @@ -24,7 +24,7 @@ use crate::{ bxes_log_metadata::{BxesClassifier, BxesExtension, BxesGlobal}, bxes_value::BxesValue, software_event_type::SoftwareEventType, - type_ids::{get_type_id, TypeIds}, + type_ids::{TypeIds, get_type_id}, }, system_models::{SystemMetadata, ValueAttributeDescriptor}, }, @@ -153,11 +153,12 @@ fn try_write_event_value_attributes(event: &BxesEvent, context: Rc(vec: Option<&Vec>) -> u32 { - if let Some(vec) = vec { - vec.len() as u32 - } else { - 0 - } + if let Some(vec) = vec { vec.len() as u32 } else { 0 } } pub fn try_write_globals(context: Rc>, globals: Option<&Vec>) -> Result<(), BxesWriteError> { @@ -742,11 +739,11 @@ pub fn compress_to_archive(log_path: &str, save_path: &str) -> Result<(), BxesWr .compression_level(Some(8)); zip_writer - .start_file(archive_log_name, options).map_err(|_| BxesWriteError::FailedToCreateArchive)?; + .start_file(archive_log_name, options) + .map_err(|_| BxesWriteError::FailedToCreateArchive)?; let bytes = fs::read(log_path).unwrap(); - zip_writer - .write_all(&bytes).map_err(|_| BxesWriteError::FailedToCreateArchive)?; + zip_writer.write_all(&bytes).map_err(|_| BxesWriteError::FailedToCreateArchive)?; zip_writer.flush().map_err(|_| BxesWriteError::FailedToCreateArchive)?; diff --git a/bxes/src/rust/bxes_kafka/src/consumer/bxes_kafka_consumer.rs b/bxes/src/rust/bxes_kafka/src/consumer/bxes_kafka_consumer.rs index e1442495..43a613d5 100644 --- a/bxes/src/rust/bxes_kafka/src/consumer/bxes_kafka_consumer.rs +++ b/bxes/src/rust/bxes_kafka/src/consumer/bxes_kafka_consumer.rs @@ -14,9 +14,9 @@ use bxes::{ }; use log::info; use rdkafka::{ + Message, consumer::{BaseConsumer, CommitMode, Consumer}, error::KafkaError, - Message, }; use std::{collections::HashMap, io::Cursor, rc::Rc, time::Duration}; use uuid::Uuid; From e403503bc5989008a988c5dda0076f0c9c9f53ed Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Wed, 25 Feb 2026 22:18:52 +0300 Subject: [PATCH 04/30] Use Display instead of ToString --- bxes/src/rust/bxes/src/read/errors.rs | 91 +++++++++++++------------ bxes/src/rust/bxes/src/writer/errors.rs | 34 +++++---- 2 files changed, 67 insertions(+), 58 deletions(-) diff --git a/bxes/src/rust/bxes/src/read/errors.rs b/bxes/src/rust/bxes/src/read/errors.rs index 0098c111..c2b6ead6 100644 --- a/bxes/src/rust/bxes/src/read/errors.rs +++ b/bxes/src/rust/bxes/src/read/errors.rs @@ -1,5 +1,5 @@ use crate::models::domain::bxes_value::BxesValue; -use std::string::FromUtf8Error; +use std::{fmt::Display, string::FromUtf8Error}; #[derive(Debug)] pub enum BxesReadError { @@ -22,43 +22,47 @@ pub enum BxesReadError { ValueAttributeNameIsNotAString, } -impl ToString for BxesReadError { - fn to_string(&self) -> String { - match self { - BxesReadError::FailedToOpenFile(value) => format!("Failed to open file {}", value), - BxesReadError::FailedToReadValue(err) => { - format!("Failed to read value: {}", err.to_string()) +impl Display for BxesReadError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "{}", + match self { + BxesReadError::FailedToOpenFile(value) => format!("Failed to open file {}", value), + BxesReadError::FailedToReadValue(err) => { + format!("Failed to read value: {}", err.to_string()) + } + BxesReadError::FailedToReadPos(error_message) => { + format!("Failed to read pos from stream: {}", error_message) + } + BxesReadError::FailedToCreateUtf8String(err) => { + format!("Failed to create string: {}", err) + } + BxesReadError::FailedToParseTypeId(type_id) => { + format!("Failed to parse type id: {}", type_id) + } + BxesReadError::FailedToIndexValue(index) => { + format!("Failed to find bxes value for index: {}", index) + } + BxesReadError::FailedToIndexKeyValue(index) => { + format!("Failed to find kv pair for index: {}", index) + } + BxesReadError::LifecycleOfEventOutOfRange => "LifecycleOfEventOutOfRange".to_string(), + BxesReadError::EventAttributeKeyIsNotAString => "EventAttributeKeyIsNotAString".to_string(), + BxesReadError::VersionsMismatchError(err) => err.to_string(), + BxesReadError::FailedToExtractArchive => "FailedToExtractArchive".to_string(), + BxesReadError::TooManyFilesInArchive => "TooManyFilesInArchive".to_string(), + BxesReadError::FailedToCreateTempDir => "FailedToCreateTempDir".to_string(), + BxesReadError::InvalidArchive(message) => format!("Invalid bxes archive: {}", message), + BxesReadError::ExpectedString(value) => { + format!("Expected string value, found: {:?}", value) + } + BxesReadError::Leb128ReadError(message) => { + format!("Failed to read LEB128 encoded value: {}", message) + } + BxesReadError::ValueAttributeNameIsNotAString => "Value attribute name was not a string".to_string(), } - BxesReadError::FailedToReadPos(error_message) => { - format!("Failed to read pos from stream: {}", error_message) - } - BxesReadError::FailedToCreateUtf8String(err) => { - format!("Failed to create string: {}", err) - } - BxesReadError::FailedToParseTypeId(type_id) => { - format!("Failed to parse type id: {}", type_id) - } - BxesReadError::FailedToIndexValue(index) => { - format!("Failed to find bxes value for index: {}", index) - } - BxesReadError::FailedToIndexKeyValue(index) => { - format!("Failed to find kv pair for index: {}", index) - } - BxesReadError::LifecycleOfEventOutOfRange => "LifecycleOfEventOutOfRange".to_string(), - BxesReadError::EventAttributeKeyIsNotAString => "EventAttributeKeyIsNotAString".to_string(), - BxesReadError::VersionsMismatchError(err) => err.to_string(), - BxesReadError::FailedToExtractArchive => "FailedToExtractArchive".to_string(), - BxesReadError::TooManyFilesInArchive => "TooManyFilesInArchive".to_string(), - BxesReadError::FailedToCreateTempDir => "FailedToCreateTempDir".to_string(), - BxesReadError::InvalidArchive(message) => format!("Invalid bxes archive: {}", message), - BxesReadError::ExpectedString(value) => { - format!("Expected string value, found: {:?}", value) - } - BxesReadError::Leb128ReadError(message) => { - format!("Failed to read LEB128 encoded value: {}", message) - } - BxesReadError::ValueAttributeNameIsNotAString => "Value attribute name was not a string".to_string(), - } + ) } } @@ -68,9 +72,9 @@ pub struct FailedToReadValueError { pub message: String, } -impl ToString for FailedToReadValueError { - fn to_string(&self) -> String { - format!("Failed to read value at offset {}, error: {}", self.offset, self.message) +impl Display for FailedToReadValueError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "Failed to read value at offset {}, error: {}", self.offset, self.message) } } @@ -86,9 +90,10 @@ pub struct VersionsMismatchError { current_version: u32, } -impl ToString for VersionsMismatchError { - fn to_string(&self) -> String { - format!( +impl Display for VersionsMismatchError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, "Versions mismatch: previous version: {}, current version: {}", self.previous_version, self.current_version ) diff --git a/bxes/src/rust/bxes/src/writer/errors.rs b/bxes/src/rust/bxes/src/writer/errors.rs index e72843b1..1d1f2ae2 100644 --- a/bxes/src/rust/bxes/src/writer/errors.rs +++ b/bxes/src/rust/bxes/src/writer/errors.rs @@ -1,4 +1,4 @@ -use std::rc::Rc; +use std::{fmt::Display, rc::Rc}; use crate::{binary_rw::error::BinaryError, models::domain::bxes_value::BxesValue}; @@ -16,19 +16,23 @@ pub enum BxesWriteError { Default(String), } -impl ToString for BxesWriteError { - fn to_string(&self) -> String { - match self { - BxesWriteError::FailedToOpenFileForWriting(err) => err.to_owned(), - BxesWriteError::WriteError(err) => err.to_string(), - BxesWriteError::FailedToGetWriterPosition(err) => err.to_owned(), - BxesWriteError::FailedToSeek(err) => err.to_owned(), - BxesWriteError::FailedToFindKeyValueIndex(value) => format!("{:?}", value), - BxesWriteError::FailedToFindValueIndex(value) => format!("{:?}", value), - BxesWriteError::FailedToCreateTempFile => "FailedToCreateTempFile".to_string(), - BxesWriteError::FailedToCreateArchive => "FailedToCreateArchive".to_string(), - BxesWriteError::LebWriteError(err) => err.to_string(), - BxesWriteError::Default(err) => err.to_owned(), - } +impl Display for BxesWriteError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "{}", + match self { + BxesWriteError::FailedToOpenFileForWriting(err) => err.to_owned(), + BxesWriteError::WriteError(err) => err.to_string(), + BxesWriteError::FailedToGetWriterPosition(err) => err.to_owned(), + BxesWriteError::FailedToSeek(err) => err.to_owned(), + BxesWriteError::FailedToFindKeyValueIndex(value) => format!("{:?}", value), + BxesWriteError::FailedToFindValueIndex(value) => format!("{:?}", value), + BxesWriteError::FailedToCreateTempFile => "FailedToCreateTempFile".to_string(), + BxesWriteError::FailedToCreateArchive => "FailedToCreateArchive".to_string(), + BxesWriteError::LebWriteError(err) => err.to_string(), + BxesWriteError::Default(err) => err.to_owned(), + } + ) } } From 75d82288c7a79e632391cabf6c5f3a8890c51fb8 Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Fri, 27 Feb 2026 20:43:29 +0300 Subject: [PATCH 05/30] Rc> -> Rc<...> --- .../bxes/src/models/domain/bxes_artifact.rs | 6 ++-- .../bxes/src/models/domain/bxes_driver.rs | 4 +-- .../bxes/src/models/domain/bxes_event_log.rs | 6 ++-- .../src/models/domain/bxes_log_metadata.rs | 14 ++++---- .../rust/bxes/src/models/domain/bxes_value.rs | 2 +- bxes/src/rust/bxes/src/models/domain/utils.rs | 17 +++------- bxes/src/rust/bxes/src/read/read_context.rs | 2 +- bxes/src/rust/bxes/src/read/read_utils.rs | 27 +++++++--------- bxes/src/rust/bxes/src/writer/errors.rs | 4 +-- .../src/rust/bxes/src/writer/write_context.rs | 4 +-- bxes/src/rust/bxes/src/writer/writer_utils.rs | 30 ++++++++--------- .../rust/bxes/tests/test_core/random_log.rs | 32 +++++++++---------- .../src/consumer/bxes_kafka_consumer.rs | 14 ++++---- 13 files changed, 75 insertions(+), 87 deletions(-) diff --git a/bxes/src/rust/bxes/src/models/domain/bxes_artifact.rs b/bxes/src/rust/bxes/src/models/domain/bxes_artifact.rs index bfb3a83e..a3b3d729 100644 --- a/bxes/src/rust/bxes/src/models/domain/bxes_artifact.rs +++ b/bxes/src/rust/bxes/src/models/domain/bxes_artifact.rs @@ -35,9 +35,9 @@ impl PartialEq for BxesArtifact { #[derive(Clone, Debug)] pub struct BxesArtifactItem { - pub model: Rc>, - pub instance: Rc>, - pub transition: Rc>, + pub model: Rc, + pub instance: Rc, + pub transition: Rc, } impl Hash for BxesArtifactItem { diff --git a/bxes/src/rust/bxes/src/models/domain/bxes_driver.rs b/bxes/src/rust/bxes/src/models/domain/bxes_driver.rs index 7ee1fef8..824ff5e5 100644 --- a/bxes/src/rust/bxes/src/models/domain/bxes_driver.rs +++ b/bxes/src/rust/bxes/src/models/domain/bxes_driver.rs @@ -36,8 +36,8 @@ impl PartialEq for BxesDrivers { #[derive(Clone, Debug)] pub struct BxesDriver { pub amount: BxesValue, - pub name: Rc>, - pub driver_type: Rc>, + pub name: Rc, + pub driver_type: Rc, } impl BxesDriver { diff --git a/bxes/src/rust/bxes/src/models/domain/bxes_event_log.rs b/bxes/src/rust/bxes/src/models/domain/bxes_event_log.rs index f954f221..6882912f 100644 --- a/bxes/src/rust/bxes/src/models/domain/bxes_event_log.rs +++ b/bxes/src/rust/bxes/src/models/domain/bxes_event_log.rs @@ -31,7 +31,7 @@ impl PartialEq for BxesEventLog { #[derive(Debug)] pub struct BxesTraceVariant { pub traces_count: u32, - pub metadata: Vec<(Rc>, Rc>)>, + pub metadata: Vec<(Rc, Rc)>, pub events: Vec, } @@ -57,9 +57,9 @@ impl PartialEq for BxesTraceVariant { #[derive(Debug, Clone)] pub struct BxesEvent { - pub name: Rc>, + pub name: Rc, pub timestamp: i64, - pub attributes: Option>, Rc>)>>, + pub attributes: Option, Rc)>>, } impl PartialEq for BxesEvent { diff --git a/bxes/src/rust/bxes/src/models/domain/bxes_log_metadata.rs b/bxes/src/rust/bxes/src/models/domain/bxes_log_metadata.rs index 39015e39..25a3e0f1 100644 --- a/bxes/src/rust/bxes/src/models/domain/bxes_log_metadata.rs +++ b/bxes/src/rust/bxes/src/models/domain/bxes_log_metadata.rs @@ -9,21 +9,21 @@ use crate::models::domain::bxes_value::BxesValue; pub struct BxesEventLogMetadata { pub extensions: Option>, pub classifiers: Option>, - pub properties: Option>, Rc>)>>, + pub properties: Option, Rc)>>, pub globals: Option>, } #[derive(Debug, PartialEq, Eq)] pub struct BxesExtension { - pub name: Rc>, - pub prefix: Rc>, - pub uri: Rc>, + pub name: Rc, + pub prefix: Rc, + pub uri: Rc, } #[derive(Debug, PartialEq, Eq)] pub struct BxesClassifier { - pub name: Rc>, - pub keys: Vec>>, + pub name: Rc, + pub keys: Vec>, } #[derive(Debug, FromPrimitive, ToPrimitive, VariantCount, PartialEq, Eq)] @@ -36,5 +36,5 @@ pub enum BxesGlobalKind { #[derive(Debug, PartialEq, Eq)] pub struct BxesGlobal { pub entity_kind: BxesGlobalKind, - pub globals: Vec<(Rc>, Rc>)>, + pub globals: Vec<(Rc, Rc)>, } diff --git a/bxes/src/rust/bxes/src/models/domain/bxes_value.rs b/bxes/src/rust/bxes/src/models/domain/bxes_value.rs index c1f7c117..f182e5bf 100644 --- a/bxes/src/rust/bxes/src/models/domain/bxes_value.rs +++ b/bxes/src/rust/bxes/src/models/domain/bxes_value.rs @@ -18,7 +18,7 @@ pub enum BxesValue { Uint64(u64), Float32(f32), Float64(f64), - String(Rc>), + String(Rc), Bool(bool), Timestamp(i64), BrafLifecycle(BrafLifecycle), diff --git a/bxes/src/rust/bxes/src/models/domain/utils.rs b/bxes/src/rust/bxes/src/models/domain/utils.rs index 3aac7f03..c53e3c22 100644 --- a/bxes/src/rust/bxes/src/models/domain/utils.rs +++ b/bxes/src/rust/bxes/src/models/domain/utils.rs @@ -2,8 +2,8 @@ use crate::models::domain::bxes_value::BxesValue; use std::{collections::HashSet, rc::Rc}; pub fn compare_list_of_attributes( - first_attributes: &Option>, Rc>)>>, - second_attributes: &Option>, Rc>)>>, + first_attributes: &Option, Rc)>>, + second_attributes: &Option, Rc)>>, ) -> bool { if first_attributes.is_none() && second_attributes.is_none() { return true; @@ -16,13 +16,9 @@ pub fn compare_list_of_attributes( return false; } - let first_set = self_attributes - .iter() - .collect::>, Rc>)>>(); + let first_set = self_attributes.iter().collect::, Rc)>>(); - let second_set = other_attributes - .iter() - .collect::>, Rc>)>>(); + let second_set = other_attributes.iter().collect::, Rc)>>(); return first_set.eq(&second_set); } @@ -30,9 +26,6 @@ pub fn compare_list_of_attributes( false } -pub fn attributes_equals( - first_attribute: &(Rc>, Rc>), - second_attribute: &(Rc>, Rc>), -) -> bool { +pub fn attributes_equals(first_attribute: &(Rc, Rc), second_attribute: &(Rc, Rc)) -> bool { first_attribute.0.eq(&second_attribute.0) && first_attribute.1.eq(&second_attribute.1) } diff --git a/bxes/src/rust/bxes/src/read/read_context.rs b/bxes/src/rust/bxes/src/read/read_context.rs index fc21c24a..82747393 100644 --- a/bxes/src/rust/bxes/src/read/read_context.rs +++ b/bxes/src/rust/bxes/src/read/read_context.rs @@ -5,7 +5,7 @@ use crate::{ use std::rc::Rc; pub struct ReadMetadata { - pub values: Option>>>, + pub values: Option>>, pub kv_pairs: Option>, pub system_metadata: Option, } diff --git a/bxes/src/rust/bxes/src/read/read_utils.rs b/bxes/src/rust/bxes/src/read/read_utils.rs index 23d92df7..6eb4cc0b 100644 --- a/bxes/src/rust/bxes/src/read/read_utils.rs +++ b/bxes/src/rust/bxes/src/read/read_utils.rs @@ -165,7 +165,7 @@ pub fn try_read_leb128(reader: &mut BinaryReader) -> Result } } -pub fn string_or_err(value: &BxesValue) -> Result>, BxesReadError> { +pub fn string_or_err(value: &BxesValue) -> Result, BxesReadError> { if let BxesValue::String(string) = value { Ok(string.clone()) } else { @@ -175,7 +175,7 @@ pub fn string_or_err(value: &BxesValue) -> Result>, BxesReadError pub fn owned_string_or_err(value: &BxesValue) -> Result { if let BxesValue::String(string) = value { - Ok(string.as_ref().as_ref().to_owned()) + Ok(string.as_ref().to_owned()) } else { Err(BxesReadError::ExpectedString(value.clone())) } @@ -205,7 +205,7 @@ pub fn try_read_trace_variant(context: &mut ReadContext) -> Result Result>, Rc>)>, BxesReadError> { +pub fn try_read_trace_variant_metadata(context: &mut ReadContext) -> Result, Rc)>, BxesReadError> { let mut variant_metadata = vec![]; let metadata_count = try_read_u32(context.reader.as_mut().unwrap())?; for _ in 0..metadata_count { @@ -243,7 +243,7 @@ fn try_read_event(context: &mut ReadContext) -> Result }) } -fn try_read_event_attributes(context: &mut ReadContext) -> Result>, Rc>)>>, BxesReadError> { +fn try_read_event_attributes(context: &mut ReadContext) -> Result, Rc)>>, BxesReadError> { let mut attributes = None; let value_attrs_len = if let Some(attrs) = context.metadata.system_metadata.as_ref().unwrap().values_attrs.as_ref() { attrs.len() @@ -258,8 +258,8 @@ fn try_read_event_attributes(context: &mut ReadContext) -> Result Result Result>, Rc>)>>, + attributes: &mut Option, Rc)>>, ) -> Result<(), BxesReadError> { let attributes_count = try_read_count(context, leb_128)?; if attributes_count > 0 && attributes.is_none() { @@ -296,10 +296,7 @@ pub fn try_fill_attributes( Ok(()) } -fn try_read_attributes( - context: &mut ReadContext, - leb_128: bool, -) -> Result>, Rc>)>>, BxesReadError> { +fn try_read_attributes(context: &mut ReadContext, leb_128: bool) -> Result, Rc)>>, BxesReadError> { let attributes_count = try_read_count(context, leb_128)?; if attributes_count == 0 { Ok(None) @@ -322,7 +319,7 @@ fn try_read_count(context: &mut ReadContext, leb_128: bool) -> Result Result<(Rc>, Rc>), BxesReadError> { +fn try_read_kv_pair(context: &mut ReadContext, leb_128: bool) -> Result<(Rc, Rc), BxesReadError> { let kv_index = try_read_count(context, leb_128)? as usize; let kv_pair = match context.metadata.kv_pairs.as_ref().unwrap().get(kv_index) { @@ -374,7 +371,7 @@ pub fn try_read_values(context: &mut ReadContext) -> Result<(), BxesReadError> { let values_count = try_read_u32(reader)?; for _ in 0..values_count { let value = try_read_bxes_value(context)?; - context.metadata.values.as_mut().unwrap().push(Rc::new(Box::new(value))); + context.metadata.values.as_mut().unwrap().push(Rc::new(value)); } Ok(()) @@ -392,7 +389,7 @@ fn try_read_bxes_value(context: &mut ReadContext) -> Result Ok(BxesValue::Float32(try_read_f32(reader)?)), TypeIds::F64 => Ok(BxesValue::Float64(try_read_f64(reader)?)), TypeIds::Bool => Ok(BxesValue::Bool(try_read_bool(reader)?)), - TypeIds::String => Ok(BxesValue::String(Rc::new(Box::new(try_read_string(reader)?)))), + TypeIds::String => Ok(BxesValue::String(Rc::new(try_read_string(reader)?))), TypeIds::Timestamp => Ok(BxesValue::Timestamp(try_read_i64(reader)?)), TypeIds::BrafLifecycle => Ok(BxesValue::BrafLifecycle(try_read_braf_lifecycle(reader)?)), TypeIds::StandardLifecycle => Ok(BxesValue::StandardLifecycle(try_read_standard_lifecycle(reader)?)), diff --git a/bxes/src/rust/bxes/src/writer/errors.rs b/bxes/src/rust/bxes/src/writer/errors.rs index 1d1f2ae2..7ba88cce 100644 --- a/bxes/src/rust/bxes/src/writer/errors.rs +++ b/bxes/src/rust/bxes/src/writer/errors.rs @@ -8,8 +8,8 @@ pub enum BxesWriteError { WriteError(BinaryError), FailedToGetWriterPosition(String), FailedToSeek(String), - FailedToFindKeyValueIndex((Rc>, Rc>)), - FailedToFindValueIndex(Rc>), + FailedToFindKeyValueIndex((Rc, Rc)), + FailedToFindValueIndex(Rc), FailedToCreateTempFile, FailedToCreateArchive, LebWriteError(String), diff --git a/bxes/src/rust/bxes/src/writer/write_context.rs b/bxes/src/rust/bxes/src/writer/write_context.rs index e8473213..3a4dae25 100644 --- a/bxes/src/rust/bxes/src/writer/write_context.rs +++ b/bxes/src/rust/bxes/src/writer/write_context.rs @@ -10,8 +10,8 @@ use crate::{ }; pub struct BxesWriteContext<'b> { - pub values_indices: Rc>, usize>>>, - pub kv_indices: Rc>, Rc>), usize>>>, + pub values_indices: Rc, usize>>>, + pub kv_indices: Rc, Rc), usize>>>, pub writer: Option<&'b mut BinaryWriter<'b>>, pub value_attributes: Option>, pub value_attributes_set: Option>, diff --git a/bxes/src/rust/bxes/src/writer/writer_utils.rs b/bxes/src/rust/bxes/src/writer/writer_utils.rs index eb4d41be..a8ec1ffc 100644 --- a/bxes/src/rust/bxes/src/writer/writer_utils.rs +++ b/bxes/src/rust/bxes/src/writer/writer_utils.rs @@ -114,7 +114,7 @@ fn try_write_event_default_attributes( for (key, value) in attributes { let should_write = if let Some(set) = context.borrow().value_attributes_set.as_ref() { let desc = ValueAttributeDescriptor { - name: string_or_err(key).ok().unwrap().as_ref().as_ref().clone(), + name: string_or_err(key).ok().unwrap().as_ref().clone(), type_id: get_type_id(value), }; @@ -140,8 +140,8 @@ fn try_write_event_value_attributes(event: &BxesEvent, context: Rc(writer: &mut BinaryWriter, value: u32) -> Result<() pub fn try_write_properties( context: Rc>, - properties: Option<&Vec<(Rc>, Rc>)>>, + properties: Option<&Vec<(Rc, Rc)>>, ) -> Result<(), BxesWriteError> { write_collection_and_count(context.clone(), false, count(properties), || { if let Some(properties) = properties { @@ -251,7 +251,7 @@ pub fn try_write_globals(context: Rc>, globals: Option pub fn try_write_kv_index( context: Rc>, - kv: &(Rc>, Rc>), + kv: &(Rc, Rc), write_leb_128: bool, ) -> Result<(), BxesWriteError> { if !context.borrow().kv_indices.borrow().contains_key(kv) { @@ -303,7 +303,7 @@ pub fn try_write_classifiers( }) } -fn try_write_value_index(context: Rc>, value: Rc>) -> Result<(), BxesWriteError> { +fn try_write_value_index(context: Rc>, value: Rc) -> Result<(), BxesWriteError> { let exists = context.borrow().values_indices.borrow().contains_key(&value); if !exists { @@ -317,7 +317,7 @@ fn try_write_value_index(context: Rc>, value: Rc>, - attributes: Option<&Vec<(Rc>, Rc>)>>, + attributes: Option<&Vec<(Rc, Rc)>>, write_leb_128_count: bool, ) -> Result<(), BxesWriteError> { write_collection_and_count(context.clone(), write_leb_128_count, count(attributes), || { @@ -365,8 +365,8 @@ pub fn try_write_key_values(log: &BxesEventLog, context: Rc { - Value(&'a Rc>), - KeyValue((&'a Rc>, &'a Rc>)), + Value(&'a Rc), + KeyValue((&'a Rc, &'a Rc)), } fn execute_with_kv_pairs<'a>( @@ -416,7 +416,7 @@ fn execute_with_kv_pairs<'a>( } fn execute_with_attributes_kv_pairs<'a>( - attributes: &'a Vec<(Rc>, Rc>)>, + attributes: &'a Vec<(Rc, Rc)>, action: &mut impl FnMut(ValueOrKeyValue<'a>) -> Result<(), BxesWriteError>, ) -> Result<(), BxesWriteError> { for (key, value) in attributes { @@ -497,12 +497,12 @@ fn try_tell_pos(writer: &mut BinaryWriter) -> Result { } } -pub fn try_write_value_if_not_present(value: &Rc>, context: &mut BxesWriteContext) -> Result { +pub fn try_write_value_if_not_present(value: &Rc, context: &mut BxesWriteContext) -> Result { if context.values_indices.borrow().contains_key(value) { return Ok(false); } - try_write_value(context, value.as_ref().as_ref())?; + try_write_value(context, value.as_ref())?; let len = context.values_indices.borrow().len(); context.values_indices.borrow_mut().insert(value.clone(), len); @@ -571,7 +571,7 @@ pub fn try_write_artifact(context: &mut BxesWriteContext, artifact: &BxesArtifac Ok(()) } -fn get_index(value: &Rc>, context: &mut BxesWriteContext) -> Result { +fn get_index(value: &Rc, context: &mut BxesWriteContext) -> Result { if let Some(index) = context.values_indices.borrow().get(value) { return Ok(*index as u32); } @@ -579,7 +579,7 @@ fn get_index(value: &Rc>, context: &mut BxesWriteContext) -> Resu Err(BxesWriteError::FailedToFindValueIndex(value.clone())) } -fn get_or_write_value_index(value: &Rc>, context: &mut BxesWriteContext) -> Result { +fn get_or_write_value_index(value: &Rc, context: &mut BxesWriteContext) -> Result { try_write_value_if_not_present(value, context)?; let index = *context.values_indices.borrow().get(value).unwrap() as u32; diff --git a/bxes/src/rust/bxes/tests/test_core/random_log.rs b/bxes/src/rust/bxes/tests/test_core/random_log.rs index 6d48a6fc..9afe4017 100644 --- a/bxes/src/rust/bxes/tests/test_core/random_log.rs +++ b/bxes/src/rust/bxes/tests/test_core/random_log.rs @@ -55,7 +55,7 @@ pub fn generate_random_system_metadata(rng: &mut ThreadRng, log: &BxesEventLog) continue; } - descriptors.insert(key, get_type_id(random_attr.1.as_ref().as_ref())); + descriptors.insert(key, get_type_id(random_attr.1.as_ref())); index += 1; } } @@ -65,7 +65,7 @@ pub fn generate_random_system_metadata(rng: &mut ThreadRng, log: &BxesEventLog) descriptors .iter() .map(|pair| ValueAttributeDescriptor { - name: pair.0.as_ref().as_ref().to_owned(), + name: pair.0.as_ref().to_owned(), type_id: pair.1.clone(), }) .collect(), @@ -165,11 +165,11 @@ fn generate_random_event(rng: &mut ThreadRng) -> BxesEvent { } } -fn generate_random_attributes(rng: &mut ThreadRng) -> Vec<(Rc>, Rc>)> { +fn generate_random_attributes(rng: &mut ThreadRng) -> Vec<(Rc, Rc)> { generate_random_list(rng, |rng| generate_random_attribute(rng)) } -fn generate_random_attributes_option(rng: &mut ThreadRng) -> Option>, Rc>)>> { +fn generate_random_attributes_option(rng: &mut ThreadRng) -> Option, Rc)>> { if rng.random_bool(0.8) { Some(generate_random_attributes(rng)) } else { @@ -177,12 +177,12 @@ fn generate_random_attributes_option(rng: &mut ThreadRng) -> Option (Rc>, Rc>) { +fn generate_random_attribute(rng: &mut ThreadRng) -> (Rc, Rc) { (generate_random_string_bxes_value(rng), generate_random_bxes_value(rng)) } -fn generate_random_string_bxes_value(rng: &mut ThreadRng) -> Rc> { - Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(generate_random_string(rng)))))) +fn generate_random_string_bxes_value(rng: &mut ThreadRng) -> Rc { + Rc::new(BxesValue::String(Rc::new(generate_random_string(rng)))) } fn generate_random_string(rng: &mut ThreadRng) -> String { @@ -190,8 +190,8 @@ fn generate_random_string(rng: &mut ThreadRng) -> String { rng.sample_iter(&Alphanumeric).take(length).map(char::from).collect() } -fn generate_random_bxes_value(rng: &mut ThreadRng) -> Rc> { - Rc::new(Box::new(match generate_random_type_id(rng) { +fn generate_random_bxes_value(rng: &mut ThreadRng) -> Rc { + Rc::new(match generate_random_type_id(rng) { TypeIds::Null => BxesValue::Int32(rng.random()), TypeIds::I32 => BxesValue::Int32(rng.random()), TypeIds::I64 => BxesValue::Int64(rng.random()), @@ -200,7 +200,7 @@ fn generate_random_bxes_value(rng: &mut ThreadRng) -> Rc> { TypeIds::F32 => BxesValue::Float32(rng.random()), TypeIds::F64 => BxesValue::Float64(rng.random()), TypeIds::Bool => BxesValue::Bool(rng.random()), - TypeIds::String => BxesValue::String(Rc::new(Box::new(generate_random_string(rng)))), + TypeIds::String => BxesValue::String(Rc::new(generate_random_string(rng))), TypeIds::Timestamp => BxesValue::Timestamp(rng.random()), TypeIds::BrafLifecycle => BxesValue::BrafLifecycle(generate_random_braf_lifecycle()), TypeIds::StandardLifecycle => BxesValue::StandardLifecycle(generate_random_standard_lifecycle()), @@ -208,7 +208,7 @@ fn generate_random_bxes_value(rng: &mut ThreadRng) -> Rc> { TypeIds::SoftwareEventType => BxesValue::SoftwareEventType(generate_random_enum::(SoftwareEventType::VARIANT_COUNT)), TypeIds::Artifact => generate_random_artifact(rng), TypeIds::Drivers => generate_random_drivers(rng), - })) + }) } fn generate_random_type_id(rng: &mut ThreadRng) -> TypeIds { @@ -229,8 +229,8 @@ fn generate_random_drivers(rng: &mut ThreadRng) -> BxesValue { fn generate_random_driver(rng: &mut ThreadRng) -> BxesDriver { BxesDriver { amount: BxesValue::Float64(rng.random()), - name: Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(generate_random_string(rng)))))), - driver_type: Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(generate_random_string(rng)))))), + name: Rc::new(BxesValue::String(Rc::new(generate_random_string(rng)))), + driver_type: Rc::new(BxesValue::String(Rc::new(generate_random_string(rng)))), } } @@ -247,9 +247,9 @@ fn generate_random_artifact(rng: &mut ThreadRng) -> BxesValue { fn generate_random_artifact_item(rng: &mut ThreadRng) -> BxesArtifactItem { BxesArtifactItem { - model: Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(generate_random_string(rng)))))), - instance: Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(generate_random_string(rng)))))), - transition: Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(generate_random_string(rng)))))), + model: Rc::new(BxesValue::String(Rc::new(generate_random_string(rng)))), + instance: Rc::new(BxesValue::String(Rc::new(generate_random_string(rng)))), + transition: Rc::new(BxesValue::String(Rc::new(generate_random_string(rng)))), } } diff --git a/bxes/src/rust/bxes_kafka/src/consumer/bxes_kafka_consumer.rs b/bxes/src/rust/bxes_kafka/src/consumer/bxes_kafka_consumer.rs index 43a613d5..5130908d 100644 --- a/bxes/src/rust/bxes_kafka/src/consumer/bxes_kafka_consumer.rs +++ b/bxes/src/rust/bxes_kafka/src/consumer/bxes_kafka_consumer.rs @@ -41,12 +41,12 @@ impl BxesKafkaConsumer { #[derive(Debug, Clone)] pub struct BxesKafkaTrace { - metadata: HashMap>>, + metadata: HashMap>, events: Vec, } impl BxesKafkaTrace { - pub fn metadata(&self) -> &HashMap>> { + pub fn metadata(&self) -> &HashMap> { &self.metadata } @@ -135,16 +135,14 @@ impl BxesKafkaConsumer { Ok(BxesKafkaTrace { metadata, events }) } - fn create_trace_metadata( - metadata: Vec<(Rc>, Rc>)>, - ) -> Result>>, BxesReadError> { + fn create_trace_metadata(metadata: Vec<(Rc, Rc)>) -> Result>, BxesReadError> { let mut new_metadata = HashMap::new(); for (key, value) in metadata { - if let BxesValue::String(key) = key.as_ref().as_ref() { - new_metadata.insert(key.as_ref().as_ref().to_owned(), value); + if let BxesValue::String(key) = key.as_ref() { + new_metadata.insert(key.as_ref().to_owned(), value); } else { - return Err(BxesReadError::ExpectedString(key.as_ref().as_ref().to_owned())); + return Err(BxesReadError::ExpectedString(key.as_ref().to_owned())); } } From 0b83428eba231c640e02fcaecebaf25eff83efbd Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Fri, 27 Feb 2026 21:27:05 +0300 Subject: [PATCH 06/30] Rc> -> Rc<...> --- .../event_log/bxes/bxes_to_xes_converter.rs | 12 ++-- .../ficus/src/event_log/bxes/conversions.rs | 10 +-- .../event_log/bxes/xes_to_bxes_converter.rs | 26 ++++---- .../ficus/src/event_log/core/event/event.rs | 4 +- .../src/event_log/core/event/event_base.rs | 4 +- .../ficus/src/event_log/xes/reader/utils.rs | 2 +- .../xes/reader/xes_log_trace_reader.rs | 6 +- .../rust/ficus/src/event_log/xes/xes_event.rs | 8 +-- .../analysis/patterns/activity_instances.rs | 2 +- .../features/analysis/patterns/repeat_sets.rs | 10 +-- .../analysis/patterns/strict_loops.rs | 2 +- .../activities/activities_common.rs | 6 +- .../features/clustering/activities/dbscan.rs | 2 +- .../features/clustering/activities/k_means.rs | 4 +- .../features/clustering/activities/merging.rs | 2 +- .../discovery/ocel/graph_annotation.rs | 2 +- .../discovery/timeline/abstraction.rs | 2 +- .../ficus/src/pipelines/activities_parts.rs | 2 +- .../rust/ficus/src/pipelines/clustering.rs | 2 +- .../rust/ficus/src/pipelines/drawing_parts.rs | 8 +-- .../ficus/src/pipelines/multithreading.rs | 2 +- Ficus/src/rust/ficus/src/utils/references.rs | 8 +-- .../tests/software_data/extractors_tests.rs | 66 +++++++++---------- .../rust/ficus_backend/src/grpc/converters.rs | 4 +- .../src/grpc/kafka/streaming/processors.rs | 28 ++++---- .../kafka/streaming/t2/dfg_data_structures.rs | 2 +- 26 files changed, 113 insertions(+), 113 deletions(-) diff --git a/Ficus/src/rust/ficus/src/event_log/bxes/bxes_to_xes_converter.rs b/Ficus/src/rust/ficus/src/event_log/bxes/bxes_to_xes_converter.rs index 2bbd551f..dba61d7c 100644 --- a/Ficus/src/rust/ficus/src/event_log/bxes/bxes_to_xes_converter.rs +++ b/Ficus/src/rust/ficus/src/event_log/bxes/bxes_to_xes_converter.rs @@ -154,7 +154,7 @@ fn set_globals(xes_log: &mut XesEventLogImpl, log: &BxesEventLog) -> Result<(), Ok(()) } -fn vector_of_strings_or_err(values: &Vec>>, entity_name: &str) -> Result, BxesToXesReadError> { +fn vector_of_strings_or_err(values: &Vec>, entity_name: &str) -> Result, BxesToXesReadError> { let mut result = vec![]; for value in values { result.push(string_or_err(value, entity_name)?) @@ -165,14 +165,14 @@ fn vector_of_strings_or_err(values: &Vec>>, entity_name: &str) fn string_or_err(value: &BxesValue, entity_name: &str) -> Result { if let BxesValue::String(string) = value { - Ok(string.as_ref().as_ref().to_owned()) + Ok(string.as_ref().to_owned()) } else { Err(BxesToXesReadError::ConversionError(format!("{} key was not a string", entity_name))) } } fn create_xes_event(bxes_event: &BxesEvent) -> Result { - let name = if let BxesValue::String(string) = bxes_event.name.as_ref().as_ref() { + let name = if let BxesValue::String(string) = bxes_event.name.as_ref() { string.clone() } else { let message = format!("The name of event was not a string: {:?}", bxes_event.name); @@ -186,14 +186,14 @@ fn create_xes_event(bxes_event: &BxesEvent) -> Result>, Rc>)>>, + attributes: Option<&Vec<(Rc, Rc)>>, ) -> Result>, BxesToXesReadError> { if let Some(attributes) = attributes { let mut payload = HashMap::new(); for (key, value) in attributes { - let key = if let BxesValue::String(string) = key.as_ref().as_ref() { - string.as_ref().as_ref().to_owned() + let key = if let BxesValue::String(string) = key.as_ref() { + string.as_ref().to_owned() } else { let message = format!("The attribute key is not a string: {:?}", key); return Err(BxesToXesReadError::ConversionError(message)); diff --git a/Ficus/src/rust/ficus/src/event_log/bxes/conversions.rs b/Ficus/src/rust/ficus/src/event_log/bxes/conversions.rs index 40203312..4823a1c1 100644 --- a/Ficus/src/rust/ficus/src/event_log/bxes/conversions.rs +++ b/Ficus/src/rust/ficus/src/event_log/bxes/conversions.rs @@ -107,9 +107,9 @@ pub(super) fn payload_value_to_bxes_value(value: &EventPayloadValue) -> BxesValu .items .iter() .map(|a| BxesArtifactItem { - instance: Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(a.instance.clone()))))), - model: Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(a.model.clone()))))), - transition: Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(a.transition.clone()))))), + instance: Rc::new(BxesValue::String(Rc::new(a.instance.clone()))), + model: Rc::new(BxesValue::String(Rc::new(a.model.clone()))), + transition: Rc::new(BxesValue::String(Rc::new(a.transition.clone()))), }) .collect(), }), @@ -119,8 +119,8 @@ pub(super) fn payload_value_to_bxes_value(value: &EventPayloadValue) -> BxesValu .iter() .map(|d| BxesDriver { amount: BxesValue::Float64(d.amount), - driver_type: Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(d.driver_type.clone()))))), - name: Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(d.name.clone()))))), + driver_type: Rc::new(BxesValue::String(Rc::new(d.driver_type.clone()))), + name: Rc::new(BxesValue::String(Rc::new(d.name.clone()))), }) .collect(), }), diff --git a/Ficus/src/rust/ficus/src/event_log/bxes/xes_to_bxes_converter.rs b/Ficus/src/rust/ficus/src/event_log/bxes/xes_to_bxes_converter.rs index 0f3d5019..46eaef95 100644 --- a/Ficus/src/rust/ficus/src/event_log/bxes/xes_to_bxes_converter.rs +++ b/Ficus/src/rust/ficus/src/event_log/bxes/xes_to_bxes_converter.rs @@ -98,7 +98,7 @@ fn create_bxes_traces(log: &XesEventLogImpl) -> Vec { fn create_bxes_event(log: &XesEventLogImpl, event: &XesEventImpl) -> BxesEvent { BxesEvent { - name: Rc::new(Box::new(BxesValue::String(event.name_pointer().clone()))), + name: Rc::new(BxesValue::String(event.name_pointer().clone())), timestamp: event.timestamp().timestamp_nanos_opt().expect("timestamp_nanos_opt"), attributes: Some( event @@ -131,9 +131,9 @@ fn create_bxes_classifiers(log: &XesEventLogImpl) -> Vec { keys: c .keys .iter() - .map(|x| Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(x.to_owned())))))) + .map(|x| Rc::new(BxesValue::String(Rc::new(x.to_owned())))) .collect(), - name: Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(c.name.to_owned()))))), + name: Rc::new(BxesValue::String(Rc::new(c.name.to_owned()))), }) .collect() } @@ -144,9 +144,9 @@ fn create_bxes_extensions(log: &XesEventLogImpl) -> Vec { fn convert_to_bxes_extension(e: &XesEventLogExtension) -> BxesExtension { BxesExtension { - name: Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(e.name.to_owned()))))), - prefix: Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(e.prefix.to_owned()))))), - uri: Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(e.uri.to_owned()))))), + name: Rc::new(BxesValue::String(Rc::new(e.name.to_owned()))), + prefix: Rc::new(BxesValue::String(Rc::new(e.prefix.to_owned()))), + uri: Rc::new(BxesValue::String(Rc::new(e.uri.to_owned()))), } } @@ -162,14 +162,14 @@ fn create_bxes_globals(log: &XesEventLogImpl) -> Result, XesToBx Ok(globals) } -fn convert_to_bxes_global_attribute(kv: &(&String, &EventPayloadValue)) -> (Rc>, Rc>) { - let key = Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(kv.0.to_owned()))))); - let value = Rc::new(Box::new(payload_value_to_bxes_value(kv.1))); +fn convert_to_bxes_global_attribute(kv: &(&String, &EventPayloadValue)) -> (Rc, Rc) { + let key = Rc::new(BxesValue::String(Rc::new(kv.0.to_owned()))); + let value = Rc::new(payload_value_to_bxes_value(kv.1)); (key, value) } -fn create_bxes_properties(log: &XesEventLogImpl) -> Vec<(Rc>, Rc>)> { +fn create_bxes_properties(log: &XesEventLogImpl) -> Vec<(Rc, Rc)> { log .properties_map() .iter() @@ -177,9 +177,9 @@ fn create_bxes_properties(log: &XesEventLogImpl) -> Vec<(Rc>, Rc< .collect() } -fn kv_pair_to_bxes_pair(kv: &(&String, &EventPayloadValue)) -> (Rc>, Rc>) { +fn kv_pair_to_bxes_pair(kv: &(&String, &EventPayloadValue)) -> (Rc, Rc) { let bxes_value = payload_value_to_bxes_value(kv.1); - let key = Rc::new(Box::new(BxesValue::String(Rc::new(Box::new(kv.0.to_owned()))))); + let key = Rc::new(BxesValue::String(Rc::new(kv.0.to_owned()))); - (key, Rc::new(Box::new(bxes_value))) + (key, Rc::new(bxes_value)) } diff --git a/Ficus/src/rust/ficus/src/event_log/core/event/event.rs b/Ficus/src/rust/ficus/src/event_log/core/event/event.rs index 6de02267..68c21569 100644 --- a/Ficus/src/rust/ficus/src/event_log/core/event/event.rs +++ b/Ficus/src/rust/ficus/src/event_log/core/event/event.rs @@ -9,7 +9,7 @@ use std::{collections::HashMap, fmt::Debug, rc::Rc}; pub enum EventPayloadValue { Null, Date(DateTime), - String(Rc>), + String(Rc), Boolean(bool), Int32(i32), Int64(i64), @@ -89,7 +89,7 @@ pub trait Event: Clone + Debug + UserDataOwner { fn new_with_max_date(name: String) -> Self; fn name(&self) -> &String; - fn name_pointer(&self) -> &Rc>; + fn name_pointer(&self) -> &Rc; fn timestamp(&self) -> &DateTime; fn payload_map(&self) -> Option<&HashMap>; diff --git a/Ficus/src/rust/ficus/src/event_log/core/event/event_base.rs b/Ficus/src/rust/ficus/src/event_log/core/event/event_base.rs index bad338d0..48be25ef 100644 --- a/Ficus/src/rust/ficus/src/event_log/core/event/event_base.rs +++ b/Ficus/src/rust/ficus/src/event_log/core/event/event_base.rs @@ -6,13 +6,13 @@ use crate::utils::user_data::user_data::UserDataImpl; #[derive(Debug)] pub struct EventBase { - pub name: Rc>, + pub name: Rc, pub timestamp: DateTime, pub user_data: UserDataImpl, } impl EventBase { - pub fn new(name: Rc>, timestamp: DateTime) -> Self { + pub fn new(name: Rc, timestamp: DateTime) -> Self { Self { name, timestamp, diff --git a/Ficus/src/rust/ficus/src/event_log/xes/reader/utils.rs b/Ficus/src/rust/ficus/src/event_log/xes/reader/utils.rs index 617c3fd0..62e155cc 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/reader/utils.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/reader/utils.rs @@ -93,7 +93,7 @@ pub fn extract_payload_value(name: &[u8], key: &str, value: &str) -> Option None, Ok(float_value) => Some(EventPayloadValue::Float64(float_value)), }, - STRING_TAG_NAME => Some(EventPayloadValue::String(Rc::new(Box::new(value.to_owned())))), + STRING_TAG_NAME => Some(EventPayloadValue::String(Rc::new(value.to_owned()))), BOOLEAN_TAG_NAME => match value.parse::() { Err(_) => None, Ok(bool_value) => Some(EventPayloadValue::Boolean(bool_value)), diff --git a/Ficus/src/rust/ficus/src/event_log/xes/reader/xes_log_trace_reader.rs b/Ficus/src/rust/ficus/src/event_log/xes/reader/xes_log_trace_reader.rs index 7db482d1..3aa48898 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/reader/xes_log_trace_reader.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/reader/xes_log_trace_reader.rs @@ -89,7 +89,7 @@ impl<'a> TraceXesEventLogIterator<'a> { fn set_defaults_value( &self, - name: &mut Option>>, + name: &mut Option>, date: &mut Option>, payload: &mut HashMap, ) { @@ -107,7 +107,7 @@ impl<'a> TraceXesEventLogIterator<'a> { payload_type: &[u8], key: &str, value: &str, - name: &mut Option>>, + name: &mut Option>, date: &mut Option>, payload: &mut HashMap, globals: &HashMap>, @@ -132,7 +132,7 @@ impl<'a> TraceXesEventLogIterator<'a> { key: &str, payload_value: EventPayloadValue, date: &mut Option>, - name: &mut Option>>, + name: &mut Option>, payload: &mut HashMap, ) { match key { diff --git a/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs b/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs index 6f6ad671..290f460e 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs @@ -28,7 +28,7 @@ impl Debug for XesEventImpl { } impl XesEventImpl { - pub fn new_all_fields(name: Rc>, timestamp: DateTime, payload: Option>) -> Self { + pub fn new_all_fields(name: Rc, timestamp: DateTime, payload: Option>) -> Self { Self { event_base: EventBase::new(name, timestamp), payload, @@ -55,7 +55,7 @@ impl UserDataOwner for XesEventImpl { impl Event for XesEventImpl { fn new(name: String, timestamp: DateTime) -> Self { Self { - event_base: EventBase::new(Rc::new(Box::new(name)), timestamp), + event_base: EventBase::new(Rc::new(name), timestamp), payload: None, } } @@ -72,7 +72,7 @@ impl Event for XesEventImpl { &self.event_base.name } - fn name_pointer(&self) -> &Rc> { + fn name_pointer(&self) -> &Rc { &self.event_base.name } @@ -103,7 +103,7 @@ impl Event for XesEventImpl { } fn set_name(&mut self, new_name: String) { - self.event_base.name = Rc::new(Box::new(new_name)); + self.event_base.name = Rc::new(new_name); } fn set_timestamp(&mut self, new_timestamp: DateTime) { diff --git a/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs b/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs index 786db9cd..828e52f2 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs @@ -648,7 +648,7 @@ fn create_log_from_traces_activities( new_trace.push(Rc::new(RefCell::new(event.borrow().clone()))); } - let name = activity_info.node.borrow().name().as_ref().as_ref().to_owned(); + let name = activity_info.node.borrow().name().as_ref().to_owned(); if let Some(activity_log) = activities_to_logs.get_mut(&name) { activity_log.borrow_mut().push(Rc::clone(&new_trace_ptr)); } else { diff --git a/Ficus/src/rust/ficus/src/features/analysis/patterns/repeat_sets.rs b/Ficus/src/rust/ficus/src/features/analysis/patterns/repeat_sets.rs index fb19cf1e..2de8eb2c 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/patterns/repeat_sets.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/patterns/repeat_sets.rs @@ -79,7 +79,7 @@ pub fn build_repeat_sets(log: &[Vec], patterns: &[Vec] #[derive(Debug, Getters)] pub struct ActivityNode { #[getset(get = "pub")] - id: Rc>, + id: Rc, #[getset(get = "pub")] repeat_set: Option, #[getset(get = "pub")] @@ -89,7 +89,7 @@ pub struct ActivityNode { #[getset(get = "pub")] level: usize, #[getset(get = "pub")] - name: Rc>, + name: Rc, #[getset(get = "pub")] pattern_kind: UnderlyingPatternKind, } @@ -100,13 +100,13 @@ impl ActivityNode { event_classes: HashSet, children: Vec>>, level: usize, - name: Rc>, + name: Rc, pattern_kind: UnderlyingPatternKind, ) -> Self { static NEXT_ID: AtomicU64 = AtomicU64::new(0); Self { - id: Rc::new(Box::new(format!("Activity_{}", NEXT_ID.fetch_add(1, Ordering::SeqCst)))), + id: Rc::new(format!("Activity_{}", NEXT_ID.fetch_add(1, Ordering::SeqCst))), repeat_set, event_classes, children, @@ -158,7 +158,7 @@ where events_set, vec![], activity_level, - Rc::new(Box::new(name_creator(repeat_set))), + Rc::new(name_creator(repeat_set)), pattern_kind, ))) }; diff --git a/Ficus/src/rust/ficus/src/features/analysis/patterns/strict_loops.rs b/Ficus/src/rust/ficus/src/features/analysis/patterns/strict_loops.rs index 649f31d3..47c19e2d 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/patterns/strict_loops.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/patterns/strict_loops.rs @@ -86,7 +86,7 @@ fn create_strict_loop_activity_instance( HashSet::from_iter(hashed_trace[array.start_index..array.start_index + array.length].iter().copied()), vec![], 0, - Rc::new(Box::new(format!("Loop[{}]", name.join("::")))), + Rc::new(format!("Loop[{}]", name.join("::"))), UnderlyingPatternKind::StrictLoop, ))), array.start_index, diff --git a/Ficus/src/rust/ficus/src/features/clustering/activities/activities_common.rs b/Ficus/src/rust/ficus/src/features/clustering/activities/activities_common.rs index b2634f66..573bdf98 100644 --- a/Ficus/src/rust/ficus/src/features/clustering/activities/activities_common.rs +++ b/Ficus/src/rust/ficus/src/features/clustering/activities/activities_common.rs @@ -142,7 +142,7 @@ fn create_activities_repr_from_subtraces( .into_iter() .map(|x| { ( - x.0.as_ref().as_ref().to_owned(), + x.0.as_ref().to_owned(), (x.1.0, x.1.1.into_iter().map(|x| (x.0, x.1)).collect()), ) }) @@ -206,7 +206,7 @@ pub(super) fn create_dataset_from_activities_classes( let mut processed = HashMap::new(); for trace_activities in traces_activities.iter() { for activity in trace_activities { - if processed.contains_key(activity.node().borrow().name().as_ref().as_ref()) { + if processed.contains_key(activity.node().borrow().name().as_ref()) { continue; } @@ -242,7 +242,7 @@ pub(super) fn create_dataset_from_activities_classes( }; processed.insert( - activity.node().borrow().name().as_ref().as_ref().to_owned(), + activity.node().borrow().name().as_ref().to_owned(), ( activity.node().clone(), activity_event_classes.into_iter().map(|x| (x, 1)).collect(), diff --git a/Ficus/src/rust/ficus/src/features/clustering/activities/dbscan.rs b/Ficus/src/rust/ficus/src/features/clustering/activities/dbscan.rs index b17633bc..c6a56a47 100644 --- a/Ficus/src/rust/ficus/src/features/clustering/activities/dbscan.rs +++ b/Ficus/src/rust/ficus/src/features/clustering/activities/dbscan.rs @@ -31,7 +31,7 @@ pub fn clusterize_activities_dbscan( let ficus_dataset = transform_to_ficus_dataset( &dataset, - processed.iter().map(|x| x.0.borrow().name().as_ref().as_ref().to_owned()).collect(), + processed.iter().map(|x| x.0.borrow().name().as_ref().to_owned()).collect(), classes_names, ); diff --git a/Ficus/src/rust/ficus/src/features/clustering/activities/k_means.rs b/Ficus/src/rust/ficus/src/features/clustering/activities/k_means.rs index 7a3ea873..21dae786 100644 --- a/Ficus/src/rust/ficus/src/features/clustering/activities/k_means.rs +++ b/Ficus/src/rust/ficus/src/features/clustering/activities/k_means.rs @@ -58,7 +58,7 @@ fn create_labeled_dataset_from_k_means( ) -> LabeledDataset { let ficus_dataset = transform_to_ficus_dataset( dataset, - processed.iter().map(|x| x.0.borrow().name().as_ref().as_ref().to_owned()).collect(), + processed.iter().map(|x| x.0.borrow().name().as_ref().to_owned()).collect(), classes_names, ); @@ -113,7 +113,7 @@ pub fn clusterize_activities_k_means_grid_search(params: &mut ActivitiesClusteri let ficus_dataset = transform_to_ficus_dataset( &dataset, - processed.iter().map(|x| x.0.borrow().name().as_ref().as_ref().to_owned()).collect(), + processed.iter().map(|x| x.0.borrow().name().as_ref().to_owned()).collect(), classes_names, ); diff --git a/Ficus/src/rust/ficus/src/features/clustering/activities/merging.rs b/Ficus/src/rust/ficus/src/features/clustering/activities/merging.rs index d89549e0..a18ade06 100644 --- a/Ficus/src/rust/ficus/src/features/clustering/activities/merging.rs +++ b/Ficus/src/rust/ficus/src/features/clustering/activities/merging.rs @@ -73,7 +73,7 @@ pub(super) fn merge_activities( new_event_classes_set, vec![], *cluster_activities[0].borrow().level(), - Rc::new(Box::new(new_activity_name)), + Rc::new(new_activity_name), *cluster_activities.first().unwrap().borrow().pattern_kind(), ); diff --git a/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs b/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs index a060ae9f..312047fd 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs @@ -156,7 +156,7 @@ pub fn create_ocel_annotation_for_dag(graph: &DefaultGraph) -> Result return Err(error.into()), }; - let processed = processed.iter().map(|x| x.0.borrow().name().as_ref().as_ref().to_owned()).collect(); + let processed = processed.iter().map(|x| x.0.borrow().name().as_ref().to_owned()).collect(); let ficus_dataset = transform_to_ficus_dataset(&dataset, processed, classes); context.put_concrete(TRACES_ACTIVITIES_DATASET_KEY.key(), ficus_dataset); diff --git a/Ficus/src/rust/ficus/src/pipelines/drawing_parts.rs b/Ficus/src/rust/ficus/src/pipelines/drawing_parts.rs index b873e6d9..ff25de0f 100644 --- a/Ficus/src/rust/ficus/src/pipelines/drawing_parts.rs +++ b/Ficus/src/rust/ficus/src/pipelines/drawing_parts.rs @@ -137,8 +137,8 @@ impl PipelineParts { SubTraceKind::Attached(activity) => { let color = colors_holder.get_or_create(activity.node().borrow().name()); let name = activity.node().borrow().name().clone(); - if !mapping.contains_key(name.as_ref().as_ref()) { - mapping.insert(name.as_ref().as_ref().to_owned(), color); + if !mapping.contains_key(name.as_ref()) { + mapping.insert(name.as_ref().to_owned(), color); } let name = HeapedOrOwned::Heaped(name); @@ -180,8 +180,8 @@ impl PipelineParts { let color = colors_holder.get_or_create(activity.node().borrow().name()); let name = activity.node().borrow().name().to_owned(); - if !mapping.contains_key(activity.node().borrow().name().as_ref().as_ref()) { - mapping.insert(activity.node().borrow().name().as_ref().as_ref().to_owned(), color); + if !mapping.contains_key(activity.node().borrow().name().as_ref()) { + mapping.insert(activity.node().borrow().name().as_ref().to_owned(), color); } let name = HeapedOrOwned::Heaped(name); diff --git a/Ficus/src/rust/ficus/src/pipelines/multithreading.rs b/Ficus/src/rust/ficus/src/pipelines/multithreading.rs index b25a8eaf..8ec2ba2f 100644 --- a/Ficus/src/rust/ficus/src/pipelines/multithreading.rs +++ b/Ficus/src/rust/ficus/src/pipelines/multithreading.rs @@ -280,7 +280,7 @@ impl PipelineParts { && let Some(type_name) = map.get_mut(config.info().type_name_attr().as_str()) { let string = type_name.to_string_repr().to_string(); - *type_name = EventPayloadValue::String(Rc::new(Box::new(Self::shorten_type_or_method_name(string)))); + *type_name = EventPayloadValue::String(Rc::new(Self::shorten_type_or_method_name(string))); } } } diff --git a/Ficus/src/rust/ficus/src/utils/references.rs b/Ficus/src/rust/ficus/src/utils/references.rs index 60263a9e..d9ee73d5 100644 --- a/Ficus/src/rust/ficus/src/utils/references.rs +++ b/Ficus/src/rust/ficus/src/utils/references.rs @@ -23,7 +23,7 @@ impl<'a, T> Deref for ReferenceOrOwned<'a, T> { } pub enum HeapedOrOwned { - Heaped(Rc>), + Heaped(Rc), Owned(T), } @@ -44,7 +44,7 @@ impl<'a, T: Deserialize<'a>> Deserialize<'a> for HeapedOrOwned { where D: Deserializer<'a>, { - Ok(HeapedOrOwned::Heaped(Rc::new(Box::new(T::deserialize(deserializer)?)))) + Ok(HeapedOrOwned::Heaped(Rc::new(T::deserialize(deserializer)?))) } } @@ -53,7 +53,7 @@ pub fn owned(t: T) -> HeapedOrOwned { } pub fn heaped(t: T) -> HeapedOrOwned { - HeapedOrOwned::Heaped(Rc::new(Box::new(t))) + HeapedOrOwned::Heaped(Rc::new(t)) } impl Deref for HeapedOrOwned { @@ -61,7 +61,7 @@ impl Deref for HeapedOrOwned { fn deref(&self) -> &Self::Target { match self { - HeapedOrOwned::Heaped(ptr) => ptr.as_ref().as_ref(), + HeapedOrOwned::Heaped(ptr) => ptr.as_ref(), HeapedOrOwned::Owned(value) => value, } } diff --git a/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs b/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs index 64d8010e..be6eac76 100644 --- a/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs +++ b/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs @@ -35,7 +35,7 @@ fn test_general_histogram() { vec![ ( "type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + EventPayloadValue::String(Rc::new("type1".to_string())), ), ("count".to_string(), EventPayloadValue::Float64(123.)), ], @@ -45,7 +45,7 @@ fn test_general_histogram() { vec![ ( "type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type2".to_string()))), + EventPayloadValue::String(Rc::new("type2".to_string())), ), ("count".to_string(), EventPayloadValue::Float32(123.)), ], @@ -55,7 +55,7 @@ fn test_general_histogram() { vec![ ( "type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + EventPayloadValue::String(Rc::new("type1".to_string())), ), ("count".to_string(), EventPayloadValue::Uint64(123)), ], @@ -65,7 +65,7 @@ fn test_general_histogram() { vec![ ( "type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + EventPayloadValue::String(Rc::new("type1".to_string())), ), ("count".to_string(), EventPayloadValue::Uint32(123)), ], @@ -75,7 +75,7 @@ fn test_general_histogram() { vec![ ( "type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + EventPayloadValue::String(Rc::new("type1".to_string())), ), ("count".to_string(), EventPayloadValue::Int64(123)), ], @@ -85,7 +85,7 @@ fn test_general_histogram() { vec![ ( "type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type2".to_string()))), + EventPayloadValue::String(Rc::new("type2".to_string())), ), ("count".to_string(), EventPayloadValue::Int32(123)), ], @@ -144,7 +144,7 @@ fn test_simple_counter() { vec![ ( "type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + EventPayloadValue::String(Rc::new("type1".to_string())), ), ("count".to_string(), EventPayloadValue::Float64(123.)), ], @@ -154,7 +154,7 @@ fn test_simple_counter() { vec![ ( "type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type2".to_string()))), + EventPayloadValue::String(Rc::new("type2".to_string())), ), ("count".to_string(), EventPayloadValue::Float32(123.)), ], @@ -164,7 +164,7 @@ fn test_simple_counter() { vec![ ( "type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + EventPayloadValue::String(Rc::new("type1".to_string())), ), ("count".to_string(), EventPayloadValue::Uint64(123)), ], @@ -174,7 +174,7 @@ fn test_simple_counter() { vec![ ( "type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + EventPayloadValue::String(Rc::new("type1".to_string())), ), ("count".to_string(), EventPayloadValue::Uint32(123)), ], @@ -184,7 +184,7 @@ fn test_simple_counter() { vec![ ( "type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + EventPayloadValue::String(Rc::new("type1".to_string())), ), ("count".to_string(), EventPayloadValue::Int64(123)), ], @@ -194,7 +194,7 @@ fn test_simple_counter() { vec![ ( "type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type2".to_string()))), + EventPayloadValue::String(Rc::new("type2".to_string())), ), ("count".to_string(), EventPayloadValue::Int32(123)), ], @@ -246,7 +246,7 @@ fn test_activities_duration() { vec![ ( "activity_id".to_string(), - EventPayloadValue::String(Rc::new(Box::new("1".to_string()))), + EventPayloadValue::String(Rc::new("1".to_string())), ), ("stamp".to_string(), EventPayloadValue::Int64(100)), ], @@ -256,7 +256,7 @@ fn test_activities_duration() { vec![ ( "activity_id".to_string(), - EventPayloadValue::String(Rc::new(Box::new("1".to_string()))), + EventPayloadValue::String(Rc::new("1".to_string())), ), ("stamp".to_string(), EventPayloadValue::Int64(200)), ], @@ -267,7 +267,7 @@ fn test_activities_duration() { vec![ ( "activity_id".to_string(), - EventPayloadValue::String(Rc::new(Box::new("2".to_string()))), + EventPayloadValue::String(Rc::new("2".to_string())), ), ("stamp".to_string(), EventPayloadValue::Int64(300)), ], @@ -333,7 +333,7 @@ fn test_activities_duration_2() { vec![ ( "activity_id".to_string(), - EventPayloadValue::String(Rc::new(Box::new("2".to_string()))), + EventPayloadValue::String(Rc::new("2".to_string())), ), ("stamp".to_string(), EventPayloadValue::Int64(50)), ], @@ -366,11 +366,11 @@ pub fn test_ocel_data_extraction() { vec![ ( "object_type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + EventPayloadValue::String(Rc::new("type1".to_string())), ), ( "object_id".to_string(), - EventPayloadValue::String(Rc::new(Box::new("id_1".to_string()))), + EventPayloadValue::String(Rc::new("id_1".to_string())), ), ], ), @@ -379,11 +379,11 @@ pub fn test_ocel_data_extraction() { vec![ ( "object_type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + EventPayloadValue::String(Rc::new("type1".to_string())), ), ( "object_id".to_string(), - EventPayloadValue::String(Rc::new(Box::new("id_2".to_string()))), + EventPayloadValue::String(Rc::new("id_2".to_string())), ), ], ), @@ -392,11 +392,11 @@ pub fn test_ocel_data_extraction() { vec![ ( "object_type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + EventPayloadValue::String(Rc::new("type1".to_string())), ), ( "object_id".to_string(), - EventPayloadValue::String(Rc::new(Box::new("id_3".to_string()))), + EventPayloadValue::String(Rc::new("id_3".to_string())), ), ], ), @@ -405,11 +405,11 @@ pub fn test_ocel_data_extraction() { vec![ ( "object_type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + EventPayloadValue::String(Rc::new("type1".to_string())), ), ( "object_id".to_string(), - EventPayloadValue::String(Rc::new(Box::new("id_2123123".to_string()))), + EventPayloadValue::String(Rc::new("id_2123123".to_string())), ), ], ), @@ -418,19 +418,19 @@ pub fn test_ocel_data_extraction() { vec![ ( "object_type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + EventPayloadValue::String(Rc::new("type1".to_string())), ), ( "object_id".to_string(), - EventPayloadValue::String(Rc::new(Box::new("id_2".to_string()))), + EventPayloadValue::String(Rc::new("id_2".to_string())), ), ( "ocel_related_objects_ids".to_string(), - EventPayloadValue::String(Rc::new(Box::new("1 2 3 4 5".to_string()))), + EventPayloadValue::String(Rc::new("1 2 3 4 5".to_string())), ), ( "ocel_related_objects_types".to_string(), - EventPayloadValue::String(Rc::new(Box::new("T1 T2 T3 T4 T5".to_string()))), + EventPayloadValue::String(Rc::new("T1 T2 T3 T4 T5".to_string())), ), ], ), @@ -439,19 +439,19 @@ pub fn test_ocel_data_extraction() { vec![ ( "object_type".to_string(), - EventPayloadValue::String(Rc::new(Box::new("type1".to_string()))), + EventPayloadValue::String(Rc::new("type1".to_string())), ), ( "object_id".to_string(), - EventPayloadValue::String(Rc::new(Box::new("id_2".to_string()))), + EventPayloadValue::String(Rc::new("id_2".to_string())), ), ( "ocel_action".to_string(), - EventPayloadValue::String(Rc::new(Box::new("AllocateMerged".to_string()))), + EventPayloadValue::String(Rc::new("AllocateMerged".to_string())), ), ( "ocel_related_objects_ids".to_string(), - EventPayloadValue::String(Rc::new(Box::new("1 2 3 4 5".to_string()))), + EventPayloadValue::String(Rc::new("1 2 3 4 5".to_string())), ), ], ), @@ -494,7 +494,7 @@ pub fn test_ocel_data_extraction() { fn create_event_with_attributes(name: String, attributes: Vec<(String, EventPayloadValue)>) -> Rc> { Rc::new(RefCell::new(XesEventImpl::new_all_fields( - Rc::new(Box::new(name)), + Rc::new(name), Utc::now(), Some(attributes.into_iter().collect()), ))) diff --git a/Ficus/src/rust/ficus_backend/src/grpc/converters.rs b/Ficus/src/rust/ficus_backend/src/grpc/converters.rs index 154132a9..c6e29029 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/converters.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/converters.rs @@ -231,7 +231,7 @@ pub(super) fn put_into_user_data( fn convert_grpc_event_attribute_to_xes_event_payload_value(attribute_value: &grpc_event_attribute::Value) -> EventPayloadValue { match attribute_value { grpc_event_attribute::Value::Int(v) => EventPayloadValue::Int64(*v), - grpc_event_attribute::Value::String(v) => EventPayloadValue::String(Rc::new(Box::new(v.to_owned()))), + grpc_event_attribute::Value::String(v) => EventPayloadValue::String(Rc::new(v.to_owned())), grpc_event_attribute::Value::Bool(v) => EventPayloadValue::Boolean(*v), grpc_event_attribute::Value::Double(v) => EventPayloadValue::Float64(*v), grpc_event_attribute::Value::Guid(v) => EventPayloadValue::Guid(Uuid::parse_str(v.guid.as_str()).unwrap()), @@ -873,7 +873,7 @@ fn convert_to_grpc_attribute_value(value: &EventPayloadValue) -> Option Some(grpc_event_attribute::Value::Null(())), EventPayloadValue::Date(date) => Some(grpc_event_attribute::Value::Stamp(convert_to_grpc_timestamp(date))), - EventPayloadValue::String(string) => Some(grpc_event_attribute::Value::String(string.as_ref().as_ref().to_owned())), + EventPayloadValue::String(string) => Some(grpc_event_attribute::Value::String(string.as_ref().to_owned())), EventPayloadValue::Boolean(bool) => Some(grpc_event_attribute::Value::Bool(bool.to_owned())), EventPayloadValue::Int32(int) => Some(grpc_event_attribute::Value::Int(*int as i64)), EventPayloadValue::Int64(int) => Some(grpc_event_attribute::Value::Int(*int)), diff --git a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/processors.rs b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/processors.rs index 99e8c19e..5e77b113 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/processors.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/processors.rs @@ -49,7 +49,7 @@ pub(in crate::grpc::kafka::streaming) struct ProcessMetadata { } impl ProcessMetadata { - pub fn create_from(metadata: &HashMap>>) -> Result { + pub fn create_from(metadata: &HashMap>) -> Result { let process_name = string_value_or_err(metadata, KAFKA_PROCESS_NAME)?; Ok(Self { process_name }) @@ -64,7 +64,7 @@ pub(in crate::grpc::kafka::streaming) struct CaseMetadata { } impl CaseMetadata { - pub fn create_from(metadata: &HashMap>>) -> Result { + pub fn create_from(metadata: &HashMap>) -> Result { let case_id = uuid_or_err(metadata, KAFKA_CASE_ID)?; let case_name_parts_joined = string_value_or_err(metadata, KAFKA_CASE_NAME_PARTS)?; let case_display_name = string_value_or_err(metadata, KAFKA_CASE_DISPLAY_NAME)?; @@ -89,7 +89,7 @@ pub(in crate::grpc::kafka::streaming) struct ExtractedTraceMetadata { } impl ExtractedTraceMetadata { - pub fn create_from(metadata: &HashMap>>) -> Result { + pub fn create_from(metadata: &HashMap>) -> Result { Ok(ExtractedTraceMetadata { process: ProcessMetadata::create_from(metadata)?, case: CaseMetadata::create_from(metadata)?, @@ -99,7 +99,7 @@ impl ExtractedTraceMetadata { } fn add_system_metadata( - metadata: &HashMap>>, + metadata: &HashMap>, context: &mut PipelineContext, ) -> Result<(), XesFromBxesKafkaTraceCreatingError> { let metadata = ExtractedTraceMetadata::create_from(metadata)?; @@ -118,22 +118,22 @@ fn add_system_metadata( } pub(in crate::grpc::kafka::streaming) fn string_value_or_err( - metadata: &HashMap>>, + metadata: &HashMap>, key_name: &str, ) -> Result { let value = value_or_err(metadata, key_name)?; - if let BxesValue::String(process_name) = value.as_ref().as_ref() { - Ok(process_name.as_ref().as_ref().to_owned()) + if let BxesValue::String(process_name) = value.as_ref() { + Ok(process_name.as_ref().to_owned()) } else { Err(XesFromBxesKafkaTraceCreatingError::MetadataValueIsNotAString(key_name.to_string())) } } pub(in crate::grpc::kafka::streaming) fn value_or_err( - metadata: &HashMap>>, + metadata: &HashMap>, key: &str, -) -> Result>, XesFromBxesKafkaTraceCreatingError> { +) -> Result, XesFromBxesKafkaTraceCreatingError> { if let Some(value) = metadata.get(key) { Ok(value.clone()) } else { @@ -142,11 +142,11 @@ pub(in crate::grpc::kafka::streaming) fn value_or_err( } pub(in crate::grpc::kafka::streaming) fn uuid_or_err( - metadata: &HashMap>>, + metadata: &HashMap>, key: &str, ) -> Result { let value = value_or_err(metadata, key)?; - if let BxesValue::Guid(id) = value.as_ref().as_ref() { + if let BxesValue::Guid(id) = value.as_ref() { Ok(*id) } else { Err(XesFromBxesKafkaTraceCreatingError::TraceIdIsNotUuid) @@ -154,15 +154,15 @@ pub(in crate::grpc::kafka::streaming) fn uuid_or_err( } pub(in crate::grpc::kafka::streaming) fn metadata_to_string_string_pairs( - metadata: &HashMap>>, + metadata: &HashMap>, ) -> Vec<(String, String)> { metadata .iter() .filter_map(|pair| { if pair.0 == KAFKA_CASE_NAME_PARTS || pair.0 == KAFKA_CASE_DISPLAY_NAME || pair.0 == KAFKA_PROCESS_NAME { None - } else if let BxesValue::String(value) = pair.1.as_ref().as_ref() { - Some((pair.0.to_owned(), value.as_ref().as_ref().to_owned())) + } else if let BxesValue::String(value) = pair.1.as_ref() { + Some((pair.0.to_owned(), value.as_ref().to_owned())) } else { None } diff --git a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t2/dfg_data_structures.rs b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t2/dfg_data_structures.rs index 3b0a13df..ec682f94 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t2/dfg_data_structures.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t2/dfg_data_structures.rs @@ -164,7 +164,7 @@ impl DfgDataStructures { impl DfgDataStructures { pub fn process_bxes_trace( &mut self, - metadata: &HashMap>>, + metadata: &HashMap>, xes_trace: &XesTraceImpl, context: &mut PipelineContext, ) -> Result<(), XesFromBxesKafkaTraceCreatingError> { From 7d8d71dfeb1e1604febac306704f2c830ed2fbe8 Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Fri, 27 Feb 2026 21:54:13 +0300 Subject: [PATCH 07/30] Update rdkafka version --- Ficus/src/rust/Cargo.lock | 469 ++++++++++++++++++++---- Ficus/src/rust/ficus_backend/Cargo.toml | 2 +- 2 files changed, 392 insertions(+), 79 deletions(-) diff --git a/Ficus/src/rust/Cargo.lock b/Ficus/src/rust/Cargo.lock index 1a11f5b2..81fc77aa 100644 --- a/Ficus/src/rust/Cargo.lock +++ b/Ficus/src/rust/Cargo.lock @@ -16,7 +16,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", "cipher", - "cpufeatures", + "cpufeatures 0.2.17", ] [[package]] @@ -179,12 +179,6 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" -[[package]] -name = "base64ct" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e050f626429857a27ddccb31e0aca21356bfa709c04041aefddac081a8f068a" - [[package]] name = "bit-set" version = "0.5.3" @@ -235,9 +229,9 @@ dependencies = [ "num 0.4.3", "num-derive", "num-traits", - "rand 0.8.5", + "rand 0.10.0", "tempfile", - "thiserror", + "thiserror 2.0.18", "uuid", "variant_count", "zip", @@ -254,12 +248,6 @@ dependencies = [ "uuid", ] -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - [[package]] name = "bytes" version = "1.11.0" @@ -268,22 +256,11 @@ checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" [[package]] name = "bzip2" -version = "0.4.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c" dependencies = [ - "bzip2-sys", - "libc", -] - -[[package]] -name = "bzip2-sys" -version = "0.1.13+1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225bff33b2141874fe80d71e07d6eec4f85c5c216453dd96388240f96e1acc14" -dependencies = [ - "cc", - "pkg-config", + "libbz2-rs-sys", ] [[package]] @@ -304,6 +281,17 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +[[package]] +name = "chacha20" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "rand_core 0.10.0", +] + [[package]] name = "chrono" version = "0.4.42" @@ -364,9 +352,9 @@ dependencies = [ [[package]] name = "constant_time_eq" -version = "0.1.5" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" [[package]] name = "convert_case" @@ -392,6 +380,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.5.0" @@ -436,6 +433,12 @@ dependencies = [ "typenum", ] +[[package]] +name = "deflate64" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "807800ff3288b621186fe0a8f3392c4652068257302709c24efd918c3dffcdc2" + [[package]] name = "deranged" version = "0.5.5" @@ -636,6 +639,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" dependencies = [ "crc32fast", + "libz-rs-sys", "miniz_oxide", ] @@ -645,6 +649,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + [[package]] name = "fuchsia-cprng" version = "0.1.1" @@ -773,6 +783,22 @@ dependencies = [ "wasip2", ] +[[package]] +name = "getrandom" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "rand_core 0.10.0", + "wasip2", + "wasip3", + "wasm-bindgen", +] + [[package]] name = "getset" version = "0.1.6" @@ -810,6 +836,15 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + [[package]] name = "hashbrown" version = "0.16.1" @@ -822,6 +857,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hmac" version = "0.12.1" @@ -934,6 +975,12 @@ dependencies = [ "cc", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "indexmap" version = "1.9.3" @@ -952,6 +999,8 @@ checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" dependencies = [ "equivalent", "hashbrown 0.16.1", + "serde", + "serde_core", ] [[package]] @@ -1035,7 +1084,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f0a0e9f770b65bac9aad00f97a67ab5c5319effed07f6da385da3c2115e47ba" dependencies = [ "num-traits", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1056,6 +1105,18 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libbz2-rs-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4a545a15244c7d945065b5d392b2d2d7f21526fba56ce51467b06ed445e8f7" + [[package]] name = "libc" version = "0.2.179" @@ -1068,6 +1129,15 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "libz-rs-sys" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c10501e7805cee23da17c7790e59df2870c0d4043ec6d03f67d31e2b53e77415" +dependencies = [ + "zlib-rs", +] + [[package]] name = "libz-sys" version = "1.1.23" @@ -1091,7 +1161,7 @@ dependencies = [ "num-traits", "rand 0.8.5", "sprs", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1110,7 +1180,7 @@ dependencies = [ "num-traits", "rand_xoshiro", "space", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1121,7 +1191,7 @@ checksum = "56e7562b41c8876d3367897067013bb2884cc78e6893f092ecd26b305176ac82" dependencies = [ "ndarray", "num-traits", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1137,7 +1207,7 @@ dependencies = [ "noisy_float", "num-traits", "order-stat", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1158,6 +1228,15 @@ version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" +[[package]] +name = "lzma-rust2" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47bb1e988e6fb779cf720ad431242d3f03167c1b3f2b1aae7f1a94b2495b36ae" +dependencies = [ + "sha2", +] + [[package]] name = "matchit" version = "0.7.3" @@ -1342,9 +1421,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" [[package]] name = "num-derive" @@ -1451,17 +1530,6 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efa535d5117d3661134dbf1719b6f0ffe06f2375843b13935db186cd094105eb" -[[package]] -name = "password-hash" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" -dependencies = [ - "base64ct", - "rand_core 0.6.4", - "subtle", -] - [[package]] name = "paste" version = "1.0.15" @@ -1470,14 +1538,12 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pbkdf2" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ "digest", "hmac", - "password-hash", - "sha2", ] [[package]] @@ -1555,6 +1621,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" +[[package]] +name = "ppmd-rust" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efca4c95a19a79d1c98f791f10aebd5c1363b473244630bb7dbde1dc98455a24" + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1574,6 +1646,16 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.111", +] + [[package]] name = "proc-macro-crate" version = "3.4.0" @@ -1631,13 +1713,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" dependencies = [ "bytes", - "heck", + "heck 0.4.1", "itertools", "lazy_static", "log", "multimap", "petgraph", - "prettyplease", + "prettyplease 0.1.25", "prost", "prost-types", "regex", @@ -1726,6 +1808,17 @@ dependencies = [ "rand_core 0.9.3", ] +[[package]] +name = "rand" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc266eb313df6c5c09c1c7b1fbe2510961e5bcd3add930c1e31f7ed9da0feff8" +dependencies = [ + "chacha20", + "getrandom 0.4.1", + "rand_core 0.10.0", +] + [[package]] name = "rand_chacha" version = "0.3.1" @@ -1779,6 +1872,12 @@ dependencies = [ "getrandom 0.3.4", ] +[[package]] +name = "rand_core" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba" + [[package]] name = "rand_distr" version = "0.4.3" @@ -1826,9 +1925,9 @@ dependencies = [ [[package]] name = "rdkafka" -version = "0.36.2" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1beea247b9a7600a81d4cc33f659ce1a77e1988323d7d2809c7ed1c21f4c316d" +checksum = "d7956f9ac12b5712e50372d9749a3102f4810a8d42481c5eae3748d36d585bcf" dependencies = [ "futures-channel", "futures-util", @@ -1844,9 +1943,9 @@ dependencies = [ [[package]] name = "rdkafka-sys" -version = "4.9.0+2.10.0" +version = "4.10.0+2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5230dca48bc354d718269f3e4353280e188b610f7af7e2fcf54b7a79d5802872" +checksum = "e234cf318915c1059d4921ef7f75616b5219b10b46e9f3a511a15eb4b56a3f77" dependencies = [ "cmake", "libc", @@ -1931,6 +2030,12 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + [[package]] name = "serde" version = "1.0.228" @@ -1981,7 +2086,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest", ] @@ -1992,7 +2097,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest", ] @@ -2126,7 +2231,16 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", ] [[package]] @@ -2140,24 +2254,36 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "time" -version = "0.3.44" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" dependencies = [ "deranged", + "js-sys", "num-conv", "powerfmt", - "serde", + "serde_core", "time-core", ] [[package]] name = "time-core" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "tokio" @@ -2283,7 +2409,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6fdaae4c2c638bb70fe42803a26fbd6fc6ac8c72f5c59f67ecc2a2dcabf4b07" dependencies = [ - "prettyplease", + "prettyplease 0.1.25", "proc-macro2", "prost-build", "quote", @@ -2359,6 +2485,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "typed-path" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e28f89b80c87b8fb0cf04ab448d5dd0dd0ade2f8891bae878de66a75a28600e" + [[package]] name = "typenum" version = "1.19.0" @@ -2377,6 +2509,12 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "utf8parse" version = "0.2.2" @@ -2451,7 +2589,16 @@ version = "1.0.1+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" dependencies = [ - "wit-bindgen", + "wit-bindgen 0.46.0", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen 0.51.0", ] [[package]] @@ -2499,6 +2646,40 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap 2.12.1", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.10.0", + "hashbrown 0.15.5", + "indexmap 2.12.1", + "semver", +] + [[package]] name = "which" version = "4.4.2" @@ -2772,6 +2953,94 @@ version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck 0.5.0", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck 0.5.0", + "indexmap 2.12.1", + "prettyplease 0.2.37", + "syn 2.0.111", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease 0.2.37", + "proc-macro2", + "quote", + "syn 2.0.111", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.10.0", + "indexmap 2.12.1", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.12.1", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + [[package]] name = "zerocopy" version = "0.8.31" @@ -2792,48 +3061,92 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + [[package]] name = "zip" -version = "0.6.6" +version = "8.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +checksum = "6e499faf5c6b97a0d086f4a8733de6d47aee2252b8127962439d8d4311a73f72" dependencies = [ "aes", - "byteorder", "bzip2", "constant_time_eq", "crc32fast", - "crossbeam-utils", + "deflate64", "flate2", + "getrandom 0.4.1", "hmac", + "indexmap 2.12.1", + "lzma-rust2", + "memchr", "pbkdf2", + "ppmd-rust", "sha1", "time", + "typed-path", + "zeroize", + "zopfli", "zstd", ] +[[package]] +name = "zlib-rs" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40990edd51aae2c2b6907af74ffb635029d5788228222c4bb811e9351c0caad3" + [[package]] name = "zmij" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d6085d62852e35540689d1f97ad663e3971fc19cf5eceab364d62c646ea167" +[[package]] +name = "zopfli" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f05cd8797d63865425ff89b5c4a48804f35ba0ce8d125800027ad6017d2b5249" +dependencies = [ + "bumpalo", + "crc32fast", + "log", + "simd-adler32", +] + [[package]] name = "zstd" -version = "0.11.2+zstd.1.5.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" +version = "7.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" dependencies = [ - "libc", "zstd-sys", ] diff --git a/Ficus/src/rust/ficus_backend/Cargo.toml b/Ficus/src/rust/ficus_backend/Cargo.toml index d7f65e9e..8cae94eb 100644 --- a/Ficus/src/rust/ficus_backend/Cargo.toml +++ b/Ficus/src/rust/ficus_backend/Cargo.toml @@ -8,7 +8,7 @@ ficus = { path = "../ficus" } tonic = "0.9.2" colog = "1.4.0" log = "0.4.29" -rdkafka = { version = "0.36.2", features = ["cmake-build"] } +rdkafka = { version = "0.39.0", features = ["cmake-build"] } bxes_kafka = { path = "../../../../bxes/src/rust/bxes_kafka" } tokio-stream = "0.1.17" tokio = { version = "1.49.0", features = ["rt-multi-thread"] } From 61cf601c0fa8274d096670e785373d6ebe247ee5 Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sat, 28 Feb 2026 21:48:36 +0300 Subject: [PATCH 08/30] HashMap -> HashMap, ...> --- .../analysis/patterns/activity_instances.rs | 14 +++++++------- .../src/features/analysis/patterns/entry_points.rs | 2 +- .../rust/ficus/src/pipelines/activities_parts.rs | 9 +++------ .../patterns/activities_instances_tests.rs | 11 +++++++++-- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs b/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs index 828e52f2..96db7452 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs @@ -587,15 +587,15 @@ where pub fn create_logs_for_activities( activities_source: &ActivitiesLogSource, -) -> HashMap>> { +) -> HashMap, Rc>> { match activities_source { ActivitiesLogSource::Log(log) => create_activities_logs_from_log(log), ActivitiesLogSource::TracesActivities(log, activities, level) => create_log_from_traces_activities(log, activities, *level), } } -fn create_activities_logs_from_log(log: &XesEventLogImpl) -> HashMap>> { - let mut activities_to_logs: HashMap>> = HashMap::new(); +fn create_activities_logs_from_log(log: &XesEventLogImpl) -> HashMap, Rc>> { + let mut activities_to_logs: HashMap, Rc>> = HashMap::new(); for trace in log.traces() { for event in trace.borrow().events() { @@ -605,7 +605,7 @@ fn create_activities_logs_from_log(log: &XesEventLogImpl) -> HashMap( log: &TLog, activities: &[Vec], activity_level: usize, -) -> HashMap>> { - let mut activities_to_logs: HashMap>> = HashMap::new(); +) -> HashMap, Rc>> { + let mut activities_to_logs: HashMap, Rc>> = HashMap::new(); for (trace_activities, trace) in activities.iter().zip(log.traces()) { let activity_handler = |activity_info: &ActivityInTraceInfo| { if activity_level != *activity_info.node.borrow().level() { @@ -648,7 +648,7 @@ fn create_log_from_traces_activities( new_trace.push(Rc::new(RefCell::new(event.borrow().clone()))); } - let name = activity_info.node.borrow().name().as_ref().to_owned(); + let name = activity_info.node.borrow().name().clone(); if let Some(activity_log) = activities_to_logs.get_mut(&name) { activity_log.borrow_mut().push(Rc::clone(&new_trace_ptr)); } else { diff --git a/Ficus/src/rust/ficus/src/features/analysis/patterns/entry_points.rs b/Ficus/src/rust/ficus/src/features/analysis/patterns/entry_points.rs index c958d827..b535dfab 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/patterns/entry_points.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/patterns/entry_points.rs @@ -111,7 +111,7 @@ where pub fn create_logs_for_activities( context: &ActivitiesDiscoveryContext, activity_level: usize, -) -> HashMap>> +) -> HashMap, Rc>> where TClassExtractor: Fn(&XesEventImpl) -> u64, TNameCreator: Fn(&SubArrayWithTraceIndex) -> String, diff --git a/Ficus/src/rust/ficus/src/pipelines/activities_parts.rs b/Ficus/src/rust/ficus/src/pipelines/activities_parts.rs index 52e20d43..3fda69f3 100644 --- a/Ficus/src/rust/ficus/src/pipelines/activities_parts.rs +++ b/Ficus/src/rust/ficus/src/pipelines/activities_parts.rs @@ -171,10 +171,7 @@ impl PipelineParts { first_stamp + delta / (events.len() as i32 - 1) }; - Rc::new(RefCell::new(XesEventImpl::new( - info.node().borrow().name().as_ref().clone(), - stamp, - ))) + Rc::new(RefCell::new(XesEventImpl::new(info.node().borrow().name().as_ref().clone(), stamp))) }); context.put_concrete(EVENT_LOG_KEY.key(), log); @@ -412,7 +409,7 @@ impl PipelineParts { for (activity_name, activity_log) in activities_to_logs { let mut temp_context = context.clone(); temp_context.put_concrete(EVENT_LOG_KEY.key(), activity_log.borrow().clone()); - temp_context.put_concrete(ACTIVITY_NAME_KEY.key(), activity_name.clone()); + temp_context.put_concrete(ACTIVITY_NAME_KEY.key(), activity_name.as_ref().to_owned()); pipeline.execute(&mut temp_context, infra)?; } @@ -424,7 +421,7 @@ impl PipelineParts { fn create_activities_to_logs( context: &mut PipelineContext, config: &UserDataImpl, - ) -> Result>>, PipelinePartExecutionError> { + ) -> Result, Rc>>, PipelinePartExecutionError> { let log = Self::get_user_data(context, &EVENT_LOG_KEY)?; let dto = Self::get_user_data(config, &ACTIVITIES_LOGS_SOURCE_KEY)?; diff --git a/Ficus/src/rust/ficus/tests/analysis/patterns/activities_instances_tests.rs b/Ficus/src/rust/ficus/tests/analysis/patterns/activities_instances_tests.rs index 8efbc13c..9724c688 100644 --- a/Ficus/src/rust/ficus/tests/analysis/patterns/activities_instances_tests.rs +++ b/Ficus/src/rust/ficus/tests/analysis/patterns/activities_instances_tests.rs @@ -278,8 +278,15 @@ fn execute_activities_logs_creation_test(log: XesEventLogImpl, pattern_kind: Pat let mut activities_logs = activities_logs .iter() .map(|pair| (pair.0.to_owned(), pair.1.borrow().to_raw_vector())) - .collect::>)>>(); + .collect::, Vec>)>>(); activities_logs.sort_by(|first, second| first.0.cmp(&second.0)); - assert_eq!(activities_logs, expected); + + assert_eq!( + activities_logs + .into_iter() + .map(|(key, log)| (key.as_ref().to_owned(), log)) + .collect::>(), + expected + ); } From e3c8c7576b90b06beb947b17f625a4e04104d09c Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sat, 28 Feb 2026 22:41:10 +0300 Subject: [PATCH 09/30] Rc -> Rc --- .../rust/bxes/src/models/domain/bxes_value.rs | 2 +- bxes/src/rust/bxes/src/models/system_models.rs | 5 +++-- bxes/src/rust/bxes/src/read/read_utils.rs | 6 +++--- bxes/src/rust/bxes/src/writer/writer_utils.rs | 8 ++++---- bxes/src/rust/bxes/tests/test_core/random_log.rs | 16 ++++++++-------- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/bxes/src/rust/bxes/src/models/domain/bxes_value.rs b/bxes/src/rust/bxes/src/models/domain/bxes_value.rs index f182e5bf..c97868d8 100644 --- a/bxes/src/rust/bxes/src/models/domain/bxes_value.rs +++ b/bxes/src/rust/bxes/src/models/domain/bxes_value.rs @@ -18,7 +18,7 @@ pub enum BxesValue { Uint64(u64), Float32(f32), Float64(f64), - String(Rc), + String(Rc), Bool(bool), Timestamp(i64), BrafLifecycle(BrafLifecycle), diff --git a/bxes/src/rust/bxes/src/models/system_models.rs b/bxes/src/rust/bxes/src/models/system_models.rs index 493c6178..4f91f5b9 100644 --- a/bxes/src/rust/bxes/src/models/system_models.rs +++ b/bxes/src/rust/bxes/src/models/system_models.rs @@ -1,14 +1,15 @@ +use std::rc::Rc; use crate::models::domain::type_ids::TypeIds; #[derive(Debug, PartialEq, Eq, Hash, Clone)] pub struct ValueAttributeDescriptor { pub type_id: TypeIds, - pub name: String, + pub name: Rc, } impl ValueAttributeDescriptor { pub fn new(type_id: TypeIds, name: String) -> Self { - Self { type_id, name } + Self { type_id, name: Rc::from(name) } } } diff --git a/bxes/src/rust/bxes/src/read/read_utils.rs b/bxes/src/rust/bxes/src/read/read_utils.rs index 6eb4cc0b..cfe7648b 100644 --- a/bxes/src/rust/bxes/src/read/read_utils.rs +++ b/bxes/src/rust/bxes/src/read/read_utils.rs @@ -165,7 +165,7 @@ pub fn try_read_leb128(reader: &mut BinaryReader) -> Result } } -pub fn string_or_err(value: &BxesValue) -> Result, BxesReadError> { +pub fn string_or_err(value: &BxesValue) -> Result, BxesReadError> { if let BxesValue::String(string) = value { Ok(string.clone()) } else { @@ -258,7 +258,7 @@ fn try_read_event_attributes(context: &mut ReadContext) -> Result Result Ok(BxesValue::Float32(try_read_f32(reader)?)), TypeIds::F64 => Ok(BxesValue::Float64(try_read_f64(reader)?)), TypeIds::Bool => Ok(BxesValue::Bool(try_read_bool(reader)?)), - TypeIds::String => Ok(BxesValue::String(Rc::new(try_read_string(reader)?))), + TypeIds::String => Ok(BxesValue::String(Rc::from(try_read_string(reader)?))), TypeIds::Timestamp => Ok(BxesValue::Timestamp(try_read_i64(reader)?)), TypeIds::BrafLifecycle => Ok(BxesValue::BrafLifecycle(try_read_braf_lifecycle(reader)?)), TypeIds::StandardLifecycle => Ok(BxesValue::StandardLifecycle(try_read_standard_lifecycle(reader)?)), diff --git a/bxes/src/rust/bxes/src/writer/writer_utils.rs b/bxes/src/rust/bxes/src/writer/writer_utils.rs index a8ec1ffc..e457fe41 100644 --- a/bxes/src/rust/bxes/src/writer/writer_utils.rs +++ b/bxes/src/rust/bxes/src/writer/writer_utils.rs @@ -50,7 +50,7 @@ fn try_write_values_attributes( write_collection_and_count(context.clone(), false, value_attributes.len() as u32, || { for attr in value_attributes { try_write_u8_no_type_id(context.borrow_mut().writer.as_mut().unwrap(), attr.type_id.to_u8().unwrap())?; - try_write_string(context.borrow_mut().writer.as_mut().unwrap(), attr.name.as_str())?; + try_write_string(context.borrow_mut().writer.as_mut().unwrap(), attr.name.as_ref())?; } Ok(()) @@ -114,7 +114,7 @@ fn try_write_event_default_attributes( for (key, value) in attributes { let should_write = if let Some(set) = context.borrow().value_attributes_set.as_ref() { let desc = ValueAttributeDescriptor { - name: string_or_err(key).ok().unwrap().as_ref().clone(), + name: string_or_err(key).ok().unwrap().clone(), type_id: get_type_id(value), }; @@ -153,7 +153,7 @@ fn try_write_event_value_attributes(event: &BxesEvent, context: Rc Result< BxesValue::Uint64(value) => try_write_u64(context.writer.as_mut().unwrap(), *value), BxesValue::Float32(value) => try_write_f32(context.writer.as_mut().unwrap(), *value), BxesValue::Float64(value) => try_write_f64(context.writer.as_mut().unwrap(), *value), - BxesValue::String(value) => try_write_string(context.writer.as_mut().unwrap(), value.as_str()), + BxesValue::String(value) => try_write_string(context.writer.as_mut().unwrap(), value.as_ref()), BxesValue::Bool(value) => try_write_bool(context.writer.as_mut().unwrap(), *value), BxesValue::Timestamp(value) => try_write_timestamp(context.writer.as_mut().unwrap(), *value), BxesValue::BrafLifecycle(value) => try_write_braf_lifecycle(context.writer.as_mut().unwrap(), value), diff --git a/bxes/src/rust/bxes/tests/test_core/random_log.rs b/bxes/src/rust/bxes/tests/test_core/random_log.rs index 9afe4017..e9476002 100644 --- a/bxes/src/rust/bxes/tests/test_core/random_log.rs +++ b/bxes/src/rust/bxes/tests/test_core/random_log.rs @@ -65,7 +65,7 @@ pub fn generate_random_system_metadata(rng: &mut ThreadRng, log: &BxesEventLog) descriptors .iter() .map(|pair| ValueAttributeDescriptor { - name: pair.0.as_ref().to_owned(), + name: pair.0.clone(), type_id: pair.1.clone(), }) .collect(), @@ -182,7 +182,7 @@ fn generate_random_attribute(rng: &mut ThreadRng) -> (Rc, Rc Rc { - Rc::new(BxesValue::String(Rc::new(generate_random_string(rng)))) + Rc::new(BxesValue::String(Rc::from(generate_random_string(rng)))) } fn generate_random_string(rng: &mut ThreadRng) -> String { @@ -200,7 +200,7 @@ fn generate_random_bxes_value(rng: &mut ThreadRng) -> Rc { TypeIds::F32 => BxesValue::Float32(rng.random()), TypeIds::F64 => BxesValue::Float64(rng.random()), TypeIds::Bool => BxesValue::Bool(rng.random()), - TypeIds::String => BxesValue::String(Rc::new(generate_random_string(rng))), + TypeIds::String => BxesValue::String(Rc::from(generate_random_string(rng))), TypeIds::Timestamp => BxesValue::Timestamp(rng.random()), TypeIds::BrafLifecycle => BxesValue::BrafLifecycle(generate_random_braf_lifecycle()), TypeIds::StandardLifecycle => BxesValue::StandardLifecycle(generate_random_standard_lifecycle()), @@ -229,8 +229,8 @@ fn generate_random_drivers(rng: &mut ThreadRng) -> BxesValue { fn generate_random_driver(rng: &mut ThreadRng) -> BxesDriver { BxesDriver { amount: BxesValue::Float64(rng.random()), - name: Rc::new(BxesValue::String(Rc::new(generate_random_string(rng)))), - driver_type: Rc::new(BxesValue::String(Rc::new(generate_random_string(rng)))), + name: Rc::new(BxesValue::String(Rc::from(generate_random_string(rng)))), + driver_type: Rc::new(BxesValue::String(Rc::from(generate_random_string(rng)))), } } @@ -247,9 +247,9 @@ fn generate_random_artifact(rng: &mut ThreadRng) -> BxesValue { fn generate_random_artifact_item(rng: &mut ThreadRng) -> BxesArtifactItem { BxesArtifactItem { - model: Rc::new(BxesValue::String(Rc::new(generate_random_string(rng)))), - instance: Rc::new(BxesValue::String(Rc::new(generate_random_string(rng)))), - transition: Rc::new(BxesValue::String(Rc::new(generate_random_string(rng)))), + model: Rc::new(BxesValue::String(Rc::from(generate_random_string(rng)))), + instance: Rc::new(BxesValue::String(Rc::from(generate_random_string(rng)))), + transition: Rc::new(BxesValue::String(Rc::from(generate_random_string(rng)))), } } From 5eaf18b156a06fc401afd4df1f3dafd35cfd127b Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sat, 28 Feb 2026 23:16:57 +0300 Subject: [PATCH 10/30] [UNFINISHED] WIP on using Rc --- .../ficus/src/event_log/bxes/conversions.rs | 10 ++-- .../event_log/bxes/xes_to_bxes_converter.rs | 14 +++--- .../ficus/src/event_log/core/event/event.rs | 46 ++++++++++--------- .../src/event_log/core/event/event_base.rs | 4 +- .../src/event_log/core/event/events_holder.rs | 10 ++-- .../ficus/src/event_log/core/trace/trace.rs | 2 +- .../ficus/src/event_log/xes/reader/utils.rs | 2 +- .../xes/reader/xes_log_trace_reader.rs | 6 +-- .../rust/ficus/src/event_log/xes/xes_event.rs | 12 ++--- .../analysis/directly_follows_graph.rs | 15 +++--- .../src/features/analysis/entropy/shared.rs | 2 +- .../analysis/patterns/activity_instances.rs | 16 +++---- .../analysis/patterns/entry_points.rs | 2 +- .../features/analysis/patterns/repeat_sets.rs | 10 ++-- .../analysis/patterns/strict_loops.rs | 2 +- .../src/features/cases/cases_discovery.rs | 2 +- .../features/clustering/activities/merging.rs | 2 +- .../features/discovery/ecfg/adjustments.rs | 3 +- .../src/features/discovery/ecfg/context.rs | 5 +- .../src/features/discovery/ecfg/discovery.rs | 9 ++-- .../features/discovery/ecfg/discovery_xes.rs | 4 +- .../features/discovery/ecfg/log_prepare.rs | 2 +- .../discovery/multithreaded_dfg/dfg.rs | 4 +- .../discovery/petri_net/annotations.rs | 13 ++---- .../src/rust/ficus/src/utils/display_name.rs | 14 +++--- Ficus/src/rust/ficus/src/utils/graph/graph.rs | 7 +-- 26 files changed, 111 insertions(+), 107 deletions(-) diff --git a/Ficus/src/rust/ficus/src/event_log/bxes/conversions.rs b/Ficus/src/rust/ficus/src/event_log/bxes/conversions.rs index 4823a1c1..cb795d9a 100644 --- a/Ficus/src/rust/ficus/src/event_log/bxes/conversions.rs +++ b/Ficus/src/rust/ficus/src/event_log/bxes/conversions.rs @@ -107,9 +107,9 @@ pub(super) fn payload_value_to_bxes_value(value: &EventPayloadValue) -> BxesValu .items .iter() .map(|a| BxesArtifactItem { - instance: Rc::new(BxesValue::String(Rc::new(a.instance.clone()))), - model: Rc::new(BxesValue::String(Rc::new(a.model.clone()))), - transition: Rc::new(BxesValue::String(Rc::new(a.transition.clone()))), + instance: Rc::new(BxesValue::String(Rc::from(a.instance.clone()))), + model: Rc::new(BxesValue::String(Rc::from(a.model.clone()))), + transition: Rc::new(BxesValue::String(Rc::from(a.transition.clone()))), }) .collect(), }), @@ -119,8 +119,8 @@ pub(super) fn payload_value_to_bxes_value(value: &EventPayloadValue) -> BxesValu .iter() .map(|d| BxesDriver { amount: BxesValue::Float64(d.amount), - driver_type: Rc::new(BxesValue::String(Rc::new(d.driver_type.clone()))), - name: Rc::new(BxesValue::String(Rc::new(d.name.clone()))), + driver_type: Rc::new(BxesValue::String(Rc::from(d.driver_type.clone()))), + name: Rc::new(BxesValue::String(Rc::from(d.name.clone()))), }) .collect(), }), diff --git a/Ficus/src/rust/ficus/src/event_log/bxes/xes_to_bxes_converter.rs b/Ficus/src/rust/ficus/src/event_log/bxes/xes_to_bxes_converter.rs index 46eaef95..241fe1d4 100644 --- a/Ficus/src/rust/ficus/src/event_log/bxes/xes_to_bxes_converter.rs +++ b/Ficus/src/rust/ficus/src/event_log/bxes/xes_to_bxes_converter.rs @@ -131,9 +131,9 @@ fn create_bxes_classifiers(log: &XesEventLogImpl) -> Vec { keys: c .keys .iter() - .map(|x| Rc::new(BxesValue::String(Rc::new(x.to_owned())))) + .map(|x| Rc::new(BxesValue::String(Rc::from(x.to_owned())))) .collect(), - name: Rc::new(BxesValue::String(Rc::new(c.name.to_owned()))), + name: Rc::new(BxesValue::String(Rc::from(c.name.to_owned()))), }) .collect() } @@ -144,9 +144,9 @@ fn create_bxes_extensions(log: &XesEventLogImpl) -> Vec { fn convert_to_bxes_extension(e: &XesEventLogExtension) -> BxesExtension { BxesExtension { - name: Rc::new(BxesValue::String(Rc::new(e.name.to_owned()))), - prefix: Rc::new(BxesValue::String(Rc::new(e.prefix.to_owned()))), - uri: Rc::new(BxesValue::String(Rc::new(e.uri.to_owned()))), + name: Rc::new(BxesValue::String(Rc::from(e.name.to_owned()))), + prefix: Rc::new(BxesValue::String(Rc::from(e.prefix.to_owned()))), + uri: Rc::new(BxesValue::String(Rc::from(e.uri.to_owned()))), } } @@ -163,7 +163,7 @@ fn create_bxes_globals(log: &XesEventLogImpl) -> Result, XesToBx } fn convert_to_bxes_global_attribute(kv: &(&String, &EventPayloadValue)) -> (Rc, Rc) { - let key = Rc::new(BxesValue::String(Rc::new(kv.0.to_owned()))); + let key = Rc::new(BxesValue::String(Rc::from(kv.0.to_owned()))); let value = Rc::new(payload_value_to_bxes_value(kv.1)); (key, value) @@ -179,7 +179,7 @@ fn create_bxes_properties(log: &XesEventLogImpl) -> Vec<(Rc, Rc (Rc, Rc) { let bxes_value = payload_value_to_bxes_value(kv.1); - let key = Rc::new(BxesValue::String(Rc::new(kv.0.to_owned()))); + let key = Rc::new(BxesValue::String(Rc::from(kv.0.to_owned()))); (key, Rc::new(bxes_value)) } diff --git a/Ficus/src/rust/ficus/src/event_log/core/event/event.rs b/Ficus/src/rust/ficus/src/event_log/core/event/event.rs index 68c21569..9872f524 100644 --- a/Ficus/src/rust/ficus/src/event_log/core/event/event.rs +++ b/Ficus/src/rust/ficus/src/event_log/core/event/event.rs @@ -9,7 +9,7 @@ use std::{collections::HashMap, fmt::Debug, rc::Rc}; pub enum EventPayloadValue { Null, Date(DateTime), - String(Rc), + String(Rc), Boolean(bool), Int32(i32), Int64(i64), @@ -61,25 +61,29 @@ pub enum EventPayloadSoftwareEventType { } impl EventPayloadValue { - pub fn to_string_repr(&self) -> HeapedOrOwned { - match self { - EventPayloadValue::Null => HeapedOrOwned::Owned("NULL".to_string()), - EventPayloadValue::Date(date) => HeapedOrOwned::Owned(date.to_rfc3339()), - EventPayloadValue::String(string) => HeapedOrOwned::Heaped(string.clone()), - EventPayloadValue::Boolean(bool) => HeapedOrOwned::Owned(bool.to_string()), - EventPayloadValue::Int32(int) => HeapedOrOwned::Owned(int.to_string()), - EventPayloadValue::Float32(float) => HeapedOrOwned::Owned(float.to_string()), - EventPayloadValue::Int64(value) => HeapedOrOwned::Owned(value.to_string()), - EventPayloadValue::Float64(value) => HeapedOrOwned::Owned(value.to_string()), - EventPayloadValue::Uint32(value) => HeapedOrOwned::Owned(value.to_string()), - EventPayloadValue::Uint64(value) => HeapedOrOwned::Owned(value.to_string()), - EventPayloadValue::Guid(value) => HeapedOrOwned::Owned(value.to_string()), - EventPayloadValue::Timestamp(value) => HeapedOrOwned::Owned(value.to_string()), - EventPayloadValue::Lifecycle(lifecycle) => HeapedOrOwned::Owned(lifecycle.to_string()), - EventPayloadValue::Artifact(artifact) => HeapedOrOwned::Owned(format!("{:?}", artifact)), - EventPayloadValue::Drivers(drivers) => HeapedOrOwned::Owned(format!("{:?}", drivers)), - EventPayloadValue::SoftwareEvent(software_event) => HeapedOrOwned::Owned(format!("{:?}", software_event)), + pub fn to_string_repr(&self) -> Rc { + if let EventPayloadValue::String(string) = self { + return string.clone(); } + + Rc::from(match self { + EventPayloadValue::Null => "NULL".to_string(), + EventPayloadValue::Date(date) => date.to_rfc3339(), + EventPayloadValue::Boolean(bool) => bool.to_string(), + EventPayloadValue::Int32(int) => int.to_string(), + EventPayloadValue::Float32(float) => float.to_string(), + EventPayloadValue::Int64(value) => value.to_string(), + EventPayloadValue::Float64(value) => value.to_string(), + EventPayloadValue::Uint32(value) => value.to_string(), + EventPayloadValue::Uint64(value) => value.to_string(), + EventPayloadValue::Guid(value) => value.to_string(), + EventPayloadValue::Timestamp(value) => value.to_string(), + EventPayloadValue::Lifecycle(lifecycle) => lifecycle.to_string(), + EventPayloadValue::Artifact(artifact) => format!("{:?}", artifact), + EventPayloadValue::Drivers(drivers) => format!("{:?}", drivers), + EventPayloadValue::SoftwareEvent(software_event) => format!("{:?}", software_event), + EventPayloadValue::String { .. } => unreachable!(), + }) } } @@ -88,8 +92,8 @@ pub trait Event: Clone + Debug + UserDataOwner { fn new_with_min_date(name: String) -> Self; fn new_with_max_date(name: String) -> Self; - fn name(&self) -> &String; - fn name_pointer(&self) -> &Rc; + fn name(&self) -> &str; + fn name_pointer(&self) -> &Rc; fn timestamp(&self) -> &DateTime; fn payload_map(&self) -> Option<&HashMap>; diff --git a/Ficus/src/rust/ficus/src/event_log/core/event/event_base.rs b/Ficus/src/rust/ficus/src/event_log/core/event/event_base.rs index 48be25ef..25298d8b 100644 --- a/Ficus/src/rust/ficus/src/event_log/core/event/event_base.rs +++ b/Ficus/src/rust/ficus/src/event_log/core/event/event_base.rs @@ -6,13 +6,13 @@ use crate::utils::user_data::user_data::UserDataImpl; #[derive(Debug)] pub struct EventBase { - pub name: Rc, + pub name: Rc, pub timestamp: DateTime, pub user_data: UserDataImpl, } impl EventBase { - pub fn new(name: Rc, timestamp: DateTime) -> Self { + pub fn new(name: Rc, timestamp: DateTime) -> Self { Self { name, timestamp, diff --git a/Ficus/src/rust/ficus/src/event_log/core/event/events_holder.rs b/Ficus/src/rust/ficus/src/event_log/core/event/events_holder.rs index c668eef2..621da8fc 100644 --- a/Ficus/src/rust/ficus/src/event_log/core/event/events_holder.rs +++ b/Ficus/src/rust/ficus/src/event_log/core/event/events_holder.rs @@ -120,12 +120,12 @@ where #[derive(Debug)] pub struct EventSequenceInfo { - events_counts: HashMap, + events_counts: HashMap, usize>, events_count: usize, } impl TraceInfo for EventSequenceInfo { - fn events_counts(&self) -> &HashMap { + fn events_counts(&self) -> &HashMap, usize> { &self.events_counts } @@ -141,7 +141,7 @@ impl EventSequenceInfo { { let mut events_counts = HashMap::new(); for event in events_holder.events() { - increase_in_map(&mut events_counts, event.borrow().name()); + increase_in_map(&mut events_counts, event.borrow().name_pointer()); } EventSequenceInfo { @@ -153,7 +153,7 @@ impl EventSequenceInfo { #[derive(Debug)] pub struct EventsPositions { - positions: HashMap>, + positions: HashMap, Vec>, } impl EventsPositions { @@ -164,7 +164,7 @@ impl EventsPositions { let mut positions = HashMap::new(); for (index, event) in events.events().iter().enumerate() { - add_to_list_in_map(&mut positions, event.borrow().name(), index); + add_to_list_in_map(&mut positions, event.borrow().name_pointer(), index); } EventsPositions { positions } diff --git a/Ficus/src/rust/ficus/src/event_log/core/trace/trace.rs b/Ficus/src/rust/ficus/src/event_log/core/trace/trace.rs index 813a999e..d3c4cec1 100644 --- a/Ficus/src/rust/ficus/src/event_log/core/trace/trace.rs +++ b/Ficus/src/rust/ficus/src/event_log/core/trace/trace.rs @@ -31,7 +31,7 @@ pub trait Trace: Clone { } pub trait TraceInfo { - fn events_counts(&self) -> &HashMap; + fn events_counts(&self) -> &HashMap, usize>; fn events_count(&self) -> usize; } diff --git a/Ficus/src/rust/ficus/src/event_log/xes/reader/utils.rs b/Ficus/src/rust/ficus/src/event_log/xes/reader/utils.rs index 62e155cc..08646629 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/reader/utils.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/reader/utils.rs @@ -93,7 +93,7 @@ pub fn extract_payload_value(name: &[u8], key: &str, value: &str) -> Option None, Ok(float_value) => Some(EventPayloadValue::Float64(float_value)), }, - STRING_TAG_NAME => Some(EventPayloadValue::String(Rc::new(value.to_owned()))), + STRING_TAG_NAME => Some(EventPayloadValue::String(Rc::from(value))), BOOLEAN_TAG_NAME => match value.parse::() { Err(_) => None, Ok(bool_value) => Some(EventPayloadValue::Boolean(bool_value)), diff --git a/Ficus/src/rust/ficus/src/event_log/xes/reader/xes_log_trace_reader.rs b/Ficus/src/rust/ficus/src/event_log/xes/reader/xes_log_trace_reader.rs index 3aa48898..546a64ae 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/reader/xes_log_trace_reader.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/reader/xes_log_trace_reader.rs @@ -89,7 +89,7 @@ impl<'a> TraceXesEventLogIterator<'a> { fn set_defaults_value( &self, - name: &mut Option>, + name: &mut Option>, date: &mut Option>, payload: &mut HashMap, ) { @@ -107,7 +107,7 @@ impl<'a> TraceXesEventLogIterator<'a> { payload_type: &[u8], key: &str, value: &str, - name: &mut Option>, + name: &mut Option>, date: &mut Option>, payload: &mut HashMap, globals: &HashMap>, @@ -132,7 +132,7 @@ impl<'a> TraceXesEventLogIterator<'a> { key: &str, payload_value: EventPayloadValue, date: &mut Option>, - name: &mut Option>, + name: &mut Option>, payload: &mut HashMap, ) { match key { diff --git a/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs b/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs index 290f460e..8c2e4fcb 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs @@ -23,12 +23,12 @@ pub struct XesEventImpl { impl Debug for XesEventImpl { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - f.write_str(self.name_pointer().as_str()) + f.write_str(self.name_pointer()) } } impl XesEventImpl { - pub fn new_all_fields(name: Rc, timestamp: DateTime, payload: Option>) -> Self { + pub fn new_all_fields(name: Rc, timestamp: DateTime, payload: Option>) -> Self { Self { event_base: EventBase::new(name, timestamp), payload, @@ -55,7 +55,7 @@ impl UserDataOwner for XesEventImpl { impl Event for XesEventImpl { fn new(name: String, timestamp: DateTime) -> Self { Self { - event_base: EventBase::new(Rc::new(name), timestamp), + event_base: EventBase::new(Rc::from(name), timestamp), payload: None, } } @@ -68,11 +68,11 @@ impl Event for XesEventImpl { Self::new(name, DateTime::::MAX_UTC) } - fn name(&self) -> &String { + fn name(&self) -> &str { &self.event_base.name } - fn name_pointer(&self) -> &Rc { + fn name_pointer(&self) -> &Rc { &self.event_base.name } @@ -103,7 +103,7 @@ impl Event for XesEventImpl { } fn set_name(&mut self, new_name: String) { - self.event_base.name = Rc::new(new_name); + self.event_base.name = Rc::from(new_name); } fn set_timestamp(&mut self, new_timestamp: DateTime) { diff --git a/Ficus/src/rust/ficus/src/features/analysis/directly_follows_graph.rs b/Ficus/src/rust/ficus/src/features/analysis/directly_follows_graph.rs index b34e7922..4c7fcce1 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/directly_follows_graph.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/directly_follows_graph.rs @@ -11,13 +11,14 @@ use crate::{ }; use log::warn; use std::collections::HashMap; +use std::rc::Rc; pub fn construct_dfg(info: &dyn EventLogInfo) -> DefaultGraph { let mut graph = Graph::empty(); let mut classes_to_node_ids = HashMap::new(); for class in info.all_event_classes() { - let node_data = Some(HeapedOrOwned::Owned(class.to_owned())); + let node_data = Some(Rc::from(class.to_owned())); classes_to_node_ids.insert(class, graph.add_node(node_data)); } @@ -26,7 +27,7 @@ pub fn construct_dfg(info: &dyn EventLogInfo) -> DefaultGraph { for (follower, count) in followers.iter() { if let Some(first_id) = classes_to_node_ids.get(class) { if let Some(second_id) = classes_to_node_ids.get(follower) { - let data = Some(HeapedOrOwned::Owned(count.to_string())); + let data = Some(Rc::from(count.to_string())); let connection_data = NodesConnectionData::new(data, *count as f64, None); graph.connect_nodes(first_id, second_id, connection_data); @@ -50,13 +51,13 @@ pub fn construct_dfg_by_attribute(log: &XesEventLogImpl, attribute: &str) -> Def for trace in log.traces() { let trace = trace.borrow(); - let mut last_seen_events: HashMap>, HeapedOrOwned> = HashMap::new(); + let mut last_seen_events: HashMap>, Rc> = HashMap::new(); for event in trace.events() { let event = event.borrow(); if !classes_to_nodes_ids.contains_key(event.name()) { - let node_data = Some(HeapedOrOwned::Heaped(event.name_pointer().to_owned())); + let node_data = Some(event.name_pointer().to_owned()); let node_id = graph.add_node(node_data); classes_to_nodes_ids.insert(event.name().to_owned(), node_id); } @@ -66,10 +67,10 @@ pub fn construct_dfg_by_attribute(log: &XesEventLogImpl, attribute: &str) -> Def Some(map) => map.get(attribute).map(|value| value.to_string_repr().to_owned()), }; - let event_name_boxed = HeapedOrOwned::Heaped(event.name_pointer().clone()); + let event_name_boxed = event.name_pointer().clone(); match last_seen_events.get(&attribute_value) { Some(last_seen_class) => { - let first_node_id = classes_to_nodes_ids.get(last_seen_class.as_str()).unwrap(); + let first_node_id = classes_to_nodes_ids.get(last_seen_class.as_ref()).unwrap(); let second_node_id = classes_to_nodes_ids.get(event.name()).unwrap(); *dfg_map.entry((*first_node_id, *second_node_id)).or_insert(0u64) += 1; @@ -83,7 +84,7 @@ pub fn construct_dfg_by_attribute(log: &XesEventLogImpl, attribute: &str) -> Def } for ((first_node_id, second_node_id), count) in dfg_map { - let edge_data = Some(HeapedOrOwned::Owned(count.to_string())); + let edge_data = Some(Rc::from(count.to_string())); let connection_data = NodesConnectionData::new(edge_data, count as f64, None); graph.connect_nodes(&first_node_id, &second_node_id, connection_data); diff --git a/Ficus/src/rust/ficus/src/features/analysis/entropy/shared.rs b/Ficus/src/rust/ficus/src/features/analysis/entropy/shared.rs index 92d0246f..de2602dd 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/entropy/shared.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/entropy/shared.rs @@ -32,7 +32,7 @@ where let counts = trace.get_or_create_trace_info().events_counts(); let mut num_of_ignored_events = 0; for ignored_event in ignored_events { - if let Some(count) = counts.get(ignored_event) { + if let Some(count) = counts.get(ignored_event.as_str()) { num_of_ignored_events += *count; } } diff --git a/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs b/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs index 96db7452..37406a03 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs @@ -587,15 +587,15 @@ where pub fn create_logs_for_activities( activities_source: &ActivitiesLogSource, -) -> HashMap, Rc>> { +) -> HashMap, Rc>> { match activities_source { ActivitiesLogSource::Log(log) => create_activities_logs_from_log(log), ActivitiesLogSource::TracesActivities(log, activities, level) => create_log_from_traces_activities(log, activities, *level), } } -fn create_activities_logs_from_log(log: &XesEventLogImpl) -> HashMap, Rc>> { - let mut activities_to_logs: HashMap, Rc>> = HashMap::new(); +fn create_activities_logs_from_log(log: &XesEventLogImpl) -> HashMap, Rc>> { + let mut activities_to_logs: HashMap, Rc>> = HashMap::new(); for trace in log.traces() { for event in trace.borrow().events() { @@ -609,7 +609,7 @@ fn create_activities_logs_from_log(log: &XesEventLogImpl) -> HashMap, let mut new_trace = XesTraceImpl::empty(); substitute_underlying_events(event, &mut new_trace); - if let Some(existing_log) = activities_to_logs.get_mut(&name) { + if let Some(existing_log) = activities_to_logs.get_mut(name.as_ref()) { existing_log.borrow_mut().push(Rc::new(RefCell::new(new_trace))); } else { let mut new_log = XesEventLogImpl::empty(); @@ -627,8 +627,8 @@ fn create_log_from_traces_activities( log: &TLog, activities: &[Vec], activity_level: usize, -) -> HashMap, Rc>> { - let mut activities_to_logs: HashMap, Rc>> = HashMap::new(); +) -> HashMap, Rc>> { + let mut activities_to_logs: HashMap, Rc>> = HashMap::new(); for (trace_activities, trace) in activities.iter().zip(log.traces()) { let activity_handler = |activity_info: &ActivityInTraceInfo| { if activity_level != *activity_info.node.borrow().level() { @@ -649,7 +649,7 @@ fn create_log_from_traces_activities( } let name = activity_info.node.borrow().name().clone(); - if let Some(activity_log) = activities_to_logs.get_mut(&name) { + if let Some(activity_log) = activities_to_logs.get_mut(name.as_ref()) { activity_log.borrow_mut().push(Rc::clone(&new_trace_ptr)); } else { let log = Rc::new(RefCell::new(TLog::empty())); @@ -691,7 +691,7 @@ where if m.start() == 0 { &event_name[0..m.end()] } else { - event_name.as_str() + event_name } } _ => event_name, diff --git a/Ficus/src/rust/ficus/src/features/analysis/patterns/entry_points.rs b/Ficus/src/rust/ficus/src/features/analysis/patterns/entry_points.rs index b535dfab..42854c2d 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/patterns/entry_points.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/patterns/entry_points.rs @@ -111,7 +111,7 @@ where pub fn create_logs_for_activities( context: &ActivitiesDiscoveryContext, activity_level: usize, -) -> HashMap, Rc>> +) -> HashMap, Rc>> where TClassExtractor: Fn(&XesEventImpl) -> u64, TNameCreator: Fn(&SubArrayWithTraceIndex) -> String, diff --git a/Ficus/src/rust/ficus/src/features/analysis/patterns/repeat_sets.rs b/Ficus/src/rust/ficus/src/features/analysis/patterns/repeat_sets.rs index 2de8eb2c..20ffe540 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/patterns/repeat_sets.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/patterns/repeat_sets.rs @@ -79,7 +79,7 @@ pub fn build_repeat_sets(log: &[Vec], patterns: &[Vec] #[derive(Debug, Getters)] pub struct ActivityNode { #[getset(get = "pub")] - id: Rc, + id: Rc, #[getset(get = "pub")] repeat_set: Option, #[getset(get = "pub")] @@ -89,7 +89,7 @@ pub struct ActivityNode { #[getset(get = "pub")] level: usize, #[getset(get = "pub")] - name: Rc, + name: Rc, #[getset(get = "pub")] pattern_kind: UnderlyingPatternKind, } @@ -100,13 +100,13 @@ impl ActivityNode { event_classes: HashSet, children: Vec>>, level: usize, - name: Rc, + name: Rc, pattern_kind: UnderlyingPatternKind, ) -> Self { static NEXT_ID: AtomicU64 = AtomicU64::new(0); Self { - id: Rc::new(format!("Activity_{}", NEXT_ID.fetch_add(1, Ordering::SeqCst))), + id: Rc::from(format!("Activity_{}", NEXT_ID.fetch_add(1, Ordering::SeqCst))), repeat_set, event_classes, children, @@ -158,7 +158,7 @@ where events_set, vec![], activity_level, - Rc::new(name_creator(repeat_set)), + Rc::from(name_creator(repeat_set)), pattern_kind, ))) }; diff --git a/Ficus/src/rust/ficus/src/features/analysis/patterns/strict_loops.rs b/Ficus/src/rust/ficus/src/features/analysis/patterns/strict_loops.rs index 47c19e2d..bd90da8e 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/patterns/strict_loops.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/patterns/strict_loops.rs @@ -86,7 +86,7 @@ fn create_strict_loop_activity_instance( HashSet::from_iter(hashed_trace[array.start_index..array.start_index + array.length].iter().copied()), vec![], 0, - Rc::new(format!("Loop[{}]", name.join("::"))), + Rc::from(format!("Loop[{}]", name.join("::"))), UnderlyingPatternKind::StrictLoop, ))), array.start_index, diff --git a/Ficus/src/rust/ficus/src/features/cases/cases_discovery.rs b/Ficus/src/rust/ficus/src/features/cases/cases_discovery.rs index dc48a1d5..f247fe81 100644 --- a/Ficus/src/rust/ficus/src/features/cases/cases_discovery.rs +++ b/Ficus/src/rust/ficus/src/features/cases/cases_discovery.rs @@ -18,7 +18,7 @@ pub fn discover_cases(log: &XesEventLogImpl, start_regex_str: &str, end_regex_st for event in trace.events() { let event = event.borrow(); - let event_name = event.name().as_str(); + let event_name = event.name(); if start_regex.is_match(event_name).expect("Regex") { state.handle_start_event(&event); continue; diff --git a/Ficus/src/rust/ficus/src/features/clustering/activities/merging.rs b/Ficus/src/rust/ficus/src/features/clustering/activities/merging.rs index a18ade06..12e3f122 100644 --- a/Ficus/src/rust/ficus/src/features/clustering/activities/merging.rs +++ b/Ficus/src/rust/ficus/src/features/clustering/activities/merging.rs @@ -73,7 +73,7 @@ pub(super) fn merge_activities( new_event_classes_set, vec![], *cluster_activities[0].borrow().level(), - Rc::new(new_activity_name), + Rc::from(new_activity_name), *cluster_activities.first().unwrap().borrow().pattern_kind(), ); diff --git a/Ficus/src/rust/ficus/src/features/discovery/ecfg/adjustments.rs b/Ficus/src/rust/ficus/src/features/discovery/ecfg/adjustments.rs index 6ca974f7..d069fcea 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ecfg/adjustments.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ecfg/adjustments.rs @@ -22,6 +22,7 @@ use std::{ collections::{HashMap, HashSet}, fmt::Debug, }; +use std::rc::Rc; pub fn merge_sequences_of_nodes(graph: &mut DefaultGraph, performance_map: Option) { for current_sequence in discover_sequences_to_merge(graph) { @@ -143,7 +144,7 @@ fn connect_added_merged_node_to_graph(nodes_ids: &NeededNodesIds, added_node: &u fn create_merged_node(nodes: &Vec, graph: &mut DefaultGraph) -> u64 { let label = nodes.iter().map(|id| id.to_string()).collect::>().join("\n"); - let node_id = graph.add_node(Some(HeapedOrOwned::Owned(label))); + let node_id = graph.add_node(Some(Rc::from(label))); let mut inner_graph = DefaultGraph::empty(); let mut prev_added_node_id = None; diff --git a/Ficus/src/rust/ficus/src/features/discovery/ecfg/context.rs b/Ficus/src/rust/ficus/src/features/discovery/ecfg/context.rs index 8689346d..50c0c53c 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ecfg/context.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ecfg/context.rs @@ -1,9 +1,10 @@ use crate::{ features::discovery::ecfg::models::RootSequenceKind, - utils::{references::HeapedOrOwned, user_data::user_data::UserDataImpl}, + utils::user_data::user_data::UserDataImpl, }; +use std::rc::Rc; -type NameExtractor<'a, T> = &'a dyn Fn(&T) -> HeapedOrOwned; +type NameExtractor<'a, T> = &'a dyn Fn(&T) -> Rc; type ArtificialStartEnd<'a, T> = &'a dyn Fn() -> (T, T); type NodeDataTransfer<'a, T> = &'a dyn Fn(&T, &mut UserDataImpl, bool); type EdgeDataTransfer<'a, T> = &'a dyn Fn(&T, &mut UserDataImpl); diff --git a/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery.rs b/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery.rs index 40e59713..30769652 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery.rs @@ -25,6 +25,7 @@ use std::{ collections::{HashMap, VecDeque}, fmt::Debug, }; +use std::rc::Rc; const EVENT_UNIQUE_ID: &str = "EVENT_UNIQUE_ID"; context_key! { EVENT_UNIQUE_ID, Vec } @@ -189,7 +190,7 @@ fn transfer_user_data( transfer_unique_event_id(node, event); } -fn transfer_unique_event_id(node: &mut GraphNode>, event: &EventWithUniqueId) { +fn transfer_unique_event_id(node: &mut GraphNode>, event: &EventWithUniqueId) { if let Some(node_ids) = node.user_data_mut().concrete_mut(EVENT_UNIQUE_ID_KEY.key()) { node_ids.push(*event.id()); } else { @@ -343,7 +344,7 @@ fn create_log_from_adjustments( fn find_start_end_node_ids( sub_graph: &DefaultGraph, - name_extractor: &dyn Fn(&T) -> HeapedOrOwned, + name_extractor: &dyn Fn(&T) -> Rc, artificial_start_end_events_factory: &dyn Fn() -> (T, T), ) -> (u64, u64) { let (mut start_node_id, mut end_node_id) = (0, 0); @@ -352,11 +353,11 @@ fn find_start_end_node_ids( for node in sub_graph.all_nodes() { if let Some(data) = node.data() { - if data.as_str().eq(art_start_name.as_str()) { + if data.as_ref().eq(art_start_name.as_ref()) { start_node_id = *node.id(); } - if data.as_str().eq(art_end_name.as_str()) { + if data.as_ref().eq(art_end_name.as_ref()) { end_node_id = *node.id(); } } diff --git a/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery_xes.rs b/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery_xes.rs index 0940666b..7d598c1e 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery_xes.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery_xes.rs @@ -243,6 +243,6 @@ fn assert_all_traces_have_artificial_start_end_events(log: &XesEventLogImpl) -> fn check_trace_have_artificial_start_end_events(trace: &XesTraceImpl) -> bool { trace.events().len() >= 2 - && trace.events().first().unwrap().borrow().name().as_str() == ARTIFICIAL_START_EVENT_NAME - && trace.events().last().unwrap().borrow().name().as_str() == ARTIFICIAL_END_EVENT_NAME + && trace.events().first().unwrap().borrow().name() == ARTIFICIAL_START_EVENT_NAME + && trace.events().last().unwrap().borrow().name() == ARTIFICIAL_END_EVENT_NAME } diff --git a/Ficus/src/rust/ficus/src/features/discovery/ecfg/log_prepare.rs b/Ficus/src/rust/ficus/src/features/discovery/ecfg/log_prepare.rs index be77d999..9a27cf48 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ecfg/log_prepare.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ecfg/log_prepare.rs @@ -25,7 +25,7 @@ pub fn prepare_software_log( .as_ref() .unwrap() .iter() - .any(|r| r.is_match(event.borrow().name().as_str()).unwrap_or(false)) + .any(|r| r.is_match(event.borrow().name()).unwrap_or(false)) }; let mut event_groups = vec![]; diff --git a/Ficus/src/rust/ficus/src/features/discovery/multithreaded_dfg/dfg.rs b/Ficus/src/rust/ficus/src/features/discovery/multithreaded_dfg/dfg.rs index 2db53c25..32024676 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/multithreaded_dfg/dfg.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/multithreaded_dfg/dfg.rs @@ -50,7 +50,7 @@ pub fn discover_multithreaded_dfg( let first_node_id = add_node(first, &mut graph, &mut added_nodes); let second_node_id = add_node(second, &mut graph, &mut added_nodes); - let data = Some(HeapedOrOwned::Owned(count.to_string())); + let data = Some(Rc::from(count.to_string())); graph.connect_nodes(&first_node_id, &second_node_id, NodesConnectionData::new(data, count as f64, None)); } @@ -141,7 +141,7 @@ fn add_node(name: String, graph: &mut DefaultGraph, added_nodes: &mut HashMap, HeapedOrOwned), (f64, usize)>; +pub type PerformanceMap = HashMap<(Rc, Rc), (f64, usize)>; pub fn create_performance_map(log: &impl EventLog) -> PerformanceMap { let mut performance_map = HashMap::new(); @@ -125,10 +125,7 @@ pub fn create_performance_map(log: &impl EventLog) -> PerformanceMap { let time_diff = second.timestamp().to_owned() - first.timestamp().to_owned(); let time_diff = time_diff.num_nanoseconds().expect("Must be convertible to nanos") as f64; - let key = ( - HeapedOrOwned::Heaped(first.name_pointer().clone()), - HeapedOrOwned::Heaped(second.name_pointer().clone()), - ); + let key = (first.name_pointer().clone(), second.name_pointer().clone()); if let Some((existing_time_diff, count)) = performance_map.get(&key) { *performance_map.get_mut(&key).expect("Must exist") = (*existing_time_diff + time_diff, *count + 1); @@ -177,8 +174,8 @@ pub fn annotate_with_time_performance(log: &impl EventLog, graph: &DefaultGraph, fn try_get_time_annotation( performance_map: &PerformanceMap, - first_node: &GraphNode>, - second_node: &GraphNode>, + first_node: &GraphNode>, + second_node: &GraphNode>, ) -> Option<(f64, usize)> { if first_node.data.is_some() && second_node.data.is_some() { let key = ( diff --git a/Ficus/src/rust/ficus/src/utils/display_name.rs b/Ficus/src/rust/ficus/src/utils/display_name.rs index b02081f5..f8dbd076 100644 --- a/Ficus/src/rust/ficus/src/utils/display_name.rs +++ b/Ficus/src/rust/ficus/src/utils/display_name.rs @@ -1,19 +1,17 @@ use crate::{ context_key, event_log::{core::event::event::Event, xes::xes_event::XesEventImpl}, - utils::{ - references::HeapedOrOwned, - user_data::user_data::{UserData, UserDataOwner}, - }, + utils::user_data::user_data::{UserData, UserDataOwner}, }; use lazy_static::lazy_static; +use std::rc::Rc; const DISPLAY_NAME: &str = "DISPLAY_NAME"; -context_key! { DISPLAY_NAME, String } +context_key! { DISPLAY_NAME, Rc } -pub fn get_display_name(event: &XesEventImpl) -> HeapedOrOwned { +pub fn get_display_name(event: &XesEventImpl) -> Rc { match event.user_data().concrete(DISPLAY_NAME_KEY.key()) { - None => HeapedOrOwned::Heaped(event.name_pointer().clone()), - Some(name) => HeapedOrOwned::Owned(name.clone()), + None => event.name_pointer().clone(), + Some(name) => name.clone(), } } diff --git a/Ficus/src/rust/ficus/src/utils/graph/graph.rs b/Ficus/src/rust/ficus/src/utils/graph/graph.rs index 1c348c8f..71c0b5b9 100644 --- a/Ficus/src/rust/ficus/src/utils/graph/graph.rs +++ b/Ficus/src/rust/ficus/src/utils/graph/graph.rs @@ -1,13 +1,14 @@ use crate::utils::{ - graph::{graph_edge::GraphEdge, graph_node::GraphNode}, - references::HeapedOrOwned, + graph::{graph_edge::GraphEdge, graph_node::GraphNode} + , user_data::user_data::UserDataImpl, }; use getset::{Getters, Setters}; +use std::rc::Rc; use std::{collections::HashMap, fmt::Display, sync::atomic::AtomicU64}; pub(crate) static NEXT_ID: AtomicU64 = AtomicU64::new(0); -pub type DefaultGraph = Graph, HeapedOrOwned>; +pub type DefaultGraph = Graph, Rc>; pub struct NodesConnectionData { pub(super) data: Option, From 48a0d141fa7e45e53bb19c754613e3e97722c14e Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sun, 1 Mar 2026 19:19:42 +0300 Subject: [PATCH 11/30] Adjust metadata map key type --- .../rust/bxes_kafka/src/consumer/bxes_kafka_consumer.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bxes/src/rust/bxes_kafka/src/consumer/bxes_kafka_consumer.rs b/bxes/src/rust/bxes_kafka/src/consumer/bxes_kafka_consumer.rs index 5130908d..203a433a 100644 --- a/bxes/src/rust/bxes_kafka/src/consumer/bxes_kafka_consumer.rs +++ b/bxes/src/rust/bxes_kafka/src/consumer/bxes_kafka_consumer.rs @@ -41,12 +41,12 @@ impl BxesKafkaConsumer { #[derive(Debug, Clone)] pub struct BxesKafkaTrace { - metadata: HashMap>, + metadata: HashMap, Rc>, events: Vec, } impl BxesKafkaTrace { - pub fn metadata(&self) -> &HashMap> { + pub fn metadata(&self) -> &HashMap, Rc> { &self.metadata } @@ -135,12 +135,12 @@ impl BxesKafkaConsumer { Ok(BxesKafkaTrace { metadata, events }) } - fn create_trace_metadata(metadata: Vec<(Rc, Rc)>) -> Result>, BxesReadError> { + fn create_trace_metadata(metadata: Vec<(Rc, Rc)>) -> Result, Rc>, BxesReadError> { let mut new_metadata = HashMap::new(); for (key, value) in metadata { if let BxesValue::String(key) = key.as_ref() { - new_metadata.insert(key.as_ref().to_owned(), value); + new_metadata.insert(key.clone(), value); } else { return Err(BxesReadError::ExpectedString(key.as_ref().to_owned())); } From a125dd72db1ab7a07aa6899f7303e4e8c7c0867f Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sun, 1 Mar 2026 19:22:36 +0300 Subject: [PATCH 12/30] String -> Rc --- Ficus/src/rust/ficus/Cargo.toml | 2 +- .../event_log/bxes/bxes_to_xes_converter.rs | 12 +- .../event_log/bxes/xes_to_bxes_converter.rs | 14 +- .../ficus/src/event_log/core/event/event.rs | 16 +- .../ficus/src/event_log/xes/logs_merger.rs | 3 +- .../xes/reader/file_xes_log_reader.rs | 31 +- .../ficus/src/event_log/xes/reader/utils.rs | 26 +- .../xes/reader/xes_log_trace_reader.rs | 24 +- .../rust/ficus/src/event_log/xes/shared.rs | 18 +- .../rust/ficus/src/event_log/xes/simple.rs | 5 +- .../xes/writer/xes_event_log_writer.rs | 10 +- .../rust/ficus/src/event_log/xes/xes_event.rs | 20 +- .../ficus/src/event_log/xes/xes_event_log.rs | 11 +- .../features/analysis/entropy/dfg_entropy.rs | 26 +- .../features/analysis/entropy/pos_entropy.rs | 10 +- .../analysis/entropy/pos_entropy_fast.rs | 6 +- .../src/features/analysis/entropy/shared.rs | 20 +- .../features/analysis/log_info/dfg_info.rs | 25 +- .../analysis/log_info/event_log_info.rs | 55 ++-- .../log_info/log_info_creation_dto.rs | 12 +- .../analysis/patterns/activity_instances.rs | 4 +- .../src/rust/ficus/src/features/cases/mod.rs | 8 +- .../activities/activities_common.rs | 2 +- .../features/clustering/activities/merging.rs | 2 +- .../ficus/src/features/clustering/common.rs | 7 +- .../src/features/clustering/traces/common.rs | 10 +- .../src/features/discovery/alpha/alpha.rs | 39 +-- .../alpha_plus_plus_nfc.rs | 47 +-- .../alpha_plus_plus_nfc_triple.rs | 56 ++-- .../alpha_plus_plus_nfc/extended_alpha_set.rs | 73 ++--- .../alpha/alpha_plus_plus_nfc/w3_pair.rs | 29 +- .../src/features/discovery/alpha/alpha_set.rs | 13 +- .../features/discovery/alpha/alpha_sharp.rs | 17 +- .../providers/alpha_plus_nfc_provider.rs | 7 +- .../alpha/providers/alpha_plus_provider.rs | 9 +- .../alpha/providers/alpha_sharp_provider.rs | 5 +- .../features/discovery/ecfg/discovery_xes.rs | 8 +- .../features/discovery/ecfg/log_prepare.rs | 4 +- .../discovery/fuzzy/fuzzy_metrics_provider.rs | 11 +- .../features/discovery/fuzzy/fuzzy_miner.rs | 10 +- .../discovery/heuristic/heuristic_miner.rs | 7 +- .../discovery/heuristic/relations_provider.rs | 13 +- .../discovery/multithreaded_dfg/dfg.rs | 8 +- .../discovery/ocel/graph_annotation.rs | 22 +- .../features/discovery/petri_net/petri_net.rs | 4 +- .../features/discovery/petri_net/replay.rs | 8 +- .../discovery/petri_net/transition.rs | 11 +- .../discovery/timeline/abstraction.rs | 36 ++- .../features/discovery/timeline/discovery.rs | 22 +- .../discovery/timeline/events_groups.rs | 2 +- .../software_data/extraction_config.rs | 61 ++-- .../extractors/activities_durations.rs | 9 +- .../timeline/software_data/extractors/core.rs | 8 +- .../software_data/extractors/event_classes.rs | 10 +- .../timeline/software_data/extractors/ocel.rs | 20 +- .../software_data/extractors/pie_charts.rs | 6 +- .../extractors/simple_counter.rs | 4 +- .../software_data/extractors/utils.rs | 11 +- .../timeline/software_data/models.rs | 22 +- .../src/features/discovery/timeline/utils.rs | 7 +- .../ficus/src/features/mutations/mutations.rs | 24 +- .../ficus/src/pipelines/activities_parts.rs | 18 +- Ficus/src/rust/ficus/src/pipelines/cases.rs | 2 +- .../ficus/src/pipelines/discovery_parts.rs | 2 +- .../rust/ficus/src/pipelines/drawing_parts.rs | 54 ++-- .../ficus/src/pipelines/keys/context_keys.rs | 42 +-- .../ficus/src/pipelines/multithreading.rs | 90 +++--- .../rust/ficus/src/pipelines/util_parts.rs | 2 +- .../src/rust/ficus/src/pipelines/xes_parts.rs | 4 +- Ficus/src/rust/ficus/src/utils/colors.rs | 22 +- .../src/utils/graph/graph_conversions.rs | 10 +- Ficus/src/rust/ficus/src/utils/vec_utils.rs | 4 +- .../ficus/tests/analysis/analysis_tests.rs | 50 ++-- .../patterns/activities_instances_tests.rs | 6 +- .../ficus/tests/discovery/ecfg_discovery.rs | 10 +- .../discovery/multithreaded_dfg_tests.rs | 7 +- .../ficus/tests/mutations/mutations_tests.rs | 8 +- .../tests/other/test_simple_event_log.rs | 10 +- .../tests/software_data/extractors_tests.rs | 273 ++++++------------ .../rust/ficus_backend/src/grpc/converters.rs | 12 +- .../src/grpc/events/kafka_events_handler.rs | 23 +- .../src/grpc/get_context_pipeline.rs | 4 +- .../src/grpc/kafka/grpc_kafka_service.rs | 16 +- .../src/grpc/kafka/kafka_service.rs | 19 +- .../ficus_backend/src/grpc/kafka/models.rs | 5 +- .../src/grpc/kafka/streaming/processors.rs | 42 +-- .../src/grpc/kafka/streaming/t1/processors.rs | 2 +- .../kafka/streaming/t2/dfg_data_structures.rs | 42 +-- 88 files changed, 881 insertions(+), 920 deletions(-) diff --git a/Ficus/src/rust/ficus/Cargo.toml b/Ficus/src/rust/ficus/Cargo.toml index 48b78714..9a7a46cd 100644 --- a/Ficus/src/rust/ficus/Cargo.toml +++ b/Ficus/src/rust/ficus/Cargo.toml @@ -26,7 +26,7 @@ num-traits = "0.2.19" approx = "0.5.1" termgraph = "0.4.0" getset = "0.1.6" -serde = { version = "1.0.228", features = ["derive"] } +serde = { version = "1.0.228", features = ["derive", "rc"] } serde_json = "1.0.148" derive-new = "0.7.0" enum-display-derive = "0.1.1" diff --git a/Ficus/src/rust/ficus/src/event_log/bxes/bxes_to_xes_converter.rs b/Ficus/src/rust/ficus/src/event_log/bxes/bxes_to_xes_converter.rs index dba61d7c..e435982f 100644 --- a/Ficus/src/rust/ficus/src/event_log/bxes/bxes_to_xes_converter.rs +++ b/Ficus/src/rust/ficus/src/event_log/bxes/bxes_to_xes_converter.rs @@ -139,7 +139,7 @@ fn set_extensions(xes_log: &mut XesEventLogImpl, log: &BxesEventLog) -> Result<( fn set_globals(xes_log: &mut XesEventLogImpl, log: &BxesEventLog) -> Result<(), BxesToXesReadError> { if let Some(globals) = log.metadata.globals.as_ref() { for global in globals { - let global_type = global_type_to_string(&global.entity_kind); + let global_type = Rc::from(global_type_to_string(&global.entity_kind)); let mut globals_map = HashMap::new(); for global_value in &global.globals { @@ -154,7 +154,7 @@ fn set_globals(xes_log: &mut XesEventLogImpl, log: &BxesEventLog) -> Result<(), Ok(()) } -fn vector_of_strings_or_err(values: &Vec>, entity_name: &str) -> Result, BxesToXesReadError> { +fn vector_of_strings_or_err(values: &Vec>, entity_name: &str) -> Result>, BxesToXesReadError> { let mut result = vec![]; for value in values { result.push(string_or_err(value, entity_name)?) @@ -163,9 +163,9 @@ fn vector_of_strings_or_err(values: &Vec>, entity_name: &str) -> R Ok(result) } -fn string_or_err(value: &BxesValue, entity_name: &str) -> Result { +fn string_or_err(value: &BxesValue, entity_name: &str) -> Result, BxesToXesReadError> { if let BxesValue::String(string) = value { - Ok(string.as_ref().to_owned()) + Ok(string.clone()) } else { Err(BxesToXesReadError::ConversionError(format!("{} key was not a string", entity_name))) } @@ -187,13 +187,13 @@ fn create_xes_event(bxes_event: &BxesEvent) -> Result, Rc)>>, -) -> Result>, BxesToXesReadError> { +) -> Result, EventPayloadValue>>, BxesToXesReadError> { if let Some(attributes) = attributes { let mut payload = HashMap::new(); for (key, value) in attributes { let key = if let BxesValue::String(string) = key.as_ref() { - string.as_ref().to_owned() + string.clone() } else { let message = format!("The attribute key is not a string: {:?}", key); return Err(BxesToXesReadError::ConversionError(message)); diff --git a/Ficus/src/rust/ficus/src/event_log/bxes/xes_to_bxes_converter.rs b/Ficus/src/rust/ficus/src/event_log/bxes/xes_to_bxes_converter.rs index 241fe1d4..ab253e78 100644 --- a/Ficus/src/rust/ficus/src/event_log/bxes/xes_to_bxes_converter.rs +++ b/Ficus/src/rust/ficus/src/event_log/bxes/xes_to_bxes_converter.rs @@ -111,7 +111,7 @@ fn create_bxes_event(log: &XesEventLogImpl, event: &XesEventImpl) -> BxesEvent { } } -fn is_not_default_attribute(log: &XesEventLogImpl, kv: &(&String, &EventPayloadValue)) -> bool { +fn is_not_default_attribute(log: &XesEventLogImpl, kv: &(&Rc, &EventPayloadValue)) -> bool { if let Some(event_globals) = log.globals_map().get(EVENT_TAG_NAME_STR) { if let Some(default_value) = event_globals.get(kv.0) { default_value != kv.1 @@ -128,11 +128,7 @@ fn create_bxes_classifiers(log: &XesEventLogImpl) -> Vec { .classifiers() .iter() .map(|c| BxesClassifier { - keys: c - .keys - .iter() - .map(|x| Rc::new(BxesValue::String(Rc::from(x.to_owned())))) - .collect(), + keys: c.keys.iter().map(|x| Rc::new(BxesValue::String(Rc::from(x.to_owned())))).collect(), name: Rc::new(BxesValue::String(Rc::from(c.name.to_owned()))), }) .collect() @@ -154,7 +150,7 @@ fn create_bxes_globals(log: &XesEventLogImpl) -> Result, XesToBx let mut globals = vec![]; for xes_global in log.ordered_globals().iter() { globals.push(BxesGlobal { - entity_kind: parse_entity_kind(xes_global.0.as_str())?, + entity_kind: parse_entity_kind(xes_global.0.as_ref())?, globals: xes_global.1.iter().map(convert_to_bxes_global_attribute).collect(), }) } @@ -162,7 +158,7 @@ fn create_bxes_globals(log: &XesEventLogImpl) -> Result, XesToBx Ok(globals) } -fn convert_to_bxes_global_attribute(kv: &(&String, &EventPayloadValue)) -> (Rc, Rc) { +fn convert_to_bxes_global_attribute(kv: &(&Rc, &EventPayloadValue)) -> (Rc, Rc) { let key = Rc::new(BxesValue::String(Rc::from(kv.0.to_owned()))); let value = Rc::new(payload_value_to_bxes_value(kv.1)); @@ -177,7 +173,7 @@ fn create_bxes_properties(log: &XesEventLogImpl) -> Vec<(Rc, Rc (Rc, Rc) { +fn kv_pair_to_bxes_pair(kv: &(&Rc, &EventPayloadValue)) -> (Rc, Rc) { let bxes_value = payload_value_to_bxes_value(kv.1); let key = Rc::new(BxesValue::String(Rc::from(kv.0.to_owned()))); diff --git a/Ficus/src/rust/ficus/src/event_log/core/event/event.rs b/Ficus/src/rust/ficus/src/event_log/core/event/event.rs index 9872f524..b788eece 100644 --- a/Ficus/src/rust/ficus/src/event_log/core/event/event.rs +++ b/Ficus/src/rust/ficus/src/event_log/core/event/event.rs @@ -88,19 +88,19 @@ impl EventPayloadValue { } pub trait Event: Clone + Debug + UserDataOwner { - fn new(name: String, stamp: DateTime) -> Self; - fn new_with_min_date(name: String) -> Self; - fn new_with_max_date(name: String) -> Self; + fn new(name: Rc, stamp: DateTime) -> Self; + fn new_with_min_date(name: Rc) -> Self; + fn new_with_max_date(name: Rc) -> Self; fn name(&self) -> &str; fn name_pointer(&self) -> &Rc; fn timestamp(&self) -> &DateTime; - fn payload_map(&self) -> Option<&HashMap>; - fn payload_map_mut(&mut self) -> Option<&mut HashMap>; - fn ordered_payload(&self) -> Vec<(&String, &EventPayloadValue)>; + fn payload_map(&self) -> Option<&HashMap, EventPayloadValue>>; + fn payload_map_mut(&mut self) -> Option<&mut HashMap, EventPayloadValue>>; + fn ordered_payload(&self) -> Vec<(&Rc, &EventPayloadValue)>; - fn set_name(&mut self, new_name: String); + fn set_name(&mut self, new_name: Rc); fn set_timestamp(&mut self, new_timestamp: DateTime); - fn add_or_update_payload(&mut self, key: String, value: EventPayloadValue); + fn add_or_update_payload(&mut self, key: Rc, value: EventPayloadValue); } diff --git a/Ficus/src/rust/ficus/src/event_log/xes/logs_merger.rs b/Ficus/src/rust/ficus/src/event_log/xes/logs_merger.rs index 10817fae..d9ce79b1 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/logs_merger.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/logs_merger.rs @@ -3,8 +3,9 @@ use crate::event_log::{ xes::{reader::file_xes_log_reader::read_event_log, xes_event_log::XesEventLogImpl}, }; use log::error; +use std::rc::Rc; -pub fn merge_xes_logs(paths: &Vec) -> XesEventLogImpl { +pub fn merge_xes_logs(paths: &Vec>) -> XesEventLogImpl { let mut merged_log = XesEventLogImpl::empty(); for path in paths { diff --git a/Ficus/src/rust/ficus/src/event_log/xes/reader/file_xes_log_reader.rs b/Ficus/src/rust/ficus/src/event_log/xes/reader/file_xes_log_reader.rs index a788bba3..4c56724b 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/reader/file_xes_log_reader.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/reader/file_xes_log_reader.rs @@ -52,7 +52,7 @@ impl<'a> BufRead for XmlReader<'a> { pub struct FromFileXesEventLogReader<'a> { storage: Rc>>, reader: Rc>>>, - seen_globals: Rc>>>, + seen_globals: Rc, HashMap, EventPayloadValue>>>>, } pub enum XesEventLogItem<'a> { @@ -152,8 +152,8 @@ impl<'a> FromFileXesEventLogReader<'a> { Some(Self::create_quickxml_reader(XmlReader::FileReader(BufReader::new(file)))) } - fn try_read_scope_name(tag: &BytesStart) -> Option { - let mut scope_name: Option = None; + fn try_read_scope_name(tag: &BytesStart) -> Option> { + let mut scope_name: Option> = None; for attr in tag.attributes() { match attr { @@ -191,17 +191,16 @@ impl<'a> FromFileXesEventLogReader<'a> { Some(descriptor) => { let payload_type = descriptor.payload_type.as_bytes(); let key = descriptor.key; - let value = descriptor.value.as_str(); + let value = descriptor.value; - utils::extract_payload_value(payload_type, key.as_str(), value) - .map(|value| XesEventLogItem::Property(XesProperty { name: key, value })) + utils::extract_payload_value(payload_type, &key, &value).map(|value| XesEventLogItem::Property(XesProperty { name: key, value })) } None => None, } } - fn try_read_global(reader: &mut Reader, storage: &mut Vec) -> Option> { - let mut map: Option> = None; + fn try_read_global(reader: &mut Reader, storage: &mut Vec) -> Option, EventPayloadValue>> { + let mut map: Option, EventPayloadValue>> = None; loop { match reader.read_event_into(storage) { @@ -213,9 +212,9 @@ impl<'a> FromFileXesEventLogReader<'a> { } let payload_type = descriptor.payload_type.as_bytes(); - let value = utils::extract_payload_value(payload_type, descriptor.key.as_str(), &descriptor.value); + let value = utils::extract_payload_value(payload_type, &descriptor.key, &descriptor.value); if let Some(payload_value) = value { - map.as_mut().unwrap().insert(descriptor.key, payload_value); + map.as_mut().unwrap().insert(descriptor.key.clone(), payload_value); } } } @@ -231,8 +230,8 @@ impl<'a> FromFileXesEventLogReader<'a> { } fn try_read_classifier(tag: &BytesStart) -> Option { - let mut name: Option = None; - let mut keys: Option> = None; + let mut name: Option> = None; + let mut keys: Option>> = None; for attr in tag.attributes() { match attr { @@ -243,7 +242,7 @@ impl<'a> FromFileXesEventLogReader<'a> { } } KEYS_ATTR_NAME => match String::from_utf8(real_attr.value.into_owned()) { - Ok(keys_string) => keys = Some(keys_string.split(" ").map(|s| s.to_owned()).collect()), + Ok(keys_string) => keys = Some(keys_string.split(" ").map(|s| Rc::from(s.to_owned())).collect()), Err(_) => return None, }, _ => continue, @@ -263,9 +262,9 @@ impl<'a> FromFileXesEventLogReader<'a> { } fn try_read_extension(tag: &BytesStart) -> Option { - let mut name: Option = None; - let mut prefix: Option = None; - let mut uri: Option = None; + let mut name: Option> = None; + let mut prefix: Option> = None; + let mut uri: Option> = None; for attr in tag.attributes() { match attr { diff --git a/Ficus/src/rust/ficus/src/event_log/xes/reader/utils.rs b/Ficus/src/rust/ficus/src/event_log/xes/reader/utils.rs index 08646629..ce8a66eb 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/reader/utils.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/reader/utils.rs @@ -16,9 +16,9 @@ pub struct KeyValuePair { } pub struct PayloadTagDescriptor { - pub payload_type: String, - pub key: String, - pub value: String, + pub payload_type: Rc, + pub key: Rc, + pub value: Rc, } pub fn read_payload_like_tag(tag: &BytesStart) -> Option { @@ -27,11 +27,11 @@ pub fn read_payload_like_tag(tag: &BytesStart) -> Option { return None; } - let key = unescape(kv.key.as_ref().unwrap()).ok().unwrap().to_string(); - let value = unescape(kv.value.as_ref().unwrap()).ok().unwrap().to_string(); + let key = Rc::from(unescape(kv.key.as_ref().unwrap()).ok().unwrap().to_string()); + let value = Rc::from(unescape(kv.value.as_ref().unwrap()).ok().unwrap().to_string()); - let payload_type = match String::from_utf8(tag.name().0.to_vec()) { - Ok(string) => string, + let payload_type = match str::from_utf8(tag.name().0) { + Ok(string) => Rc::from(string), Err(_) => return None, }; @@ -65,18 +65,18 @@ pub fn extract_key_value(start: &BytesStart) -> KeyValuePair { } #[inline] -pub fn read_attr_value(real_attr: &Attribute, var: &mut Option) -> bool { - match String::from_utf8(real_attr.value.as_ref().to_vec()) { +pub fn read_attr_value(real_attr: &Attribute, var: &mut Option>) -> bool { + match str::from_utf8(real_attr.value.as_ref()) { Ok(string) => { - *var = Some(string); + *var = Some(Rc::from(string)); true } Err(_) => false, } } -pub fn extract_payload_value(name: &[u8], key: &str, value: &str) -> Option { - if key == LIFECYCLE_TRANSITION_STR && name == STRING_TAG_NAME { +pub fn extract_payload_value(name: &[u8], key: &Rc, value: &Rc) -> Option { + if key.as_ref() == LIFECYCLE_TRANSITION_STR && name == STRING_TAG_NAME { return Some(EventPayloadValue::Lifecycle(Lifecycle::from_str(value).ok().unwrap())); } @@ -93,7 +93,7 @@ pub fn extract_payload_value(name: &[u8], key: &str, value: &str) -> Option None, Ok(float_value) => Some(EventPayloadValue::Float64(float_value)), }, - STRING_TAG_NAME => Some(EventPayloadValue::String(Rc::from(value))), + STRING_TAG_NAME => Some(EventPayloadValue::String(value.clone())), BOOLEAN_TAG_NAME => match value.parse::() { Err(_) => None, Ok(bool_value) => Some(EventPayloadValue::Boolean(bool_value)), diff --git a/Ficus/src/rust/ficus/src/event_log/xes/reader/xes_log_trace_reader.rs b/Ficus/src/rust/ficus/src/event_log/xes/reader/xes_log_trace_reader.rs index 546a64ae..0ca2c91f 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/reader/xes_log_trace_reader.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/reader/xes_log_trace_reader.rs @@ -13,7 +13,7 @@ use super::utils; pub struct TraceXesEventLogIterator<'a> { buffer: Vec, reader: Rc>>>, - globals: Rc>>>, + globals: Rc, HashMap, EventPayloadValue>>>>, } impl<'a> Iterator for TraceXesEventLogIterator<'a> { @@ -44,7 +44,7 @@ impl<'a> Iterator for TraceXesEventLogIterator<'a> { impl<'a> TraceXesEventLogIterator<'a> { pub(crate) fn new( reader: Rc>>, - seen_globals: Rc>>>, + seen_globals: Rc, HashMap, EventPayloadValue>>>>, ) -> TraceXesEventLogIterator { TraceXesEventLogIterator { reader, @@ -75,8 +75,8 @@ impl<'a> TraceXesEventLogIterator<'a> { Ok(quick_xml::events::Event::Empty(empty)) => match utils::read_payload_like_tag(&empty) { Some(descriptor) => { let payload_type = descriptor.payload_type.as_bytes(); - let key = descriptor.key.as_str(); - let value = descriptor.value.as_str(); + let key = &descriptor.key; + let value = &descriptor.value; Self::set_parsed_value(payload_type, key, value, &mut name, &mut date, &mut payload, &self.globals.borrow()); } @@ -91,7 +91,7 @@ impl<'a> TraceXesEventLogIterator<'a> { &self, name: &mut Option>, date: &mut Option>, - payload: &mut HashMap, + payload: &mut HashMap, EventPayloadValue>, ) { let globals = self.globals.borrow_mut(); if !globals.contains_key(EVENT_TAG_NAME_STR) { @@ -105,12 +105,12 @@ impl<'a> TraceXesEventLogIterator<'a> { fn set_parsed_value( payload_type: &[u8], - key: &str, - value: &str, + key: &Rc, + value: &Rc, name: &mut Option>, date: &mut Option>, - payload: &mut HashMap, - globals: &HashMap>, + payload: &mut HashMap, EventPayloadValue>, + globals: &HashMap, HashMap, EventPayloadValue>>, ) -> bool { let payload_value = utils::extract_payload_value(payload_type, key, value); if payload_value.is_none() { @@ -129,13 +129,13 @@ impl<'a> TraceXesEventLogIterator<'a> { } fn update_event_data( - key: &str, + key: &Rc, payload_value: EventPayloadValue, date: &mut Option>, name: &mut Option>, - payload: &mut HashMap, + payload: &mut HashMap, EventPayloadValue>, ) { - match key { + match key.as_ref() { TIME_TIMESTAMP_STR => { if let EventPayloadValue::Date(parsed_date) = payload_value { *date = Some(parsed_date); diff --git a/Ficus/src/rust/ficus/src/event_log/xes/shared.rs b/Ficus/src/rust/ficus/src/event_log/xes/shared.rs index c5af3391..ed222bfe 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/shared.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/shared.rs @@ -1,28 +1,28 @@ use std::collections::HashMap; - +use std::rc::Rc; use crate::event_log::core::event::event::EventPayloadValue; #[derive(Debug, Clone)] pub struct XesEventLogExtension { - pub name: String, - pub prefix: String, - pub uri: String, + pub name: Rc, + pub prefix: Rc, + pub uri: Rc, } #[derive(Debug, Clone)] pub struct XesGlobal { - pub scope: String, - pub default_values: HashMap, + pub scope: Rc, + pub default_values: HashMap, EventPayloadValue>, } #[derive(Debug, Clone)] pub struct XesClassifier { - pub name: String, - pub keys: Vec, + pub name: Rc, + pub keys: Vec>, } #[derive(Debug, Clone)] pub struct XesProperty { - pub name: String, + pub name: Rc, pub value: EventPayloadValue, } diff --git a/Ficus/src/rust/ficus/src/event_log/xes/simple.rs b/Ficus/src/rust/ficus/src/event_log/xes/simple.rs index 5858dfe9..f75428d2 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/simple.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/simple.rs @@ -11,7 +11,10 @@ pub fn create_simple_event_log(raw_log: &Vec>) -> XesEventLogImpl { for raw_trace in raw_log { let mut trace = XesTraceImpl::empty(); for raw_event in raw_trace { - trace.push(Rc::new(RefCell::new(XesEventImpl::new(raw_event.to_string(), Utc::now())))) + trace.push(Rc::new(RefCell::new(XesEventImpl::new( + Rc::from(raw_event.to_string()), + Utc::now(), + )))) } log.push(Rc::new(RefCell::new(trace))) diff --git a/Ficus/src/rust/ficus/src/event_log/xes/writer/xes_event_log_writer.rs b/Ficus/src/rust/ficus/src/event_log/xes/writer/xes_event_log_writer.rs index 40d52e39..b0298013 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/writer/xes_event_log_writer.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/writer/xes_event_log_writer.rs @@ -44,9 +44,9 @@ fn write_event_log_to_writer(log: &XesEventLogImpl, writer: & for ext in log.extensions() { let attrs = vec![ - (NAME_ATTR_NAME_STR, ext.name.as_str()), - (URI_ATTR_NAME_STR, ext.uri.as_str()), - (PREFIX_ATTR_NAME_STR, ext.prefix.as_str()), + (NAME_ATTR_NAME_STR, ext.name.as_ref()), + (URI_ATTR_NAME_STR, ext.uri.as_ref()), + (PREFIX_ATTR_NAME_STR, ext.prefix.as_ref()), ]; write_empty(&mut writer.borrow_mut(), EXTENSION_TAG_NAME_STR, &attrs)?; @@ -54,7 +54,7 @@ fn write_event_log_to_writer(log: &XesEventLogImpl, writer: & for classifier in log.classifiers() { let keys = classifier.keys.join(" "); - let attrs = vec![(NAME_ATTR_NAME_STR, classifier.name.as_str()), (KEYS_ATTR_NAME_STR, keys.as_str())]; + let attrs = vec![(NAME_ATTR_NAME_STR, classifier.name.as_ref()), (KEYS_ATTR_NAME_STR, keys.as_str())]; write_empty(&mut writer.borrow_mut(), CLASSIFIER_TAG_NAME_STR, &attrs)?; } @@ -64,7 +64,7 @@ fn write_event_log_to_writer(log: &XesEventLogImpl, writer: & } for (scope, defaults) in log.ordered_globals() { - let mut attrs = vec![(SCOPE_ATTR_NAME_STR, scope.as_str())]; + let mut attrs = vec![(SCOPE_ATTR_NAME_STR, scope.as_ref())]; let _global_cookie = StartEndElementCookie::new_with_attrs(writer, GLOBAL_TAG_NAME_STR, &attrs); diff --git a/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs b/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs index 8c2e4fcb..f1e0e87d 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs @@ -18,7 +18,7 @@ use crate::{ pub struct XesEventImpl { event_base: EventBase, - payload: Option>, + payload: Option, EventPayloadValue>>, } impl Debug for XesEventImpl { @@ -28,7 +28,7 @@ impl Debug for XesEventImpl { } impl XesEventImpl { - pub fn new_all_fields(name: Rc, timestamp: DateTime, payload: Option>) -> Self { + pub fn new_all_fields(name: Rc, timestamp: DateTime, payload: Option, EventPayloadValue>>) -> Self { Self { event_base: EventBase::new(name, timestamp), payload, @@ -53,18 +53,18 @@ impl UserDataOwner for XesEventImpl { } impl Event for XesEventImpl { - fn new(name: String, timestamp: DateTime) -> Self { + fn new(name: Rc, timestamp: DateTime) -> Self { Self { event_base: EventBase::new(Rc::from(name), timestamp), payload: None, } } - fn new_with_min_date(name: String) -> Self { + fn new_with_min_date(name: Rc) -> Self { Self::new(name, DateTime::::MIN_UTC) } - fn new_with_max_date(name: String) -> Self { + fn new_with_max_date(name: Rc) -> Self { Self::new(name, DateTime::::MAX_UTC) } @@ -80,15 +80,15 @@ impl Event for XesEventImpl { &self.event_base.timestamp } - fn payload_map(&self) -> Option<&HashMap> { + fn payload_map(&self) -> Option<&HashMap, EventPayloadValue>> { self.payload.as_ref() } - fn payload_map_mut(&mut self) -> Option<&mut HashMap> { + fn payload_map_mut(&mut self) -> Option<&mut HashMap, EventPayloadValue>> { self.payload.as_mut() } - fn ordered_payload(&self) -> Vec<(&String, &EventPayloadValue)> { + fn ordered_payload(&self) -> Vec<(&Rc, &EventPayloadValue)> { let mut payload = Vec::new(); if let Some(payload_map) = self.payload_map() { for (key, value) in payload_map { @@ -102,7 +102,7 @@ impl Event for XesEventImpl { } } - fn set_name(&mut self, new_name: String) { + fn set_name(&mut self, new_name: Rc) { self.event_base.name = Rc::from(new_name); } @@ -110,7 +110,7 @@ impl Event for XesEventImpl { self.event_base.timestamp = new_timestamp; } - fn add_or_update_payload(&mut self, key: String, value: EventPayloadValue) { + fn add_or_update_payload(&mut self, key: Rc, value: EventPayloadValue) { if self.payload.is_none() { self.payload = Some(HashMap::new()); } diff --git a/Ficus/src/rust/ficus/src/event_log/xes/xes_event_log.rs b/Ficus/src/rust/ficus/src/event_log/xes/xes_event_log.rs index c7bc5d31..43788255 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/xes_event_log.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/xes_event_log.rs @@ -20,14 +20,14 @@ use std::{cell::RefCell, collections::HashMap, rc::Rc}; pub struct XesEventLogImpl { base: EventLogBase, - globals: HashMap>, + globals: HashMap, HashMap, EventPayloadValue>>, extensions: Vec, classifiers: Vec, properties: Vec, } impl XesEventLogImpl { - pub fn globals_map(&self) -> &HashMap> { + pub fn globals_map(&self) -> &HashMap, HashMap, EventPayloadValue>> { &self.globals } @@ -43,7 +43,7 @@ impl XesEventLogImpl { &self.properties } - pub fn globals_mut(&mut self) -> &mut HashMap> { + pub fn globals_mut(&mut self) -> &mut HashMap, HashMap, EventPayloadValue>> { &mut self.globals } @@ -59,7 +59,7 @@ impl XesEventLogImpl { &mut self.classifiers } - pub fn ordered_properties(&self) -> Vec<(&String, &EventPayloadValue)> { + pub fn ordered_properties(&self) -> Vec<(&Rc, &EventPayloadValue)> { let mut properties = Vec::new(); for property in self.properties_map() { properties.push((&property.name, &property.value)); @@ -69,7 +69,7 @@ impl XesEventLogImpl { properties } - pub fn ordered_globals(&self) -> Vec<(&String, Vec<(&String, &EventPayloadValue)>)> { + pub fn ordered_globals(&self) -> Vec<(&Rc, Vec<(&Rc, &EventPayloadValue)>)> { let mut globals = Vec::new(); for (key, value) in self.globals_map() { let mut defaults = Vec::new(); @@ -82,6 +82,7 @@ impl XesEventLogImpl { } vec_utils::sort_by_first(&mut globals); + globals } } diff --git a/Ficus/src/rust/ficus/src/features/analysis/entropy/dfg_entropy.rs b/Ficus/src/rust/ficus/src/features/analysis/entropy/dfg_entropy.rs index 3dedd831..3f63894f 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/entropy/dfg_entropy.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/entropy/dfg_entropy.rs @@ -1,5 +1,3 @@ -use std::collections::{HashMap, HashSet}; - use crate::{ event_log::core::event_log::EventLog, features::analysis::{ @@ -10,8 +8,12 @@ use crate::{ }, }, }; +use std::{ + collections::{HashMap, HashSet}, + rc::Rc, +}; -pub fn calculate_laplace_dfg_entropy(log: &TLog, ignored_events: Option<&HashSet>) -> HashMap +pub fn calculate_laplace_dfg_entropy(log: &TLog, ignored_events: Option<&HashSet>>) -> HashMap where TLog: EventLog, { @@ -22,13 +24,13 @@ where x / y }; - let dfr_calculator = |first: &String, second: &String, log_info: &dyn EventLogInfo| { + let dfr_calculator = |first: &Rc, second: &Rc, log_info: &dyn EventLogInfo| { let pair_count = log_info.dfg_info().get_directly_follows_count(first, second); let first_count = log_info.event_count(first); dfr_or_dpr_calculator(pair_count, log_info.event_classes_count(), first_count) }; - let dpr_calculator = |first: &String, second: &String, log_info: &dyn EventLogInfo| { + let dpr_calculator = |first: &Rc, second: &Rc, log_info: &dyn EventLogInfo| { let pair_count = log_info.dfg_info().get_directly_follows_count(second, first); let first_count = log_info.event_count(first); dfr_or_dpr_calculator(pair_count, log_info.event_classes_count(), first_count) @@ -39,18 +41,18 @@ where calculate_dfg_entropy(&log_info, dfr_calculator, dpr_calculator) } -pub fn calculate_default_dfg_entropy(log: &TLog, ignored_events: Option<&HashSet>) -> HashMap +pub fn calculate_default_dfg_entropy(log: &TLog, ignored_events: Option<&HashSet>>) -> HashMap where TLog: EventLog, { - let dfr_calculator = |first: &String, second: &String, log_info: &dyn EventLogInfo| { + let dfr_calculator = |first: &Rc, second: &Rc, log_info: &dyn EventLogInfo| { let dfg = log_info.dfg_info(); let dfr = dfg.get_directly_follows_count(first, second); let first_count = log_info.event_count(first); dfr as f64 / first_count as f64 }; - let dpr_calculator = |first: &String, second: &String, log_info: &dyn EventLogInfo| { + let dpr_calculator = |first: &Rc, second: &Rc, log_info: &dyn EventLogInfo| { let dfg = log_info.dfg_info(); let dfr = dfg.get_directly_follows_count(second, first); let first_count = log_info.event_count(first); @@ -68,18 +70,18 @@ fn calculate_dfg_entropy( dpr_calculator: TDprEntropyCalculator, ) -> HashMap where - TDfrEntropyCalculator: Fn(&String, &String, &dyn EventLogInfo) -> f64, - TDprEntropyCalculator: Fn(&String, &String, &dyn EventLogInfo) -> f64, + TDfrEntropyCalculator: Fn(&Rc, &Rc, &dyn EventLogInfo) -> f64, + TDprEntropyCalculator: Fn(&Rc, &Rc, &dyn EventLogInfo) -> f64, { let mut entropy = HashMap::new(); let events_names = &log_info.all_event_classes(); let mut dfr_events_names = events_names.clone(); - let fake_end = FAKE_EVENT_END_NAME.to_string(); + let fake_end = Rc::::from(FAKE_EVENT_END_NAME); dfr_events_names.push(&fake_end); let mut dpr_events_names = events_names.clone(); - let fake_start = FAKE_EVENT_START_NAME.to_string(); + let fake_start = Rc::::from(FAKE_EVENT_START_NAME.to_string()); dpr_events_names.push(&fake_start); for event_name in events_names { diff --git a/Ficus/src/rust/ficus/src/features/analysis/entropy/pos_entropy.rs b/Ficus/src/rust/ficus/src/features/analysis/entropy/pos_entropy.rs index 6af7610c..fd7f29e5 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/entropy/pos_entropy.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/entropy/pos_entropy.rs @@ -1,17 +1,19 @@ -use std::collections::{HashMap, HashSet}; - use crate::event_log::core::{event::event::Event, event_log::EventLog, trace::trace::Trace}; +use std::{ + collections::{HashMap, HashSet}, + rc::Rc, +}; use super::shared::{calculate_entropies, calculate_max_vector_length, calculate_pos_entropy}; -pub fn calculate_pos_entropies(log: &TLog, ignored_events: &Option>) -> HashMap +pub fn calculate_pos_entropies(log: &TLog, ignored_events: &Option>>) -> HashMap, f64> where TLog: EventLog, { calculate_entropies(log, ignored_events.as_ref(), calculate_pos_entropy_for_event) } -pub fn calculate_pos_entropy_for_event(log: &TLog, event_name: &str, ignored_events: Option<&HashSet>) -> f64 +pub fn calculate_pos_entropy_for_event(log: &TLog, event_name: &str, ignored_events: Option<&HashSet>>) -> f64 where TLog: EventLog, { diff --git a/Ficus/src/rust/ficus/src/features/analysis/entropy/pos_entropy_fast.rs b/Ficus/src/rust/ficus/src/features/analysis/entropy/pos_entropy_fast.rs index fc66c997..a33424f2 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/entropy/pos_entropy_fast.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/entropy/pos_entropy_fast.rs @@ -1,5 +1,5 @@ use std::collections::{HashMap, HashSet}; - +use std::rc::Rc; use crate::event_log::core::{ event_log::EventLog, trace::trace::{Trace, TraceEventsPositions}, @@ -7,14 +7,14 @@ use crate::event_log::core::{ use super::shared::{calculate_entropies, calculate_max_vector_length, calculate_pos_entropy}; -pub fn calculate_pos_entropies_fast(log: &TLog, ignored_events: Option<&HashSet>) -> HashMap +pub fn calculate_pos_entropies_fast(log: &TLog, ignored_events: Option<&HashSet>>) -> HashMap, f64> where TLog: EventLog, { calculate_entropies(log, ignored_events, calculate_pos_entropy_for_event_fast) } -pub fn calculate_pos_entropy_for_event_fast(log: &TLog, name: &str, ignored_events: Option<&HashSet>) -> f64 +pub fn calculate_pos_entropy_for_event_fast(log: &TLog, name: &str, ignored_events: Option<&HashSet>>) -> f64 where TLog: EventLog, { diff --git a/Ficus/src/rust/ficus/src/features/analysis/entropy/shared.rs b/Ficus/src/rust/ficus/src/features/analysis/entropy/shared.rs index de2602dd..28d8f0f4 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/entropy/shared.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/entropy/shared.rs @@ -1,5 +1,3 @@ -use std::collections::{HashMap, HashSet}; - use crate::{ event_log::core::{ event_log::EventLog, @@ -10,8 +8,12 @@ use crate::{ log_info_creation_dto::EventLogInfoCreationDto, }, }; +use std::{ + collections::{HashMap, HashSet}, + rc::Rc, +}; -pub fn calculate_max_vector_length(log: &TLog, ignored_events: Option<&HashSet>) -> usize +pub fn calculate_max_vector_length(log: &TLog, ignored_events: Option<&HashSet>>) -> usize where TLog: EventLog, { @@ -21,7 +23,7 @@ where } } -fn calculate_vector_length_with_ignored_events(log: &TLog, ignored_events: &HashSet) -> usize +fn calculate_vector_length_with_ignored_events(log: &TLog, ignored_events: &HashSet>) -> usize where TLog: EventLog, { @@ -32,7 +34,7 @@ where let counts = trace.get_or_create_trace_info().events_counts(); let mut num_of_ignored_events = 0; for ignored_event in ignored_events { - if let Some(count) = counts.get(ignored_event.as_str()) { + if let Some(count) = counts.get(ignored_event.as_ref()) { num_of_ignored_events += *count; } } @@ -76,18 +78,18 @@ pub fn calculate_pos_entropy(probabilities: &mut [f64], traces_count: f64) -> f6 pub fn calculate_entropies( log: &TLog, - ignored_events: Option<&HashSet>, + ignored_events: Option<&HashSet>>, entropy_calculator: TEntropyCalculator, -) -> HashMap +) -> HashMap, f64> where TLog: EventLog, - TEntropyCalculator: Fn(&TLog, &str, Option<&HashSet>) -> f64, + TEntropyCalculator: Fn(&TLog, &str, Option<&HashSet>>) -> f64, { let log_info = OfflineEventLogInfo::create_from(EventLogInfoCreationDto::default(log)); let mut entropies = HashMap::new(); for event_name in log_info.all_event_classes() { if let Some(ignored_events) = ignored_events - && ignored_events.contains(event_name.as_str()) + && ignored_events.contains(event_name.as_ref()) { continue; } diff --git a/Ficus/src/rust/ficus/src/features/analysis/log_info/dfg_info.rs b/Ficus/src/rust/ficus/src/features/analysis/log_info/dfg_info.rs index 1614c9f1..a15f2bb5 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/log_info/dfg_info.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/log_info/dfg_info.rs @@ -1,24 +1,27 @@ -use std::collections::{HashMap, HashSet}; +use std::{ + collections::{HashMap, HashSet}, + rc::Rc, +}; pub trait DfgInfo { fn get_directly_follows_count(&self, first: &str, second: &str) -> usize; fn is_in_directly_follows_relation(&self, left: &str, right: &str) -> bool; - fn get_followed_events(&self, event_class: &str) -> Option<&HashMap>; - fn get_precedes_events(&self, event_class: &str) -> Option<&HashMap>; + fn get_followed_events(&self, event_class: &str) -> Option<&HashMap, usize>>; + fn get_precedes_events(&self, event_class: &str) -> Option<&HashMap, usize>>; fn is_event_with_single_follower(&self, event_class: &str) -> bool; } #[derive(Debug)] pub struct OfflineDfgInfo { - pub(super) followed_events: HashMap>, - pub(super) precedes_events: HashMap>, - pub(super) events_with_single_follower: HashSet, + pub(super) followed_events: HashMap, HashMap, usize>>, + pub(super) precedes_events: HashMap, HashMap, usize>>, + pub(super) events_with_single_follower: HashSet>, } impl OfflineDfgInfo { - pub fn create_from_relations(relations: &HashMap<(String, String), u64>) -> OfflineDfgInfo { - let mut followed_events: HashMap> = HashMap::new(); - let mut precedes_events: HashMap> = HashMap::new(); + pub fn create_from_relations(relations: &HashMap<(Rc, Rc), u64>) -> OfflineDfgInfo { + let mut followed_events: HashMap, HashMap, usize>> = HashMap::new(); + let mut precedes_events: HashMap, HashMap, usize>> = HashMap::new(); let mut events_with_single_follower = HashSet::new(); for (relation, count) in relations { @@ -66,14 +69,14 @@ impl DfgInfo for OfflineDfgInfo { } } - fn get_followed_events(&self, event_class: &str) -> Option<&HashMap> { + fn get_followed_events(&self, event_class: &str) -> Option<&HashMap, usize>> { match self.followed_events.get(event_class) { Some(followers_counts) => Some(followers_counts), None => None, } } - fn get_precedes_events(&self, event_class: &str) -> Option<&HashMap> { + fn get_precedes_events(&self, event_class: &str) -> Option<&HashMap, usize>> { match self.precedes_events.get(event_class) { Some(followers_counts) => Some(followers_counts), None => None, diff --git a/Ficus/src/rust/ficus/src/features/analysis/log_info/event_log_info.rs b/Ficus/src/rust/ficus/src/features/analysis/log_info/event_log_info.rs index 456fc3b8..4778edaa 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/log_info/event_log_info.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/log_info/event_log_info.rs @@ -44,21 +44,21 @@ pub trait EventLogInfo { fn event_classes_count(&self) -> u64; fn event_count(&self, event_class: &str) -> u64; fn dfg_info(&self) -> &dyn DfgInfo; - fn all_event_classes(&self) -> Vec<&String>; - fn start_event_classes(&self) -> &HashSet; - fn end_event_classes(&self) -> &HashSet; + fn all_event_classes(&self) -> Vec<&Rc>; + fn start_event_classes(&self) -> &HashSet>; + fn end_event_classes(&self) -> &HashSet>; } pub struct OfflineEventLogInfo { counts: Option, - event_classes_counts: HashMap, + event_classes_counts: HashMap, u64>, dfg_info: OfflineDfgInfo, - start_event_classes: HashSet, - end_event_classes: HashSet, + start_event_classes: HashSet>, + end_event_classes: HashSet>, } impl OfflineEventLogInfo { - pub fn create_from_relations(relations: &HashMap<(String, String), u64>, event_classes_count: &HashMap) -> Self { + pub fn create_from_relations(relations: &HashMap<(Rc, Rc), u64>, event_classes_count: &HashMap, u64>) -> Self { let dfg_info = OfflineDfgInfo::create_from_relations(relations); let start_event_classes = event_classes_count @@ -98,33 +98,36 @@ impl OfflineEventLogInfo { let mut new_log = None; if let Some(thread_attribute) = thread_attribute { - new_log = Some(create_threads_log_by_attribute::(log, thread_attribute.as_str())); + new_log = Some(create_threads_log_by_attribute::(log, thread_attribute.as_ref())); log = new_log.as_ref().unwrap(); } - let mut dfg_pairs: HashMap> = HashMap::new(); + let mut dfg_pairs: HashMap, HashMap, usize>> = HashMap::new(); let mut events_count = 0; let mut events_counts = HashMap::new(); let mut start_event_classes = HashSet::new(); let mut end_event_classes = HashSet::new(); - let mut update_events_counts = |event_name: &String| { + let mut update_events_counts = |event_name: &Rc| { increase_in_map(&mut events_counts, event_name); }; - let mut update_pairs_count = |first_name: &String, second_name: &String| { + let mut update_pairs_count = |first_name: &Rc, second_name: &Rc| { if let Some(values) = dfg_pairs.get_mut(first_name) { if let Some(count) = values.get_mut(second_name) { *count += 1; } else { - values.insert(second_name.to_string(), 1); + values.insert(second_name.clone(), 1); } } else { - let map = HashMap::from_iter(vec![(second_name.to_owned(), 1)]); - dfg_pairs.insert(first_name.to_owned(), map); + let map = HashMap::from_iter(vec![(second_name.clone(), 1)]); + dfg_pairs.insert(first_name.clone(), map); } }; + let fake_start_name = Rc::::from(FAKE_EVENT_START_NAME); + let fake_end_name = Rc::::from(FAKE_EVENT_END_NAME); + for trace in log.traces() { let trace = trace.borrow(); let events = trace.events(); @@ -132,16 +135,16 @@ impl OfflineEventLogInfo { let mut prev_event_name = None; if !events.is_empty() { - start_event_classes.insert(events.first().unwrap().borrow().name().to_owned()); - end_event_classes.insert(events.last().unwrap().borrow().name().to_owned()); + start_event_classes.insert(events.first().unwrap().borrow().name_pointer().clone()); + end_event_classes.insert(events.last().unwrap().borrow().name_pointer().clone()); } for event in events { let event = event.borrow(); - let current_name = event.name().to_owned(); + let current_name = event.name_pointer(); if let Some(ignored_events) = ignored_events - && ignored_events.contains(¤t_name) + && ignored_events.contains(current_name) { continue; } @@ -151,7 +154,7 @@ impl OfflineEventLogInfo { if prev_event_name.is_none() { prev_event_name = Some(current_name.to_owned()); if add_fake_start_end_events { - update_pairs_count(&FAKE_EVENT_START_NAME.to_string(), ¤t_name); + update_pairs_count(&fake_start_name, current_name); } continue; @@ -159,15 +162,15 @@ impl OfflineEventLogInfo { let prev_name = prev_event_name.unwrap(); update_pairs_count(&prev_name, ¤t_name); - prev_event_name = Some(event.name().to_owned()); + prev_event_name = Some(event.name_pointer().clone()); } if add_fake_start_end_events && let Some(prev_event_name) = prev_event_name { - update_pairs_count(&prev_event_name, &FAKE_EVENT_END_NAME.to_string()); + update_pairs_count(&prev_event_name, &fake_end_name); } } - let mut precedes_events: HashMap> = HashMap::new(); + let mut precedes_events: HashMap, HashMap, usize>> = HashMap::new(); let mut events_with_single_follower = HashSet::new(); for (first, followers_map) in &dfg_pairs { @@ -207,7 +210,7 @@ pub fn create_threads_log_by_attribute(log: &TLog, thread_attrib for trace in log.traces() { let trace = trace.borrow(); - let mut threads_traces = HashMap::, TLog::TTrace>::new(); + let mut threads_traces = HashMap::>, TLog::TTrace>::new(); for event in trace.events() { let thread_id = extract_thread_id(event.borrow().deref(), thread_attribute); @@ -252,15 +255,15 @@ impl EventLogInfo for OfflineEventLogInfo { &self.dfg_info } - fn all_event_classes(&self) -> Vec<&String> { + fn all_event_classes(&self) -> Vec<&Rc> { self.event_classes_counts.keys().collect() } - fn start_event_classes(&self) -> &HashSet { + fn start_event_classes(&self) -> &HashSet> { &self.start_event_classes } - fn end_event_classes(&self) -> &HashSet { + fn end_event_classes(&self) -> &HashSet> { &self.end_event_classes } } diff --git a/Ficus/src/rust/ficus/src/features/analysis/log_info/log_info_creation_dto.rs b/Ficus/src/rust/ficus/src/features/analysis/log_info/log_info_creation_dto.rs index e4984cda..171d0b41 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/log_info/log_info_creation_dto.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/log_info/log_info_creation_dto.rs @@ -1,5 +1,5 @@ use crate::event_log::core::event_log::EventLog; -use std::collections::HashSet; +use std::{collections::HashSet, rc::Rc}; pub struct EventLogInfoCreationDto<'a, TLog> where @@ -7,8 +7,8 @@ where { pub(super) log: &'a TLog, pub(super) add_fake_start_end_events: bool, - pub(super) ignored_events: Option<&'a HashSet>, - pub(super) thread_attribute: Option, + pub(super) ignored_events: Option<&'a HashSet>>, + pub(super) thread_attribute: Option>, } impl<'a, TLog> EventLogInfoCreationDto<'a, TLog> @@ -33,7 +33,7 @@ where } } - pub fn default_fake_ignored(log: &'a TLog, ignored_events: Option<&'a HashSet>) -> Self { + pub fn default_fake_ignored(log: &'a TLog, ignored_events: Option<&'a HashSet>>) -> Self { Self { log, add_fake_start_end_events: true, @@ -42,7 +42,7 @@ where } } - pub fn default_ignore(log: &'a TLog, ignored_events: &'a HashSet) -> Self { + pub fn default_ignore(log: &'a TLog, ignored_events: &'a HashSet>) -> Self { Self { log, add_fake_start_end_events: false, @@ -51,7 +51,7 @@ where } } - pub fn default_thread(log: &'a TLog, thread_attribute: String) -> Self { + pub fn default_thread(log: &'a TLog, thread_attribute: Rc) -> Self { Self { log, add_fake_start_end_events: false, diff --git a/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs b/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs index 37406a03..97521f75 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs @@ -497,7 +497,7 @@ where for event in &underlying_events { execute_with_underlying_events(event, &mut |event| { let payload_value = EventPayloadValue::String(activity.node.borrow().id().clone()); - let key = format!("hierarchy_level_{}", level); + let key = Rc::from(format!("hierarchy_level_{}", level)); event.add_or_update_payload(key, payload_value); }) } @@ -666,7 +666,7 @@ fn create_log_from_traces_activities( activities_to_logs } -pub fn create_activity_name(log: &TLog, sub_array: &SubArrayWithTraceIndex, class_extractor: Option<&String>) -> String +pub fn create_activity_name(log: &TLog, sub_array: &SubArrayWithTraceIndex, class_extractor: Option<&str>) -> String where TLog: EventLog, { diff --git a/Ficus/src/rust/ficus/src/features/cases/mod.rs b/Ficus/src/rust/ficus/src/features/cases/mod.rs index d66a1cb9..fcc5692f 100644 --- a/Ficus/src/rust/ficus/src/features/cases/mod.rs +++ b/Ficus/src/rust/ficus/src/features/cases/mod.rs @@ -1,14 +1,16 @@ +use std::rc::Rc; + #[derive(Clone, Debug)] pub struct CaseName { - pub display_name: String, - pub name_parts: Vec, + pub display_name: Rc, + pub name_parts: Vec>, } impl CaseName { pub fn empty() -> Self { Self { name_parts: vec![], - display_name: "UNDEFINED".to_string(), + display_name: "UNDEFINED".into(), } } } diff --git a/Ficus/src/rust/ficus/src/features/clustering/activities/activities_common.rs b/Ficus/src/rust/ficus/src/features/clustering/activities/activities_common.rs index 573bdf98..f8b55c99 100644 --- a/Ficus/src/rust/ficus/src/features/clustering/activities/activities_common.rs +++ b/Ficus/src/rust/ficus/src/features/clustering/activities/activities_common.rs @@ -151,7 +151,7 @@ fn create_activities_repr_from_subtraces( fn create_dataset_internal( traces_activities: &TracesActivities, - class_extractor: Option, + class_extractor: Option>, activities_repr_fullfiller: impl Fn( &Vec>, Option<&RegexEventHasher>, diff --git a/Ficus/src/rust/ficus/src/features/clustering/activities/merging.rs b/Ficus/src/rust/ficus/src/features/clustering/activities/merging.rs index 12e3f122..1c4524ca 100644 --- a/Ficus/src/rust/ficus/src/features/clustering/activities/merging.rs +++ b/Ficus/src/rust/ficus/src/features/clustering/activities/merging.rs @@ -66,7 +66,7 @@ pub(super) fn merge_activities( new_activity_name_parts.sort(); let mut new_activity_name = String::new(); - new_activity_name.push_str(create_cluster_name(*cluster).as_str()); + new_activity_name.push_str(create_cluster_name(*cluster).as_ref()); let new_node = ActivityNode::new( None, diff --git a/Ficus/src/rust/ficus/src/features/clustering/common.rs b/Ficus/src/rust/ficus/src/features/clustering/common.rs index 457a9f73..f9ab5599 100644 --- a/Ficus/src/rust/ficus/src/features/clustering/common.rs +++ b/Ficus/src/rust/ficus/src/features/clustering/common.rs @@ -1,5 +1,6 @@ use linfa::DatasetBase; use ndarray::{Array1, ArrayBase, Dim, OwnedRepr}; +use std::rc::Rc; use crate::{ event_log::xes::xes_event_log::XesEventLogImpl, @@ -15,7 +16,7 @@ pub(super) type ClusteredDataset = DatasetBase, Dim<[us pub struct CommonVisualizationParams<'a> { pub log: &'a XesEventLogImpl, pub colors_holder: &'a mut ColorsHolder, - pub class_extractor: Option, + pub class_extractor: Option>, } pub fn transform_to_ficus_dataset(dataset: &MyDataset, processed: Vec, classes_names: Vec) -> FicusDataset { @@ -60,8 +61,8 @@ pub fn scale_raw_dataset_min_max(vector: &mut [f64], objects_count: usize, featu } } -pub fn create_cluster_name(cluster_index: usize) -> String { - format!("CLUSTER_{}", cluster_index) +pub fn create_cluster_name(cluster_index: usize) -> Rc { + Rc::from(format!("CLUSTER_{}", cluster_index)) } pub(super) fn adjust_dbscan_labels(clusters: Array1>, put_noise_events_in_one_cluster: bool) -> Vec { diff --git a/Ficus/src/rust/ficus/src/features/clustering/traces/common.rs b/Ficus/src/rust/ficus/src/features/clustering/traces/common.rs index 86f1c757..4587f3dd 100644 --- a/Ficus/src/rust/ficus/src/features/clustering/traces/common.rs +++ b/Ficus/src/rust/ficus/src/features/clustering/traces/common.rs @@ -82,7 +82,7 @@ pub fn do_clusterize_log_by_traces( fn create_traces_dataset( log: &XesEventLogImpl, distance: &FicusDistance, - class_extractor: Option<&String>, + class_extractor: Option<&Rc>, feature_count_kind: FeatureCountKind, trace_repr_source: &TracesRepresentationSource, ) -> Result<(MyDataset, Vec, Vec), ClusteringError> { @@ -98,7 +98,7 @@ fn create_traces_dataset( fn create_traces_dataset_default( log: &XesEventLogImpl, - class_extractor: Option<&String>, + class_extractor: Option<&Rc>, feature_count_kind: FeatureCountKind, trace_repr_source: &TracesRepresentationSource, ) -> Result<(MyDataset, Vec, Vec), ClusteringError> { @@ -135,7 +135,7 @@ fn create_trace_representation(trace: &XesTraceImpl, trace_repr_source: &TracesR fn create_traces_dataset_default_internal( log: &TLog, - class_extractor: Option<&String>, + class_extractor: Option<&Rc>, feature_count_kind: FeatureCountKind, trace_repr_creator: impl Fn(&TLog::TTrace) -> Vec>>, ) -> Result<(MyDataset, Vec, Vec), ClusteringError> { @@ -216,7 +216,7 @@ fn create_traces_dataset_default_internal( fn create_traces_dataset_levenshtein( log: &XesEventLogImpl, - class_extractor: Option<&String>, + class_extractor: Option<&Rc>, trace_repr_source: &TracesRepresentationSource, ) -> Result<(MyDataset, Vec, Vec), ClusteringError> { create_traces_dataset_levenshtein_internal(log, class_extractor, |trace| create_trace_representation(trace, trace_repr_source)) @@ -224,7 +224,7 @@ fn create_traces_dataset_levenshtein( fn create_traces_dataset_levenshtein_internal( log: &TLog, - class_extractor: Option<&String>, + class_extractor: Option<&Rc>, trace_repr_creator: impl Fn(&TLog::TTrace) -> Vec>>, ) -> Result<(MyDataset, Vec, Vec), ClusteringError> { let regex_hasher = class_extractor diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha.rs index 4c48870c..8e288bc4 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha.rs @@ -1,4 +1,5 @@ use crate::{ + context_key, event_log::core::{event::event::Event, event_log::EventLog, trace::trace::Trace}, features::{ analysis::log_info::event_log_info::EventLogInfo, @@ -16,15 +17,18 @@ use crate::{ }, }, }, - utils::user_data::{keys::DefaultKey, user_data::UserData}, + utils::user_data::user_data::UserData, }; +use lazy_static::lazy_static; use once_cell::sync::Lazy; use std::{ collections::{HashMap, HashSet}, + rc::Rc, string::ToString, }; -pub static ALPHA_SET: Lazy> = Lazy::new(|| DefaultKey::new("alpha_set".to_string())); +const ALPHA_SET: &str = "alpha_set"; +context_key! { ALPHA_SET, AlphaSet } pub fn discover_petri_net_alpha(provider: &impl AlphaRelationsProvider) -> DefaultPetriNet { do_discover_petri_net_alpha(provider) @@ -52,7 +56,7 @@ fn add_one_length_loops(provider: &impl AlphaPlusRelationsProvider, original_log if let Some(followed_events) = original_log_info.dfg_info().get_followed_events(transition_name) { for event in followed_events.keys() { if event != transition_name { - alpha_set.insert_right_class(event.to_owned()); + alpha_set.insert_right_class(event.clone()); } } } @@ -60,7 +64,7 @@ fn add_one_length_loops(provider: &impl AlphaPlusRelationsProvider, original_log if let Some(precedes_events) = original_log_info.dfg_info().get_precedes_events(transition_name) { for event in precedes_events.keys() { if event != transition_name { - alpha_set.insert_left_class(event.to_owned()); + alpha_set.insert_left_class(event.clone()); } } } @@ -82,18 +86,17 @@ fn add_one_length_loops(provider: &impl AlphaPlusRelationsProvider, original_log } fn add_alpha_plus_plus_transitions(provider: &impl AlphaPlusRelationsProvider, petri_net: &mut DefaultPetriNet) { - let key = Lazy::get(&ALPHA_SET).unwrap(); let mut transitions_connections = HashSet::new(); let mut places_connections = HashSet::new(); for transition in provider.one_length_loop_transitions() { if let Some(transition) = petri_net.find_transition_by_name(transition) { for place in petri_net.all_places() { - if let Some(alpha_set) = place.user_data().concrete(key) { + if let Some(alpha_set) = place.user_data().concrete(ALPHA_SET_KEY.key()) { for outgoing_arc in transition.outgoing_arcs() { if outgoing_arc.place_id() != place.id() { let outgoing_place = petri_net.place(&outgoing_arc.place_id()); - if let Some(outgoing_alpha_set) = outgoing_place.user_data().concrete(key) + if let Some(outgoing_alpha_set) = outgoing_place.user_data().concrete(ALPHA_SET_KEY.key()) && alpha_set.is_full_subset(outgoing_alpha_set) { transitions_connections.insert((transition.id(), outgoing_place.id())); @@ -104,7 +107,7 @@ fn add_alpha_plus_plus_transitions(provider: &impl AlphaPlusRelationsProvider, p for incoming_arc in transition.incoming_arcs() { if incoming_arc.place_id() != place.id() { let incoming_place = petri_net.place(&incoming_arc.place_id()); - if let Some(incoming_alpha_set) = incoming_place.user_data().concrete(key) + if let Some(incoming_alpha_set) = incoming_place.user_data().concrete(ALPHA_SET_KEY.key()) && alpha_set.is_full_subset(incoming_alpha_set) { places_connections.insert((incoming_place.id(), transition.id())); @@ -125,14 +128,14 @@ fn add_alpha_plus_plus_transitions(provider: &impl AlphaPlusRelationsProvider, p } } -pub fn find_transitions_one_length_loop(log: &impl EventLog) -> HashSet { +pub fn find_transitions_one_length_loop(log: &impl EventLog) -> HashSet> { let mut one_loop_transitions = HashSet::new(); for trace in log.traces() { let trace = trace.borrow(); let events = trace.events(); for i in 0..(events.len() - 1) { if events[i].borrow().name() == events[i + 1].borrow().name() { - one_loop_transitions.insert(events[i].borrow().name().to_owned()); + one_loop_transitions.insert(events[i].borrow().name_pointer().clone()); } } } @@ -152,13 +155,13 @@ fn create_initial_sets(provider: &impl AlphaRelationsProvider) -> HashSet) -> Defa let mut event_classes_to_transition_ids = HashMap::new(); for class in info.all_event_classes() { let id = petri_net.add_transition(Transition::empty(class.to_owned(), false, Some(class.to_owned()))); - event_classes_to_transition_ids.insert(class, id); + event_classes_to_transition_ids.insert(class.as_ref(), id); } for alpha_set in alpha_sets { let mut place = Place::with_name(alpha_set.to_string()); - place.user_data_mut().put_concrete(&ALPHA_SET, alpha_set.clone()); + place.user_data_mut().put_concrete(ALPHA_SET_KEY.key(), alpha_set.clone()); let place_id = petri_net.add_place(place); for class in alpha_set.left_classes() { - petri_net.connect_transition_to_place(&event_classes_to_transition_ids[&class], &place_id, None); + petri_net.connect_transition_to_place(&event_classes_to_transition_ids[class.as_ref()], &place_id, None); } for class in alpha_set.right_classes() { - petri_net.connect_place_to_transition(&place_id, &event_classes_to_transition_ids[&class], None); + petri_net.connect_place_to_transition(&place_id, &event_classes_to_transition_ids[&class.as_ref()], None); } } let start_place_id = petri_net.add_place(Place::with_name("StartPlace".to_string())); for start_activity in info.start_event_classes() { - petri_net.connect_place_to_transition(&start_place_id, &event_classes_to_transition_ids[start_activity], None); + petri_net.connect_place_to_transition(&start_place_id, &event_classes_to_transition_ids[start_activity.as_ref()], None); } let end_place_id = petri_net.add_place(Place::with_name("EndPlace".to_string())); for end_activity in info.end_event_classes() { - petri_net.connect_transition_to_place(&event_classes_to_transition_ids[end_activity], &end_place_id, None); + petri_net.connect_transition_to_place(&event_classes_to_transition_ids[end_activity.as_ref()], &end_place_id, None); } petri_net.set_initial_marking(Marking::new(vec![SingleMarking::new(start_place_id, 1)])); diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs index 4e2e1978..8c994195 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs @@ -7,7 +7,7 @@ use crate::{ }, discovery::{ alpha::{ - alpha::{ALPHA_SET, discover_petri_net_alpha, discover_petri_net_alpha_plus, find_transitions_one_length_loop}, + alpha::{discover_petri_net_alpha, discover_petri_net_alpha_plus, find_transitions_one_length_loop}, alpha_plus_plus_nfc::{alpha_plus_plus_nfc_triple::AlphaPlusPlusNfcTriple, extended_alpha_set::ExtendedAlphaSet, w3_pair::W3Pair}, providers::alpha_plus_nfc_provider::AlphaPlusNfcRelationsProvider, utils::maximize, @@ -18,7 +18,11 @@ use crate::{ }, utils::{sets::two_sets::TwoSets, user_data::user_data::UserData}, }; -use std::collections::{HashMap, HashSet, VecDeque}; +use std::{ + collections::{HashMap, HashSet, VecDeque}, + rc::Rc, +}; +use crate::features::discovery::alpha::alpha::ALPHA_SET_KEY; pub fn discover_petri_net_alpha_plus_plus_nfc(log: &TLog) -> DefaultPetriNet { let one_length_loop_transitions = find_transitions_one_length_loop(log); @@ -32,7 +36,7 @@ pub fn discover_petri_net_alpha_plus_plus_nfc(log: &TLog) -> Def for a_class in info.all_event_classes() { for b_class in info.all_event_classes() { for c_class in &one_length_loop_transitions { - if let Some(triple) = AlphaPlusPlusNfcTriple::try_new(a_class, b_class, c_class, &provider) { + if let Some(triple) = AlphaPlusPlusNfcTriple::try_new(a_class.clone(), b_class.clone(), c_class.clone(), &provider) { x_w.insert(triple); } } @@ -76,13 +80,13 @@ pub fn discover_petri_net_alpha_plus_plus_nfc(log: &TLog) -> Def let alpha_net = discover_petri_net_alpha(&provider); for place in alpha_net.all_places() { - if let Some(alpha_set) = place.user_data().concrete(&ALPHA_SET) { + if let Some(alpha_set) = place.user_data().concrete(ALPHA_SET_KEY.key()) { for first_class in info.all_event_classes() { for second_class in info.all_event_classes() { let set = ExtendedAlphaSet::try_new( alpha_set.clone(), - first_class, - second_class, + first_class.clone(), + second_class.clone(), &mut provider, &w1_relations, &w2_relations, @@ -94,12 +98,12 @@ pub fn discover_petri_net_alpha_plus_plus_nfc(log: &TLog) -> Def } for class in info.all_event_classes() { - let set = ExtendedAlphaSet::try_new_only_left(alpha_set.clone(), class, &mut provider, &w1_relations, &w2_relations); + let set = ExtendedAlphaSet::try_new_only_left(alpha_set.clone(), class.clone(), &mut provider, &w1_relations, &w2_relations); if let Some(set) = set { x_w.insert(set); } - let set = ExtendedAlphaSet::try_new_only_right(alpha_set.clone(), class, &mut provider, &w1_relations, &w2_relations); + let set = ExtendedAlphaSet::try_new_only_right(alpha_set.clone(), class.clone(), &mut provider, &w1_relations, &w2_relations); if let Some(set) = set { x_w.insert(set); } @@ -108,7 +112,7 @@ pub fn discover_petri_net_alpha_plus_plus_nfc(log: &TLog) -> Def } for place in alpha_net.all_places() { - if let Some(alpha_set) = place.user_data().concrete(&ALPHA_SET) { + if let Some(alpha_set) = place.user_data().concrete(ALPHA_SET_KEY.key()) { x_w.insert(ExtendedAlphaSet::new_without_extensions(alpha_set.clone())); } } @@ -136,18 +140,17 @@ pub fn discover_petri_net_alpha_plus_plus_nfc(log: &TLog) -> Def for a_class in info.all_event_classes() { for b_class in info.all_event_classes() { if provider.w3_relation(a_class, b_class, &petri_net) { - w3_relations.insert((a_class, b_class)); + w3_relations.insert((a_class.as_ref(), b_class.as_ref())); } } } - let w3_closure = construct_w3_transitive_closure_cache(&w3_relations); - eliminate_w3_relations_by_rule_2(&mut w3_relations, &w3_closure); + eliminate_w3_relations_by_rule_2(&mut w3_relations); let mut x_w = HashSet::new(); for first_class in info.all_event_classes() { for second_class in info.all_event_classes() { - if let Some(pair) = W3Pair::try_new(first_class, second_class, &w3_relations, &provider) { + if let Some(pair) = W3Pair::try_new(first_class.clone(), second_class.clone(), &w3_relations, &provider) { x_w.insert(pair); } } @@ -163,7 +166,7 @@ pub fn discover_petri_net_alpha_plus_plus_nfc(log: &TLog) -> Def }); let mut p_w = HashSet::new(); - let check_should_add_to_pw = |two_sets: &TwoSets<&String>| { + let check_should_add_to_pw = |two_sets: &TwoSets>| { for l_w_item in &l_w { if l_w_item.a_classes().eq(two_sets.first_set()) && l_w_item.b_classes().eq(two_sets.second_set()) { return false; @@ -212,7 +215,7 @@ pub fn discover_petri_net_alpha_plus_plus_nfc(log: &TLog) -> Def } fn eliminate_by_reduction_rule_1( - w2_relations: &mut HashSet<(&String, &String)>, + w2_relations: &mut HashSet<(&Rc, &Rc)>, provider: &mut AlphaPlusNfcRelationsProvider, petri_net: &DefaultPetriNet, info: &OfflineEventLogInfo, @@ -235,8 +238,8 @@ fn eliminate_by_reduction_rule_1( } } -fn construct_w3_transitive_closure_cache<'a>(w3_relations: &'a HashSet<(&'a String, &'a String)>) -> HashMap> { - let mut graph: HashMap<&String, HashSet<&String>> = HashMap::new(); +fn construct_w3_transitive_closure_cache<'a>(w3_relations: &'a HashSet<(&'a str, &'a str)>) -> HashMap<&'a str, HashSet<&'a str>> { + let mut graph: HashMap<&'a str, HashSet<&'a str>> = HashMap::new(); let mut all_classes = HashSet::new(); for relation in w3_relations { if let Some(children) = graph.get_mut(relation.0) { @@ -249,7 +252,7 @@ fn construct_w3_transitive_closure_cache<'a>(w3_relations: &'a HashSet<(&'a Stri all_classes.insert(relation.1); } - let mut closure: HashMap> = HashMap::new(); + let mut closure: HashMap<&'a str, HashSet<&'a str>> = HashMap::new(); for first_class in &all_classes { for second_class in &all_classes { @@ -279,9 +282,9 @@ fn construct_w3_transitive_closure_cache<'a>(w3_relations: &'a HashSet<(&'a Stri if is_in_closure { if let Some(children) = closure.get_mut(*first_class) { - children.insert((**second_class).clone()); + children.insert(second_class); } else { - closure.insert((**first_class).clone(), HashSet::from_iter(vec![(**second_class).clone()])); + closure.insert(first_class, HashSet::from_iter(vec![*second_class])); } } } @@ -290,8 +293,10 @@ fn construct_w3_transitive_closure_cache<'a>(w3_relations: &'a HashSet<(&'a Stri closure } -fn eliminate_w3_relations_by_rule_2(w3_relations: &mut HashSet<(&String, &String)>, closure_cache: &HashMap>) { +fn eliminate_w3_relations_by_rule_2(w3_relations: &mut HashSet<(&str, &str)>) { + let closure_cache = construct_w3_transitive_closure_cache(&w3_relations); let mut to_remove = HashSet::new(); + for relation in w3_relations.iter() { if let Some(children) = closure_cache.get(relation.0) && children.contains(relation.1) diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc_triple.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc_triple.rs index d6a4790c..241ebd86 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc_triple.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc_triple.rs @@ -6,20 +6,21 @@ use crate::{ }, utils::{hash_utils::compare_based_on_hashes, sets::two_sets::TwoSets}, }; -use std::{ +use std::rc::Rc; +pub use std::{ collections::BTreeSet, fmt::Display, hash::{Hash, Hasher}, }; -pub(crate) struct AlphaPlusPlusNfcTriple<'a> { - a_classes: BTreeSet<&'a String>, - b_classes: BTreeSet<&'a String>, - c_classes: BTreeSet<&'a String>, +pub(crate) struct AlphaPlusPlusNfcTriple { + a_classes: BTreeSet>, + b_classes: BTreeSet>, + c_classes: BTreeSet>, } -impl<'a> AlphaPlusPlusNfcTriple<'a> { - pub fn new(a_class: &'a String, b_class: &'a String, c_class: &'a String) -> Self { +impl AlphaPlusPlusNfcTriple { + pub fn new(a_class: Rc, b_class: Rc, c_class: Rc) -> Self { Self { a_classes: BTreeSet::from_iter(vec![a_class]), b_classes: BTreeSet::from_iter(vec![b_class]), @@ -28,10 +29,10 @@ impl<'a> AlphaPlusPlusNfcTriple<'a> { } pub fn try_new( - a_class: &'a String, - b_class: &'a String, - c_class: &'a String, - provider: &AlphaPlusNfcRelationsProvider<'a, TLog>, + a_class: Rc, + b_class: Rc, + c_class: Rc, + provider: &AlphaPlusNfcRelationsProvider<'_, TLog>, ) -> Option { let candidate = Self::new(a_class, b_class, c_class); match candidate.valid(provider) { @@ -40,10 +41,9 @@ impl<'a> AlphaPlusPlusNfcTriple<'a> { } } - pub fn try_merge(first: &Self, second: &Self, provider: &AlphaPlusNfcRelationsProvider<'a, TLog>) -> Option { - let merge_sets = |first: &BTreeSet<&'a String>, second: &BTreeSet<&'a String>| -> BTreeSet<&'a String> { - first.iter().chain(second.iter()).copied().collect() - }; + pub fn try_merge(first: &Self, second: &Self, provider: &AlphaPlusNfcRelationsProvider<'_, TLog>) -> Option { + let merge_sets = + |first: &BTreeSet>, second: &BTreeSet>| -> BTreeSet> { first.iter().chain(second.iter()).cloned().collect() }; let new_triple = Self { a_classes: merge_sets(&first.a_classes, &second.a_classes), @@ -57,7 +57,7 @@ impl<'a> AlphaPlusPlusNfcTriple<'a> { } } - pub fn valid(&self, provider: &AlphaPlusNfcRelationsProvider<'a, TLog>) -> bool { + pub fn valid(&self, provider: &AlphaPlusNfcRelationsProvider<'_, TLog>) -> bool { for a_class in &self.a_classes { for b_class in &self.b_classes { for c_class in &self.c_classes { @@ -83,25 +83,25 @@ impl<'a> AlphaPlusPlusNfcTriple<'a> { true } - pub fn two_sets(&self) -> TwoSets<&'a String> { + pub fn two_sets(&self) -> TwoSets> { let first = self.a_classes.iter().chain(self.c_classes.iter()); let second = self.b_classes.iter().chain(self.c_classes.iter()); - TwoSets::new(first.copied().collect(), second.copied().collect()) + TwoSets::new(first.cloned().collect(), second.cloned().collect()) } - pub fn a_classes(&self) -> &BTreeSet<&'a String> { + pub fn a_classes(&self) -> &BTreeSet> { &self.a_classes } - pub fn b_classes(&self) -> &BTreeSet<&'a String> { + pub fn b_classes(&self) -> &BTreeSet> { &self.b_classes } } -impl<'a> Hash for AlphaPlusPlusNfcTriple<'a> { +impl Hash for AlphaPlusPlusNfcTriple { fn hash(&self, state: &mut H) { - let mut hash_classes = |set: &BTreeSet<&'a String>| { + let mut hash_classes = |set: &BTreeSet>| { for class in set { state.write(class.as_bytes()); } @@ -113,13 +113,13 @@ impl<'a> Hash for AlphaPlusPlusNfcTriple<'a> { } } -impl<'a> PartialEq for AlphaPlusPlusNfcTriple<'a> { +impl PartialEq for AlphaPlusPlusNfcTriple { fn eq(&self, other: &Self) -> bool { compare_based_on_hashes(self, other) } } -impl<'a> Clone for AlphaPlusPlusNfcTriple<'a> { +impl Clone for AlphaPlusPlusNfcTriple { fn clone(&self) -> Self { Self { a_classes: self.a_classes.clone(), @@ -129,18 +129,18 @@ impl<'a> Clone for AlphaPlusPlusNfcTriple<'a> { } } -impl<'a> Eq for AlphaPlusPlusNfcTriple<'a> {} +impl Eq for AlphaPlusPlusNfcTriple {} -impl<'a> Display for AlphaPlusPlusNfcTriple<'a> { +impl Display for AlphaPlusPlusNfcTriple { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let mut repr = String::new(); repr.push('('); - let mut push_set = |set: &BTreeSet<&'a String>| { + let mut push_set = |set: &BTreeSet>| { repr.push('{'); for class in set.iter() { - repr.push_str(class.as_str()); + repr.push_str(class); repr.push(',') } diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/extended_alpha_set.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/extended_alpha_set.rs index cc12038f..3bf5fac3 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/extended_alpha_set.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/extended_alpha_set.rs @@ -10,15 +10,16 @@ use std::{ collections::{BTreeSet, HashSet}, fmt::Display, hash::{Hash, Hasher}, + rc::Rc, }; -pub(crate) struct ExtendedAlphaSet<'a> { +pub(crate) struct ExtendedAlphaSet { alpha_set: AlphaSet, - left_extension: BTreeSet<&'a String>, - right_extension: BTreeSet<&'a String>, + left_extension: BTreeSet>, + right_extension: BTreeSet>, } -impl<'a> ExtendedAlphaSet<'a> { +impl ExtendedAlphaSet { pub fn new_without_extensions(alpha_set: AlphaSet) -> Self { Self { alpha_set, @@ -27,7 +28,7 @@ impl<'a> ExtendedAlphaSet<'a> { } } - pub fn new(alpha_set: AlphaSet, left_extension: &'a String, right_extension: &'a String) -> Self { + pub fn new(alpha_set: AlphaSet, left_extension: Rc, right_extension: Rc) -> Self { Self { alpha_set, left_extension: BTreeSet::from_iter(vec![left_extension]), @@ -35,7 +36,7 @@ impl<'a> ExtendedAlphaSet<'a> { } } - pub fn new_only_left(alpha_set: AlphaSet, left_extension: &'a String) -> Self { + pub fn new_only_left(alpha_set: AlphaSet, left_extension: Rc) -> Self { Self { alpha_set, left_extension: BTreeSet::from_iter(vec![left_extension]), @@ -43,7 +44,7 @@ impl<'a> ExtendedAlphaSet<'a> { } } - pub fn new_only_right(alpha_set: AlphaSet, right_extension: &'a String) -> Self { + pub fn new_only_right(alpha_set: AlphaSet, right_extension: Rc) -> Self { Self { alpha_set, left_extension: BTreeSet::new(), @@ -53,11 +54,11 @@ impl<'a> ExtendedAlphaSet<'a> { pub fn try_new( alpha_set: AlphaSet, - left_extension: &'a String, - right_extension: &'a String, + left_extension: Rc, + right_extension: Rc, provider: &mut AlphaPlusNfcRelationsProvider, - w1_relations: &HashSet<(&'a String, &'a String)>, - w2_relations: &HashSet<(&'a String, &'a String)>, + w1_relations: &HashSet<(&Rc, &Rc)>, + w2_relations: &HashSet<(&Rc, &Rc)>, ) -> Option { Self::try_new_internal(provider, w1_relations, w2_relations, move || { Self::new(alpha_set, left_extension, right_extension) @@ -66,8 +67,8 @@ impl<'a> ExtendedAlphaSet<'a> { fn try_new_internal( provider: &mut AlphaPlusNfcRelationsProvider, - w1_relations: &HashSet<(&'a String, &'a String)>, - w2_relations: &HashSet<(&'a String, &'a String)>, + w1_relations: &HashSet<(&Rc, &Rc)>, + w2_relations: &HashSet<(&Rc, &Rc)>, factory: impl FnOnce() -> Self, ) -> Option { let new_set = factory(); @@ -79,10 +80,10 @@ impl<'a> ExtendedAlphaSet<'a> { pub fn try_new_only_left( alpha_set: AlphaSet, - left_extension: &'a String, + left_extension: Rc, provider: &mut AlphaPlusNfcRelationsProvider, - w1_relations: &HashSet<(&'a String, &'a String)>, - w2_relations: &HashSet<(&'a String, &'a String)>, + w1_relations: &HashSet<(&Rc, &Rc)>, + w2_relations: &HashSet<(&Rc, &Rc)>, ) -> Option { Self::try_new_internal(provider, w1_relations, w2_relations, || { Self::new_only_left(alpha_set, left_extension) @@ -91,10 +92,10 @@ impl<'a> ExtendedAlphaSet<'a> { pub fn try_new_only_right( alpha_set: AlphaSet, - right_extension: &'a String, + right_extension: Rc, provider: &mut AlphaPlusNfcRelationsProvider, - w1_relations: &HashSet<(&'a String, &'a String)>, - w2_relations: &HashSet<(&'a String, &'a String)>, + w1_relations: &HashSet<(&Rc, &Rc)>, + w2_relations: &HashSet<(&Rc, &Rc)>, ) -> Option { Self::try_new_internal(provider, w1_relations, w2_relations, || { Self::new_only_right(alpha_set, right_extension) @@ -104,8 +105,8 @@ impl<'a> ExtendedAlphaSet<'a> { pub fn valid( &self, provider: &mut AlphaPlusNfcRelationsProvider, - w1_relations: &HashSet<(&'a String, &'a String)>, - w2_relations: &HashSet<(&'a String, &'a String)>, + w1_relations: &HashSet<(&Rc, &Rc)>, + w2_relations: &HashSet<(&Rc, &Rc)>, ) -> bool { for a in &self.left_extension { if self.alpha_set.contains_left(a) { @@ -127,7 +128,7 @@ impl<'a> ExtendedAlphaSet<'a> { } } - for b_class in self.alpha_set.right_classes().iter().chain(self.right_extension.iter()) { + for b_class in self.alpha_set.right_classes().into_iter().chain(self.right_extension.iter()) { for a in &self.left_extension { if !(w1_relations.contains(&(a, b_class)) || w2_relations.contains(&(a, b_class))) { return false; @@ -157,19 +158,19 @@ impl<'a> ExtendedAlphaSet<'a> { pub fn merge(&self, other: &Self) -> Self { Self { alpha_set: self.alpha_set.extend(&other.alpha_set), - left_extension: self.left_extension.iter().chain(&other.left_extension).copied().collect(), - right_extension: self.right_extension.iter().chain(&other.right_extension).copied().collect(), + left_extension: self.left_extension.iter().chain(&other.left_extension).cloned().collect(), + right_extension: self.right_extension.iter().chain(&other.right_extension).cloned().collect(), } } - pub fn two_sets(&'a self) -> TwoSets<&'a String> { + pub fn two_sets(&self) -> TwoSets> { let first = self.alpha_set.left_classes(); - let first = first.iter().chain(self.left_extension.iter()); + let first = first.into_iter().chain(&self.left_extension); let second = self.alpha_set.right_classes(); - let second = second.iter().chain(self.right_extension.iter()); + let second = second.into_iter().chain(&self.right_extension); - TwoSets::new(first.copied().collect(), second.copied().collect()) + TwoSets::new(first.cloned().collect(), second.cloned().collect()) } pub fn alpha_set(&self) -> &AlphaSet { @@ -177,7 +178,7 @@ impl<'a> ExtendedAlphaSet<'a> { } } -impl<'a> Hash for ExtendedAlphaSet<'a> { +impl Hash for ExtendedAlphaSet { fn hash(&self, state: &mut H) { self.alpha_set.hash(state); for left in &self.left_extension { @@ -190,22 +191,22 @@ impl<'a> Hash for ExtendedAlphaSet<'a> { } } -impl<'a> PartialEq for ExtendedAlphaSet<'a> { +impl PartialEq for ExtendedAlphaSet { fn eq(&self, other: &Self) -> bool { compare_based_on_hashes(self, other) } } -impl<'a> Eq for ExtendedAlphaSet<'a> {} +impl Eq for ExtendedAlphaSet {} -impl<'a> Display for ExtendedAlphaSet<'a> { +impl Display for ExtendedAlphaSet { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let mut repr = String::new(); repr.push('('); repr.push_str(self.alpha_set.to_string().as_str()); repr.push_str(", "); - let mut serialize_set = |set: &BTreeSet<&'a String>| { + let mut serialize_set = |set: &BTreeSet>| { repr.push('{'); for item in set { repr.push_str(item); @@ -231,12 +232,12 @@ impl<'a> Display for ExtendedAlphaSet<'a> { } } -impl<'a> Clone for ExtendedAlphaSet<'a> { +impl Clone for ExtendedAlphaSet { fn clone(&self) -> Self { Self { alpha_set: self.alpha_set.clone(), - left_extension: self.left_extension.iter().copied().collect(), - right_extension: self.right_extension.iter().copied().collect(), + left_extension: self.left_extension.iter().cloned().collect(), + right_extension: self.right_extension.iter().cloned().collect(), } } } diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/w3_pair.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/w3_pair.rs index dd455b69..bf141ae1 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/w3_pair.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/w3_pair.rs @@ -8,22 +8,23 @@ use std::{ fmt::Display, hash::{Hash, Hasher}, }; +use std::rc::Rc; -pub(crate) struct W3Pair<'a> { - two_sets: TwoSets<&'a String>, +pub(crate) struct W3Pair { + two_sets: TwoSets>, } -impl<'a> W3Pair<'a> { - pub fn new(first: &'a String, second: &'a String) -> Self { +impl W3Pair { + pub fn new(first: Rc, second: Rc) -> Self { Self { two_sets: TwoSets::new_one_element(first, second), } } pub fn try_new( - first: &'a String, - second: &'a String, - w3_relations: &HashSet<(&String, &String)>, + first: Rc, + second: Rc, + w3_relations: &HashSet<(&str, &str)>, provider: &AlphaPlusNfcRelationsProvider, ) -> Option { let new_pair = Self::new(first, second); @@ -33,7 +34,7 @@ impl<'a> W3Pair<'a> { } } - pub fn valid(&self, w3_relations: &HashSet<(&String, &String)>, provider: &AlphaPlusNfcRelationsProvider) -> bool { + pub fn valid(&self, w3_relations: &HashSet<(&str, &str)>, provider: &AlphaPlusNfcRelationsProvider) -> bool { for first in self.two_sets.first_set().iter() { for second in self.two_sets.second_set().iter() { if !(w3_relations.contains(&(first, second))) { @@ -67,26 +68,26 @@ impl<'a> W3Pair<'a> { } } - pub fn two_sets(&self) -> TwoSets<&'a String> { + pub fn two_sets(&self) -> TwoSets> { self.two_sets.clone() } } -impl<'a> Hash for W3Pair<'a> { +impl Hash for W3Pair { fn hash(&self, state: &mut H) { self.two_sets.hash(state) } } -impl<'a> PartialEq for W3Pair<'a> { +impl PartialEq for W3Pair { fn eq(&self, other: &Self) -> bool { compare_based_on_hashes(self, other) } } -impl<'a> Eq for W3Pair<'a> {} +impl Eq for W3Pair {} -impl<'a> Clone for W3Pair<'a> { +impl Clone for W3Pair { fn clone(&self) -> Self { Self { two_sets: self.two_sets.clone(), @@ -94,7 +95,7 @@ impl<'a> Clone for W3Pair<'a> { } } -impl<'a> Display for W3Pair<'a> { +impl Display for W3Pair { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str(self.two_sets.to_string().as_str()) } diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_set.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_set.rs index 042c0a6d..63531eb8 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_set.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_set.rs @@ -5,11 +5,12 @@ use crate::{ use std::{ fmt::Display, hash::{Hash, Hasher}, + rc::Rc, }; #[derive(Debug)] pub struct AlphaSet { - two_sets: TwoSets, + two_sets: TwoSets>, } impl AlphaSet { @@ -19,7 +20,7 @@ impl AlphaSet { } } - pub fn new(left_class: String, right_class: String) -> Self { + pub fn new(left_class: Rc, right_class: Rc) -> Self { Self { two_sets: TwoSets::new_one_element(left_class, right_class), } @@ -45,19 +46,19 @@ impl AlphaSet { self.two_sets.second_set().contains(class) } - pub fn left_classes(&self) -> Vec<&String> { + pub fn left_classes(&self) -> Vec<&Rc> { self.two_sets.first_set().iter().collect() } - pub fn right_classes(&self) -> Vec<&String> { + pub fn right_classes(&self) -> Vec<&Rc> { self.two_sets.second_set().iter().collect() } - pub fn insert_left_class(&mut self, class: String) { + pub fn insert_left_class(&mut self, class: Rc) { self.two_sets.first_set_mut().insert(class); } - pub fn insert_right_class(&mut self, class: String) { + pub fn insert_right_class(&mut self, class: Rc) { self.two_sets.second_set_mut().insert(class); } diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_sharp.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_sharp.rs index eb94f530..4d6b24a5 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_sharp.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_sharp.rs @@ -21,9 +21,10 @@ use std::{ collections::{BTreeSet, HashSet}, fmt::Display, hash::{Hash, Hasher}, + rc::Rc, }; -type AlphaSharpSet<'a> = BTreeSet<(BTreeSet<&'a String>, BTreeSet<&'a String>)>; +type AlphaSharpSet<'a> = BTreeSet<(BTreeSet<&'a str>, BTreeSet<&'a str>)>; struct AlphaSharpTuple<'a> { provider: &'a AlphaSharpRelationsProvider<'a>, @@ -33,8 +34,8 @@ struct AlphaSharpTuple<'a> { impl<'a> AlphaSharpTuple<'a> { pub fn try_create_new( - p_in: (&'a String, &'a String), - p_out: (&'a String, &'a String), + p_in: (&'a str, &'a str), + p_out: (&'a str, &'a str), provider: &'a AlphaSharpRelationsProvider<'a>, ) -> Option { let p_in = BTreeSet::from_iter(vec![(BTreeSet::from_iter(vec![p_in.0]), BTreeSet::from_iter(vec![p_in.1]))]); @@ -83,7 +84,7 @@ impl<'a> AlphaSharpTuple<'a> { } } - let p_in = self.p_in.iter().collect::, BTreeSet<&'a String>)>>(); + let p_in = self.p_in.iter().collect::, BTreeSet<&'a str>)>>(); for i in 0..p_in.len() { for j in (i + 1)..p_in.len() { if !self.any_parallel_items(&p_in[i].0, &p_in[j].0) { @@ -92,7 +93,7 @@ impl<'a> AlphaSharpTuple<'a> { } } - let p_out = self.p_out.iter().collect::, BTreeSet<&'a String>)>>(); + let p_out = self.p_out.iter().collect::, BTreeSet<&'a str>)>>(); for i in 0..p_out.len() { for j in (i + 1)..p_out.len() { if !self.any_parallel_items(&p_out[i].1, &p_out[j].1) { @@ -104,7 +105,7 @@ impl<'a> AlphaSharpTuple<'a> { true } - fn any_parallel_items(&self, first_set: &BTreeSet<&String>, second_set: &BTreeSet<&String>) -> bool { + fn any_parallel_items(&self, first_set: &BTreeSet<&str>, second_set: &BTreeSet<&str>) -> bool { let mut any_parallel = false; 'a_set_parallel_check_loop: for first_a in first_set { for second_a in second_set { @@ -157,7 +158,7 @@ impl<'a> Display for AlphaSharpTuple<'a> { string.push('('); string.push('{'); for class in &tuple.0 { - string.push_str(class.as_str()); + string.push_str(class); string.push(',') } @@ -168,7 +169,7 @@ impl<'a> Display for AlphaSharpTuple<'a> { string.push_str("}, {"); for class in &tuple.1 { - string.push_str(class.as_str()); + string.push_str(class); string.push(',') } diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_plus_nfc_provider.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_plus_nfc_provider.rs index c87f05df..5c38de67 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_plus_nfc_provider.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_plus_nfc_provider.rs @@ -14,6 +14,7 @@ use crate::{ }, }; use std::collections::HashSet; +use std::rc::Rc; enum PrePostSet { PreSet, @@ -84,7 +85,7 @@ where self.triangle_relation(first, second) && self.triangle_relation(second, first) } - fn one_length_loop_transitions(&self) -> &HashSet { + fn one_length_loop_transitions(&self) -> &HashSet> { self.alpha_plus_provider.one_length_loop_transitions() } } @@ -97,7 +98,7 @@ where info: &'a dyn EventLogInfo, log: &'a TLog, triangle_relation: &'a dyn TriangleRelation, - one_length_loop_transitions: &'a HashSet, + one_length_loop_transitions: &'a HashSet>, ) -> Self { Self { additional_causal_relations: HashSet::new(), @@ -492,7 +493,7 @@ where arcs.iter().map(|arc| arc.place_id()).collect() } - pub fn add_additional_causal_relation(&mut self, first: &'a String, second: &'a String) { + pub fn add_additional_causal_relation(&mut self, first: &'a str, second: &'a str) { self.additional_causal_relations.insert((first, second)); } } diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_plus_provider.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_plus_provider.rs index edf2ae1c..5ce3faee 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_plus_provider.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_plus_provider.rs @@ -3,25 +3,26 @@ use crate::features::{ discovery::{alpha::providers::alpha_provider::AlphaRelationsProvider, relations::triangle_relation::TriangleRelation}, }; use std::collections::HashSet; +use std::rc::Rc; pub trait AlphaPlusRelationsProvider: AlphaRelationsProvider { fn triangle_relation(&self, first: &str, second: &str) -> bool; fn romb_relation(&self, first: &str, second: &str) -> bool; - fn one_length_loop_transitions(&self) -> &HashSet; + fn one_length_loop_transitions(&self) -> &HashSet>; } pub struct AlphaPlusRelationsProviderImpl<'a> { pub log_info: &'a dyn EventLogInfo, triangle_relation: &'a dyn TriangleRelation, - one_length_loop_transitions: &'a HashSet, + one_length_loop_transitions: &'a HashSet>, } impl<'a> AlphaPlusRelationsProviderImpl<'a> { pub fn new( log_info: &'a dyn EventLogInfo, triangle_relation: &'a dyn TriangleRelation, - one_length_loop_transitions: &'a HashSet, + one_length_loop_transitions: &'a HashSet>, ) -> Self { Self { log_info, @@ -62,7 +63,7 @@ impl<'a> AlphaPlusRelationsProvider for AlphaPlusRelationsProviderImpl<'a> { self.triangle_relation(first, second) && self.triangle_relation(second, first) } - fn one_length_loop_transitions(&self) -> &HashSet { + fn one_length_loop_transitions(&self) -> &HashSet> { self.one_length_loop_transitions } } diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_sharp_provider.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_sharp_provider.rs index 341bb180..e9e85457 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_sharp_provider.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_sharp_provider.rs @@ -9,6 +9,7 @@ use crate::features::{ }, }; use std::collections::HashSet; +use std::rc::Rc; pub struct AlphaSharpRelationsProvider<'a> { alpha_plus_provider: AlphaPlusRelationsProviderImpl<'a>, @@ -77,7 +78,7 @@ impl<'a> AlphaSharpRelationsProvider<'a> { let classes = self.info.all_event_classes(); for c_class in &classes { for d_class in &classes { - if c_class.as_str() != first && d_class.as_str() != second { + if c_class.as_ref() != first && d_class.as_ref() != second { let c_causal_d = self.causal_relation(c_class, d_class); let first_advanced_d = self.advanced_ordering_relation(first, d_class); let c_advanced_second = self.advanced_ordering_relation(c_class, second); @@ -97,7 +98,7 @@ impl<'a> AlphaSharpRelationsProvider<'a> { pub fn new( triangle_relation: &'a dyn TriangleRelation, info: &'a OfflineEventLogInfo, - one_length_loop_transitions: &'a HashSet, + one_length_loop_transitions: &'a HashSet>, ) -> Self { Self { alpha_plus_provider: AlphaPlusRelationsProviderImpl::new(info, triangle_relation, one_length_loop_transitions), diff --git a/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery_xes.rs b/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery_xes.rs index 7d598c1e..7cd64433 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery_xes.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery_xes.rs @@ -46,10 +46,12 @@ pub fn discover_ecfg_from_event_log( let artificial_start_end_events_factory = || { ( - Rc::new(RefCell::new(XesEventImpl::new_with_min_date( + Rc::new(RefCell::new(XesEventImpl::new_with_min_date(Rc::from( ARTIFICIAL_START_EVENT_NAME.to_string(), - ))), - Rc::new(RefCell::new(XesEventImpl::new_with_min_date(ARTIFICIAL_END_EVENT_NAME.to_string()))), + )))), + Rc::new(RefCell::new(XesEventImpl::new_with_min_date(Rc::from( + ARTIFICIAL_END_EVENT_NAME.to_string(), + )))), ) }; diff --git a/Ficus/src/rust/ficus/src/features/discovery/ecfg/log_prepare.rs b/Ficus/src/rust/ficus/src/features/discovery/ecfg/log_prepare.rs index 9a27cf48..7cc9ed64 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ecfg/log_prepare.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ecfg/log_prepare.rs @@ -13,7 +13,7 @@ use std::{cell::RefCell, collections::HashMap, rc::Rc}; pub fn prepare_software_log( log: &XesEventLogImpl, config: &SoftwareDataExtractionConfig, - time_attribute: Option<&String>, + time_attribute: Option<&Rc>, ) -> Result { let control_flow_regexes = config.control_flow_regexes().map_err(PipelinePartExecutionError::new_raw)?; if control_flow_regexes.is_none() { @@ -98,5 +98,5 @@ pub fn prepare_software_log( } } - abstract_event_groups(event_groups, &labels, None, time_attribute.cloned(), config) + abstract_event_groups(event_groups, &labels, None, time_attribute, config) } diff --git a/Ficus/src/rust/ficus/src/features/discovery/fuzzy/fuzzy_metrics_provider.rs b/Ficus/src/rust/ficus/src/features/discovery/fuzzy/fuzzy_metrics_provider.rs index 4c124100..bf1c2404 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/fuzzy/fuzzy_metrics_provider.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/fuzzy/fuzzy_metrics_provider.rs @@ -6,6 +6,7 @@ use crate::{ discovery::alpha::providers::relations_cache::RelationsCaches, }, }; +use std::rc::Rc; const PROXIMITY_CORRELATION: &str = "ProximityCorrelation"; @@ -34,15 +35,15 @@ where self.log_info } - pub fn unary_frequency_significance(&self, event_class: &String) -> f64 { + pub fn unary_frequency_significance(&self, event_class: &str) -> f64 { self.log_info.event_count(event_class) as f64 } - pub fn binary_frequency_significance(&self, first_class: &String, second_class: &String) -> f64 { + pub fn binary_frequency_significance(&self, first_class: &str, second_class: &str) -> f64 { self.log_info.dfg_info().get_directly_follows_count(first_class, second_class) as f64 } - pub fn proximity_correlation(&mut self, first_class: &String, second_class: &String) -> f64 { + pub fn proximity_correlation(&mut self, first_class: &str, second_class: &str) -> f64 { if let Some(value) = self.caches.cache(PROXIMITY_CORRELATION).try_get(first_class, second_class) { return *value; } @@ -85,7 +86,7 @@ where result } - pub fn relative_significance(&self, a: &String, b: &String, graph: &FuzzyGraph) -> f64 { + pub fn relative_significance(&self, a: &str, b: &str, graph: &FuzzyGraph) -> f64 { let a_b_sig = self.binary_frequency_significance(a, b); let mut first_sig = 0.5 * a_b_sig; @@ -105,7 +106,7 @@ where first_sig + second_sig } - pub fn utility_measure(&mut self, first: &String, second: &String, utility_rate: f64) -> f64 { + pub fn utility_measure(&mut self, first: &str, second: &str, utility_rate: f64) -> f64 { utility_rate * self.binary_frequency_significance(first, second) + (1.0 - utility_rate) * self.proximity_correlation(first, second) } } diff --git a/Ficus/src/rust/ficus/src/features/discovery/fuzzy/fuzzy_miner.rs b/Ficus/src/rust/ficus/src/features/discovery/fuzzy/fuzzy_miner.rs index 770da33c..cc971dab 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/fuzzy/fuzzy_miner.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/fuzzy/fuzzy_miner.rs @@ -13,7 +13,7 @@ use std::{ rc::Rc, }; -pub type FuzzyGraph = Graph; +pub type FuzzyGraph = Graph, f64>; pub fn discover_graph_fuzzy( log: &impl EventLog, @@ -49,13 +49,13 @@ pub fn discover_graph_fuzzy( fn initialize_fuzzy_graph( graph: &mut FuzzyGraph, provider: &FuzzyMetricsProvider, - classes_to_ids: &mut HashMap, + classes_to_ids: &mut HashMap, u64>, unary_frequency_threshold: f64, binary_frequency_significance_threshold: f64, ) { for class in provider.log_info().all_event_classes() { if provider.unary_frequency_significance(class) > unary_frequency_threshold { - let node_id = graph.add_node(Some(class.to_owned())); + let node_id = graph.add_node(Some(class.clone())); classes_to_ids.insert(class.to_owned(), node_id); } } @@ -75,7 +75,7 @@ fn initialize_fuzzy_graph( } fn resolve_conflicts( - classes_to_ids: &HashMap, + classes_to_ids: &HashMap, u64>, provider: &FuzzyMetricsProvider, graph: &mut FuzzyGraph, preserve_threshold: f64, @@ -257,7 +257,7 @@ fn merge_nodes(graph: &mut FuzzyGraph, clusters: &ClustersMap) { cluster_data.push(']'); - Some(cluster_data) + Some(Rc::from(cluster_data)) }, |edges_data| { edges_data.iter().fold(NodesConnectionData::empty(), |first, second| { diff --git a/Ficus/src/rust/ficus/src/features/discovery/heuristic/heuristic_miner.rs b/Ficus/src/rust/ficus/src/features/discovery/heuristic/heuristic_miner.rs index 834be91f..fe734e28 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/heuristic/heuristic_miner.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/heuristic/heuristic_miner.rs @@ -10,7 +10,10 @@ use crate::{ }, utils::sets::one_set::OneSet, }; -use std::collections::{HashMap, HashSet}; +use std::{ + collections::{HashMap, HashSet}, + rc::Rc, +}; pub fn discover_petri_net_heuristic( info: &dyn EventLogInfo, @@ -89,7 +92,7 @@ fn construct_heuristic_petri_net(provider: &HeuristicMinerRelationsProvider, pet petri_net.connect_transition_to_place(classes_to_ids.get(first_class).unwrap(), &post_place_id, None); for group in ¶llel_groups { - let name = format!("silent_start_{first_class}"); + let name = Rc::::from(format!("silent_start_{first_class}")); let id = petri_net.add_transition(Transition::empty(name.to_owned(), true, Some(name.to_owned()))); petri_net.connect_place_to_transition(&post_place_id, &id, None); diff --git a/Ficus/src/rust/ficus/src/features/discovery/heuristic/relations_provider.rs b/Ficus/src/rust/ficus/src/features/discovery/heuristic/relations_provider.rs index 0e784bb8..0cd7df66 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/heuristic/relations_provider.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/heuristic/relations_provider.rs @@ -6,8 +6,9 @@ use crate::features::{ }, }; use std::collections::HashMap; +use std::rc::Rc; -type DependencyRelations = HashMap>; +type DependencyRelations = HashMap, HashMap, f64>>; pub(crate) struct HeuristicMinerRelationsProvider<'a> { dependency_threshold: f64, @@ -52,7 +53,7 @@ impl<'a> HeuristicMinerRelationsProvider<'a> { } fn initialize_dependency_relations(&mut self) { - let mut relations = HashMap::>::new(); + let mut relations = HashMap::, Vec<(Rc, f64)>>::new(); for first_class in self.provider.log_info().all_event_classes() { for second_class in self.provider.log_info().all_event_classes() { let second_follows_first = self.get_directly_follows_count(first_class, second_class); @@ -74,7 +75,7 @@ impl<'a> HeuristicMinerRelationsProvider<'a> { } for key in self.provider.log_info().all_event_classes() { - if let Some(values) = relations.get_mut(key.as_str()) { + if let Some(values) = relations.get_mut(key.as_ref()) { let best_value = values.iter().max_by(|first, second| first.1.total_cmp(&second.1)).unwrap().1; let min_value = best_value * (1.0 - self.relative_to_best_threshold); @@ -104,7 +105,7 @@ impl<'a> HeuristicMinerRelationsProvider<'a> { } } - pub fn and_or_xor_relation(&self, a: &String, b: &String, c: &String) -> AndOrXorRelation { + pub fn and_or_xor_relation(&self, a: &str, b: &str, c: &str) -> AndOrXorRelation { let b_c = self.get_directly_follows_count(b, c) as f64; let c_b = self.get_directly_follows_count(c, b) as f64; let a_b = self.get_directly_follows_count(a, b) as f64; @@ -126,7 +127,7 @@ impl<'a> HeuristicMinerRelationsProvider<'a> { (a_b + b_a) / (a_b + b_a + 1.0) > self.loop_length_two_threshold } - fn calculate_dependency_measure(&self, first: &String, second: &String) -> f64 { + fn calculate_dependency_measure(&self, first: &str, second: &str) -> f64 { let b_follows_a = self.get_directly_follows_count(first, second) as f64; let a_follows_b = self.get_directly_follows_count(second, first) as f64; @@ -137,7 +138,7 @@ impl<'a> HeuristicMinerRelationsProvider<'a> { } } - fn get_directly_follows_count(&self, first: &String, second: &String) -> usize { + fn get_directly_follows_count(&self, first: &str, second: &str) -> usize { self.provider.log_info().dfg_info().get_directly_follows_count(first, second) } diff --git a/Ficus/src/rust/ficus/src/features/discovery/multithreaded_dfg/dfg.rs b/Ficus/src/rust/ficus/src/features/discovery/multithreaded_dfg/dfg.rs index 32024676..5b518ca8 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/multithreaded_dfg/dfg.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/multithreaded_dfg/dfg.rs @@ -141,7 +141,7 @@ fn add_node(name: String, graph: &mut DefaultGraph, added_nodes: &mut HashMap(&event.borrow(), thread_attribute); events_threads - .entry(event.borrow().name().as_str().to_string()) + .entry(event.borrow().name().to_string()) .or_insert(HashSet::new()) .insert(thread_id); } @@ -281,7 +281,7 @@ fn enumerate_trace_parts( let is_control_flow = |index: usize| { if let Some(regexes) = control_flow_regexes { let event = trace.events().get(index).unwrap().borrow(); - let name = event.name().as_str(); + let name = event.name(); for regex in regexes { if regex.is_match(name).unwrap_or(false) { @@ -297,7 +297,7 @@ fn enumerate_trace_parts( let is_sequential = |index: usize| { let event = trace.events().get(index).unwrap().borrow(); - let name = event.name().as_str(); + let name = event.name(); match strategy { MultithreadedTracePartsCreationStrategy::Regexes(regexes) => regexes.iter().any(|r| r.is_match(name).unwrap_or(false)), diff --git a/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs b/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs index 312047fd..5a432e38 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs @@ -29,14 +29,14 @@ pub enum OcelAnnotationCreationError { #[derive(Getters, Default)] pub struct NodeObjectsState { #[getset(get = "pub")] - map: HashMap, HashSet>>, + map: HashMap, HashSet>>, } impl NodeObjectsState { pub fn add_allocated_object( &mut self, - object_type: HeapedOrOwned, - object_id: HeapedOrOwned, + object_type: Rc, + object_id: Rc, ) -> Result<(), OcelAnnotationCreationError> { if self.contains_object(&object_type, &object_id) { return Err(OcelAnnotationCreationError::ObjectAlreadyExistsInNodeState); @@ -46,13 +46,13 @@ impl NodeObjectsState { Ok(()) } - pub fn remove_object(&mut self, object_type: &HeapedOrOwned, id: &HeapedOrOwned) { + pub fn remove_object(&mut self, object_type: &Rc, id: &Rc) { let Some(set) = self.map.get_mut(object_type) else { return }; set.remove(id); } - pub fn remove_unknown_object(&mut self, id: &HeapedOrOwned) { + pub fn remove_unknown_object(&mut self, id: &Rc) { for (_, set) in self.map.iter_mut() { if set.remove(id) { return; @@ -60,7 +60,7 @@ impl NodeObjectsState { } } - pub fn contains_object(&self, object_type: &HeapedOrOwned, object_id: &HeapedOrOwned) -> bool { + pub fn contains_object(&self, object_type: &str, object_id: &str) -> bool { if let Some(type_objects) = self.map.get(object_type) { type_objects.contains(object_id) } else { @@ -68,11 +68,11 @@ impl NodeObjectsState { } } - pub fn contains_unknown_object(&self, object_id: &HeapedOrOwned) -> bool { + pub fn contains_unknown_object(&self, object_id: &str) -> bool { self.map.values().any(|set| set.contains(object_id)) } - fn type_set_mut(&mut self, object_type: &HeapedOrOwned) -> &mut HashSet> { + fn type_set_mut(&mut self, object_type: &Rc) -> &mut HashSet> { if !self.map.contains_key(object_type) { self.map.insert(object_type.clone(), HashSet::new()); } @@ -104,11 +104,11 @@ pub struct ProcessNodesStates { #[derive(new, Getters)] pub struct OcelObjectRelations { #[get = "pub"] - object_id: HeapedOrOwned, + object_id: Rc, #[get = "pub"] from_element_id: u64, #[get = "pub"] - related_objects_ids: Vec>, + related_objects_ids: Vec>, } lazy_static! { @@ -156,7 +156,7 @@ pub fn create_ocel_annotation_for_dag(graph: &DefaultGraph) -> Result; +pub type DefaultPetriNet = PetriNet, ()>; #[derive(Debug)] struct PlaceTransitions { diff --git a/Ficus/src/rust/ficus/src/features/discovery/petri_net/replay.rs b/Ficus/src/rust/ficus/src/features/discovery/petri_net/replay.rs index b72c973c..b2105eb7 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/petri_net/replay.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/petri_net/replay.rs @@ -1,6 +1,8 @@ -use std::collections::{HashMap, VecDeque}; - use crate::event_log::core::{event::event::Event, event_log::EventLog, trace::trace::Trace}; +use std::{ + collections::{HashMap, VecDeque}, + rc::Rc, +}; use super::{marking::Marking, petri_net::DefaultPetriNet, transition::Transition}; @@ -81,7 +83,7 @@ impl ReplayState { Some(new_states) } - fn find_transitions_to_fire<'a>(net: &'a DefaultPetriNet, symbol: &'a str) -> Vec<&'a Transition> { + fn find_transitions_to_fire<'a>(net: &'a DefaultPetriNet, symbol: &'a str) -> Vec<&'a Transition, ()>> { let mut result = vec![]; for transition in net.all_transitions() { if transition.name() == symbol { diff --git a/Ficus/src/rust/ficus/src/features/discovery/petri_net/transition.rs b/Ficus/src/rust/ficus/src/features/discovery/petri_net/transition.rs index dd4b2963..f079f077 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/petri_net/transition.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/petri_net/transition.rs @@ -1,5 +1,8 @@ use crate::features::discovery::petri_net::{arc::Arc, ids::next_id}; -use std::hash::{Hash, Hasher}; +use std::{ + hash::{Hash, Hasher}, + rc::Rc, +}; #[derive(Debug)] pub struct Transition @@ -7,7 +10,7 @@ where TTransitionData: ToString, { id: u64, - name: String, + name: Rc, silent_transition: bool, incoming_arcs: Vec>, outgoing_arcs: Vec>, @@ -38,7 +41,7 @@ impl Transition where TTransitionData: ToString, { - pub fn empty(name: String, silent_transition: bool, data: Option) -> Self { + pub fn empty(name: Rc, silent_transition: bool, data: Option) -> Self { Self { id: next_id(), name, @@ -81,7 +84,7 @@ where self.data.as_ref() } - pub fn name(&self) -> &String { + pub fn name(&self) -> &str { &self.name } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/abstraction.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/abstraction.rs index a45eca69..101feca4 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/abstraction.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/abstraction.rs @@ -42,8 +42,8 @@ use std::{cell::RefCell, rc::Rc}; pub fn abstract_event_groups( event_groups: Vec>, labels: &[usize], - thread_attribute: Option, - time_attribute: Option, + thread_attribute: Option<&Rc>, + time_attribute: Option<&Rc>, config: &SoftwareDataExtractionConfig, ) -> Result { let mut current_label_index = 0; @@ -73,8 +73,8 @@ pub fn abstract_event_groups( let abstracted_event = create_abstracted_event( event_group, group_label, - thread_attribute.as_ref(), - time_attribute.as_ref(), + thread_attribute, + time_attribute, EventCoordinates::new(trace_id as u64, event_index as u64), config, node_data, @@ -94,8 +94,8 @@ pub fn abstract_event_groups( fn create_abstracted_event( event_group: &EventGroup, label: &usize, - thread_attribute: Option<&String>, - time_attribute: Option<&String>, + thread_attribute: Option<&Rc>, + time_attribute: Option<&Rc>, event_coordinates: EventCoordinates, config: &SoftwareDataExtractionConfig, mut node_software_data: SoftwareData, @@ -105,20 +105,26 @@ fn create_abstracted_event( let abstracted_event_stamp = *event_group.control_flow_events().last().unwrap().borrow().timestamp() - first_stamp; let abstracted_event_stamp = first_stamp + abstracted_event_stamp; - let label_name = Rc::new(label.to_string()); + let label_name = Rc::from(label.to_string()); let mut event = XesEventImpl::new_all_fields(label_name, abstracted_event_stamp, None); extract_software_data( config, event_group, - thread_attribute, - time_attribute, + thread_attribute.map(|a| a.as_ref()), + time_attribute.map(|a| a.as_ref()), &mut node_software_data, &mut edge_software_data, )?; - put_node_user_data(&mut event, node_software_data, event_coordinates, event_group, time_attribute)?; + put_node_user_data( + &mut event, + node_software_data, + event_coordinates, + event_group, + time_attribute.map(|a| a.as_ref()), + )?; if let Some(after_group_events) = event_group.after_group_events().is_non_empty() { put_edge_user_data( @@ -126,7 +132,7 @@ fn create_abstracted_event( edge_software_data, event_coordinates, after_group_events, - time_attribute, + time_attribute.map(|a| a.as_ref()), )?; } @@ -144,7 +150,7 @@ fn put_node_user_data( node_software_data: SoftwareData, event_coordinates: EventCoordinates, event_group: &EventGroup, - time_attribute: Option<&String>, + time_attribute: Option<&str>, ) -> Result<(), PipelinePartExecutionError> { let software_data = NodeAdditionalDataContainer::new(node_software_data, event_coordinates); event @@ -179,7 +185,7 @@ fn put_edge_user_data( edge_software_data: SoftwareData, event_coordinates: EventCoordinates, after_group_events: &[Rc>], - time_attribute: Option<&String>, + time_attribute: Option<&str>, ) -> Result<(), PipelinePartExecutionError> { event .user_data_mut() @@ -206,8 +212,8 @@ fn put_edge_user_data( fn extract_software_data( config: &SoftwareDataExtractionConfig, event_group: &EventGroup, - thread_attribute: Option<&String>, - time_attribute: Option<&String>, + thread_attribute: Option<&str>, + time_attribute: Option<&str>, node_software_data: &mut SoftwareData, edge_software_data: &mut SoftwareData, ) -> Result<(), PipelinePartExecutionError> { diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/discovery.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/discovery.rs index 6249baf7..13fcf13e 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/discovery.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/discovery.rs @@ -24,9 +24,9 @@ use std::{ #[derive(Debug, Clone, Getters, new)] pub struct LogTimelineDiagram { #[getset(get = "pub")] - thread_attribute: String, + thread_attribute: Rc, #[getset(get = "pub")] - time_attribute: Option, + time_attribute: Option>, #[getset(get = "pub")] control_flow_regexes: Option>, #[getset(get = "pub")] @@ -107,7 +107,7 @@ impl From for PipelinePartExecutionError { pub fn discover_traces_timeline_diagram( log: &XesEventLogImpl, - time_attribute: Option<&String>, + time_attribute: Option<&Rc>, event_group_delta: Option, discover_event_groups_in_each_trace: bool, control_flow_regexes: Option<&Vec>, @@ -116,6 +116,7 @@ pub fn discover_traces_timeline_diagram( for trace in log.traces().iter().map(|t| t.borrow()) { let mut thread_events = vec![]; + let time_attribute = time_attribute.map(|a| a.as_ref()); let min_stamp = get_stamp(&trace.events().first().unwrap().borrow(), time_attribute)?; for event in trace.events() { @@ -149,9 +150,9 @@ pub fn discover_traces_timeline_diagram( Ok(LogTimelineDiagram { control_flow_regexes: control_flow_regexes.cloned(), - thread_attribute: "Trace".to_string(), + thread_attribute: Rc::from("Trace".to_string()), traces: timeline_fragments, - time_attribute: time_attribute.map(|s| s.to_owned()), + time_attribute: time_attribute.map(|s| s.clone()), }) } @@ -169,8 +170,8 @@ fn discover_events_groups_internal( pub fn discover_timeline_diagram( log: &XesEventLogImpl, - thread_attribute: &str, - time_attribute: Option<&String>, + thread_attribute: &Rc, + time_attribute: Option<&Rc>, event_group_delta: Option, control_flow_regexes: Option<&Vec>, ) -> Result { @@ -182,8 +183,9 @@ pub fn discover_timeline_diagram( continue; } + let time_attribute = time_attribute.map(|a| a.as_ref()); let min_stamp = get_stamp(&trace.events().first().unwrap().borrow(), time_attribute)?; - let mut threads: HashMap, TraceThread> = HashMap::new(); + let mut threads: HashMap>, TraceThread> = HashMap::new(); for i in 0..trace.events().len() { let event = trace.events().get(i).expect("Must be in range"); @@ -216,8 +218,8 @@ pub fn discover_timeline_diagram( Ok(LogTimelineDiagram { control_flow_regexes: control_flow_regexes.cloned(), - thread_attribute: thread_attribute.to_string(), - time_attribute: time_attribute.map(|s| s.to_owned()), + thread_attribute: thread_attribute.clone(), + time_attribute: time_attribute.cloned(), traces, }) } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/events_groups.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/events_groups.rs index 76aaff25..e425b940 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/events_groups.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/events_groups.rs @@ -219,7 +219,7 @@ pub fn enumerate_event_groups(log: &LogTimelineDiagram) -> Vec> } if let Some(current_group) = current_group.as_mut() { - if log.is_control_flow_event(event.original_event().borrow().name().as_str()) { + if log.is_control_flow_event(event.original_event().borrow().name()) { current_group.control_flow_events_mut().push(event.original_event().clone()); } else { current_group.statistic_events_mut().push(event.original_event().clone()); diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extraction_config.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extraction_config.rs index 220cfbc0..3e1ec820 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extraction_config.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extraction_config.rs @@ -1,12 +1,9 @@ -use crate::{ - features::mutations::mutations::{ARTIFICIAL_END_EVENT_NAME, ARTIFICIAL_START_EVENT_NAME}, - utils::references::HeapedOrOwned, -}; +use crate::features::mutations::mutations::{ARTIFICIAL_END_EVENT_NAME, ARTIFICIAL_START_EVENT_NAME}; use derive_new::new; use fancy_regex::Regex; use getset::{Getters, Setters}; use serde::{Deserialize, Serialize}; -use std::fmt::Debug; +use std::{fmt::Debug, rc::Rc}; #[derive(Clone, Debug, Setters, Getters, Serialize, Deserialize)] pub struct SoftwareDataExtractionConfig { @@ -93,29 +90,29 @@ pub struct OcelAllocateMergeExtractionConfig { #[getset(get = "pub")] allocated_obj: OcelObjectExtractionConfigBase, #[getset(get = "pub")] - related_object_ids_attr: String, + related_object_ids_attr: Rc, } #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] pub struct OcelConsumeProduceExtractionConfig { #[getset(get = "pub")] - object_id_attr: String, + object_id_attr: Rc, #[getset(get = "pub")] - related_object_ids_attr: String, + related_object_ids_attr: Rc, #[getset(get = "pub")] - related_object_type_attr: String, + related_object_type_attr: Rc, } #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] pub struct AllocationExtractionConfig { #[getset(get = "pub")] - type_name_attr: String, + type_name_attr: Rc, #[getset(get = "pub")] - allocated_count_attr: String, + allocated_count_attr: Rc, #[getset(get = "pub")] - object_size_bytes_attr: Option, + object_size_bytes_attr: Option>, #[getset(get = "pub")] - total_allocated_bytes_attr: Option, + total_allocated_bytes_attr: Option>, } #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] @@ -123,23 +120,23 @@ pub struct MethodStartEndConfig { #[getset(get = "pub")] method_attrs: MethodCommonAttributesConfig, #[getset(get = "pub")] - prefix: Option, + prefix: Option>, } #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] pub struct MethodCommonAttributesConfig { #[getset(get = "pub")] - name_attr: String, + name_attr: Rc, #[getset(get = "pub")] - namespace_attr: String, + namespace_attr: Rc, #[getset(get = "pub")] - signature_attr: String, + signature_attr: Rc, } #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] pub struct ExtractionConfig { #[getset(get = "pub")] - event_class_regex: String, + event_class_regex: Rc, #[getset(get = "pub")] info: TConcreteInfo, } @@ -151,17 +148,17 @@ pub struct PieChartExtractionConfig { #[getset(get = "pub")] grouping_attr: Option, #[getset(get = "pub")] - count_attr: Option, + count_attr: Option>, } #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] pub struct GenericExtractionConfigBase { #[getset(get = "pub")] - name: HeapedOrOwned, + name: Rc, #[getset(get = "pub")] - units: HeapedOrOwned, + units: Rc, #[getset(get = "pub")] - group: Option>, + group: Option>, } #[derive(Clone, Debug, Serialize, Deserialize, new)] @@ -172,7 +169,7 @@ pub enum NameCreationStrategy { } impl NameCreationStrategy { - pub fn fallback_value(&self) -> HeapedOrOwned { + pub fn fallback_value(&self) -> Rc { match self { NameCreationStrategy::SingleAttribute(s) => s.fallback_value().clone(), NameCreationStrategy::ManyAttributes(m) => m.fallback_value().clone(), @@ -183,19 +180,19 @@ impl NameCreationStrategy { #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] pub struct SingleAttribute { #[getset(get = "pub")] - name: String, + name: Rc, #[getset(get = "pub")] - fallback_value: HeapedOrOwned, + fallback_value: Rc, } #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] pub struct ManyAttributes { #[getset(get = "pub")] - attributes: Vec, + attributes: Vec>, #[getset(get = "pub")] - separator: String, + separator: Rc, #[getset(get = "pub")] - fallback_value: HeapedOrOwned, + fallback_value: Rc, } #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] @@ -203,7 +200,7 @@ pub struct SimpleCountExtractionConfig { #[getset(get = "pub")] base: GenericExtractionConfigBase, #[getset(get = "pub")] - count_attr: Option, + count_attr: Option>, } #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] @@ -211,9 +208,9 @@ pub struct ActivityDurationExtractionConfig { #[getset(get = "pub")] base: GenericExtractionConfigBase, #[getset(get = "pub")] - start_event_regex: String, + start_event_regex: Rc, #[getset(get = "pub")] - end_event_regex: String, + end_event_regex: Rc, #[getset(get = "pub")] time_attribute: Option, #[getset(get = "pub")] @@ -223,7 +220,7 @@ pub struct ActivityDurationExtractionConfig { #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] pub struct TimeAttributeConfig { #[getset(get = "pub")] - time_attribute: String, + time_attribute: Rc, #[getset(get = "pub")] kind: TimeKind, } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/activities_durations.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/activities_durations.rs index d7475676..745c37e2 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/activities_durations.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/activities_durations.rs @@ -57,9 +57,8 @@ fn create_configs(config: &SoftwareDataExtractionConfig) -> Configs<'_> { .iter() .map(|info| { ( - Regex::new(info.start_event_regex()) - .map_err(|_| SoftwareDataExtractionError::FailedToParseRegex(info.start_event_regex().to_string())), - Regex::new(info.end_event_regex()).map_err(|_| SoftwareDataExtractionError::FailedToParseRegex(info.end_event_regex().to_string())), + Regex::new(info.start_event_regex()).map_err(|_| SoftwareDataExtractionError::FailedToParseRegex(info.start_event_regex().clone())), + Regex::new(info.end_event_regex()).map_err(|_| SoftwareDataExtractionError::FailedToParseRegex(info.end_event_regex().clone())), info, Vec::new(), Vec::new(), @@ -236,7 +235,7 @@ impl DurationsMapExtensions for DurationsMap { #[derive(Getters, new)] struct StackActivityStartEntry { #[getset(get = "pub")] - id: Option>, + id: Option>, #[getset(get = "pub")] event: Rc>, } @@ -334,5 +333,5 @@ fn get_stamp_or_err( attribute: Option<&TimeAttributeConfig>, ) -> Result { let attribute = attribute.map(|a| a.time_attribute()); - get_stamp(&event.borrow(), attribute).map_err(|_| SoftwareDataExtractionError::FailedToGetStamp) + get_stamp(&event.borrow(), attribute.map(|a| a.as_ref())).map_err(|_| SoftwareDataExtractionError::FailedToGetStamp) } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/core.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/core.rs index 2870cdca..ca583f1e 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/core.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/core.rs @@ -12,8 +12,8 @@ use std::{ #[derive(Debug, Clone)] pub enum SoftwareDataExtractionError { - FailedToParseRegex(String), - FailedToParseValue(String), + FailedToParseRegex(Rc), + FailedToParseValue(Rc), FailedToGetStamp, } @@ -54,9 +54,9 @@ pub trait EventGroupTraceSoftwareDataExtractor { pub(super) fn parse_or_err(value: &str) -> Result { match value.parse::() { Ok(value) => Ok(value), - Err(_) => Err(SoftwareDataExtractionError::FailedToParseValue(format!( + Err(_) => Err(SoftwareDataExtractionError::FailedToParseValue(Rc::from(format!( "Failed to parse value: {}", value - ))), + )))), } } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/event_classes.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/event_classes.rs index 55c2bbdf..29de9a89 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/event_classes.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/event_classes.rs @@ -16,8 +16,8 @@ use std::{cell::RefCell, collections::HashMap, ops::Deref, rc::Rc}; #[derive(Debug, Clone, new)] pub struct EventClassesDataExtractor<'a> { - thread_attribute: Option<&'a String>, - time_attribute: Option<&'a String>, + thread_attribute: Option<&'a str>, + time_attribute: Option<&'a str>, } impl<'a> EventGroupSoftwareDataExtractor for EventClassesDataExtractor<'a> { @@ -33,11 +33,11 @@ impl<'a> EventGroupSoftwareDataExtractor for EventClassesDataExtractor<'a> { let mut threads = HashMap::new(); for event in events { - let name = HeapedOrOwned::Heaped(event.borrow().name_pointer().clone()); + let name = event.borrow().name_pointer().clone(); *software_data.event_classes_mut().entry(name).or_insert(0) += 1; - if let Some(thread_attribute) = self.thread_attribute { - let thread_id = extract_thread_id(event.borrow().deref(), thread_attribute); + if let Some(thread_attribute) = self.thread_attribute.as_ref() { + let thread_id = extract_thread_id(event.borrow().deref(), thread_attribute.as_ref()); let stamp = match get_stamp(event.borrow().deref(), self.time_attribute) { Ok(stamp) => stamp, Err(_) => return Err(SoftwareDataExtractionError::FailedToGetStamp), diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/ocel.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/ocel.rs index 022f14f7..3d4e1142 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/ocel.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/ocel.rs @@ -11,7 +11,6 @@ use crate::{ extractors::core::{EventGroupSoftwareDataExtractor, SoftwareDataExtractionError}, models::{ObjectTypeWithData, OcelData, OcelObjectAction, OcelProducedObjectAfterConsume, SoftwareData}, }, - utils::references::HeapedOrOwned, }; use derive_new::new; use fancy_regex::Regex; @@ -86,7 +85,7 @@ impl<'a> OcelDataExtractor<'a> { fn try_get_config<'b, T>(event: &'b XesEventImpl, config: Option<&'b (Regex, T)>) -> Option<&'b T> { let (regex, config) = config?; - if !regex.is_match(event.name().as_str()).unwrap_or(false) { + if !regex.is_match(event.name()).unwrap_or(false) { return None; } @@ -115,7 +114,7 @@ impl<'a> OcelDataExtractor<'a> { fn extract_object_id_and_type( event: &XesEventImpl, config: &OcelObjectExtractionConfigBase, - ) -> Option<(HeapedOrOwned, HeapedOrOwned)> { + ) -> Option<(Rc, Rc)> { let object_type = config.object_type_attr().create(event); let object_id = match Self::parse_object_id(event, config.object_id_attr().as_str()) { @@ -167,9 +166,10 @@ impl<'a> OcelDataExtractor<'a> { }; let Some(payload) = event.payload_map() else { return false }; - let Some(object_id) = Self::parse_object_id(event, config.object_id_attr().as_str()) else { + let Some(object_id) = Self::parse_object_id(event, config.object_id_attr().as_ref()) else { return false; }; + let related_objects_ids = Self::parse_related_objects_ids(payload, Some(config.related_object_ids_attr()), delimiter); let Some(related_objects_ids) = related_objects_ids else { return false; @@ -197,7 +197,7 @@ impl<'a> OcelDataExtractor<'a> { true } - fn parse_object_id(event: &XesEventImpl, object_id_attr: &str) -> Option> { + fn parse_object_id(event: &XesEventImpl, object_id_attr: &str) -> Option> { if let Some(map) = event.payload_map().as_ref() && let Some(object_id) = map.get(object_id_attr).as_ref() { @@ -208,20 +208,20 @@ impl<'a> OcelDataExtractor<'a> { } fn parse_related_objects_ids( - payload: &HashMap, - related_objects_ids_attr: Option<&String>, + payload: &HashMap, EventPayloadValue>, + related_objects_ids_attr: Option<&Rc>, delimiter: &str, - ) -> Option>> { + ) -> Option>> { if let Some(related_objects_ids_attr) = related_objects_ids_attr && let Some(objects_ids) = payload.get(related_objects_ids_attr) { - let parsed_ids: Vec> = objects_ids + let parsed_ids: Vec> = objects_ids .to_string_repr() .trim() .split(delimiter) .filter_map(|s| { if !s.is_empty() { - Some(HeapedOrOwned::Owned(s.to_string())) + Some(Rc::from(s)) } else { None } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/pie_charts.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/pie_charts.rs index 87058e10..6df1e84e 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/pie_charts.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/pie_charts.rs @@ -35,7 +35,7 @@ impl<'a> EventGroupSoftwareDataExtractor for PieChartExtractor<'a> { .iter() .map(|c| { ( - Regex::new(c.event_class_regex()).map_err(|_| SoftwareDataExtractionError::FailedToParseRegex(c.event_class_regex().to_string())), + Regex::new(c.event_class_regex()).map_err(|_| SoftwareDataExtractionError::FailedToParseRegex(c.event_class_regex().clone())), c.info(), ) }) @@ -50,7 +50,7 @@ impl<'a> EventGroupSoftwareDataExtractor for PieChartExtractor<'a> { if regex.is_match(event.borrow().name()).unwrap_or(false) { let count = if let Some(count_attr) = config.count_attr() { if let Some(count) = payload.get(count_attr) { - parse_or_err::(count.to_string_repr().as_str())? + parse_or_err::(count.to_string_repr().as_ref())? } else { continue; } @@ -61,7 +61,7 @@ impl<'a> EventGroupSoftwareDataExtractor for PieChartExtractor<'a> { let grouping_value = if let Some(strategy) = config.grouping_attr() { strategy.create(&event.borrow()) } else { - HeapedOrOwned::Heaped(event.borrow().name_pointer().clone()) + event.borrow().name_pointer().clone() }; *result diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/simple_counter.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/simple_counter.rs index 9f5664cc..775263ab 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/simple_counter.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/simple_counter.rs @@ -34,7 +34,7 @@ impl<'a> EventGroupSoftwareDataExtractor for SimpleCounterExtractor<'a> { .iter() .map(|c| { ( - Regex::new(c.event_class_regex()).map_err(|_| SoftwareDataExtractionError::FailedToParseRegex(c.event_class_regex().to_string())), + Regex::new(c.event_class_regex()).map_err(|_| SoftwareDataExtractionError::FailedToParseRegex(c.event_class_regex().clone())), c.info(), ) }) @@ -49,7 +49,7 @@ impl<'a> EventGroupSoftwareDataExtractor for SimpleCounterExtractor<'a> { let count = if let Some(count_attribute) = config.count_attr().as_ref() { if let Some(payload) = event.borrow().payload_map() { if let Some(count_value) = payload.get(count_attribute) { - parse_or_err::(count_value.to_string_repr().as_str())? + parse_or_err::(count_value.to_string_repr().as_ref())? } else { continue; } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/utils.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/utils.rs index 2e6f390a..fad5d030 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/utils.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/utils.rs @@ -4,22 +4,21 @@ use crate::{ xes::xes_event::XesEventImpl, }, features::discovery::timeline::software_data::{extraction_config::NameCreationStrategy, extractors::core::SoftwareDataExtractionError}, - utils::references::HeapedOrOwned, }; use fancy_regex::Regex; -use std::collections::HashMap; +use std::{collections::HashMap, rc::Rc}; pub type RegexParingResult = Result; impl NameCreationStrategy { - pub(super) fn create(&self, event: &XesEventImpl) -> HeapedOrOwned { + pub(super) fn create(&self, event: &XesEventImpl) -> Rc { if let Some(map) = event.payload_map() { match self { NameCreationStrategy::SingleAttribute(single_attribute) => self.value_or_fallback(single_attribute.name(), map), NameCreationStrategy::ManyAttributes(many_attributes) => { let mut result = String::new(); for attr in many_attributes.attributes() { - result.push_str(self.value_or_fallback(attr, map).as_str()); + result.push_str(self.value_or_fallback(attr, map).as_ref()); result.push_str(many_attributes.separator()); } @@ -27,7 +26,7 @@ impl NameCreationStrategy { result.remove(result.len() - 1); } - HeapedOrOwned::Owned(result) + Rc::from(result) } } } else { @@ -35,7 +34,7 @@ impl NameCreationStrategy { } } - fn value_or_fallback(&self, attr: &String, payload: &HashMap) -> HeapedOrOwned { + fn value_or_fallback(&self, attr: &str, payload: &HashMap, EventPayloadValue>) -> Rc { if let Some(attr_value) = payload.get(attr) { attr_value.to_string_repr() } else { diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/models.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/models.rs index 11bcfcc8..e48aa490 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/models.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/models.rs @@ -6,13 +6,13 @@ use derive_new::new; use enum_display::EnumDisplay; use getset::{Getters, MutGetters}; use serde::{Deserialize, Serialize}; -use std::collections::HashMap; +use std::{collections::HashMap, rc::Rc}; #[derive(Clone, Debug, Getters, MutGetters, Serialize, Deserialize)] pub struct SoftwareData { #[getset(get = "pub", get_mut = "pub")] #[serde(skip_serializing_if = "HashMap::is_empty")] - event_classes: HashMap, usize>, + event_classes: HashMap, usize>, #[getset(get = "pub", get_mut = "pub")] #[serde(skip)] @@ -51,15 +51,15 @@ impl SoftwareData { #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] pub struct OcelProducedObjectAfterConsume { #[getset(get = "pub")] - id: HeapedOrOwned, + id: Rc, #[getset(get = "pub")] - r#type: Option>, + r#type: Option>, } #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] pub struct ObjectTypeWithData { #[getset(get = "pub")] - r#type: Option>, + r#type: Option>, #[getset(get = "pub")] data: T, } @@ -68,14 +68,14 @@ pub struct ObjectTypeWithData { pub enum OcelObjectAction { Allocate(ObjectTypeWithData<()>), Consume(ObjectTypeWithData<()>), - AllocateMerged(ObjectTypeWithData>>), + AllocateMerged(ObjectTypeWithData>>), ConsumeWithProduce(Vec), } #[derive(Clone, Debug, Getters, new, Serialize, Deserialize)] pub struct OcelData { #[getset(get = "pub")] - object_id: HeapedOrOwned, + object_id: Rc, #[getset(get = "pub")] action: OcelObjectAction, } @@ -91,17 +91,17 @@ pub struct HistogramData { #[derive(Clone, Debug, Getters, MutGetters, new, Serialize, Deserialize)] pub struct GenericEnhancementBase { #[getset(get = "pub")] - name: HeapedOrOwned, + name: Rc, #[getset(get = "pub")] - units: HeapedOrOwned, + units: Rc, #[getset(get = "pub")] - group: Option>, + group: Option>, } #[derive(Clone, Debug, Getters, new, Serialize, Deserialize)] pub struct HistogramEntry { #[getset(get = "pub")] - name: HeapedOrOwned, + name: Rc, #[getset(get = "pub")] value: f64, } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/utils.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/utils.rs index 06ee1304..d2316180 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/utils.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/utils.rs @@ -6,13 +6,14 @@ use crate::{ features::discovery::timeline::discovery::LogThreadsDiagramError, }; use chrono::{DateTime, Utc}; +use std::rc::Rc; -pub fn extract_thread_id(event: &TEvent, thread_attribute: &str) -> Option { +pub fn extract_thread_id(event: &TEvent, thread_attribute: &str) -> Option> { let value = event.payload_map()?.get(thread_attribute)?; - Some(value.to_string_repr().as_str().to_owned()) + Some(value.to_string_repr().clone()) } -pub fn get_stamp(event: &XesEventImpl, attribute: Option<&String>) -> Result { +pub fn get_stamp(event: &XesEventImpl, attribute: Option<&str>) -> Result { if let Some(attribute) = attribute && let Some(map) = event.payload_map() && let Some(value) = map.get(attribute) diff --git a/Ficus/src/rust/ficus/src/features/mutations/mutations.rs b/Ficus/src/rust/ficus/src/features/mutations/mutations.rs index 926aa990..35adc2b7 100644 --- a/Ficus/src/rust/ficus/src/features/mutations/mutations.rs +++ b/Ficus/src/rust/ficus/src/features/mutations/mutations.rs @@ -1,14 +1,14 @@ use crate::event_log::core::{event::event::Event, event_log::EventLog, trace::trace::Trace}; use std::{cell::RefCell, rc::Rc}; -pub fn rename_events(log: &mut TLog, new_name: &str, filter: TFilter) +pub fn rename_events(log: &mut TLog, new_name: Rc, filter: TFilter) where TLog: EventLog, TFilter: Fn(&TLog::TEvent) -> bool, { log.mutate_events(|event| { if filter(event) { - event.set_name(new_name.to_owned()) + event.set_name(new_name.clone()) } }) } @@ -25,18 +25,20 @@ pub fn add_artificial_start_end_activities( log: &mut TLog, add_start_events: bool, add_end_events: bool, - attributes_to_copy: Option<&Vec>, + attributes_to_copy: Option<&Vec>>, ) { + let art_start_name = Rc::::from(ARTIFICIAL_START_EVENT_NAME); + let art_end_name = Rc::::from(ARTIFICIAL_END_EVENT_NAME); + for trace in log.traces() { let mut trace = trace.borrow_mut(); let events = trace.events_mut(); let mut add_artificial_event = |start_or_end: StartOrEnd| { let name = match start_or_end { - StartOrEnd::Start => ARTIFICIAL_START_EVENT_NAME, - StartOrEnd::End => ARTIFICIAL_END_EVENT_NAME, - } - .to_string(); + StartOrEnd::Start => art_start_name.clone(), + StartOrEnd::End => art_end_name.clone(), + }; let artificial_start_event = if events.is_empty() { match start_or_end { @@ -74,7 +76,7 @@ pub fn add_artificial_start_end_activities( } } -fn copy_payload(from: &TLog::TEvent, to: &mut TLog::TEvent, attributes_to_copy: Option<&Vec>) { +fn copy_payload(from: &TLog::TEvent, to: &mut TLog::TEvent, attributes_to_copy: Option<&Vec>>) { let Some(attributes_to_copy) = attributes_to_copy else { return }; let Some(payload_map) = from.payload_map() else { return }; @@ -84,7 +86,7 @@ fn copy_payload(from: &TLog::TEvent, to: &mut TLog::TEvent, attr } } -pub fn append_attributes_to_name(log: &mut TLog, attributes: &Vec) { +pub fn append_attributes_to_name(log: &mut TLog, attributes: &Vec>) { log.mutate_events(|event| { let mut new_name = event.name().to_owned(); let payload = event.payload_map(); @@ -97,12 +99,12 @@ pub fn append_attributes_to_name(log: &mut TLog, attributes: &Ve let attribute_value_string = match value { None => "None".to_string(), - Some(value) => value.as_str().to_owned(), + Some(value) => value.as_ref().to_owned(), }; new_name += format!("_{}", attribute_value_string).as_str(); } - event.set_name(new_name); + event.set_name(Rc::from(new_name)); }) } diff --git a/Ficus/src/rust/ficus/src/pipelines/activities_parts.rs b/Ficus/src/rust/ficus/src/pipelines/activities_parts.rs index 3fda69f3..fc06b5e7 100644 --- a/Ficus/src/rust/ficus/src/pipelines/activities_parts.rs +++ b/Ficus/src/rust/ficus/src/pipelines/activities_parts.rs @@ -105,7 +105,7 @@ impl PipelineParts { &repeat_sets, activity_level as usize, *underlying_patterns_kind, - |sub_array| create_activity_name(log, sub_array, event_class_regex), + |sub_array| create_activity_name(log, sub_array, event_class_regex.map(|r| r.as_ref())), ); context.put_concrete(ACTIVITIES_KEY.key(), tree); @@ -156,7 +156,9 @@ impl PipelineParts { let strategy = match undef_activity_strat { UndefActivityHandlingStrategyDto::DontInsert => UndefActivityHandlingStrategy::DontInsert, UndefActivityHandlingStrategyDto::InsertAsSingleEvent => UndefActivityHandlingStrategy::InsertAsSingleEvent(Box::new(|| { - Rc::new(RefCell::new(XesEventImpl::new_with_min_date(UNDEF_ACTIVITY_NAME.to_owned()))) + Rc::new(RefCell::new(XesEventImpl::new_with_min_date(Rc::from( + UNDEF_ACTIVITY_NAME.to_owned(), + )))) })), UndefActivityHandlingStrategyDto::InsertAllEvents => UndefActivityHandlingStrategy::InsertAllEvents, }; @@ -171,7 +173,7 @@ impl PipelineParts { first_stamp + delta / (events.len() as i32 - 1) }; - Rc::new(RefCell::new(XesEventImpl::new(info.node().borrow().name().as_ref().clone(), stamp))) + Rc::new(RefCell::new(XesEventImpl::new(info.node().borrow().name().clone(), stamp))) }); context.put_concrete(EVENT_LOG_KEY.key(), log); @@ -409,7 +411,7 @@ impl PipelineParts { for (activity_name, activity_log) in activities_to_logs { let mut temp_context = context.clone(); temp_context.put_concrete(EVENT_LOG_KEY.key(), activity_log.borrow().clone()); - temp_context.put_concrete(ACTIVITY_NAME_KEY.key(), activity_name.as_ref().to_owned()); + temp_context.put_concrete(ACTIVITY_NAME_KEY.key(), activity_name.clone()); pipeline.execute(&mut temp_context, infra)?; } @@ -421,7 +423,7 @@ impl PipelineParts { fn create_activities_to_logs( context: &mut PipelineContext, config: &UserDataImpl, - ) -> Result, Rc>>, PipelinePartExecutionError> { + ) -> Result, Rc>>, PipelinePartExecutionError> { let log = Self::get_user_data(context, &EVENT_LOG_KEY)?; let dto = Self::get_user_data(config, &ACTIVITIES_LOGS_SOURCE_KEY)?; @@ -485,7 +487,7 @@ impl PipelineParts { drop(borrowed_event); if start == 0 { - let new_name = event.borrow().name()[start..end].to_owned(); + let new_name = Rc::from(event.borrow().name()[start..end].to_owned()); event.borrow_mut().set_name(new_name); } } @@ -498,7 +500,7 @@ impl PipelineParts { serialize_activities_logs, |context: &mut PipelineContext, _, config: &UserDataImpl| { let logs_to_activities = Self::create_activities_to_logs(context, config)?; - let path = Path::new(Self::get_user_data(config, &PATH_KEY)?); + let path = Path::new(Self::get_user_data(config, &PATH_KEY)?.as_ref()); let format = Self::get_user_data(config, &LOG_SERIALIZATION_FORMAT_KEY)?; let mut log_number = 1; @@ -566,7 +568,7 @@ impl PipelineParts { } for update in updates { - let new_key = format!("{}{}", HIERARCHY_LEVEL, update.0); + let new_key = Rc::from(format!("{}{}", HIERARCHY_LEVEL, update.0)); event.payload_map_mut().unwrap().insert(new_key, update.1); } } diff --git a/Ficus/src/rust/ficus/src/pipelines/cases.rs b/Ficus/src/rust/ficus/src/pipelines/cases.rs index 8dac1a2c..e86c44fb 100644 --- a/Ficus/src/rust/ficus/src/pipelines/cases.rs +++ b/Ficus/src/rust/ficus/src/pipelines/cases.rs @@ -20,7 +20,7 @@ impl PipelineParts { let end_case_regex = Self::get_user_data(config, &END_CASE_REGEX_KEY)?; let inline_inner_cases = *Self::get_user_data(config, &INLINE_INNER_CASES_KEY)?; - let new_log = discover_cases(log, start_case_regex.as_str(), end_case_regex.as_str(), inline_inner_cases); + let new_log = discover_cases(log, start_case_regex.as_ref(), end_case_regex.as_ref(), inline_inner_cases); let mut new_context = context.clone(); new_context.put_concrete(EVENT_LOG_KEY.key(), new_log); diff --git a/Ficus/src/rust/ficus/src/pipelines/discovery_parts.rs b/Ficus/src/rust/ficus/src/pipelines/discovery_parts.rs index 0aa66348..777e65d9 100644 --- a/Ficus/src/rust/ficus/src/pipelines/discovery_parts.rs +++ b/Ficus/src/rust/ficus/src/pipelines/discovery_parts.rs @@ -106,7 +106,7 @@ impl PipelineParts { pipeline_part!(discover_dfg, |context: &mut PipelineContext, _, config: &UserDataImpl| { let log = Self::get_user_data(context, &EVENT_LOG_KEY)?; let creation_dto = match Self::get_user_data(config, &THREAD_ATTRIBUTE_KEY) { - Ok(thread_attribute) => EventLogInfoCreationDto::default_thread(log, thread_attribute.to_owned()), + Ok(thread_attribute) => EventLogInfoCreationDto::default_thread(log, thread_attribute.clone()), Err(_) => EventLogInfoCreationDto::default(log), }; diff --git a/Ficus/src/rust/ficus/src/pipelines/drawing_parts.rs b/Ficus/src/rust/ficus/src/pipelines/drawing_parts.rs index ff25de0f..37ccc11b 100644 --- a/Ficus/src/rust/ficus/src/pipelines/drawing_parts.rs +++ b/Ficus/src/rust/ficus/src/pipelines/drawing_parts.rs @@ -1,6 +1,3 @@ -use fancy_regex::Regex; -use std::{collections::HashMap, ops::Deref}; - use super::{context::PipelineContext, errors::pipeline_errors::PipelinePartExecutionError, pipelines::PipelinePartFactory}; use crate::{ event_log::{ @@ -17,16 +14,17 @@ use crate::{ }, utils::{ colors::{Color, ColoredRectangle, ColorsEventLog, ColorsHolder}, - references::HeapedOrOwned, user_data::user_data::{UserData, UserDataImpl}, }, }; +use fancy_regex::Regex; +use std::{collections::HashMap, rc::Rc}; impl PipelineParts { pipeline_part!(traces_diversity_diagram, |context: &mut PipelineContext, _, _| { let log = Self::get_user_data(context, &EVENT_LOG_KEY)?; let colors_holder = context.concrete_mut(COLORS_HOLDER_KEY.key()).expect("Should be initialized"); - let colors_log = Self::create_traces_diversity_colors_log(log, colors_holder, |e| HeapedOrOwned::Heaped(e.name_pointer().clone())); + let colors_log = Self::create_traces_diversity_colors_log(log, colors_holder, |e| e.name_pointer().clone()); context.put_concrete(COLORS_EVENT_LOG_KEY.key(), colors_log); @@ -36,7 +34,7 @@ impl PipelineParts { fn create_traces_diversity_colors_log( log: &XesEventLogImpl, colors_holder: &mut ColorsHolder, - color_key_selector: impl Fn(&XesEventImpl) -> HeapedOrOwned, + color_key_selector: impl Fn(&XesEventImpl) -> Rc, ) -> ColorsEventLog { let mut mapping = HashMap::new(); let mut traces = vec![]; @@ -47,14 +45,13 @@ impl PipelineParts { let event = event.borrow(); let colors_key = color_key_selector(&event); - let colors_key = colors_key.deref(); - let color = colors_holder.get_or_create(colors_key); - if !mapping.contains_key(colors_key) { + let color = colors_holder.get_or_create(&colors_key); + if !mapping.contains_key(&colors_key) { mapping.insert(colors_key.to_owned(), color); } - let name = HeapedOrOwned::Owned(colors_key.to_owned()); + let name = colors_key.to_owned(); vec.push(ColoredRectangle::square(name, index as f64)); } @@ -68,7 +65,7 @@ impl PipelineParts { draw_placement_of_event_by_name, |context: &mut PipelineContext, _, config: &UserDataImpl| { let event_name = Self::get_user_data(config, &EVENT_NAME_KEY)?; - Self::draw_events_placement(context, &|event| event.name() == event_name) + Self::draw_events_placement(context, &|event| event.name() == event_name.as_ref()) } ); @@ -81,24 +78,24 @@ impl PipelineParts { let mut traces = vec![]; let mut mapping = HashMap::new(); - mapping.insert(UNDEF_ACTIVITY_NAME.to_owned(), Color::black()); + mapping.insert(Rc::from(UNDEF_ACTIVITY_NAME.to_owned()), Color::black()); for trace in log.traces() { let mut colors_trace = vec![]; for (index, event) in trace.borrow().events().iter().enumerate() { let event = event.borrow(); - let name = event.name(); + let name = event.name_pointer(); if selector(&event) { - let color = colors_holder.get_or_create(name.as_str()); + let color = colors_holder.get_or_create(name); if !mapping.contains_key(name) { - mapping.insert(name.to_owned(), color); + mapping.insert(name.clone(), color); } - let name = HeapedOrOwned::Heaped(event.name_pointer().clone()); + let name = event.name_pointer().clone(); colors_trace.push(ColoredRectangle::square(name, index as f64)); } else { - let name = HeapedOrOwned::Owned(UNDEF_ACTIVITY_NAME.to_owned()); + let name = Rc::from(UNDEF_ACTIVITY_NAME.to_owned()); colors_trace.push(ColoredRectangle::square(name, index as f64)); } } @@ -127,7 +124,7 @@ impl PipelineParts { let mut traces = vec![]; let mut mapping = HashMap::new(); - mapping.insert(UNDEF_ACTIVITY_NAME.to_string(), Color::black()); + mapping.insert(Rc::from(UNDEF_ACTIVITY_NAME), Color::black()); for (activities, trace) in traces_activities.iter().zip(log.traces().iter()) { let mut colors_trace = vec![]; @@ -138,15 +135,14 @@ impl PipelineParts { let color = colors_holder.get_or_create(activity.node().borrow().name()); let name = activity.node().borrow().name().clone(); if !mapping.contains_key(name.as_ref()) { - mapping.insert(name.as_ref().to_owned(), color); + mapping.insert(name.clone(), color); } - let name = HeapedOrOwned::Heaped(name); colors_trace.push(ColoredRectangle::new(name, *activity.start_pos() as f64, *activity.length() as f64)); } SubTraceKind::Unattached(start_pos, length) => { colors_trace.push(ColoredRectangle::new( - HeapedOrOwned::Owned(UNDEF_ACTIVITY_NAME.to_string()), + Rc::from(UNDEF_ACTIVITY_NAME.to_string()), start_pos as f64, length as f64, )); @@ -168,7 +164,7 @@ impl PipelineParts { let mut traces = vec![]; let mut mapping = HashMap::new(); - mapping.insert(UNDEF_ACTIVITY_NAME.to_owned(), Color::black()); + mapping.insert(Rc::::from(UNDEF_ACTIVITY_NAME), Color::black()); for (activities, trace) in traces_activities.iter().zip(log.traces().iter()) { let mut colors_trace = vec![]; @@ -178,17 +174,17 @@ impl PipelineParts { match sub_trace { SubTraceKind::Attached(activity) => { let color = colors_holder.get_or_create(activity.node().borrow().name()); - let name = activity.node().borrow().name().to_owned(); + let node = activity.node().borrow(); + let name = node.name(); - if !mapping.contains_key(activity.node().borrow().name().as_ref()) { - mapping.insert(activity.node().borrow().name().as_ref().to_owned(), color); + if !mapping.contains_key(name) { + mapping.insert(name.clone(), color); } - let name = HeapedOrOwned::Heaped(name); - colors_trace.push(ColoredRectangle::new(name, index as f64, 1.)); + colors_trace.push(ColoredRectangle::new(name.clone(), index as f64, 1.)); } SubTraceKind::Unattached(_, _) => { - let ptr = HeapedOrOwned::Owned(UNDEF_ACTIVITY_NAME.to_owned()); + let ptr = Rc::from(UNDEF_ACTIVITY_NAME.to_owned()); colors_trace.push(ColoredRectangle::new(ptr, index as f64, 1.)); } } @@ -218,7 +214,7 @@ impl PipelineParts { return value.to_string_repr(); } - HeapedOrOwned::Owned("UNDEF_ATTRIBUTE".to_string()) + Rc::from("UNDEF_ATTRIBUTE".to_string()) }); context.put_concrete(COLORS_EVENT_LOG_KEY.key(), colors_log); diff --git a/Ficus/src/rust/ficus/src/pipelines/keys/context_keys.rs b/Ficus/src/rust/ficus/src/pipelines/keys/context_keys.rs index 6f176df3..266ee91a 100644 --- a/Ficus/src/rust/ficus/src/pipelines/keys/context_keys.rs +++ b/Ficus/src/rust/ficus/src/pipelines/keys/context_keys.rs @@ -156,25 +156,25 @@ context_key! { ACTIVITIES, Vec>> } context_key! { REPEAT_SETS, Vec } context_key! { TRACE_ACTIVITIES, Vec> } context_key! { PATTERNS, Vec> } -context_key! { ACTIVITIES_TO_LOGS, HashMap } -context_key! { ACTIVITY_NAME, String } +context_key! { ACTIVITIES_TO_LOGS, HashMap, XesEventLogImpl> } +context_key! { ACTIVITY_NAME, Rc } context_key! { HASHES_EVENT_LOG, Vec> } -context_key! { NAMES_EVENT_LOG, Vec> } +context_key! { NAMES_EVENT_LOG, Vec>> } context_key! { TANDEM_ARRAY_LENGTH, u32 } context_key! { ACTIVITY_LEVEL, u32 } context_key! { NARROW_ACTIVITIES, ActivityNarrowingKind } -context_key! { EVENT_NAME, String } -context_key! { REGEX, String } +context_key! { EVENT_NAME, Rc } +context_key! { REGEX, Rc } context_key! { COLORS_EVENT_LOG, ColorsEventLog } context_key! { COLORS_HOLDER, ColorsHolder } context_key! { PATTERNS_DISCOVERY_STRATEGY, PatternsDiscoveryStrategy } -context_key! { OUTPUT_STRING, String } +context_key! { OUTPUT_STRING, Rc } context_key! { EVENT_LOG_INFO, OfflineEventLogInfo } context_key! { UNDERLYING_EVENTS_COUNT, usize } context_key! { EVENTS_COUNT, u32 } -context_key! { REGEXES, Vec } +context_key! { REGEXES, Vec> } context_key! { ADJUSTING_MODE, AdjustingMode } -context_key! { EVENT_CLASS_REGEX, String } +context_key! { EVENT_CLASS_REGEX, Rc } context_key! { PATTERNS_KIND, PatternsKindDto } context_key! { PIPELINE, Pipeline } context_key! { MIN_ACTIVITY_LENGTH, u32 } @@ -209,32 +209,32 @@ context_key! { LABELED_TRACES_ACTIVITIES_DATASET, LabeledDataset } context_key! { ACTIVITIES_REPR_SOURCE, ActivityRepresentationSource } context_key! { DISTANCE, FicusDistance } context_key! { EXECUTE_ONLY_ON_LAST_EXTRACTION, bool } -context_key! { EVENT_LOG_NAME, String } +context_key! { EVENT_LOG_NAME, Rc } context_key! { LOG_TRACES_DATASET, FicusDataset } context_key! { LABELED_LOG_TRACES_DATASET, LabeledDataset } context_key! { TRACES_REPR_SOURCE, TracesRepresentationSource } context_key! { SYSTEM_METADATA, SystemMetadata } context_key! { LOG_SERIALIZATION_FORMAT, LogSerializationFormat } context_key! { BYTES, Vec } -context_key! { PATH, String } +context_key! { PATH, Rc } context_key! { CASE_NAME, CaseName } -context_key! { PROCESS_NAME, String } -context_key! { PIPELINE_NAME, String } +context_key! { PROCESS_NAME, Rc } +context_key! { PIPELINE_NAME, Rc } context_key! { PIPELINE_ID, Uuid } -context_key! { SUBSCRIPTION_NAME, String } +context_key! { SUBSCRIPTION_NAME, Rc } context_key! { SUBSCRIPTION_ID, Uuid } -context_key! { UNSTRUCTURED_METADATA, Vec<(String, String)> } -context_key! { START_CASE_REGEX, String } -context_key! { END_CASE_REGEX, String } +context_key! { UNSTRUCTURED_METADATA, Vec<(Rc, Rc)> } +context_key! { START_CASE_REGEX, Rc } +context_key! { END_CASE_REGEX, Rc } context_key! { INLINE_INNER_CASES, bool } context_key! { GRAPH_TIME_ANNOTATION, HashMap } -context_key! { ATTRIBUTE, String } +context_key! { ATTRIBUTE, Rc } context_key! { TIME_ANNOTATION_KIND, TimeAnnotationKind } -context_key! { ATTRIBUTES, Vec } -context_key! { PATHS, Vec } +context_key! { ATTRIBUTES, Vec> } +context_key! { PATHS, Vec> } context_key! { LOG_THREADS_DIAGRAM, LogTimelineDiagram } -context_key! { THREAD_ATTRIBUTE, String } -context_key! { TIME_ATTRIBUTE, String } +context_key! { THREAD_ATTRIBUTE, Rc } +context_key! { TIME_ATTRIBUTE, Rc } context_key! { TIME_DELTA, u32 } context_key! { FEATURE_COUNT_KIND, FeatureCountKindDto } context_key! { PERCENT_FROM_MAX_VALUE, f64 } diff --git a/Ficus/src/rust/ficus/src/pipelines/multithreading.rs b/Ficus/src/rust/ficus/src/pipelines/multithreading.rs index 8ec2ba2f..a075e53c 100644 --- a/Ficus/src/rust/ficus/src/pipelines/multithreading.rs +++ b/Ficus/src/rust/ficus/src/pipelines/multithreading.rs @@ -75,7 +75,7 @@ impl PipelineParts { let diagram = discover_timeline_diagram( log, - thread_attribute.as_str(), + thread_attribute, time_attribute, event_group_delta.map(|delta| *delta as u64), Self::get_control_flow_regexes(&software_data_extraction_config)?.as_ref(), @@ -114,8 +114,8 @@ impl PipelineParts { context, config, infra, - thread_attribute, - time_attribute, + &thread_attribute, + time_attribute.as_ref(), ) } ); @@ -125,9 +125,9 @@ impl PipelineParts { Ok(enumerate_event_groups(timeline)) } - fn extract_thread_and_time_attribute(context: &PipelineContext) -> Result<(String, Option), PipelinePartExecutionError> { + fn extract_thread_and_time_attribute(context: &PipelineContext) -> Result<(Rc, Option>), PipelinePartExecutionError> { let timeline = Self::get_user_data(context, &LOG_THREADS_DIAGRAM_KEY)?; - Ok((timeline.thread_attribute().clone(), timeline.time_attribute().as_ref().cloned())) + Ok((timeline.thread_attribute().clone(), timeline.time_attribute().clone())) } fn abstract_event_groups( @@ -135,8 +135,8 @@ impl PipelineParts { context: &mut PipelineContext, config: &UserDataImpl, infra: &PipelineInfrastructure, - thread_attribute: String, - time_attribute: Option, + thread_attribute: &Rc, + time_attribute: Option<&Rc>, ) -> Result<(), PipelinePartExecutionError> { let extraction_config = Self::get_software_data_extraction_config(context); let events_groups_log = Self::create_groups_event_log(&events_groups); @@ -180,10 +180,10 @@ impl PipelineParts { let strategy = Self::create_multithreaded_trace_parts_creation_strategy(config)?; - let groups = enumerate_multithreaded_events_groups(log, &software_config, thread_attribute.as_str(), &strategy) + let groups = enumerate_multithreaded_events_groups(log, &software_config, thread_attribute.as_ref(), &strategy) .map_err(PipelinePartExecutionError::new_raw)?; - Self::abstract_event_groups(groups, context, config, infra, thread_attribute, time_attribute) + Self::abstract_event_groups(groups, context, config, infra, &thread_attribute, time_attribute.as_ref()) } ); @@ -274,13 +274,12 @@ impl PipelineParts { for trace in log.traces() { let trace = trace.borrow_mut(); for event in trace.events() { - if alloc_regex.is_match(event.borrow().name().as_str()).unwrap_or(false) { + if alloc_regex.is_match(event.borrow().name()).unwrap_or(false) { let mut event = event.borrow_mut(); if let Some(map) = event.payload_map_mut() - && let Some(type_name) = map.get_mut(config.info().type_name_attr().as_str()) + && let Some(type_name) = map.get_mut(config.info().type_name_attr().as_ref()) { - let string = type_name.to_string_repr().to_string(); - *type_name = EventPayloadValue::String(Rc::new(Self::shorten_type_or_method_name(string))); + *type_name = EventPayloadValue::String(Rc::from(Self::shorten_type_or_method_name(type_name.to_string_repr().as_ref()))); } } } @@ -290,7 +289,7 @@ impl PipelineParts { Ok(()) }); - fn shorten_type_or_method_name(name: String) -> String { + fn shorten_type_or_method_name(name: &str) -> String { let mut result = String::new(); let mut chars = name.chars(); let mut last_seen_word = String::new(); @@ -338,10 +337,10 @@ impl PipelineParts { pipeline_part!(shorten_method_names, |context: &mut PipelineContext, _, _| { let log = Self::get_user_data_mut(context, &EVENT_LOG_KEY)?; - let methods_id_factories: Vec<&dyn Fn(&String, &String, &String) -> String> = vec![ + let methods_id_factories: Vec<&dyn Fn(&Rc, &Rc, &Rc) -> Rc> = vec![ &|_, name, _| name.to_owned(), - &|_, name, signature| name.to_owned() + signature, - &|namespace, name, _| namespace.to_string() + name, + &|_, name, signature| Rc::from(name.as_ref().to_owned() + signature.as_ref()), + &|namespace, name, _| Rc::from(namespace.to_string() + name), ]; let configs = Self::create_processed_method_extraction_configs(context); @@ -366,7 +365,7 @@ impl PipelineParts { continue; }; - event.set_name(name); + event.set_name(Rc::from(name)); } } @@ -377,7 +376,7 @@ impl PipelineParts { for trace in log.traces() { let trace = trace.borrow_mut(); for event in trace.events() { - if config.event_regex.is_match(event.borrow().name().as_str()).unwrap_or(false) { + if config.event_regex.is_match(event.borrow().name()).unwrap_or(false) { Self::shorten_method_name(config, &mut event.borrow_mut()); } } @@ -416,9 +415,9 @@ impl PipelineParts { Ok(Some(ProcessedMethodStartEndConfig { event_regex: regex, - name_attr: config.info().method_attrs().name_attr().to_owned(), - signature_attr: config.info().method_attrs().signature_attr().to_owned(), - namespace_attr: config.info().method_attrs().namespace_attr().to_owned(), + name_attr: config.info().method_attrs().name_attr().clone(), + signature_attr: config.info().method_attrs().signature_attr().clone(), + namespace_attr: config.info().method_attrs().namespace_attr().clone(), prefix: config.info().prefix().as_ref().cloned(), })) } else { @@ -429,9 +428,10 @@ impl PipelineParts { fn shorten_method_name(config: &ProcessedMethodStartEndConfig, event: &mut XesEventImpl) { let shortened_name = if let Some(payload) = event.payload_map() { if let Some((namespace, name, signature)) = Self::extract_method_name_parts(payload, config) { - let shortened_name = Self::shorten_type_or_method_name(namespace + "." + name.as_str()) + signature.as_str(); + let name = namespace.as_ref().to_owned() + "." + name.as_ref(); + let shortened_name = Self::shorten_type_or_method_name(&name) + signature.as_ref(); if let Some(prefix) = config.prefix.as_ref().cloned() { - prefix + shortened_name.as_str() + prefix.as_ref().to_owned() + shortened_name.as_str() } else { shortened_name } @@ -442,22 +442,16 @@ impl PipelineParts { return; }; - event.set_name(shortened_name); + event.set_name(Rc::from(shortened_name)); } fn extract_method_name_parts( - payload: &HashMap, + payload: &HashMap, EventPayloadValue>, config: &ProcessedMethodStartEndConfig, - ) -> Option<(String, String, String)> { - let namespace = payload - .get(config.namespace_attr.as_str()) - .map(|v| v.to_string_repr().as_str().to_owned())?; - let name = payload - .get(config.name_attr.as_str()) - .map(|v| v.to_string_repr().as_str().to_owned())?; - let signature = payload - .get(config.signature_attr.as_str()) - .map(|v| v.to_string_repr().as_str().to_owned())?; + ) -> Option<(Rc, Rc, Rc)> { + let namespace = payload.get(config.namespace_attr.as_ref()).map(|v| v.to_string_repr().clone())?; + let name = payload.get(config.name_attr.as_ref()).map(|v| v.to_string_repr().clone())?; + let signature = payload.get(config.signature_attr.as_ref()).map(|v| v.to_string_repr().clone())?; Some((namespace, name, signature)) } @@ -465,13 +459,13 @@ impl PipelineParts { fn check_if_can_use_method_id( log: &XesEventLogImpl, config: &ProcessedMethodStartEndConfig, - method_id_factory: impl Fn(&String, &String, &String) -> String, + method_id_factory: impl Fn(&Rc, &Rc, &Rc) -> Rc, ) -> bool { let mut map = HashMap::new(); for trace in log.traces().iter().map(|t| t.borrow()) { for event in trace.events().iter().map(|e| e.borrow()) { - if config.event_regex.is_match(event.name().as_str()).unwrap_or(false) { + if config.event_regex.is_match(event.name()).unwrap_or(false) { continue; } @@ -479,7 +473,7 @@ impl PipelineParts { && let Some((namespace, name, signature)) = Self::extract_method_name_parts(payload, config) { let id = method_id_factory(&namespace, &name, &signature); - let fqn = namespace + name.as_str() + signature.as_str(); + let fqn = namespace.as_ref().to_owned() + name.as_ref() + signature.as_ref(); if let Some(entry) = map.get(&id) { if !fqn.eq(entry) { @@ -505,12 +499,12 @@ impl PipelineParts { let mut display_name = None; if let Some(payload) = event.borrow().payload_map() { for config in &configs { - if config.event_regex.is_match(event.borrow().name().as_str()).unwrap_or(false) + if config.event_regex.is_match(event.borrow().name()).unwrap_or(false) && let Some((_, name, _)) = Self::extract_method_name_parts(payload, config) { display_name = Some(match config.prefix.as_ref() { None => name, - Some(prefix) => prefix.to_string() + name.as_str(), + Some(prefix) => Rc::from(prefix.to_string() + name.as_ref()), }); } } @@ -544,7 +538,7 @@ impl PipelineParts { }; if let Some(config) = Self::create_method_extraction_info(config.as_ref())? { - log.filter_events_by(|e| config.event_regex.is_match(e.name().as_str()).unwrap_or(false)); + log.filter_events_by(|e| config.event_regex.is_match(e.name()).unwrap_or(false)); } Ok(()) @@ -561,7 +555,7 @@ impl PipelineParts { let thread_attribute = Self::get_user_data(config, &THREAD_ATTRIBUTE_KEY)?; let strategy = Self::create_multithreaded_trace_parts_creation_strategy(config)?; - let dfg = discover_multithreaded_dfg(log, thread_attribute.as_str(), &strategy); + let dfg = discover_multithreaded_dfg(log, thread_attribute.as_ref(), &strategy); context.put_concrete(GRAPH_KEY.key(), dfg); Ok(()) @@ -576,7 +570,7 @@ impl PipelineParts { let mut result = vec![]; for r in regexes .iter() - .map(|r| Regex::new(r.as_str()).map_err(|e| PipelinePartExecutionError::new_raw(e.to_string()))) + .map(|r| Regex::new(r.as_ref()).map_err(|e| PipelinePartExecutionError::new_raw(e.to_string()))) { result.push(r?); } @@ -590,8 +584,8 @@ impl PipelineParts { struct ProcessedMethodStartEndConfig { event_regex: Regex, - namespace_attr: String, - name_attr: String, - signature_attr: String, - prefix: Option, + namespace_attr: Rc, + name_attr: Rc, + signature_attr: Rc, + prefix: Option>, } diff --git a/Ficus/src/rust/ficus/src/pipelines/util_parts.rs b/Ficus/src/rust/ficus/src/pipelines/util_parts.rs index e645e8a2..1d5c5d7d 100644 --- a/Ficus/src/rust/ficus/src/pipelines/util_parts.rs +++ b/Ficus/src/rust/ficus/src/pipelines/util_parts.rs @@ -68,7 +68,7 @@ impl PipelineParts { for trace in log.traces() { let mut vec = vec![]; for event in trace.borrow().events() { - vec.push(event.borrow().name().to_string()); + vec.push(event.borrow().name_pointer().clone()); } result.push(vec); diff --git a/Ficus/src/rust/ficus/src/pipelines/xes_parts.rs b/Ficus/src/rust/ficus/src/pipelines/xes_parts.rs index 1faf34bf..ac30f9c0 100644 --- a/Ficus/src/rust/ficus/src/pipelines/xes_parts.rs +++ b/Ficus/src/rust/ficus/src/pipelines/xes_parts.rs @@ -37,7 +37,7 @@ impl PipelineParts { let log = read_event_log(path); if log.is_none() { - let message = format!("Failed to read event log from {}", path.as_str()); + let message = format!("Failed to read event log from {}", path.as_ref()); return Err(PipelinePartExecutionError::Raw(RawPartExecutionError::new(message))); } @@ -54,7 +54,7 @@ impl PipelineParts { Ok(()) } Err(err) => { - let message = format!("Failed to read event log from {}, error: {}", path.as_str(), err); + let message = format!("Failed to read event log from {}, error: {}", path.as_ref(), err); Err(PipelinePartExecutionError::Raw(RawPartExecutionError::new(message))) } } diff --git a/Ficus/src/rust/ficus/src/utils/colors.rs b/Ficus/src/rust/ficus/src/utils/colors.rs index 5709e7c2..3ba3a675 100644 --- a/Ficus/src/rust/ficus/src/utils/colors.rs +++ b/Ficus/src/rust/ficus/src/utils/colors.rs @@ -1,11 +1,9 @@ +use rand::Rng; use std::{ collections::{HashMap, HashSet}, - ops::Deref, + rc::Rc, }; -use crate::utils::references::HeapedOrOwned; -use rand::Rng; - #[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)] pub struct Color { red: u8, @@ -53,7 +51,7 @@ impl Color { } pub struct ColorsHolder { - names_to_colors: HashMap, + names_to_colors: HashMap, Color>, used_colors: HashSet, } @@ -65,7 +63,7 @@ impl ColorsHolder { } } - pub fn get_or_create(&mut self, name: &str) -> Color { + pub fn get_or_create(&mut self, name: &Rc) -> Color { if let Some(existing_color) = self.names_to_colors.get(name) { *existing_color } else { @@ -78,22 +76,22 @@ impl ColorsHolder { } pub struct ColorsEventLog { - pub mapping: HashMap, + pub mapping: HashMap, Color>, pub traces: Vec>, } pub struct ColoredRectangle { - name: HeapedOrOwned, + name: Rc, start_x: f64, length: f64, } impl ColoredRectangle { - pub fn new(name: HeapedOrOwned, start_x: f64, length: f64) -> Self { + pub fn new(name: Rc, start_x: f64, length: f64) -> Self { Self { name, start_x, length } } - pub fn square(name: HeapedOrOwned, start_pos: f64) -> Self { + pub fn square(name: Rc, start_pos: f64) -> Self { Self::new(name, start_pos, 1.) } @@ -105,7 +103,7 @@ impl ColoredRectangle { self.length } - pub fn name(&self) -> &String { - self.name.deref() + pub fn name(&self) -> &str { + &self.name } } diff --git a/Ficus/src/rust/ficus/src/utils/graph/graph_conversions.rs b/Ficus/src/rust/ficus/src/utils/graph/graph_conversions.rs index b1b95c5c..87680a94 100644 --- a/Ficus/src/rust/ficus/src/utils/graph/graph_conversions.rs +++ b/Ficus/src/rust/ficus/src/utils/graph/graph_conversions.rs @@ -6,7 +6,7 @@ use crate::utils::{ }, references::HeapedOrOwned, }; -use std::{collections::HashMap, fmt::Display}; +use std::{collections::HashMap, fmt::Display, rc::Rc}; impl Graph where @@ -23,13 +23,13 @@ where } #[rustfmt::skip] - fn to_default_graph_nodes(&self) -> HashMap>> { + fn to_default_graph_nodes(&self) -> HashMap>> { self.nodes.iter().map(|pair| { ( *pair.0, GraphNode { id: pair.1.id.to_owned(), - data: pair.1.data.as_ref().map(|data| HeapedOrOwned::Owned(data.to_string())), + data: pair.1.data.as_ref().map(|data| Rc::from(data.to_string())), user_data: pair.1.user_data.clone() }, ) @@ -37,7 +37,7 @@ where } #[rustfmt::skip] - fn to_default_graph_connections(&self) -> HashMap>>> { + fn to_default_graph_connections(&self) -> HashMap>>> { self.connections.iter().map(|pair| { ( *pair.0, @@ -48,7 +48,7 @@ where pair.1.from_node, pair.1.to_node, pair.1.weight, - pair.1.data().as_ref().map(|data| HeapedOrOwned::Owned(data.to_string())), + pair.1.data().as_ref().map(|data| Rc::from(data.to_string())), Some(pair.1.user_data.clone()) ) ) diff --git a/Ficus/src/rust/ficus/src/utils/vec_utils.rs b/Ficus/src/rust/ficus/src/utils/vec_utils.rs index 7d9ee84a..956bd131 100644 --- a/Ficus/src/rust/ficus/src/utils/vec_utils.rs +++ b/Ficus/src/rust/ficus/src/utils/vec_utils.rs @@ -1,4 +1,6 @@ -pub fn sort_by_first(vec: &mut Vec<(&String, TValue)>) { +use std::rc::Rc; + +pub fn sort_by_first(vec: &mut Vec<(&Rc, TValue)>) { vec.sort_by(|first, second| first.0.partial_cmp(second.0).unwrap()); } diff --git a/Ficus/src/rust/ficus/tests/analysis/analysis_tests.rs b/Ficus/src/rust/ficus/tests/analysis/analysis_tests.rs index c0ff4dd6..9f3193a7 100644 --- a/Ficus/src/rust/ficus/tests/analysis/analysis_tests.rs +++ b/Ficus/src/rust/ficus/tests/analysis/analysis_tests.rs @@ -1,5 +1,3 @@ -use std::collections::{HashMap, HashSet}; - use crate::test_core::simple_events_logs_provider::{ create_log_from_filter_out_chaotic_events, create_log_from_filter_out_chaotic_events_with_noise, create_simple_event_log, }; @@ -14,6 +12,10 @@ use ficus::features::analysis::{ log_info_creation_dto::EventLogInfoCreationDto, }, }; +use std::{ + collections::{HashMap, HashSet}, + rc::Rc, +}; #[test] fn test_dfg_info() { @@ -33,10 +35,10 @@ fn test_dfg_info() { assert!(!dfg.is_event_with_single_follower(&"C".to_string())); let followers = dfg.get_followed_events(&"A".to_string()).unwrap(); - assert_eq!(followers.get(&"B".to_string()).unwrap(), &2usize); + assert_eq!(followers.get("B").unwrap(), &2usize); let followers = dfg.get_followed_events(&"B".to_string()).unwrap(); - assert_eq!(followers.get(&"C".to_string()).unwrap(), &2usize); + assert_eq!(followers.get("C").unwrap(), &2usize); assert_eq!(dfg.get_followed_events(&"C".to_string()), None); } @@ -58,7 +60,7 @@ fn test_dfg_entropy() { #[test] fn test_dfg_entropy_with_noise() { let log = create_log_from_filter_out_chaotic_events_with_noise(); - let ignored_events = HashSet::from_iter(vec!["d".to_string(), "v".to_string()]); + let ignored_events = HashSet::from_iter(vec![Rc::from("d"), Rc::from("v")]); let entropies = calculate_default_dfg_entropy(&log, Some(&ignored_events)); let expected = HashMap::from_iter(vec![ @@ -88,7 +90,7 @@ fn test_dfg_laplace_entropy() { #[test] fn test_dfg_laplace_entropy_with_noise() { let log = create_log_from_filter_out_chaotic_events_with_noise(); - let ignored_events = HashSet::from_iter(vec!["d".to_string(), "v".to_string()]); + let ignored_events = HashSet::from_iter(vec![Rc::from("d"), Rc::from("v")]); let entropies = calculate_laplace_dfg_entropy(&log, Some(&ignored_events)); @@ -107,10 +109,10 @@ fn test_pos_entropy() { let log = create_log_from_filter_out_chaotic_events(); let entropies = calculate_pos_entropies(&log, &None); let expected = HashMap::from_iter(vec![ - ("c".to_string(), 0.2211099839259014), - ("b".to_string(), 0.2211099839259014), - ("x".to_string(), 0.3230075074711545), - ("a".to_string(), 0.0), + (Rc::from("c"), 0.2211099839259014), + (Rc::from("b"), 0.2211099839259014), + (Rc::from("x"), 0.3230075074711545), + (Rc::from("a"), 0.0), ]); assert_eq!(entropies, expected); @@ -119,14 +121,14 @@ fn test_pos_entropy() { #[test] fn test_pos_entropy_with_noise() { let log = create_log_from_filter_out_chaotic_events_with_noise(); - let ignored_events = HashSet::from_iter(vec!["d".to_string(), "v".to_string()]); + let ignored_events = HashSet::from_iter(vec![Rc::from("d"), Rc::from("v")]); let entropies = calculate_pos_entropies(&log, &Some(ignored_events)); let expected = HashMap::from_iter(vec![ - ("c".to_string(), 0.2211099839259014), - ("b".to_string(), 0.2211099839259014), - ("x".to_string(), 0.3230075074711545), - ("a".to_string(), 0.0), + (Rc::from("c"), 0.2211099839259014), + (Rc::from("b"), 0.2211099839259014), + (Rc::from("x"), 0.3230075074711545), + (Rc::from("a"), 0.0), ]); assert_eq!(entropies, expected); @@ -137,10 +139,10 @@ fn test_pos_entropy_fast() { let log = create_log_from_filter_out_chaotic_events(); let entropies = calculate_pos_entropies_fast(&log, None); let expected = HashMap::from_iter(vec![ - ("c".to_string(), 0.2211099839259014), - ("b".to_string(), 0.2211099839259014), - ("x".to_string(), 0.3230075074711545), - ("a".to_string(), 0.0), + (Rc::from("c"), 0.2211099839259014), + (Rc::from("b"), 0.2211099839259014), + (Rc::from("x"), 0.3230075074711545), + (Rc::from("a"), 0.0), ]); assert_eq!(entropies, expected); @@ -149,14 +151,14 @@ fn test_pos_entropy_fast() { #[test] fn test_pos_entropy_fast_with_noise() { let log = create_log_from_filter_out_chaotic_events_with_noise(); - let ignored_events = HashSet::from_iter(vec!["d".to_string(), "v".to_string()]); + let ignored_events = HashSet::from_iter(vec![Rc::from("d"), Rc::from("v")]); let entropies = calculate_pos_entropies_fast(&log, Some(&ignored_events)); let expected = HashMap::from_iter(vec![ - ("c".to_string(), 0.2211099839259014), - ("b".to_string(), 0.2211099839259014), - ("x".to_string(), 0.3230075074711545), - ("a".to_string(), 0.0), + (Rc::from("c"), 0.2211099839259014), + (Rc::from("b"), 0.2211099839259014), + (Rc::from("x"), 0.3230075074711545), + (Rc::from("a"), 0.0), ]); assert_eq!(entropies, expected); diff --git a/Ficus/src/rust/ficus/tests/analysis/patterns/activities_instances_tests.rs b/Ficus/src/rust/ficus/tests/analysis/patterns/activities_instances_tests.rs index 9724c688..598b88ca 100644 --- a/Ficus/src/rust/ficus/tests/analysis/patterns/activities_instances_tests.rs +++ b/Ficus/src/rust/ficus/tests/analysis/patterns/activities_instances_tests.rs @@ -124,7 +124,7 @@ fn execute_activities_discovery_test( let context = ActivitiesInstancesDiscoveryContext::new(context, strategy, |info, _| { Rc::new(RefCell::new(XesEventImpl::new_with_min_date( - info.node().borrow().name().to_string(), + info.node().borrow().name().clone() ))) }); @@ -138,7 +138,7 @@ fn test_creating_new_log_from_activity_instances_insert_as_single_event() { execute_activities_discovery_test( create_log_from_taxonomy_of_patterns(), UndefActivityHandlingStrategy::InsertAsSingleEvent(Box::new(|| { - Rc::new(RefCell::new(XesEventImpl::new_with_min_date(UNDEF_ACTIVITY_NAME.to_string()))) + Rc::new(RefCell::new(XesEventImpl::new_with_min_date(Rc::from(UNDEF_ACTIVITY_NAME.to_string())))) })), &vec![vec![UNDEF_ACTIVITY_NAME, "(a)::(b)::(c)", UNDEF_ACTIVITY_NAME, "(a)::(b)::(c)"]], ); @@ -278,7 +278,7 @@ fn execute_activities_logs_creation_test(log: XesEventLogImpl, pattern_kind: Pat let mut activities_logs = activities_logs .iter() .map(|pair| (pair.0.to_owned(), pair.1.borrow().to_raw_vector())) - .collect::, Vec>)>>(); + .collect::, Vec>)>>(); activities_logs.sort_by(|first, second| first.0.cmp(&second.0)); diff --git a/Ficus/src/rust/ficus/tests/discovery/ecfg_discovery.rs b/Ficus/src/rust/ficus/tests/discovery/ecfg_discovery.rs index b306eb04..160c94dd 100644 --- a/Ficus/src/rust/ficus/tests/discovery/ecfg_discovery.rs +++ b/Ficus/src/rust/ficus/tests/discovery/ecfg_discovery.rs @@ -8,6 +8,7 @@ use ficus::{ utils::{references::HeapedOrOwned, user_data::user_data::UserDataImpl}, vecs, }; +use std::rc::Rc; use termgraph::{Config, DirectedGraph, ValueFormatter}; #[test] @@ -356,7 +357,7 @@ fn execute_ecfg_discovery_test(mut traces: Vec>, gold_root_sequence: let root_sequence = discover_root_sequence(&traces, root_sequence_kind); assert_eq!(root_sequence, gold_root_sequence); - let name_extractor = |s: &String| HeapedOrOwned::Owned(s.to_owned()); + let name_extractor = |s: &String| Rc::from(s.to_owned()); let to_node_data_transfer = |_: &String, _: &mut UserDataImpl, _| {}; let to_edge_data_transfer = |_: &String, _: &mut UserDataImpl| {}; @@ -384,12 +385,7 @@ fn execute_ecfg_discovery_test(mut traces: Vec>, gold_root_sequence: if test_result != gold { let mut tgraph = DirectedGraph::new(); - tgraph.add_nodes( - graph - .all_nodes() - .into_iter() - .map(|n| (*n.id(), n.data().unwrap().as_str().to_owned())), - ); + tgraph.add_nodes(graph.all_nodes().into_iter().map(|n| (*n.id(), n.data().unwrap().to_owned()))); tgraph.add_edges(graph.all_edges().into_iter().map(|e| (*e.from_node(), *e.to_node()))); let tconfig = Config::new(ValueFormatter::new(), 10).default_colors(); diff --git a/Ficus/src/rust/ficus/tests/discovery/multithreaded_dfg_tests.rs b/Ficus/src/rust/ficus/tests/discovery/multithreaded_dfg_tests.rs index 066cc672..416a21e6 100644 --- a/Ficus/src/rust/ficus/tests/discovery/multithreaded_dfg_tests.rs +++ b/Ficus/src/rust/ficus/tests/discovery/multithreaded_dfg_tests.rs @@ -71,8 +71,11 @@ fn create_multithreaded_event_log(raw_traces: Vec>>) -> XesEventLo let mut xes_trace = XesTraceImpl::empty(); for (thread, thread_index) in trace.iter().zip(0..trace.len()) { for event in thread { - let mut xes_event = XesEventImpl::new_with_max_date(event.to_string()); - xes_event.add_or_update_payload(TEST_THREAD_ID_ATTRIBUTE.to_string(), EventPayloadValue::Uint64(thread_index as u64)); + let mut xes_event = XesEventImpl::new_with_max_date(Rc::from(event.to_string())); + xes_event.add_or_update_payload( + Rc::from(TEST_THREAD_ID_ATTRIBUTE.to_string()), + EventPayloadValue::Uint64(thread_index as u64), + ); xes_trace.push(Rc::new(RefCell::new(xes_event))); } diff --git a/Ficus/src/rust/ficus/tests/mutations/mutations_tests.rs b/Ficus/src/rust/ficus/tests/mutations/mutations_tests.rs index 76210c0a..8234e18a 100644 --- a/Ficus/src/rust/ficus/tests/mutations/mutations_tests.rs +++ b/Ficus/src/rust/ficus/tests/mutations/mutations_tests.rs @@ -59,7 +59,7 @@ fn test_removing_events5() { #[test] fn test_renaming() { let mut log = create_simple_event_log(); - rename_events(&mut log, "D", |event| event.name() == "A"); + rename_events(&mut log, Rc::from("D"), |event| event.name() == "A"); assert_eq!(log.to_raw_vector(), vec![vec!["D", "B", "C"], vec!["D", "B", "C"]]) } @@ -67,7 +67,7 @@ fn test_renaming() { #[test] fn test_renaming2() { let mut log = create_simple_event_log2(); - rename_events(&mut log, "D", |_| true); + rename_events(&mut log, Rc::from("D"), |_| true); assert_eq!( log.to_raw_vector(), @@ -84,7 +84,7 @@ fn test_renaming2() { #[test] fn test_renaming2_no_change() { let mut log = create_simple_event_log2(); - rename_events(&mut log, "D", |_| false); + rename_events(&mut log, Rc::from("D"), |_| false); assert_eq!(log.to_raw_vector(), create_raw_event_log2()); } @@ -92,7 +92,7 @@ fn test_renaming2_no_change() { #[test] fn test_renaming3() { let mut log = create_simple_event_log3(); - rename_events(&mut log, "D", |event| event.name() == "E"); + rename_events(&mut log, Rc::from("D"), |event| event.name() == "E"); assert_eq!( log.to_raw_vector(), diff --git a/Ficus/src/rust/ficus/tests/other/test_simple_event_log.rs b/Ficus/src/rust/ficus/tests/other/test_simple_event_log.rs index d98967dd..170d99cd 100644 --- a/Ficus/src/rust/ficus/tests/other/test_simple_event_log.rs +++ b/Ficus/src/rust/ficus/tests/other/test_simple_event_log.rs @@ -5,6 +5,7 @@ use ficus::event_log::{ core::{event::event::Event, event_log::EventLog, trace::trace::Trace}, xes::{xes_event::XesEventImpl, xes_event_log::XesEventLogImpl}, }; +use std::rc::Rc; #[test] fn test_simple_event_log_creation() { @@ -16,9 +17,14 @@ fn test_simple_event_log_creation() { #[test] fn test_set_name() { let log = create_simple_event_log(); - let value = String::from_utf8("ASDASD".into()).ok().unwrap(); + let value = Rc::::from("ASDASD"); - execute_test_set_test(&log, &value, |event| event.name(), |event, value| event.set_name(value.to_owned())) + execute_test_set_test( + &log, + &value, + |event| event.name_pointer(), + |event, value| event.set_name(value.clone()), + ) } #[test] diff --git a/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs b/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs index be6eac76..e6897dea 100644 --- a/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs +++ b/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs @@ -19,8 +19,8 @@ use ficus::{ }, models::SoftwareData, }, - }, - utils::references::heaped, + } + , }; use std::{cell::RefCell, rc::Rc}; @@ -33,61 +33,43 @@ fn test_general_histogram() { create_event_with_attributes( "histogram_event".to_string(), vec![ - ( - "type".to_string(), - EventPayloadValue::String(Rc::new("type1".to_string())), - ), - ("count".to_string(), EventPayloadValue::Float64(123.)), + ("type".into(), EventPayloadValue::String(Rc::from("type1".to_string()))), + ("count".into(), EventPayloadValue::Float64(123.)), ], ), create_event_with_attributes( "histogram_event".to_string(), vec![ - ( - "type".to_string(), - EventPayloadValue::String(Rc::new("type2".to_string())), - ), - ("count".to_string(), EventPayloadValue::Float32(123.)), + ("type".into(), EventPayloadValue::String(Rc::from("type2".to_string()))), + ("count".into(), EventPayloadValue::Float32(123.)), ], ), create_event_with_attributes( "histogram_event".to_string(), vec![ - ( - "type".to_string(), - EventPayloadValue::String(Rc::new("type1".to_string())), - ), - ("count".to_string(), EventPayloadValue::Uint64(123)), + ("type".into(), EventPayloadValue::String(Rc::from("type1".to_string()))), + ("count".into(), EventPayloadValue::Uint64(123)), ], ), create_event_with_attributes( "unknown".to_string(), vec![ - ( - "type".to_string(), - EventPayloadValue::String(Rc::new("type1".to_string())), - ), - ("count".to_string(), EventPayloadValue::Uint32(123)), + ("type".into(), EventPayloadValue::String(Rc::from("type1".to_string()))), + ("count".into(), EventPayloadValue::Uint32(123)), ], ), create_event_with_attributes( "hst_event".to_string(), vec![ - ( - "type".to_string(), - EventPayloadValue::String(Rc::new("type1".to_string())), - ), - ("count".to_string(), EventPayloadValue::Int64(123)), + ("type".into(), EventPayloadValue::String(Rc::from("type1".to_string()))), + ("count".into(), EventPayloadValue::Int64(123)), ], ), create_event_with_attributes( "hst_event".to_string(), vec![ - ( - "type".to_string(), - EventPayloadValue::String(Rc::new("type2".to_string())), - ), - ("count".to_string(), EventPayloadValue::Int32(123)), + ("type".into(), EventPayloadValue::String(Rc::from("type2".to_string()))), + ("count".into(), EventPayloadValue::Int32(123)), ], ), ]; @@ -95,25 +77,25 @@ fn test_general_histogram() { let mut config = SoftwareDataExtractionConfig::empty(); config.set_pie_chart_extraction_configs(vec![ ExtractionConfig::new( - "histogram_event".to_string(), + "histogram_event".into(), PieChartExtractionConfig::new( - GenericExtractionConfigBase::new(heaped("g1".to_string()), heaped("units".to_string()), None), + GenericExtractionConfigBase::new("g1".into(), "units".into(), None), Some(NameCreationStrategy::SingleAttribute(SingleAttribute::new( - "type".to_string(), - heaped("xd".to_string()), + "type".into(), + "xd".into(), ))), - Some("count".to_string()), + Some("count".into()), ), ), ExtractionConfig::new( - "hst_event".to_string(), + "hst_event".into(), PieChartExtractionConfig::new( - GenericExtractionConfigBase::new(heaped("g2".to_string()), heaped("units".to_string()), None), + GenericExtractionConfigBase::new("g2".into(), "units".into(), None), Some(NameCreationStrategy::SingleAttribute(SingleAttribute::new( - "type".to_string(), - heaped("xd".to_string()), + "type".into(), + "xd".into(), ))), - Some("count".to_string()), + Some("count".into()), ), ), ]); @@ -142,61 +124,43 @@ fn test_simple_counter() { create_event_with_attributes( "histogram_event".to_string(), vec![ - ( - "type".to_string(), - EventPayloadValue::String(Rc::new("type1".to_string())), - ), - ("count".to_string(), EventPayloadValue::Float64(123.)), + ("type".into(), EventPayloadValue::String(Rc::from("type1".to_string()))), + ("count".into(), EventPayloadValue::Float64(123.)), ], ), create_event_with_attributes( "histogram_event".to_string(), vec![ - ( - "type".to_string(), - EventPayloadValue::String(Rc::new("type2".to_string())), - ), - ("count".to_string(), EventPayloadValue::Float32(123.)), + ("type".into(), EventPayloadValue::String(Rc::from("type2".to_string()))), + ("count".into(), EventPayloadValue::Float32(123.)), ], ), create_event_with_attributes( "histogram_event".to_string(), vec![ - ( - "type".to_string(), - EventPayloadValue::String(Rc::new("type1".to_string())), - ), - ("count".to_string(), EventPayloadValue::Uint64(123)), + ("type".into(), EventPayloadValue::String(Rc::from("type1".to_string()))), + ("count".into(), EventPayloadValue::Uint64(123)), ], ), create_event_with_attributes( "unknown".to_string(), vec![ - ( - "type".to_string(), - EventPayloadValue::String(Rc::new("type1".to_string())), - ), - ("count".to_string(), EventPayloadValue::Uint32(123)), + ("type".into(), EventPayloadValue::String(Rc::from("type1".to_string()))), + ("count".into(), EventPayloadValue::Uint32(123)), ], ), create_event_with_attributes( "hst_event".to_string(), vec![ - ( - "type".to_string(), - EventPayloadValue::String(Rc::new("type1".to_string())), - ), - ("count".to_string(), EventPayloadValue::Int64(123)), + ("type".into(), EventPayloadValue::String(Rc::from("type1".to_string()))), + ("count".into(), EventPayloadValue::Int64(123)), ], ), create_event_with_attributes( "hst_event".to_string(), vec![ - ( - "type".to_string(), - EventPayloadValue::String(Rc::new("type2".to_string())), - ), - ("count".to_string(), EventPayloadValue::Int32(123)), + ("type".into(), EventPayloadValue::String(Rc::from("type2".to_string()))), + ("count".into(), EventPayloadValue::Int32(123)), ], ), ]; @@ -204,17 +168,14 @@ fn test_simple_counter() { let mut config = SoftwareDataExtractionConfig::empty(); config.set_simple_counter_configs(vec![ ExtractionConfig::new( - "histogram_event".to_string(), - SimpleCountExtractionConfig::new( - GenericExtractionConfigBase::new(heaped("counter1".to_string()), heaped("units".to_string()), None), - None, - ), + "histogram_event".into(), + SimpleCountExtractionConfig::new(GenericExtractionConfigBase::new("counter1".into(), "units".into(), None), None), ), ExtractionConfig::new( - "hst_event".to_string(), + "hst_event".into(), SimpleCountExtractionConfig::new( - GenericExtractionConfigBase::new(heaped("counter2".to_string()), heaped("units".to_string()), None), - Some("count".to_string()), + GenericExtractionConfigBase::new("counter2".into(), "units".into(), None), + Some("count".into()), ), ), ]); @@ -237,39 +198,30 @@ fn test_activities_duration() { r#"[[{"activities_durations":[{"base":{"name":"activity","units":"units","group":null},"duration":300,"kind":"Unknown"}]},{"activities_durations":[{"base":{"name":"activity","units":"units","group":null},"duration":50,"kind":"Unknown"}]}]]"#, vec![vec![ vec![ - create_event_with_attributes("some_event".to_string(), vec![("stamp".to_string(), EventPayloadValue::Int64(50))]), - create_event_with_attributes("some_event".to_string(), vec![("stamp".to_string(), EventPayloadValue::Int64(250))]), + create_event_with_attributes("some_event".to_string(), vec![("stamp".into(), EventPayloadValue::Int64(50))]), + create_event_with_attributes("some_event".to_string(), vec![("stamp".into(), EventPayloadValue::Int64(250))]), ], vec![ create_event_with_attributes( "event_start".to_string(), vec![ - ( - "activity_id".to_string(), - EventPayloadValue::String(Rc::new("1".to_string())), - ), - ("stamp".to_string(), EventPayloadValue::Int64(100)), + ("activity_id".into(), EventPayloadValue::String(Rc::from("1".to_string()))), + ("stamp".into(), EventPayloadValue::Int64(100)), ], ), create_event_with_attributes( "event_end".to_string(), vec![ - ( - "activity_id".to_string(), - EventPayloadValue::String(Rc::new("1".to_string())), - ), - ("stamp".to_string(), EventPayloadValue::Int64(200)), + ("activity_id".into(), EventPayloadValue::String(Rc::from("1".to_string()))), + ("stamp".into(), EventPayloadValue::Int64(200)), ], ), ], vec![create_event_with_attributes( "event_end".to_string(), vec![ - ( - "activity_id".to_string(), - EventPayloadValue::String(Rc::new("2".to_string())), - ), - ("stamp".to_string(), EventPayloadValue::Int64(300)), + ("activity_id".into(), EventPayloadValue::String(Rc::from("2".to_string()))), + ("stamp".into(), EventPayloadValue::Int64(300)), ], )], ]], @@ -279,13 +231,13 @@ fn test_activities_duration() { fn execute_test_with_activities_durations(gold: &str, raw_event_groups: Vec>>>>) { let mut config = SoftwareDataExtractionConfig::empty(); config.set_activities_duration_configs(vec![ActivityDurationExtractionConfig::new( - GenericExtractionConfigBase::new(heaped("activity".to_string()), heaped("units".to_string()), None), - "event_start".to_string(), - "event_end".to_string(), - Some(TimeAttributeConfig::new("stamp".to_string(), TimeKind::Unknown)), + GenericExtractionConfigBase::new("activity".into(), "units".into(), None), + "event_start".into(), + "event_end".into(), + Some(TimeAttributeConfig::new("stamp".into(), TimeKind::Unknown)), Some(NameCreationStrategy::SingleAttribute(SingleAttribute::new( - "activity_id".to_string(), - heaped("xd".to_string()), + "activity_id".into(), + "xd".into(), ))), )]); @@ -325,30 +277,27 @@ fn test_activities_duration_2() { vec![ vec![ vec![ - create_event_with_attributes("some_event".to_string(), vec![("stamp".to_string(), EventPayloadValue::Int64(50))]), - create_event_with_attributes("some_event".to_string(), vec![("stamp".to_string(), EventPayloadValue::Int64(100))]), + create_event_with_attributes("some_event".to_string(), vec![("stamp".into(), EventPayloadValue::Int64(50))]), + create_event_with_attributes("some_event".to_string(), vec![("stamp".into(), EventPayloadValue::Int64(100))]), ], vec![create_event_with_attributes( "event_start".to_string(), vec![ - ( - "activity_id".to_string(), - EventPayloadValue::String(Rc::new("2".to_string())), - ), - ("stamp".to_string(), EventPayloadValue::Int64(50)), + ("activity_id".into(), EventPayloadValue::String("2".into())), + ("stamp".into(), EventPayloadValue::Int64(50)), ], )], vec![], ], vec![ vec![ - create_event_with_attributes("some_event".to_string(), vec![("stamp".to_string(), EventPayloadValue::Int64(100))]), - create_event_with_attributes("some_event".to_string(), vec![("stamp".to_string(), EventPayloadValue::Int64(200))]), + create_event_with_attributes("some_event".to_string(), vec![("stamp".into(), EventPayloadValue::Int64(100))]), + create_event_with_attributes("some_event".to_string(), vec![("stamp".into(), EventPayloadValue::Int64(200))]), ], vec![], vec![create_event_with_attributes( "some_event".to_string(), - vec![("stamp".to_string(), EventPayloadValue::Int64(500))], + vec![("stamp".into(), EventPayloadValue::Int64(500))], )], ], ], @@ -364,94 +313,58 @@ pub fn test_ocel_data_extraction() { create_event_with_attributes( "ocel_allocate".to_string(), vec![ - ( - "object_type".to_string(), - EventPayloadValue::String(Rc::new("type1".to_string())), - ), - ( - "object_id".to_string(), - EventPayloadValue::String(Rc::new("id_1".to_string())), - ), + ("object_type".into(), EventPayloadValue::String(Rc::from("type1".to_string()))), + ("object_id".into(), EventPayloadValue::String(Rc::from("id_1".to_string()))), ], ), create_event_with_attributes( "ocel_consume".to_string(), vec![ - ( - "object_type".to_string(), - EventPayloadValue::String(Rc::new("type1".to_string())), - ), - ( - "object_id".to_string(), - EventPayloadValue::String(Rc::new("id_2".to_string())), - ), + ("object_type".into(), EventPayloadValue::String(Rc::from("type1".to_string()))), + ("object_id".into(), EventPayloadValue::String(Rc::from("id_2".to_string()))), ], ), create_event_with_attributes( "ocel_allocate".to_string(), vec![ - ( - "object_type".to_string(), - EventPayloadValue::String(Rc::new("type1".to_string())), - ), - ( - "object_id".to_string(), - EventPayloadValue::String(Rc::new("id_3".to_string())), - ), + ("object_type".into(), EventPayloadValue::String(Rc::from("type1".to_string()))), + ("object_id".into(), EventPayloadValue::String(Rc::from("id_3".to_string()))), ], ), create_event_with_attributes( "unknown".to_string(), vec![ - ( - "object_type".to_string(), - EventPayloadValue::String(Rc::new("type1".to_string())), - ), - ( - "object_id".to_string(), - EventPayloadValue::String(Rc::new("id_2123123".to_string())), - ), + ("object_type".into(), EventPayloadValue::String(Rc::from("type1".to_string()))), + ("object_id".into(), EventPayloadValue::String(Rc::from("id_2123123".to_string()))), ], ), create_event_with_attributes( "ocel_consume_produce".to_string(), vec![ + ("object_type".into(), EventPayloadValue::String(Rc::from("type1".to_string()))), + ("object_id".into(), EventPayloadValue::String(Rc::from("id_2".to_string()))), ( - "object_type".to_string(), - EventPayloadValue::String(Rc::new("type1".to_string())), - ), - ( - "object_id".to_string(), - EventPayloadValue::String(Rc::new("id_2".to_string())), - ), - ( - "ocel_related_objects_ids".to_string(), - EventPayloadValue::String(Rc::new("1 2 3 4 5".to_string())), + "ocel_related_objects_ids".into(), + EventPayloadValue::String(Rc::from("1 2 3 4 5".to_string())), ), ( - "ocel_related_objects_types".to_string(), - EventPayloadValue::String(Rc::new("T1 T2 T3 T4 T5".to_string())), + "ocel_related_objects_types".into(), + EventPayloadValue::String(Rc::from("T1 T2 T3 T4 T5".to_string())), ), ], ), create_event_with_attributes( "ocel_allocate_merge".to_string(), vec![ + ("object_type".into(), EventPayloadValue::String(Rc::from("type1".to_string()))), + ("object_id".into(), EventPayloadValue::String(Rc::from("id_2".to_string()))), ( - "object_type".to_string(), - EventPayloadValue::String(Rc::new("type1".to_string())), - ), - ( - "object_id".to_string(), - EventPayloadValue::String(Rc::new("id_2".to_string())), - ), - ( - "ocel_action".to_string(), - EventPayloadValue::String(Rc::new("AllocateMerged".to_string())), + "ocel_action".into(), + EventPayloadValue::String(Rc::from("AllocateMerged".to_string())), ), ( - "ocel_related_objects_ids".to_string(), - EventPayloadValue::String(Rc::new("1 2 3 4 5".to_string())), + "ocel_related_objects_ids".into(), + EventPayloadValue::String(Rc::from("1 2 3 4 5".to_string())), ), ], ), @@ -459,7 +372,7 @@ pub fn test_ocel_data_extraction() { let mut config = SoftwareDataExtractionConfig::empty(); let object_id_attr = "object_id"; - let object_type_attr = SingleAttribute::new("object_type".to_string(), heaped("???".to_string())); + let object_type_attr = SingleAttribute::new("object_type".to_string().into(), "???".to_string().into()); let object_type_attr = NameCreationStrategy::SingleAttribute(object_type_attr); let base_conf = OcelObjectExtractionConfigBase::new(object_type_attr.to_owned(), object_id_attr.to_string()); let related_ids_attr = "ocel_related_objects_ids"; @@ -467,19 +380,15 @@ pub fn test_ocel_data_extraction() { config.set_ocel(Some(OcelUnitedExtractionConfig::new( Some(" ".to_string()), - Some(ExtractionConfig::new("ocel_allocate".to_string(), base_conf.to_owned())), - Some(ExtractionConfig::new("ocel_consume".to_string(), base_conf.to_owned())), + Some(ExtractionConfig::new("ocel_allocate".into(), base_conf.to_owned())), + Some(ExtractionConfig::new("ocel_consume".into(), base_conf.to_owned())), Some(ExtractionConfig::new( - "ocel_allocate_merge".to_string(), - OcelAllocateMergeExtractionConfig::new(base_conf.to_owned(), related_ids_attr.to_string()), + "ocel_allocate_merge".into(), + OcelAllocateMergeExtractionConfig::new(base_conf.to_owned(), related_ids_attr.into()), )), Some(ExtractionConfig::new( - "ocel_consume_produce".to_string(), - OcelConsumeProduceExtractionConfig::new( - object_id_attr.to_string(), - related_ids_attr.to_string(), - related_types_attr.to_string(), - ), + "ocel_consume_produce".into(), + OcelConsumeProduceExtractionConfig::new(object_id_attr.into(), related_ids_attr.into(), related_types_attr.into()), )), ))); @@ -492,9 +401,9 @@ pub fn test_ocel_data_extraction() { ) } -fn create_event_with_attributes(name: String, attributes: Vec<(String, EventPayloadValue)>) -> Rc> { +fn create_event_with_attributes(name: String, attributes: Vec<(Rc, EventPayloadValue)>) -> Rc> { Rc::new(RefCell::new(XesEventImpl::new_all_fields( - Rc::new(name), + name.into(), Utc::now(), Some(attributes.into_iter().collect()), ))) diff --git a/Ficus/src/rust/ficus_backend/src/grpc/converters.rs b/Ficus/src/rust/ficus_backend/src/grpc/converters.rs index c6e29029..1b70f4ca 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/converters.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/converters.rs @@ -204,7 +204,7 @@ pub(super) fn put_into_user_data( Some(stamp) => convert_timestamp_to_datetime(stamp), }; - let mut xes_event = XesEventImpl::new(event.name.to_owned(), date); + let mut xes_event = XesEventImpl::new(event.name.clone().into(), date); for attribute in &event.attributes { let payload_value = attribute .value @@ -212,7 +212,7 @@ pub(super) fn put_into_user_data( .map(convert_grpc_event_attribute_to_xes_event_payload_value); if let Some(xes_attribute) = payload_value { - xes_event.add_or_update_payload(attribute.key.clone(), xes_attribute) + xes_event.add_or_update_payload(attribute.key.clone().into(), xes_attribute) } } @@ -231,7 +231,7 @@ pub(super) fn put_into_user_data( fn convert_grpc_event_attribute_to_xes_event_payload_value(attribute_value: &grpc_event_attribute::Value) -> EventPayloadValue { match attribute_value { grpc_event_attribute::Value::Int(v) => EventPayloadValue::Int64(*v), - grpc_event_attribute::Value::String(v) => EventPayloadValue::String(Rc::new(v.to_owned())), + grpc_event_attribute::Value::String(v) => EventPayloadValue::String(v.to_owned().into()), grpc_event_attribute::Value::Bool(v) => EventPayloadValue::Boolean(*v), grpc_event_attribute::Value::Double(v) => EventPayloadValue::Float64(*v), grpc_event_attribute::Value::Guid(v) => EventPayloadValue::Guid(Uuid::parse_str(v.guid.as_str()).unwrap()), @@ -545,7 +545,7 @@ fn try_convert_to_grpc_colors_event_log(value: &dyn Any) -> Option>>) -> GrpcS payload .iter() .map(|(k, v)| GrpcEventAttribute { - key: k.to_owned(), + key: k.to_string(), value: convert_to_grpc_attribute_value(v), }) .collect() @@ -1031,7 +1031,7 @@ fn convert_to_grpc_simple_counter_data(data: &SimpleCounterData) -> GrpcSimpleCo } } -fn convert_to_grpc_histogram_entries(histogram: &HashMap, usize>) -> Vec { +fn convert_to_grpc_histogram_entries(histogram: &HashMap, usize>) -> Vec { histogram .iter() .map(|(key, value)| GrpcHistogramEntry { diff --git a/Ficus/src/rust/ficus_backend/src/grpc/events/kafka_events_handler.rs b/Ficus/src/rust/ficus_backend/src/grpc/events/kafka_events_handler.rs index 00273ffd..34faf7d0 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/events/kafka_events_handler.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/events/kafka_events_handler.rs @@ -13,6 +13,7 @@ use rdkafka::{ util::Timeout, ClientConfig, }; +use std::rc::Rc; use uuid::Uuid; pub struct PipelineEventsProducer { @@ -118,34 +119,34 @@ impl GetContextValuesEvent<'_> { pub struct ProcessCaseMetadata { pub case_name: CaseName, - pub process_name: String, + pub process_name: Rc, pub subscription_id: Option, - pub subscription_name: Option, + pub subscription_name: Option>, pub pipeline_id: Option, - pub pipeline_name: Option, - pub metadata: Vec<(String, String)>, + pub pipeline_name: Option>, + pub metadata: Vec<(Rc, Rc)>, } impl ProcessCaseMetadata { fn to_grpc_process_case_metadata(&self) -> GrpcProcessCaseMetadata { GrpcProcessCaseMetadata { case_name: Some(GrpcCaseName { - display_name: self.case_name.display_name.clone(), - full_name_parts: self.case_name.name_parts.clone(), + display_name: self.case_name.display_name.to_string(), + full_name_parts: self.case_name.name_parts.iter().map(|p| p.to_string()).collect(), }), - process_name: self.process_name.clone(), + process_name: self.process_name.to_string(), subscription_id: self.subscription_id.map(GrpcGuid::from), - subscription_name: self.subscription_name.clone().map_or("".to_string(), |name| name), + subscription_name: self.subscription_name.clone().map_or("".to_string(), |name| name.to_string()), pipeline_id: self.pipeline_id.map(GrpcGuid::from), - pipeline_name: self.pipeline_name.clone().map_or("".to_string(), |name| name), + pipeline_name: self.pipeline_name.clone().map_or("".to_string(), |name| name.to_string()), metadata: self .metadata .iter() .map(|pair| GrpcStringKeyValue { - key: pair.0.clone(), - value: pair.1.clone(), + key: pair.0.to_string(), + value: pair.1.to_string(), }) .collect(), } diff --git a/Ficus/src/rust/ficus_backend/src/grpc/get_context_pipeline.rs b/Ficus/src/rust/ficus_backend/src/grpc/get_context_pipeline.rs index 1cf07297..a157899e 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/get_context_pipeline.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/get_context_pipeline.rs @@ -83,7 +83,7 @@ impl GetContextValuePipelinePart { fn create_process_case_metadata(context: &PipelineContext) -> ProcessCaseMetadata { let case_name = Self::value_or_default(context, &CASE_NAME_KEY, CaseName::empty); - let process_name = Self::value_or_default(context, &PROCESS_NAME_KEY, || "UNDEFINED_PROCESS".to_string()); + let process_name = Self::value_or_default(context, &PROCESS_NAME_KEY, || "UNDEFINED_PROCESS".into()); let subscription_id = Self::value_or_none(context, &SUBSCRIPTION_ID_KEY); let subscription_name = Self::value_or_none(context, &SUBSCRIPTION_NAME_KEY); @@ -91,7 +91,7 @@ impl GetContextValuePipelinePart { let pipeline_id = Self::value_or_none(context, &PIPELINE_ID_KEY); let pipeline_name = Self::value_or_none(context, &PIPELINE_NAME_KEY); - let metadata = Self::value_or_default(context, &UNSTRUCTURED_METADATA_KEY, std::vec::Vec::new); + let metadata = Self::value_or_default(context, &UNSTRUCTURED_METADATA_KEY, Vec::new); ProcessCaseMetadata { process_name, diff --git a/Ficus/src/rust/ficus_backend/src/grpc/kafka/grpc_kafka_service.rs b/Ficus/src/rust/ficus_backend/src/grpc/kafka/grpc_kafka_service.rs index 6ac27912..27a7a995 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/kafka/grpc_kafka_service.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/kafka/grpc_kafka_service.rs @@ -25,7 +25,7 @@ use ficus::{ utils::user_data::user_data::UserData, }; use futures::Stream; -use std::{pin::Pin, sync::Arc}; +use std::{pin::Pin, rc::Rc, sync::Arc}; use tokio::sync::mpsc; use tokio_stream::wrappers::ReceiverStream; use tonic::{Request, Response, Status}; @@ -154,7 +154,7 @@ impl GrpcKafkaService for GrpcKafkaServiceImpl { .map(|(id, s)| GrpcKafkaSubscription { id: Some(GrpcGuid::from(id)), metadata: Some(GrpcKafkaSubscriptionMetadata { - subscription_name: s.name(), + subscription_name: s.name().to_owned(), }), pipelines: s .pipelines() @@ -209,7 +209,7 @@ impl GrpcKafkaService for GrpcKafkaServiceImpl { let request = request.get_ref(); let case_info = request.case_info.as_ref().expect("Case info must be supplied"); - let case_name = case_info.case_name.clone(); + let case_name: Rc = case_info.case_name.clone().into(); let process_name = case_info.process_name.clone(); let pipeline_id = Uuid::parse_str(request.pipeline_id.as_ref().expect("Must be supplied").guid.as_str()); let subscription_id = Uuid::parse_str(request.subscription_id.as_ref().expect("Must be supplied").guid.as_str()); @@ -221,15 +221,15 @@ impl GrpcKafkaService for GrpcKafkaServiceImpl { let execution_result = context.execute_grpc_pipeline(move |context| { context.put_concrete(SUBSCRIPTION_ID_KEY.key(), subscription_id.unwrap()); context.put_concrete(PIPELINE_ID_KEY.key(), pipeline_id.unwrap()); - context.put_concrete(SUBSCRIPTION_NAME_KEY.key(), subscription_name); - context.put_concrete(PIPELINE_NAME_KEY.key(), pipeline_name); + context.put_concrete(SUBSCRIPTION_NAME_KEY.key(), subscription_name.into()); + context.put_concrete(PIPELINE_NAME_KEY.key(), pipeline_name.into()); - context.put_concrete(PROCESS_NAME_KEY.key(), process_name); + context.put_concrete(PROCESS_NAME_KEY.key(), process_name.into()); context.put_concrete( CASE_NAME_KEY.key(), CaseName { - display_name: case_name.to_string(), - name_parts: vec![case_name.to_string()], + display_name: case_name.clone(), + name_parts: vec![case_name], }, ); diff --git a/Ficus/src/rust/ficus_backend/src/grpc/kafka/kafka_service.rs b/Ficus/src/rust/ficus_backend/src/grpc/kafka/kafka_service.rs index 5f5f310d..d1d39deb 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/kafka/kafka_service.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/kafka/kafka_service.rs @@ -33,6 +33,7 @@ use log::error; use rdkafka::{error::KafkaError, ClientConfig}; use std::{ collections::HashMap, + rc::Rc, sync::{Arc, Mutex}, }; use tonic::Status; @@ -65,20 +66,20 @@ impl KafkaSubscriptionPipeline { #[derive(Clone)] pub struct KafkaSubscription { - name: String, + name: Arc, pipelines: HashMap, } impl KafkaSubscription { - fn new(name: String) -> Self { + fn new(name: Arc) -> Self { Self { name, pipelines: HashMap::new(), } } - pub fn name(&self) -> String { - self.name.clone() + pub fn name(&self) -> &str { + self.name.as_ref() } pub fn pipelines(&self) -> Vec<(Uuid, KafkaSubscriptionPipeline)> { self.pipelines.iter().map(|p| (*p.0, p.1.clone())).collect() @@ -124,7 +125,7 @@ impl KafkaService { impl KafkaService { pub(super) fn subscribe_to_kafka_topic(&self, request: GrpcSubscribeToKafkaRequest) -> Result { let name = request.subscription_metadata.as_ref().unwrap().subscription_name.clone(); - let creation_dto = self.create_kafka_creation_dto(name); + let creation_dto = self.create_kafka_creation_dto(name.into()); let id = creation_dto.uuid; match Self::spawn_consumer(request, creation_dto) { @@ -145,7 +146,7 @@ impl KafkaService { match consumer.subscribe() { Ok(_) => { let mut map = dto.subscriptions_to_execution_requests.lock().expect("Must acquire lock"); - map.insert(dto.uuid, KafkaSubscription::new(dto.name.clone())); + map.insert(dto.uuid, KafkaSubscription::new(dto.name.clone().into())); } Err(err) => { return match err { @@ -252,8 +253,8 @@ impl KafkaService { context.put_concrete(SUBSCRIPTION_ID_KEY.key(), dto.uuid); context.put_concrete(PIPELINE_ID_KEY.key(), *pipeline_id); - context.put_concrete(SUBSCRIPTION_NAME_KEY.key(), dto.name.clone()); - context.put_concrete(PIPELINE_NAME_KEY.key(), pipeline.name.clone()); + context.put_concrete(SUBSCRIPTION_NAME_KEY.key(), dto.name.as_ref().into()); + context.put_concrete(PIPELINE_NAME_KEY.key(), pipeline.name.clone().into()); Ok(()) }); @@ -325,7 +326,7 @@ impl KafkaService { } impl KafkaService { - fn create_kafka_creation_dto(&self, name: String) -> KafkaConsumerCreationDto { + fn create_kafka_creation_dto(&self, name: Arc) -> KafkaConsumerCreationDto { KafkaConsumerCreationDto::new(name, self.subscriptions_to_execution_requests.clone()) } diff --git a/Ficus/src/rust/ficus_backend/src/grpc/kafka/models.rs b/Ficus/src/rust/ficus_backend/src/grpc/kafka/models.rs index b08a8751..ed04441f 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/kafka/models.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/kafka/models.rs @@ -10,6 +10,7 @@ use std::{ fmt::{Debug, Display, Formatter}, sync::{Arc, Mutex}, }; +use std::rc::Rc; use uuid::Uuid; pub(super) const KAFKA_CASE_DISPLAY_NAME: &str = "case_display_name"; @@ -77,13 +78,13 @@ impl PipelineExecutionDto { #[derive(Clone)] pub struct KafkaConsumerCreationDto { pub uuid: Uuid, - pub name: String, + pub name: Arc, pub subscriptions_to_execution_requests: Arc>>, pub logger: ConsoleLogMessageHandler, } impl KafkaConsumerCreationDto { - pub fn new(name: String, subscriptions_to_execution_requests: Arc>>) -> Self { + pub fn new(name: Arc, subscriptions_to_execution_requests: Arc>>) -> Self { Self { uuid: Uuid::new_v4(), name, diff --git a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/processors.rs b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/processors.rs index 5e77b113..b1046148 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/processors.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/processors.rs @@ -45,11 +45,11 @@ impl TracesProcessor { } pub(in crate::grpc::kafka::streaming) struct ProcessMetadata { - pub process_name: String, + pub process_name: Rc, } impl ProcessMetadata { - pub fn create_from(metadata: &HashMap>) -> Result { + pub fn create_from(metadata: &HashMap, Rc>) -> Result { let process_name = string_value_or_err(metadata, KAFKA_PROCESS_NAME)?; Ok(Self { process_name }) @@ -58,19 +58,19 @@ impl ProcessMetadata { pub(in crate::grpc::kafka::streaming) struct CaseMetadata { pub case_id: Uuid, - pub case_display_name: String, - pub case_name_parts: Vec, - pub case_name_parts_joined: String, + pub case_display_name: Rc, + pub case_name_parts: Vec>, + pub case_name_parts_joined: Rc, } impl CaseMetadata { - pub fn create_from(metadata: &HashMap>) -> Result { + pub fn create_from(metadata: &HashMap, Rc>) -> Result { let case_id = uuid_or_err(metadata, KAFKA_CASE_ID)?; let case_name_parts_joined = string_value_or_err(metadata, KAFKA_CASE_NAME_PARTS)?; let case_display_name = string_value_or_err(metadata, KAFKA_CASE_DISPLAY_NAME)?; - let case_name_parts: Vec = case_name_parts_joined + let case_name_parts: Vec> = case_name_parts_joined .split(KAFKA_CASE_NAME_PARTS_SEPARATOR) - .map(|s| s.to_string()) + .map(|s| s.to_string().into()) .collect(); Ok(Self { @@ -85,11 +85,11 @@ impl CaseMetadata { pub(in crate::grpc::kafka::streaming) struct ExtractedTraceMetadata { pub process: ProcessMetadata, pub case: CaseMetadata, - pub unstructured_metadata: Vec<(String, String)>, + pub unstructured_metadata: Vec<(Rc, Rc)>, } impl ExtractedTraceMetadata { - pub fn create_from(metadata: &HashMap>) -> Result { + pub fn create_from(metadata: &HashMap, Rc>) -> Result { Ok(ExtractedTraceMetadata { process: ProcessMetadata::create_from(metadata)?, case: CaseMetadata::create_from(metadata)?, @@ -99,12 +99,12 @@ impl ExtractedTraceMetadata { } fn add_system_metadata( - metadata: &HashMap>, + metadata: &HashMap, Rc>, context: &mut PipelineContext, ) -> Result<(), XesFromBxesKafkaTraceCreatingError> { let metadata = ExtractedTraceMetadata::create_from(metadata)?; - context.put_concrete(PROCESS_NAME_KEY.key(), metadata.process.process_name); + context.put_concrete(PROCESS_NAME_KEY.key(), metadata.process.process_name.into()); context.put_concrete(UNSTRUCTURED_METADATA_KEY.key(), metadata.unstructured_metadata); context.put_concrete( CASE_NAME_KEY.key(), @@ -118,20 +118,20 @@ fn add_system_metadata( } pub(in crate::grpc::kafka::streaming) fn string_value_or_err( - metadata: &HashMap>, + metadata: &HashMap, Rc>, key_name: &str, -) -> Result { +) -> Result, XesFromBxesKafkaTraceCreatingError> { let value = value_or_err(metadata, key_name)?; if let BxesValue::String(process_name) = value.as_ref() { - Ok(process_name.as_ref().to_owned()) + Ok(process_name.clone()) } else { Err(XesFromBxesKafkaTraceCreatingError::MetadataValueIsNotAString(key_name.to_string())) } } pub(in crate::grpc::kafka::streaming) fn value_or_err( - metadata: &HashMap>, + metadata: &HashMap, Rc>, key: &str, ) -> Result, XesFromBxesKafkaTraceCreatingError> { if let Some(value) = metadata.get(key) { @@ -142,7 +142,7 @@ pub(in crate::grpc::kafka::streaming) fn value_or_err( } pub(in crate::grpc::kafka::streaming) fn uuid_or_err( - metadata: &HashMap>, + metadata: &HashMap, Rc>, key: &str, ) -> Result { let value = value_or_err(metadata, key)?; @@ -154,15 +154,15 @@ pub(in crate::grpc::kafka::streaming) fn uuid_or_err( } pub(in crate::grpc::kafka::streaming) fn metadata_to_string_string_pairs( - metadata: &HashMap>, -) -> Vec<(String, String)> { + metadata: &HashMap, Rc>, +) -> Vec<(Rc, Rc)> { metadata .iter() .filter_map(|pair| { - if pair.0 == KAFKA_CASE_NAME_PARTS || pair.0 == KAFKA_CASE_DISPLAY_NAME || pair.0 == KAFKA_PROCESS_NAME { + if pair.0.as_ref() == KAFKA_CASE_NAME_PARTS || pair.0.as_ref() == KAFKA_CASE_DISPLAY_NAME || pair.0.as_ref() == KAFKA_PROCESS_NAME { None } else if let BxesValue::String(value) = pair.1.as_ref() { - Some((pair.0.to_owned(), value.as_ref().to_owned())) + Some((pair.0.to_owned(), value.clone())) } else { None } diff --git a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t1/processors.rs b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t1/processors.rs index 1b5b266d..7564d195 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t1/processors.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t1/processors.rs @@ -65,7 +65,7 @@ impl T1StreamingProcessor { let case_id = uuid_or_err(trace.metadata(), KAFKA_CASE_ID)?; let case_name_parts_joined = string_value_or_err(trace.metadata(), KAFKA_CASE_NAME_PARTS)?; - self.get_or_create_event_log(trace, case_id, case_name_parts_joined.as_str()) + self.get_or_create_event_log(trace, case_id, case_name_parts_joined.as_ref()) } fn get_or_create_event_log( diff --git a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t2/dfg_data_structures.rs b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t2/dfg_data_structures.rs index ec682f94..3ec61f65 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t2/dfg_data_structures.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t2/dfg_data_structures.rs @@ -41,16 +41,16 @@ impl StreamingCounterFactory { #[derive(Clone)] struct DfgDataStructureBase { factory: StreamingCounterFactory, - processes_dfg: HashMap>>>, - traces_last_event_classes: Rc>>, - event_classes_count: HashMap>>>, + processes_dfg: HashMap, Rc, Rc), ()>>>>, + traces_last_event_classes: Rc>>>, + event_classes_count: HashMap, Rc, ()>>>>, } unsafe impl Send for DfgDataStructureBase {} unsafe impl Sync for DfgDataStructureBase {} impl DfgDataStructureBase { - pub fn observe_dfg_relation(&mut self, process_name: &str, relation: (String, String)) { + pub fn observe_dfg_relation(&mut self, process_name: &Rc, relation: (Rc, Rc)) { debug!( "Observing relation, process: {}, relation: ({}, {})", process_name, &relation.0, &relation.1 @@ -64,7 +64,7 @@ impl DfgDataStructureBase { .observe(relation, ValueUpdateKind::DoNothing); } - pub fn observe_event_class(&mut self, process_name: &str, event_class: String) { + pub fn observe_event_class(&mut self, process_name: &Rc, event_class: Rc) { debug!("Observing event class, process: {}, event class: {}", process_name, event_class); self @@ -75,11 +75,11 @@ impl DfgDataStructureBase { .observe(event_class, ValueUpdateKind::DoNothing); } - pub fn observe_last_trace_class(&self, case_id: Uuid, last_class: String) { + pub fn observe_last_trace_class(&self, case_id: Uuid, last_class: Rc) { debug!( "Observing last trace class, case id: {}, last class: {}", &case_id, - last_class.as_str() + last_class.as_ref() ); self @@ -88,15 +88,15 @@ impl DfgDataStructureBase { .observe(case_id, ValueUpdateKind::Replace(last_class)) } - pub fn last_seen_event_class(&self, case_id: &Uuid) -> Option { + pub fn last_seen_event_class(&self, case_id: &Uuid) -> Option> { self .traces_last_event_classes .borrow() .get(case_id) - .map(|value| value.value().unwrap().to_owned()) + .map(|value| value.value().unwrap().clone()) } - pub fn to_event_log_info(&self, process_name: &str) -> Option { + pub fn to_event_log_info(&self, process_name: &Rc) -> Option { let event_classes_count = match self.event_classes_count.get(process_name) { None => return None, Some(classes) => classes.borrow().to_freq_count_map().into_iter().map(|(k, v)| (k, v.1)).collect(), @@ -164,7 +164,7 @@ impl DfgDataStructures { impl DfgDataStructures { pub fn process_bxes_trace( &mut self, - metadata: &HashMap>, + metadata: &HashMap, Rc>, xes_trace: &XesTraceImpl, context: &mut PipelineContext, ) -> Result<(), XesFromBxesKafkaTraceCreatingError> { @@ -174,27 +174,29 @@ impl DfgDataStructures { let process_metadata = ProcessMetadata::create_from(metadata)?; let case_metadata = CaseMetadata::create_from(metadata)?; - let process_name = process_metadata.process_name.as_str(); + let process_name = &process_metadata.process_name; for i in 0..(xes_trace.events().len() - 1) { - let first_name = xes_trace.events().get(i).unwrap().borrow().name().to_owned(); - let second_name = xes_trace.events().get(i + 1).unwrap().borrow().name().to_owned(); + let first_name = xes_trace.events().get(i).unwrap().borrow().name_pointer().clone(); + let second_name = xes_trace.events().get(i + 1).unwrap().borrow().name_pointer().clone(); - self.base.observe_dfg_relation(process_name, (first_name.clone(), second_name)); - self.base.observe_event_class(process_name, first_name); + self + .base + .observe_dfg_relation(process_name, (first_name.clone(), second_name.clone())); + self.base.observe_event_class(process_name, first_name.clone()); } if let Some(last_seen_class) = self.base.last_seen_event_class(&case_metadata.case_id) { - let first_class = xes_trace.events().first().unwrap().borrow().name().to_owned(); - self.base.observe_dfg_relation(process_name, (last_seen_class, first_class)); + let first_class = xes_trace.events().first().unwrap().borrow().name_pointer().clone(); + self.base.observe_dfg_relation(process_name, (last_seen_class, first_class.clone())); } - let new_trace_last_class = xes_trace.events().last().unwrap().borrow().name().to_owned(); + let new_trace_last_class = xes_trace.events().last().unwrap().borrow().name_pointer().clone(); self.base.observe_event_class(process_name, new_trace_last_class.clone()); self .base - .observe_last_trace_class(case_metadata.case_id.to_owned(), new_trace_last_class); + .observe_last_trace_class(case_metadata.case_id.to_owned(), new_trace_last_class.clone()); match self.base.to_event_log_info(process_name) { None => { From 530201a803a63efe01a8ca1211158e753700cd8d Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sun, 1 Mar 2026 19:28:27 +0300 Subject: [PATCH 13/30] Apply cargo clippy fixes --- .../src/event_log/bxes/xes_to_bxes_converter.rs | 14 +++++++------- .../rust/ficus/src/event_log/core/event/event.rs | 1 - .../src/rust/ficus/src/event_log/xes/xes_event.rs | 4 ++-- .../features/analysis/directly_follows_graph.rs | 7 ++----- .../features/analysis/log_info/event_log_info.rs | 4 ++-- .../analysis/patterns/activity_instances.rs | 1 - .../ficus/src/features/discovery/alpha/alpha.rs | 1 - .../alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs | 2 +- .../src/features/discovery/alpha/alpha_sharp.rs | 1 - .../src/features/discovery/ecfg/adjustments.rs | 1 - .../ficus/src/features/discovery/ecfg/discovery.rs | 1 - .../discovery/fuzzy/fuzzy_metrics_provider.rs | 1 - .../features/discovery/multithreaded_dfg/dfg.rs | 1 - .../features/discovery/ocel/graph_annotation.rs | 2 +- .../features/discovery/petri_net/annotations.rs | 1 - .../src/features/discovery/timeline/discovery.rs | 2 +- .../extractors/activities_durations.rs | 2 +- .../software_data/extractors/event_classes.rs | 3 +-- .../software_data/extractors/pie_charts.rs | 1 - .../discovery/timeline/software_data/models.rs | 5 +---- .../src/rust/ficus/src/pipelines/multithreading.rs | 2 +- .../ficus/src/utils/graph/graph_conversions.rs | 7 ++----- .../src/rust/ficus_backend/src/grpc/converters.rs | 1 - .../ficus_backend/src/grpc/kafka/kafka_service.rs | 3 +-- .../rust/ficus_backend/src/grpc/kafka/models.rs | 1 - .../src/grpc/kafka/streaming/processors.rs | 2 +- 26 files changed, 24 insertions(+), 47 deletions(-) diff --git a/Ficus/src/rust/ficus/src/event_log/bxes/xes_to_bxes_converter.rs b/Ficus/src/rust/ficus/src/event_log/bxes/xes_to_bxes_converter.rs index ab253e78..594a29ba 100644 --- a/Ficus/src/rust/ficus/src/event_log/bxes/xes_to_bxes_converter.rs +++ b/Ficus/src/rust/ficus/src/event_log/bxes/xes_to_bxes_converter.rs @@ -128,8 +128,8 @@ fn create_bxes_classifiers(log: &XesEventLogImpl) -> Vec { .classifiers() .iter() .map(|c| BxesClassifier { - keys: c.keys.iter().map(|x| Rc::new(BxesValue::String(Rc::from(x.to_owned())))).collect(), - name: Rc::new(BxesValue::String(Rc::from(c.name.to_owned()))), + keys: c.keys.iter().map(|x| Rc::new(BxesValue::String(x.to_owned()))).collect(), + name: Rc::new(BxesValue::String(c.name.to_owned())), }) .collect() } @@ -140,9 +140,9 @@ fn create_bxes_extensions(log: &XesEventLogImpl) -> Vec { fn convert_to_bxes_extension(e: &XesEventLogExtension) -> BxesExtension { BxesExtension { - name: Rc::new(BxesValue::String(Rc::from(e.name.to_owned()))), - prefix: Rc::new(BxesValue::String(Rc::from(e.prefix.to_owned()))), - uri: Rc::new(BxesValue::String(Rc::from(e.uri.to_owned()))), + name: Rc::new(BxesValue::String(e.name.to_owned())), + prefix: Rc::new(BxesValue::String(e.prefix.to_owned())), + uri: Rc::new(BxesValue::String(e.uri.to_owned())), } } @@ -159,7 +159,7 @@ fn create_bxes_globals(log: &XesEventLogImpl) -> Result, XesToBx } fn convert_to_bxes_global_attribute(kv: &(&Rc, &EventPayloadValue)) -> (Rc, Rc) { - let key = Rc::new(BxesValue::String(Rc::from(kv.0.to_owned()))); + let key = Rc::new(BxesValue::String(kv.0.to_owned())); let value = Rc::new(payload_value_to_bxes_value(kv.1)); (key, value) @@ -175,7 +175,7 @@ fn create_bxes_properties(log: &XesEventLogImpl) -> Vec<(Rc, Rc, &EventPayloadValue)) -> (Rc, Rc) { let bxes_value = payload_value_to_bxes_value(kv.1); - let key = Rc::new(BxesValue::String(Rc::from(kv.0.to_owned()))); + let key = Rc::new(BxesValue::String(kv.0.to_owned())); (key, Rc::new(bxes_value)) } diff --git a/Ficus/src/rust/ficus/src/event_log/core/event/event.rs b/Ficus/src/rust/ficus/src/event_log/core/event/event.rs index b788eece..a376099c 100644 --- a/Ficus/src/rust/ficus/src/event_log/core/event/event.rs +++ b/Ficus/src/rust/ficus/src/event_log/core/event/event.rs @@ -1,7 +1,6 @@ use crate::utils::user_data::user_data::UserDataOwner; use super::lifecycle::xes_lifecycle::Lifecycle; -use crate::utils::references::HeapedOrOwned; use chrono::{DateTime, Utc}; use std::{collections::HashMap, fmt::Debug, rc::Rc}; diff --git a/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs b/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs index f1e0e87d..ec4b556a 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs @@ -55,7 +55,7 @@ impl UserDataOwner for XesEventImpl { impl Event for XesEventImpl { fn new(name: Rc, timestamp: DateTime) -> Self { Self { - event_base: EventBase::new(Rc::from(name), timestamp), + event_base: EventBase::new(name, timestamp), payload: None, } } @@ -103,7 +103,7 @@ impl Event for XesEventImpl { } fn set_name(&mut self, new_name: Rc) { - self.event_base.name = Rc::from(new_name); + self.event_base.name = new_name; } fn set_timestamp(&mut self, new_timestamp: DateTime) { diff --git a/Ficus/src/rust/ficus/src/features/analysis/directly_follows_graph.rs b/Ficus/src/rust/ficus/src/features/analysis/directly_follows_graph.rs index 4c7fcce1..af35dacd 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/directly_follows_graph.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/directly_follows_graph.rs @@ -4,10 +4,7 @@ use crate::{ xes::xes_event_log::XesEventLogImpl, }, features::analysis::log_info::event_log_info::EventLogInfo, - utils::{ - graph::graph::{DefaultGraph, Graph, NodesConnectionData}, - references::HeapedOrOwned, - }, + utils::graph::graph::{DefaultGraph, Graph, NodesConnectionData}, }; use log::warn; use std::collections::HashMap; @@ -18,7 +15,7 @@ pub fn construct_dfg(info: &dyn EventLogInfo) -> DefaultGraph { let mut classes_to_node_ids = HashMap::new(); for class in info.all_event_classes() { - let node_data = Some(Rc::from(class.to_owned())); + let node_data = Some(class.to_owned()); classes_to_node_ids.insert(class, graph.add_node(node_data)); } diff --git a/Ficus/src/rust/ficus/src/features/analysis/log_info/event_log_info.rs b/Ficus/src/rust/ficus/src/features/analysis/log_info/event_log_info.rs index 4778edaa..074074f2 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/log_info/event_log_info.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/log_info/event_log_info.rs @@ -149,7 +149,7 @@ impl OfflineEventLogInfo { continue; } - update_events_counts(¤t_name); + update_events_counts(current_name); if prev_event_name.is_none() { prev_event_name = Some(current_name.to_owned()); @@ -161,7 +161,7 @@ impl OfflineEventLogInfo { } let prev_name = prev_event_name.unwrap(); - update_pairs_count(&prev_name, ¤t_name); + update_pairs_count(&prev_name, current_name); prev_event_name = Some(event.name_pointer().clone()); } diff --git a/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs b/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs index 97521f75..12bb7411 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs @@ -18,7 +18,6 @@ use fancy_regex::Regex; use getset::{Getters, MutGetters}; use lazy_static::lazy_static; use std::{ - borrow::ToOwned, cell::RefCell, collections::{HashMap, HashSet, VecDeque}, ops::DerefMut, diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha.rs index 8e288bc4..8702d1ca 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha.rs @@ -20,7 +20,6 @@ use crate::{ utils::user_data::user_data::UserData, }; use lazy_static::lazy_static; -use once_cell::sync::Lazy; use std::{ collections::{HashMap, HashSet}, rc::Rc, diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs index 8c994195..0bf33c5f 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs @@ -294,7 +294,7 @@ fn construct_w3_transitive_closure_cache<'a>(w3_relations: &'a HashSet<(&'a str, } fn eliminate_w3_relations_by_rule_2(w3_relations: &mut HashSet<(&str, &str)>) { - let closure_cache = construct_w3_transitive_closure_cache(&w3_relations); + let closure_cache = construct_w3_transitive_closure_cache(w3_relations); let mut to_remove = HashSet::new(); for relation in w3_relations.iter() { diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_sharp.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_sharp.rs index 4d6b24a5..8377799a 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_sharp.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_sharp.rs @@ -21,7 +21,6 @@ use std::{ collections::{BTreeSet, HashSet}, fmt::Display, hash::{Hash, Hasher}, - rc::Rc, }; type AlphaSharpSet<'a> = BTreeSet<(BTreeSet<&'a str>, BTreeSet<&'a str>)>; diff --git a/Ficus/src/rust/ficus/src/features/discovery/ecfg/adjustments.rs b/Ficus/src/rust/ficus/src/features/discovery/ecfg/adjustments.rs index d069fcea..e0048c47 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ecfg/adjustments.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ecfg/adjustments.rs @@ -14,7 +14,6 @@ use crate::{ utils::{ context_key::DefaultContextKey, graph::graph::{DefaultGraph, NodesConnectionData}, - references::HeapedOrOwned, user_data::user_data::UserData, }, }; diff --git a/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery.rs b/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery.rs index 30769652..9ee34639 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery.rs @@ -16,7 +16,6 @@ use crate::{ graphs_merging::{END_NODE_ID_KEY, START_NODE_ID_KEY}, }, lcs::find_longest_common_subsequence, - references::HeapedOrOwned, user_data::user_data::UserData, }, }; diff --git a/Ficus/src/rust/ficus/src/features/discovery/fuzzy/fuzzy_metrics_provider.rs b/Ficus/src/rust/ficus/src/features/discovery/fuzzy/fuzzy_metrics_provider.rs index bf1c2404..cef8b036 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/fuzzy/fuzzy_metrics_provider.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/fuzzy/fuzzy_metrics_provider.rs @@ -6,7 +6,6 @@ use crate::{ discovery::alpha::providers::relations_cache::RelationsCaches, }, }; -use std::rc::Rc; const PROXIMITY_CORRELATION: &str = "ProximityCorrelation"; diff --git a/Ficus/src/rust/ficus/src/features/discovery/multithreaded_dfg/dfg.rs b/Ficus/src/rust/ficus/src/features/discovery/multithreaded_dfg/dfg.rs index 5b518ca8..b335a73d 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/multithreaded_dfg/dfg.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/multithreaded_dfg/dfg.rs @@ -9,7 +9,6 @@ use crate::{ }, utils::{ graph::graph::{DefaultGraph, NodesConnectionData}, - references::HeapedOrOwned, user_data::user_data::UserData, }, }; diff --git a/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs b/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs index 5a432e38..26a492be 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs @@ -1,6 +1,6 @@ use crate::{ features::discovery::{ecfg::context_keys::EDGE_SOFTWARE_DATA_KEY, timeline::software_data::models::OcelObjectAction}, - utils::{graph::graph::DefaultGraph, references::HeapedOrOwned, user_data::user_data::UserData}, + utils::{graph::graph::DefaultGraph, user_data::user_data::UserData}, }; use derive_new::new; use enum_display::EnumDisplay; diff --git a/Ficus/src/rust/ficus/src/features/discovery/petri_net/annotations.rs b/Ficus/src/rust/ficus/src/features/discovery/petri_net/annotations.rs index bc7d7963..4e627e81 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/petri_net/annotations.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/petri_net/annotations.rs @@ -4,7 +4,6 @@ use crate::{ event_log::core::{event::event::Event, event_log::EventLog, trace::trace::Trace}, utils::{ graph::{graph::DefaultGraph, graph_node::GraphNode}, - references::HeapedOrOwned, user_data::user_data::UserData, }, }; diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/discovery.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/discovery.rs index 13fcf13e..e9f18185 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/discovery.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/discovery.rs @@ -152,7 +152,7 @@ pub fn discover_traces_timeline_diagram( control_flow_regexes: control_flow_regexes.cloned(), thread_attribute: Rc::from("Trace".to_string()), traces: timeline_fragments, - time_attribute: time_attribute.map(|s| s.clone()), + time_attribute: time_attribute.cloned(), }) } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/activities_durations.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/activities_durations.rs index 745c37e2..75a0a797 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/activities_durations.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/activities_durations.rs @@ -12,7 +12,7 @@ use crate::{ }, utils::get_stamp, }, - utils::{references::HeapedOrOwned, vec_utils::VectorOptionExtensions}, + utils::vec_utils::VectorOptionExtensions, }; use derive_new::new; use fancy_regex::Regex; diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/event_classes.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/event_classes.rs index 29de9a89..1221c40e 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/event_classes.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/event_classes.rs @@ -9,7 +9,6 @@ use crate::{ }, utils::{extract_thread_id, get_stamp}, }, - utils::references::HeapedOrOwned, }; use derive_new::new; use std::{cell::RefCell, collections::HashMap, ops::Deref, rc::Rc}; @@ -37,7 +36,7 @@ impl<'a> EventGroupSoftwareDataExtractor for EventClassesDataExtractor<'a> { *software_data.event_classes_mut().entry(name).or_insert(0) += 1; if let Some(thread_attribute) = self.thread_attribute.as_ref() { - let thread_id = extract_thread_id(event.borrow().deref(), thread_attribute.as_ref()); + let thread_id = extract_thread_id(event.borrow().deref(), thread_attribute); let stamp = match get_stamp(event.borrow().deref(), self.time_attribute) { Ok(stamp) => stamp, Err(_) => return Err(SoftwareDataExtractionError::FailedToGetStamp), diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/pie_charts.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/pie_charts.rs index 6df1e84e..2e97ca61 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/pie_charts.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/pie_charts.rs @@ -8,7 +8,6 @@ use crate::{ }, models::{GenericEnhancementBase, HistogramData, HistogramEntry, SoftwareData}, }, - utils::references::HeapedOrOwned, }; use derive_new::new; use fancy_regex::Regex; diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/models.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/models.rs index e48aa490..a0277e3f 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/models.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/models.rs @@ -1,7 +1,4 @@ -use crate::{ - features::discovery::timeline::{discovery::TraceThread, software_data::extraction_config::TimeKind}, - utils::references::HeapedOrOwned, -}; +use crate::features::discovery::timeline::{discovery::TraceThread, software_data::extraction_config::TimeKind}; use derive_new::new; use enum_display::EnumDisplay; use getset::{Getters, MutGetters}; diff --git a/Ficus/src/rust/ficus/src/pipelines/multithreading.rs b/Ficus/src/rust/ficus/src/pipelines/multithreading.rs index a075e53c..8e48c55c 100644 --- a/Ficus/src/rust/ficus/src/pipelines/multithreading.rs +++ b/Ficus/src/rust/ficus/src/pipelines/multithreading.rs @@ -365,7 +365,7 @@ impl PipelineParts { continue; }; - event.set_name(Rc::from(name)); + event.set_name(name); } } diff --git a/Ficus/src/rust/ficus/src/utils/graph/graph_conversions.rs b/Ficus/src/rust/ficus/src/utils/graph/graph_conversions.rs index 87680a94..6d614a4b 100644 --- a/Ficus/src/rust/ficus/src/utils/graph/graph_conversions.rs +++ b/Ficus/src/rust/ficus/src/utils/graph/graph_conversions.rs @@ -1,11 +1,8 @@ -use crate::utils::{ - graph::{ +use crate::utils::graph::{ graph::{DefaultGraph, Graph}, graph_edge::GraphEdge, graph_node::GraphNode, - }, - references::HeapedOrOwned, -}; + }; use std::{collections::HashMap, fmt::Display, rc::Rc}; impl Graph diff --git a/Ficus/src/rust/ficus_backend/src/grpc/converters.rs b/Ficus/src/rust/ficus_backend/src/grpc/converters.rs index 1b70f4ca..182aaf1d 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/converters.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/converters.rs @@ -94,7 +94,6 @@ use ficus::{ graph_node::GraphNode, }, log_serialization_format::LogSerializationFormat, - references::HeapedOrOwned, user_data::{ keys::Key, user_data::{UserData, UserDataImpl}, diff --git a/Ficus/src/rust/ficus_backend/src/grpc/kafka/kafka_service.rs b/Ficus/src/rust/ficus_backend/src/grpc/kafka/kafka_service.rs index d1d39deb..ebceec3a 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/kafka/kafka_service.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/kafka/kafka_service.rs @@ -33,7 +33,6 @@ use log::error; use rdkafka::{error::KafkaError, ClientConfig}; use std::{ collections::HashMap, - rc::Rc, sync::{Arc, Mutex}, }; use tonic::Status; @@ -146,7 +145,7 @@ impl KafkaService { match consumer.subscribe() { Ok(_) => { let mut map = dto.subscriptions_to_execution_requests.lock().expect("Must acquire lock"); - map.insert(dto.uuid, KafkaSubscription::new(dto.name.clone().into())); + map.insert(dto.uuid, KafkaSubscription::new(dto.name.clone())); } Err(err) => { return match err { diff --git a/Ficus/src/rust/ficus_backend/src/grpc/kafka/models.rs b/Ficus/src/rust/ficus_backend/src/grpc/kafka/models.rs index ed04441f..5416efae 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/kafka/models.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/kafka/models.rs @@ -10,7 +10,6 @@ use std::{ fmt::{Debug, Display, Formatter}, sync::{Arc, Mutex}, }; -use std::rc::Rc; use uuid::Uuid; pub(super) const KAFKA_CASE_DISPLAY_NAME: &str = "case_display_name"; diff --git a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/processors.rs b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/processors.rs index b1046148..36a3df61 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/processors.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/processors.rs @@ -104,7 +104,7 @@ fn add_system_metadata( ) -> Result<(), XesFromBxesKafkaTraceCreatingError> { let metadata = ExtractedTraceMetadata::create_from(metadata)?; - context.put_concrete(PROCESS_NAME_KEY.key(), metadata.process.process_name.into()); + context.put_concrete(PROCESS_NAME_KEY.key(), metadata.process.process_name); context.put_concrete(UNSTRUCTURED_METADATA_KEY.key(), metadata.unstructured_metadata); context.put_concrete( CASE_NAME_KEY.key(), From f539776c7cca97a6cbcc47d7b9e18aac7fccf5dd Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sun, 1 Mar 2026 19:29:10 +0300 Subject: [PATCH 14/30] cargo fmt --- Ficus/src/rust/ficus/src/event_log/xes/shared.rs | 3 +-- .../src/features/analysis/directly_follows_graph.rs | 3 +-- .../features/analysis/entropy/pos_entropy_fast.rs | 6 ++++-- .../clustering/activities/activities_common.rs | 7 +------ .../alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs | 3 +-- .../discovery/alpha/alpha_plus_plus_nfc/w3_pair.rs | 2 +- .../alpha/providers/alpha_plus_nfc_provider.rs | 3 +-- .../alpha/providers/alpha_plus_provider.rs | 3 +-- .../alpha/providers/alpha_sharp_provider.rs | 3 +-- .../src/features/discovery/ecfg/adjustments.rs | 2 +- .../ficus/src/features/discovery/ecfg/context.rs | 5 +---- .../ficus/src/features/discovery/ecfg/discovery.rs | 2 +- .../discovery/heuristic/relations_provider.rs | 3 +-- .../src/features/discovery/ocel/graph_annotation.rs | 6 +----- .../src/features/discovery/petri_net/petri_net.rs | 5 ++--- .../timeline/software_data/extractors/ocel.rs | 13 ++----------- Ficus/src/rust/ficus/src/utils/graph/graph.rs | 6 ++---- .../rust/ficus/src/utils/graph/graph_conversions.rs | 8 ++++---- .../analysis/patterns/activities_instances_tests.rs | 8 ++++---- .../ficus/tests/software_data/extractors_tests.rs | 3 +-- 20 files changed, 32 insertions(+), 62 deletions(-) diff --git a/Ficus/src/rust/ficus/src/event_log/xes/shared.rs b/Ficus/src/rust/ficus/src/event_log/xes/shared.rs index ed222bfe..2123c8ba 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/shared.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/shared.rs @@ -1,6 +1,5 @@ -use std::collections::HashMap; -use std::rc::Rc; use crate::event_log::core::event::event::EventPayloadValue; +use std::{collections::HashMap, rc::Rc}; #[derive(Debug, Clone)] pub struct XesEventLogExtension { diff --git a/Ficus/src/rust/ficus/src/features/analysis/directly_follows_graph.rs b/Ficus/src/rust/ficus/src/features/analysis/directly_follows_graph.rs index af35dacd..734c88f0 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/directly_follows_graph.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/directly_follows_graph.rs @@ -7,8 +7,7 @@ use crate::{ utils::graph::graph::{DefaultGraph, Graph, NodesConnectionData}, }; use log::warn; -use std::collections::HashMap; -use std::rc::Rc; +use std::{collections::HashMap, rc::Rc}; pub fn construct_dfg(info: &dyn EventLogInfo) -> DefaultGraph { let mut graph = Graph::empty(); diff --git a/Ficus/src/rust/ficus/src/features/analysis/entropy/pos_entropy_fast.rs b/Ficus/src/rust/ficus/src/features/analysis/entropy/pos_entropy_fast.rs index a33424f2..8d817f4e 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/entropy/pos_entropy_fast.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/entropy/pos_entropy_fast.rs @@ -1,9 +1,11 @@ -use std::collections::{HashMap, HashSet}; -use std::rc::Rc; use crate::event_log::core::{ event_log::EventLog, trace::trace::{Trace, TraceEventsPositions}, }; +use std::{ + collections::{HashMap, HashSet}, + rc::Rc, +}; use super::shared::{calculate_entropies, calculate_max_vector_length, calculate_pos_entropy}; diff --git a/Ficus/src/rust/ficus/src/features/clustering/activities/activities_common.rs b/Ficus/src/rust/ficus/src/features/clustering/activities/activities_common.rs index f8b55c99..2862ec66 100644 --- a/Ficus/src/rust/ficus/src/features/clustering/activities/activities_common.rs +++ b/Ficus/src/rust/ficus/src/features/clustering/activities/activities_common.rs @@ -140,12 +140,7 @@ fn create_activities_repr_from_subtraces( processed .into_iter() - .map(|x| { - ( - x.0.as_ref().to_owned(), - (x.1.0, x.1.1.into_iter().map(|x| (x.0, x.1)).collect()), - ) - }) + .map(|x| (x.0.as_ref().to_owned(), (x.1.0, x.1.1.into_iter().map(|x| (x.0, x.1)).collect()))) .collect() } diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs index 0bf33c5f..c7b7c66c 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs @@ -7,7 +7,7 @@ use crate::{ }, discovery::{ alpha::{ - alpha::{discover_petri_net_alpha, discover_petri_net_alpha_plus, find_transitions_one_length_loop}, + alpha::{ALPHA_SET_KEY, discover_petri_net_alpha, discover_petri_net_alpha_plus, find_transitions_one_length_loop}, alpha_plus_plus_nfc::{alpha_plus_plus_nfc_triple::AlphaPlusPlusNfcTriple, extended_alpha_set::ExtendedAlphaSet, w3_pair::W3Pair}, providers::alpha_plus_nfc_provider::AlphaPlusNfcRelationsProvider, utils::maximize, @@ -22,7 +22,6 @@ use std::{ collections::{HashMap, HashSet, VecDeque}, rc::Rc, }; -use crate::features::discovery::alpha::alpha::ALPHA_SET_KEY; pub fn discover_petri_net_alpha_plus_plus_nfc(log: &TLog) -> DefaultPetriNet { let one_length_loop_transitions = find_transitions_one_length_loop(log); diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/w3_pair.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/w3_pair.rs index bf141ae1..5074d921 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/w3_pair.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/w3_pair.rs @@ -7,8 +7,8 @@ use std::{ collections::HashSet, fmt::Display, hash::{Hash, Hasher}, + rc::Rc, }; -use std::rc::Rc; pub(crate) struct W3Pair { two_sets: TwoSets>, diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_plus_nfc_provider.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_plus_nfc_provider.rs index 5c38de67..06b589e0 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_plus_nfc_provider.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_plus_nfc_provider.rs @@ -13,8 +13,7 @@ use crate::{ }, }, }; -use std::collections::HashSet; -use std::rc::Rc; +use std::{collections::HashSet, rc::Rc}; enum PrePostSet { PreSet, diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_plus_provider.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_plus_provider.rs index 5ce3faee..4760adf2 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_plus_provider.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_plus_provider.rs @@ -2,8 +2,7 @@ use crate::features::{ analysis::log_info::event_log_info::EventLogInfo, discovery::{alpha::providers::alpha_provider::AlphaRelationsProvider, relations::triangle_relation::TriangleRelation}, }; -use std::collections::HashSet; -use std::rc::Rc; +use std::{collections::HashSet, rc::Rc}; pub trait AlphaPlusRelationsProvider: AlphaRelationsProvider { fn triangle_relation(&self, first: &str, second: &str) -> bool; diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_sharp_provider.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_sharp_provider.rs index e9e85457..5ae58892 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_sharp_provider.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/alpha_sharp_provider.rs @@ -8,8 +8,7 @@ use crate::features::{ relations::triangle_relation::TriangleRelation, }, }; -use std::collections::HashSet; -use std::rc::Rc; +use std::{collections::HashSet, rc::Rc}; pub struct AlphaSharpRelationsProvider<'a> { alpha_plus_provider: AlphaPlusRelationsProviderImpl<'a>, diff --git a/Ficus/src/rust/ficus/src/features/discovery/ecfg/adjustments.rs b/Ficus/src/rust/ficus/src/features/discovery/ecfg/adjustments.rs index e0048c47..4bb5b955 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ecfg/adjustments.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ecfg/adjustments.rs @@ -20,8 +20,8 @@ use crate::{ use std::{ collections::{HashMap, HashSet}, fmt::Debug, + rc::Rc, }; -use std::rc::Rc; pub fn merge_sequences_of_nodes(graph: &mut DefaultGraph, performance_map: Option) { for current_sequence in discover_sequences_to_merge(graph) { diff --git a/Ficus/src/rust/ficus/src/features/discovery/ecfg/context.rs b/Ficus/src/rust/ficus/src/features/discovery/ecfg/context.rs index 50c0c53c..6cd9d51d 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ecfg/context.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ecfg/context.rs @@ -1,7 +1,4 @@ -use crate::{ - features::discovery::ecfg::models::RootSequenceKind, - utils::user_data::user_data::UserDataImpl, -}; +use crate::{features::discovery::ecfg::models::RootSequenceKind, utils::user_data::user_data::UserDataImpl}; use std::rc::Rc; type NameExtractor<'a, T> = &'a dyn Fn(&T) -> Rc; diff --git a/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery.rs b/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery.rs index 9ee34639..261cc440 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery.rs @@ -23,8 +23,8 @@ use lazy_static::lazy_static; use std::{ collections::{HashMap, VecDeque}, fmt::Debug, + rc::Rc, }; -use std::rc::Rc; const EVENT_UNIQUE_ID: &str = "EVENT_UNIQUE_ID"; context_key! { EVENT_UNIQUE_ID, Vec } diff --git a/Ficus/src/rust/ficus/src/features/discovery/heuristic/relations_provider.rs b/Ficus/src/rust/ficus/src/features/discovery/heuristic/relations_provider.rs index 0cd7df66..357bfd3f 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/heuristic/relations_provider.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/heuristic/relations_provider.rs @@ -5,8 +5,7 @@ use crate::features::{ relations::triangle_relation::TriangleRelation, }, }; -use std::collections::HashMap; -use std::rc::Rc; +use std::{collections::HashMap, rc::Rc}; type DependencyRelations = HashMap, HashMap, f64>>; diff --git a/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs b/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs index 26a492be..63d88bf7 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ocel/graph_annotation.rs @@ -33,11 +33,7 @@ pub struct NodeObjectsState { } impl NodeObjectsState { - pub fn add_allocated_object( - &mut self, - object_type: Rc, - object_id: Rc, - ) -> Result<(), OcelAnnotationCreationError> { + pub fn add_allocated_object(&mut self, object_type: Rc, object_id: Rc) -> Result<(), OcelAnnotationCreationError> { if self.contains_object(&object_type, &object_id) { return Err(OcelAnnotationCreationError::ObjectAlreadyExistsInNodeState); } diff --git a/Ficus/src/rust/ficus/src/features/discovery/petri_net/petri_net.rs b/Ficus/src/rust/ficus/src/features/discovery/petri_net/petri_net.rs index 707363e9..66a1bc67 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/petri_net/petri_net.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/petri_net/petri_net.rs @@ -1,7 +1,6 @@ -use crate::features::discovery::petri_net::{marking::Marking, place::Place, transition::Transition}; -use std::collections::HashMap; -use std::rc::Rc; use super::arc::Arc; +use crate::features::discovery::petri_net::{marking::Marking, place::Place, transition::Transition}; +use std::{collections::HashMap, rc::Rc}; pub type DefaultPetriNet = PetriNet, ()>; diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/ocel.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/ocel.rs index 3d4e1142..80acc359 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/ocel.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/ocel.rs @@ -111,10 +111,7 @@ impl<'a> OcelDataExtractor<'a> { true } - fn extract_object_id_and_type( - event: &XesEventImpl, - config: &OcelObjectExtractionConfigBase, - ) -> Option<(Rc, Rc)> { + fn extract_object_id_and_type(event: &XesEventImpl, config: &OcelObjectExtractionConfigBase) -> Option<(Rc, Rc)> { let object_type = config.object_type_attr().create(event); let object_id = match Self::parse_object_id(event, config.object_id_attr().as_str()) { @@ -219,13 +216,7 @@ impl<'a> OcelDataExtractor<'a> { .to_string_repr() .trim() .split(delimiter) - .filter_map(|s| { - if !s.is_empty() { - Some(Rc::from(s)) - } else { - None - } - }) + .filter_map(|s| if !s.is_empty() { Some(Rc::from(s)) } else { None }) .collect(); if parsed_ids.is_empty() { diff --git a/Ficus/src/rust/ficus/src/utils/graph/graph.rs b/Ficus/src/rust/ficus/src/utils/graph/graph.rs index 71c0b5b9..babcccf2 100644 --- a/Ficus/src/rust/ficus/src/utils/graph/graph.rs +++ b/Ficus/src/rust/ficus/src/utils/graph/graph.rs @@ -1,11 +1,9 @@ use crate::utils::{ - graph::{graph_edge::GraphEdge, graph_node::GraphNode} - , + graph::{graph_edge::GraphEdge, graph_node::GraphNode}, user_data::user_data::UserDataImpl, }; use getset::{Getters, Setters}; -use std::rc::Rc; -use std::{collections::HashMap, fmt::Display, sync::atomic::AtomicU64}; +use std::{collections::HashMap, fmt::Display, rc::Rc, sync::atomic::AtomicU64}; pub(crate) static NEXT_ID: AtomicU64 = AtomicU64::new(0); pub type DefaultGraph = Graph, Rc>; diff --git a/Ficus/src/rust/ficus/src/utils/graph/graph_conversions.rs b/Ficus/src/rust/ficus/src/utils/graph/graph_conversions.rs index 6d614a4b..9557c9a1 100644 --- a/Ficus/src/rust/ficus/src/utils/graph/graph_conversions.rs +++ b/Ficus/src/rust/ficus/src/utils/graph/graph_conversions.rs @@ -1,8 +1,8 @@ use crate::utils::graph::{ - graph::{DefaultGraph, Graph}, - graph_edge::GraphEdge, - graph_node::GraphNode, - }; + graph::{DefaultGraph, Graph}, + graph_edge::GraphEdge, + graph_node::GraphNode, +}; use std::{collections::HashMap, fmt::Display, rc::Rc}; impl Graph diff --git a/Ficus/src/rust/ficus/tests/analysis/patterns/activities_instances_tests.rs b/Ficus/src/rust/ficus/tests/analysis/patterns/activities_instances_tests.rs index 598b88ca..10195afc 100644 --- a/Ficus/src/rust/ficus/tests/analysis/patterns/activities_instances_tests.rs +++ b/Ficus/src/rust/ficus/tests/analysis/patterns/activities_instances_tests.rs @@ -123,9 +123,7 @@ fn execute_activities_discovery_test( ); let context = ActivitiesInstancesDiscoveryContext::new(context, strategy, |info, _| { - Rc::new(RefCell::new(XesEventImpl::new_with_min_date( - info.node().borrow().name().clone() - ))) + Rc::new(RefCell::new(XesEventImpl::new_with_min_date(info.node().borrow().name().clone()))) }); let new_log = discover_activities_and_create_new_log(&context); @@ -138,7 +136,9 @@ fn test_creating_new_log_from_activity_instances_insert_as_single_event() { execute_activities_discovery_test( create_log_from_taxonomy_of_patterns(), UndefActivityHandlingStrategy::InsertAsSingleEvent(Box::new(|| { - Rc::new(RefCell::new(XesEventImpl::new_with_min_date(Rc::from(UNDEF_ACTIVITY_NAME.to_string())))) + Rc::new(RefCell::new(XesEventImpl::new_with_min_date(Rc::from( + UNDEF_ACTIVITY_NAME.to_string(), + )))) })), &vec![vec![UNDEF_ACTIVITY_NAME, "(a)::(b)::(c)", UNDEF_ACTIVITY_NAME, "(a)::(b)::(c)"]], ); diff --git a/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs b/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs index e6897dea..03ddec7f 100644 --- a/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs +++ b/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs @@ -19,8 +19,7 @@ use ficus::{ }, models::SoftwareData, }, - } - , + }, }; use std::{cell::RefCell, rc::Rc}; From 3c0165d3520124a20224b7f76c78921a6aac3d3c Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sun, 1 Mar 2026 22:26:29 +0300 Subject: [PATCH 15/30] Fix converters --- .../rust/ficus_backend/src/grpc/converters.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Ficus/src/rust/ficus_backend/src/grpc/converters.rs b/Ficus/src/rust/ficus_backend/src/grpc/converters.rs index 182aaf1d..5c877a19 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/converters.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/converters.rs @@ -120,7 +120,7 @@ pub(super) fn put_into_user_data( context: &ServicePipelineExecutionContext, ) { match value { - ContextValue::String(string) => user_data.put_any::(key, string.clone()), + ContextValue::String(string) => user_data.put_any::>(key, string.clone().into()), ContextValue::HashesLog(_) => todo!(), ContextValue::NamesLog(grpc_log) => put_names_log_to_context(key, grpc_log, user_data), ContextValue::Uint32(number) => user_data.put_any::(key, *number), @@ -162,7 +162,7 @@ pub(super) fn put_into_user_data( } } ContextValue::EventLogInfo(_) => todo!(), - ContextValue::Strings(strings) => user_data.put_any::>(key, strings.strings.clone()), + ContextValue::Strings(strings) => user_data.put_any::>>(key, strings.strings.iter().map(|s| s.clone().into()).collect()), ContextValue::Pipeline(pipeline) => { let pipeline = context.with_pipeline(pipeline).to_pipeline(); user_data.put_any::(key, pipeline); @@ -256,13 +256,13 @@ fn put_names_log_to_context(key: &dyn Key, grpc_log: &GrpcNamesEventLogContextVa for grpc_trace in &grpc_log.traces { let mut trace = vec![]; for grpc_event in &grpc_trace.events { - trace.push(grpc_event.clone()); + trace.push(grpc_event.clone().into()); } names_log.push(trace); } - user_data.put_any::>>(key, names_log); + user_data.put_any::>>>(key, names_log); } pub fn convert_to_grpc_context_value(key: &dyn ContextKey, value: &dyn Any) -> Option { @@ -427,11 +427,11 @@ fn try_convert_to_grpc_graph_time_annotation(value: &dyn Any) -> Option Option { - if !value.is::() { + if !value.is::>() { None } else { Some(GrpcContextValue { - context_value: Some(ContextValue::String(value.downcast_ref::().unwrap().clone())), + context_value: Some(ContextValue::String(value.downcast_ref::>().unwrap().to_string())), }) } } @@ -460,15 +460,15 @@ fn try_convert_to_hashes_event_log(value: &dyn Any) -> Option } fn try_convert_to_names_event_log(value: &dyn Any) -> Option { - if !value.is::>>() { + if !value.is::>>>() { None } else { - let vec = value.downcast_ref::>>().unwrap(); + let vec = value.downcast_ref::>>>().unwrap(); let mut traces = vec![]; for trace in vec { let mut events = vec![]; for event in trace { - events.push(event.clone()); + events.push(event.to_string()); } traces.push(GrpcNamesTrace { events }); From 1ef369e2055b74c8ba51b5826ec26adf58b78e1a Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sun, 1 Mar 2026 22:47:27 +0300 Subject: [PATCH 16/30] Revert rdkafka version update --- Ficus/src/rust/Cargo.lock | 4 ++-- Ficus/src/rust/ficus_backend/Cargo.toml | 2 +- bxes/src/rust/Cargo.lock | 4 ++-- bxes/src/rust/bxes_kafka/Cargo.toml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Ficus/src/rust/Cargo.lock b/Ficus/src/rust/Cargo.lock index 81fc77aa..c8c0fdea 100644 --- a/Ficus/src/rust/Cargo.lock +++ b/Ficus/src/rust/Cargo.lock @@ -1925,9 +1925,9 @@ dependencies = [ [[package]] name = "rdkafka" -version = "0.39.0" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7956f9ac12b5712e50372d9749a3102f4810a8d42481c5eae3748d36d585bcf" +checksum = "1beea247b9a7600a81d4cc33f659ce1a77e1988323d7d2809c7ed1c21f4c316d" dependencies = [ "futures-channel", "futures-util", diff --git a/Ficus/src/rust/ficus_backend/Cargo.toml b/Ficus/src/rust/ficus_backend/Cargo.toml index 8cae94eb..d7f65e9e 100644 --- a/Ficus/src/rust/ficus_backend/Cargo.toml +++ b/Ficus/src/rust/ficus_backend/Cargo.toml @@ -8,7 +8,7 @@ ficus = { path = "../ficus" } tonic = "0.9.2" colog = "1.4.0" log = "0.4.29" -rdkafka = { version = "0.39.0", features = ["cmake-build"] } +rdkafka = { version = "0.36.2", features = ["cmake-build"] } bxes_kafka = { path = "../../../../bxes/src/rust/bxes_kafka" } tokio-stream = "0.1.17" tokio = { version = "1.49.0", features = ["rt-multi-thread"] } diff --git a/bxes/src/rust/Cargo.lock b/bxes/src/rust/Cargo.lock index 5a930483..1885b3b0 100644 --- a/bxes/src/rust/Cargo.lock +++ b/bxes/src/rust/Cargo.lock @@ -897,9 +897,9 @@ checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba" [[package]] name = "rdkafka" -version = "0.39.0" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7956f9ac12b5712e50372d9749a3102f4810a8d42481c5eae3748d36d585bcf" +checksum = "1beea247b9a7600a81d4cc33f659ce1a77e1988323d7d2809c7ed1c21f4c316d" dependencies = [ "futures-channel", "futures-util", diff --git a/bxes/src/rust/bxes_kafka/Cargo.toml b/bxes/src/rust/bxes_kafka/Cargo.toml index c7409cc7..e306ae67 100644 --- a/bxes/src/rust/bxes_kafka/Cargo.toml +++ b/bxes/src/rust/bxes_kafka/Cargo.toml @@ -5,7 +5,7 @@ edition = "2024" [dependencies] bxes = { path = "../bxes" } -rdkafka = { version = "0.39.0", features = ["cmake-build"] } +rdkafka = { version = "0.36.2", features = ["cmake-build"] } uuid = { version = "1.19.0", features = ["v4"] } log = "0.4.29" colog = "1.4.0" From 0343d6740babf0af145f2c3e7f14231a451f41b3 Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sun, 1 Mar 2026 22:56:26 +0300 Subject: [PATCH 17/30] Update cargo lock? --- Ficus/src/rust/Cargo.lock | 387 +++++++++++++++++--------------------- 1 file changed, 176 insertions(+), 211 deletions(-) diff --git a/Ficus/src/rust/Cargo.lock b/Ficus/src/rust/Cargo.lock index c8c0fdea..1f3c2005 100644 --- a/Ficus/src/rust/Cargo.lock +++ b/Ficus/src/rust/Cargo.lock @@ -89,9 +89,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.100" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" [[package]] name = "approx" @@ -119,7 +119,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -202,9 +202,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" [[package]] name = "block-buffer" @@ -217,9 +217,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.19.1" +version = "3.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" [[package]] name = "bxes" @@ -250,9 +250,9 @@ dependencies = [ [[package]] name = "bytes" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" [[package]] name = "bzip2" @@ -265,9 +265,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.51" +version = "1.2.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a0aeaff4ff1a90589618835a598e545176939b97874f7abc7851caa0618f203" +checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" dependencies = [ "find-msvc-tools", "jobserver", @@ -294,9 +294,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.42" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" dependencies = [ "iana-time-zone", "js-sys", @@ -343,11 +343,11 @@ checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "colored" -version = "3.0.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fde0e0ec90c9dfb3b4b1a0891a7dcd0e2bffde2f7efed5fe7c9bb00e5bfb915e" +checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -441,9 +441,9 @@ checksum = "807800ff3288b621186fe0a8f3392c4652068257302709c24efd918c3dffcdc2" [[package]] name = "deranged" -version = "0.5.5" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" dependencies = [ "powerfmt", ] @@ -456,7 +456,7 @@ checksum = "2cdc8d50f426189eef89dac62fabfa0abb27d5cc008f25bf4156a0203325becc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -511,9 +511,9 @@ dependencies = [ [[package]] name = "env_filter" -version = "0.1.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" +checksum = "7a1c3cc8e57274ec99de65301228b537f1e4eedc1b8e0f9411c6caac8ae7308f" dependencies = [ "log", "regex", @@ -521,9 +521,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +checksum = "b2daee4ea451f429a58296525ddf28b45a3b64f1acf6587e2067437bb11e218d" dependencies = [ "anstream", "anstyle", @@ -622,9 +622,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645cbb3a84e60b7531617d5ae4e57f7e27308f6445f5abf653209ea76dec8dff" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "fixedbitset" @@ -634,13 +634,12 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.1.5" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" dependencies = [ - "crc32fast", - "libz-rs-sys", "miniz_oxide", + "zlib-rs", ] [[package]] @@ -663,9 +662,9 @@ checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "futures" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" dependencies = [ "futures-channel", "futures-core", @@ -678,9 +677,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" dependencies = [ "futures-core", "futures-sink", @@ -688,15 +687,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" [[package]] name = "futures-executor" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" dependencies = [ "futures-core", "futures-task", @@ -705,38 +704,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" [[package]] name = "futures-macro" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] name = "futures-sink" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" [[package]] name = "futures-task" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" [[package]] name = "futures-util" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" dependencies = [ "futures-channel", "futures-core", @@ -746,7 +745,6 @@ dependencies = [ "futures-task", "memchr", "pin-project-lite", - "pin-utils", "slab", ] @@ -762,9 +760,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", "libc", @@ -808,7 +806,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -823,7 +821,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.12.1", + "indexmap 2.13.0", "slab", "tokio", "tokio-util", @@ -953,9 +951,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.64" +version = "0.1.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -993,9 +991,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.12.1" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" dependencies = [ "equivalent", "hashbrown 0.16.1", @@ -1035,9 +1033,9 @@ checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "jiff" -version = "0.2.17" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a87d9b8105c23642f50cbbae03d1f75d8422c5cb98ce7ee9271f7ff7505be6b8" +checksum = "819b44bc7c87d9117eb522f14d46e918add69ff12713c475946b0a29363ed1c2" dependencies = [ "jiff-static", "log", @@ -1048,13 +1046,13 @@ dependencies = [ [[package]] name = "jiff-static" -version = "0.2.17" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b787bebb543f8969132630c51fd0afab173a86c6abae56ff3b9e5e3e3f9f6e58" +checksum = "470252db18ecc35fd766c0891b1e3ec6cbbcd62507e85276c01bf75d8e94d4a1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -1069,9 +1067,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.83" +version = "0.3.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" +checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" dependencies = [ "once_cell", "wasm-bindgen", @@ -1119,30 +1117,21 @@ checksum = "2c4a545a15244c7d945065b5d392b2d2d7f21526fba56ce51467b06ed445e8f7" [[package]] name = "libc" -version = "0.2.179" +version = "0.2.182" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5a2d376baa530d1238d133232d15e239abad80d05838b4b59354e5268af431f" +checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112" [[package]] name = "libm" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" - -[[package]] -name = "libz-rs-sys" -version = "0.5.5" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c10501e7805cee23da17c7790e59df2870c0d4043ec6d03f67d31e2b53e77415" -dependencies = [ - "zlib-rs", -] +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "libz-sys" -version = "1.1.23" +version = "1.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15d118bbf3771060e7311cc7bb0545b01d08a8b4a7de949198dec1fa0ca1c0f7" +checksum = "4735e9cbde5aac84a5ce588f6b23a90b9b0b528f6c5a8db8a4aff300463a0839" dependencies = [ "cc", "libc", @@ -1218,9 +1207,9 @@ checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "linux-raw-sys" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "log" @@ -1255,9 +1244,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.6" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] name = "mime" @@ -1341,9 +1330,9 @@ dependencies = [ [[package]] name = "noisy_float" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978fe6e6ebc0bf53de533cd456ca2d9de13de13856eda1518a285d7705a213af" +checksum = "c16843be85dd410c6a12251c4eca0dd1d3ee8c5725f746c4d5e0fdcec0a864b2" dependencies = [ "num-traits", ] @@ -1433,7 +1422,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -1509,7 +1498,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -1559,40 +1548,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.12.1", + "indexmap 2.13.0", ] [[package]] name = "pin-project" -version = "1.1.10" +version = "1.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" +checksum = "f1749c7ed4bcaf4c3d0a3efc28538844fb29bcdd7d2b67b2be7e20ba861ff517" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.10" +version = "1.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" +checksum = "d9b20ed30f105399776b9c883e68e536ef602a16ae6f596d2c473591d6ad64c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] name = "pin-project-lite" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" - -[[package]] -name = "pin-utils" -version = "0.1.0" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "pkg-config" @@ -1602,15 +1585,15 @@ checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "portable-atomic" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" [[package]] name = "portable-atomic-util" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +checksum = "7a9db96d7fa8782dd8c15ce32ffe8680bbd1e978a43bf51a34d39483540495f5" dependencies = [ "portable-atomic", ] @@ -1653,7 +1636,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -1684,14 +1667,14 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] name = "proc-macro2" -version = "1.0.104" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] @@ -1761,9 +1744,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.42" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" dependencies = [ "proc-macro2", ] @@ -1805,7 +1788,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha 0.9.0", - "rand_core 0.9.3", + "rand_core 0.9.5", ] [[package]] @@ -1836,7 +1819,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core 0.9.3", + "rand_core 0.9.5", ] [[package]] @@ -1860,14 +1843,14 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.16", + "getrandom 0.2.17", ] [[package]] name = "rand_core" -version = "0.9.3" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" dependencies = [ "getrandom 0.3.4", ] @@ -1965,9 +1948,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.12.2" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", @@ -1977,9 +1960,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ "aho-corasick", "memchr", @@ -1988,9 +1971,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] name = "rustc-serialize" @@ -2004,7 +1987,7 @@ version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "errno", "libc", "linux-raw-sys 0.4.15", @@ -2013,14 +1996,14 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "errno", "libc", - "linux-raw-sys 0.11.0", + "linux-raw-sys 0.12.1", "windows-sys 0.61.2", ] @@ -2063,14 +2046,14 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] name = "serde_json" -version = "1.0.148" +version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3084b546a1dd6289475996f182a22aba973866ea8e8b02c51d9f46b1336a22da" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" dependencies = [ "itoa", "memchr", @@ -2115,9 +2098,9 @@ checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" [[package]] name = "slab" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" @@ -2137,9 +2120,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0" dependencies = [ "libc", "windows-sys 0.60.2", @@ -2191,9 +2174,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.111" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -2208,14 +2191,14 @@ checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "tempfile" -version = "3.24.0" +version = "3.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" +checksum = "82a72c767771b47409d2345987fda8628641887d5466101319899796367354a0" dependencies = [ "fastrand", - "getrandom 0.3.4", + "getrandom 0.4.1", "once_cell", - "rustix 1.1.3", + "rustix 1.1.4", "windows-sys 0.61.2", ] @@ -2251,7 +2234,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -2262,7 +2245,7 @@ checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -2295,7 +2278,7 @@ dependencies = [ "libc", "mio", "pin-project-lite", - "socket2 0.6.1", + "socket2 0.6.2", "tokio-macros", "windows-sys 0.61.2", ] @@ -2318,14 +2301,14 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] name = "tokio-stream" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" dependencies = [ "futures-core", "pin-project-lite", @@ -2334,9 +2317,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.17" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" dependencies = [ "bytes", "futures-core", @@ -2360,7 +2343,7 @@ version = "0.23.10+spec-1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" dependencies = [ - "indexmap 2.12.1", + "indexmap 2.13.0", "toml_datetime", "toml_parser", "winnow", @@ -2368,9 +2351,9 @@ dependencies = [ [[package]] name = "toml_parser" -version = "1.0.6+spec-1.1.0" +version = "1.0.9+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44" +checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4" dependencies = [ "winnow", ] @@ -2467,7 +2450,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -2499,9 +2482,9 @@ checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" [[package]] name = "unicode-ident" -version = "1.0.22" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "unicode-segmentation" @@ -2523,28 +2506,16 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.19.0" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a" +checksum = "b672338555252d43fd2240c714dc444b8c6fb0a5c5335e65a07bba7742735ddb" dependencies = [ - "getrandom 0.3.4", + "getrandom 0.4.1", "js-sys", "rand 0.9.2", - "uuid-macro-internal", "wasm-bindgen", ] -[[package]] -name = "uuid-macro-internal" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39d11901c36b3650df7acb0f9ebe624f35b5ac4e1922ecd3c57f444648429594" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.111", -] - [[package]] name = "variant_count" version = "1.2.0" @@ -2553,7 +2524,7 @@ checksum = "a1935e10c6f04d22688d07c0790f2fc0e1b1c5c2c55bc0cc87ed67656e587dd8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -2585,11 +2556,11 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasip2" -version = "1.0.1+wasi-0.2.4" +version = "1.0.2+wasi-0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" dependencies = [ - "wit-bindgen 0.46.0", + "wit-bindgen", ] [[package]] @@ -2598,14 +2569,14 @@ version = "0.4.0+wasi-0.3.0-rc-2026-01-06" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" dependencies = [ - "wit-bindgen 0.51.0", + "wit-bindgen", ] [[package]] name = "wasm-bindgen" -version = "0.2.106" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" +checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" dependencies = [ "cfg-if", "once_cell", @@ -2616,9 +2587,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.106" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" +checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2626,22 +2597,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.106" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" +checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.106" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" +checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" dependencies = [ "unicode-ident", ] @@ -2663,7 +2634,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" dependencies = [ "anyhow", - "indexmap 2.12.1", + "indexmap 2.13.0", "wasm-encoder", "wasmparser", ] @@ -2674,9 +2645,9 @@ version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "hashbrown 0.15.5", - "indexmap 2.12.1", + "indexmap 2.13.0", "semver", ] @@ -2735,7 +2706,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -2746,7 +2717,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -2947,12 +2918,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "wit-bindgen" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" - [[package]] name = "wit-bindgen" version = "0.51.0" @@ -2981,9 +2946,9 @@ checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" dependencies = [ "anyhow", "heck 0.5.0", - "indexmap 2.12.1", + "indexmap 2.13.0", "prettyplease 0.2.37", - "syn 2.0.111", + "syn 2.0.117", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -2999,7 +2964,7 @@ dependencies = [ "prettyplease 0.2.37", "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", "wit-bindgen-core", "wit-bindgen-rust", ] @@ -3011,8 +2976,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" dependencies = [ "anyhow", - "bitflags 2.10.0", - "indexmap 2.12.1", + "bitflags 2.11.0", + "indexmap 2.13.0", "log", "serde", "serde_derive", @@ -3031,7 +2996,7 @@ checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" dependencies = [ "anyhow", "id-arena", - "indexmap 2.12.1", + "indexmap 2.13.0", "log", "semver", "serde", @@ -3043,22 +3008,22 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.31" +version = "0.8.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" +checksum = "a789c6e490b576db9f7e6b6d661bcc9799f7c0ac8352f56ea20193b2681532e5" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.31" +version = "0.8.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" +checksum = "f65c489a7071a749c849713807783f70672b28094011623e200cb86dcb835953" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -3078,7 +3043,7 @@ checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 2.0.117", ] [[package]] @@ -3095,7 +3060,7 @@ dependencies = [ "flate2", "getrandom 0.4.1", "hmac", - "indexmap 2.12.1", + "indexmap 2.13.0", "lzma-rust2", "memchr", "pbkdf2", @@ -3110,15 +3075,15 @@ dependencies = [ [[package]] name = "zlib-rs" -version = "0.5.5" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40990edd51aae2c2b6907af74ffb635029d5788228222c4bb811e9351c0caad3" +checksum = "c745c48e1007337ed136dc99df34128b9faa6ed542d80a1c673cf55a6d7236c8" [[package]] name = "zmij" -version = "1.0.0" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d6085d62852e35540689d1f97ad663e3971fc19cf5eceab364d62c646ea167" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" [[package]] name = "zopfli" From 7a3ed2deeb74dcbcf9fb62374baf402d5a6d2533 Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sun, 1 Mar 2026 23:24:07 +0300 Subject: [PATCH 18/30] Some packages updates --- Ficus/src/rust/Cargo.lock | 517 +++++++----------- Ficus/src/rust/ficus/Cargo.toml | 5 +- .../discovery/petri_net/pnml_serialization.rs | 2 +- Ficus/src/rust/ficus/src/utils/xml_utils.rs | 8 +- Ficus/src/rust/ficus_backend/Cargo.toml | 11 +- Ficus/src/rust/ficus_backend/build.rs | 4 +- .../src/grpc/context_values_service.rs | 3 +- bxes/src/rust/Cargo.lock | 69 +-- bxes/src/rust/bxes/Cargo.toml | 1 - bxes/src/rust/bxes_kafka/Cargo.toml | 2 +- 10 files changed, 230 insertions(+), 392 deletions(-) diff --git a/Ficus/src/rust/Cargo.lock b/Ficus/src/rust/Cargo.lock index 1f3c2005..1dff75c1 100644 --- a/Ficus/src/rust/Cargo.lock +++ b/Ficus/src/rust/Cargo.lock @@ -122,6 +122,12 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.5.0" @@ -130,26 +136,23 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "axum" -version = "0.6.20" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" +checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8" dependencies = [ - "async-trait", "axum-core", - "bitflags 1.3.2", "bytes", "futures-util", "http", "http-body", - "hyper", + "http-body-util", "itoa", "matchit", "memchr", "mime", "percent-encoding", "pin-project-lite", - "rustversion", - "serde", + "serde_core", "sync_wrapper", "tower", "tower-layer", @@ -158,47 +161,42 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.3.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" dependencies = [ - "async-trait", "bytes", - "futures-util", + "futures-core", "http", "http-body", + "http-body-util", "mime", - "rustversion", + "pin-project-lite", + "sync_wrapper", "tower-layer", "tower-service", ] [[package]] name = "base64" -version = "0.21.7" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bit-set" -version = "0.5.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ "bit-vec", ] [[package]] name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - -[[package]] -name = "bitflags" -version = "1.3.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitflags" @@ -226,7 +224,6 @@ name = "bxes" version = "0.1.0" dependencies = [ "leb128", - "num 0.4.3", "num-derive", "num-traits", "rand 0.10.0", @@ -550,12 +547,13 @@ dependencies = [ [[package]] name = "fancy-regex" -version = "0.11.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2" +checksum = "72cf461f865c862bb7dc573f643dd6a2b6842f7c30b07882b56bd148cc2761b8" dependencies = [ "bit-set", - "regex", + "regex-automata", + "regex-syntax", ] [[package]] @@ -593,7 +591,6 @@ dependencies = [ "serde_json", "stopwatch", "termgraph", - "tonic", "uuid", ] @@ -616,7 +613,8 @@ dependencies = [ "tokio", "tokio-stream", "tonic", - "tonic-build", + "tonic-prost", + "tonic-prost-build", "uuid", ] @@ -628,9 +626,9 @@ checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "fixedbitset" -version = "0.4.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" [[package]] name = "flate2" @@ -811,15 +809,15 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.27" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" +checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54" dependencies = [ + "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "futures-util", "http", "indexmap 2.13.0", "slab", @@ -849,12 +847,6 @@ version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "heck" version = "0.5.0" @@ -871,33 +863,35 @@ dependencies = [ ] [[package]] -name = "home" -version = "0.5.12" +name = "http" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" dependencies = [ - "windows-sys 0.61.2", + "bytes", + "itoa", ] [[package]] -name = "http" -version = "0.2.12" +name = "http-body" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "fnv", - "itoa", + "http", ] [[package]] -name = "http-body" -version = "0.4.6" +name = "http-body-util" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ "bytes", + "futures-core", "http", + "http-body", "pin-project-lite", ] @@ -915,14 +909,14 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.32" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" dependencies = [ + "atomic-waker", "bytes", "futures-channel", "futures-core", - "futures-util", "h2", "http", "http-body", @@ -930,23 +924,43 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.5.10", + "pin-utils", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] [[package]] name = "hyper-timeout" -version = "0.4.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" dependencies = [ "hyper", + "hyper-util", "pin-project-lite", "tokio", - "tokio-io-timeout", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "libc", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", ] [[package]] @@ -1025,6 +1039,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.17" @@ -1199,12 +1222,6 @@ dependencies = [ "thiserror 1.0.69", ] -[[package]] -name = "linux-raw-sys" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" - [[package]] name = "linux-raw-sys" version = "0.12.1" @@ -1228,9 +1245,9 @@ dependencies = [ [[package]] name = "matchit" -version = "0.7.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" [[package]] name = "matrixmultiply" @@ -1277,9 +1294,9 @@ dependencies = [ [[package]] name = "multimap" -version = "0.8.3" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084" [[package]] name = "nameof" @@ -1320,7 +1337,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af5a8477ac96877b5bd1fd67e0c28736c12943aba24eda92b127e036b0c8f400" dependencies = [ "indexmap 1.9.3", - "itertools", + "itertools 0.10.5", "ndarray", "noisy_float", "num-integer", @@ -1343,25 +1360,11 @@ version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9bdb1fb680e609c2e0930c1866cafdd0be7e7c7a1ecf92aec71ed8d99d3e133" dependencies = [ - "num-bigint 0.1.45", + "num-bigint", "num-complex 0.1.44", "num-integer", "num-iter", - "num-rational 0.1.43", - "num-traits", -] - -[[package]] -name = "num" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" -dependencies = [ - "num-bigint 0.4.6", - "num-complex 0.4.6", - "num-integer", - "num-iter", - "num-rational 0.4.2", + "num-rational", "num-traits", ] @@ -1378,16 +1381,6 @@ dependencies = [ "rustc-serialize", ] -[[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", -] - [[package]] name = "num-complex" version = "0.1.44" @@ -1452,23 +1445,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbfff0773e8a07fb033d726b9ff1327466709820788e5298afce4d752965ff1e" dependencies = [ "autocfg", - "num-bigint 0.1.45", + "num-bigint", "num-integer", "num-traits", "rustc-serialize", ] -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-bigint 0.4.6", - "num-integer", - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -1543,11 +1525,12 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "petgraph" -version = "0.6.5" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" dependencies = [ "fixedbitset", + "hashbrown 0.15.5", "indexmap 2.13.0", ] @@ -1577,6 +1560,12 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkg-config" version = "0.3.32" @@ -1619,16 +1608,6 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "prettyplease" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" -dependencies = [ - "proc-macro2", - "syn 1.0.109", -] - [[package]] name = "prettyplease" version = "0.2.37" @@ -1681,9 +1660,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.9" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +checksum = "d2ea70524a2f82d518bce41317d0fae74151505651af45faf1ffbd6fd33f0568" dependencies = [ "bytes", "prost-derive", @@ -1691,53 +1670,72 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.9" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" +checksum = "343d3bd7056eda839b03204e68deff7d1b13aba7af2b2fd16890697274262ee7" dependencies = [ - "bytes", - "heck 0.4.1", - "itertools", - "lazy_static", + "heck", + "itertools 0.13.0", "log", "multimap", "petgraph", - "prettyplease 0.1.25", + "prettyplease", "prost", "prost-types", + "pulldown-cmark", + "pulldown-cmark-to-cmark", "regex", - "syn 1.0.109", + "syn 2.0.117", "tempfile", - "which", ] [[package]] name = "prost-derive" -version = "0.11.9" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b" dependencies = [ "anyhow", - "itertools", + "itertools 0.13.0", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.117", ] [[package]] name = "prost-types" -version = "0.11.9" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" +checksum = "8991c4cbdb8bc5b11f0b074ffe286c30e523de90fee5ba8132f1399f23cb3dd7" dependencies = [ "prost", ] +[[package]] +name = "pulldown-cmark" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83c41efbf8f90ac44de7f3a868f0867851d261b56291732d0cbf7cceaaeb55a6" +dependencies = [ + "bitflags", + "memchr", + "unicase", +] + +[[package]] +name = "pulldown-cmark-to-cmark" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50793def1b900256624a709439404384204a5dc3a6ec580281bfaac35e882e90" +dependencies = [ + "pulldown-cmark", +] + [[package]] name = "quick-xml" -version = "0.29.0" +version = "0.39.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b9228215d82c7b61490fec1de287136b5de6f5700f6e58ea9ad61a7964ca51" +checksum = "958f21e8e7ceb5a1aa7fa87fab28e7c75976e0bfe7e23ff069e0a260f894067d" dependencies = [ "memchr", ] @@ -1908,9 +1906,9 @@ dependencies = [ [[package]] name = "rdkafka" -version = "0.36.2" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1beea247b9a7600a81d4cc33f659ce1a77e1988323d7d2809c7ed1c21f4c316d" +checksum = "d7956f9ac12b5712e50372d9749a3102f4810a8d42481c5eae3748d36d585bcf" dependencies = [ "futures-channel", "futures-util", @@ -1981,29 +1979,16 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe834bc780604f4674073badbad26d7219cadfb4a2275802db12cbae17498401" -[[package]] -name = "rustix" -version = "0.38.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" -dependencies = [ - "bitflags 2.11.0", - "errno", - "libc", - "linux-raw-sys 0.4.15", - "windows-sys 0.59.0", -] - [[package]] name = "rustix" version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ - "bitflags 2.11.0", + "bitflags", "errno", "libc", - "linux-raw-sys 0.12.1", + "linux-raw-sys", "windows-sys 0.61.2", ] @@ -2108,16 +2093,6 @@ version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" -[[package]] -name = "socket2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "socket2" version = "0.6.2" @@ -2152,7 +2127,7 @@ version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d04b5ebc78da44d3a456319d8bc2783e7d8cc7ccbb5cb4dc3f54afbd93bf728" dependencies = [ - "num 0.1.43", + "num", ] [[package]] @@ -2185,9 +2160,9 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "0.1.2" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" [[package]] name = "tempfile" @@ -2198,7 +2173,7 @@ dependencies = [ "fastrand", "getrandom 0.4.1", "once_cell", - "rustix 1.1.4", + "rustix", "windows-sys 0.61.2", ] @@ -2278,21 +2253,11 @@ dependencies = [ "libc", "mio", "pin-project-lite", - "socket2 0.6.2", + "socket2", "tokio-macros", "windows-sys 0.61.2", ] -[[package]] -name = "tokio-io-timeout" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bd86198d9ee903fedd2f9a2e72014287c0d9167e4ae43b5853007205dda1b76" -dependencies = [ - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-macros" version = "2.6.0" @@ -2360,24 +2325,25 @@ dependencies = [ [[package]] name = "tonic" -version = "0.9.2" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" +checksum = "fec7c61a0695dc1887c1b53952990f3ad2e3a31453e1f49f10e75424943a93ec" dependencies = [ "async-trait", "axum", "base64", "bytes", - "futures-core", - "futures-util", "h2", "http", "http-body", + "http-body-util", "hyper", "hyper-timeout", + "hyper-util", "percent-encoding", "pin-project", - "prost", + "socket2", + "sync_wrapper", "tokio", "tokio-stream", "tower", @@ -2388,30 +2354,55 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.9.2" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6fdaae4c2c638bb70fe42803a26fbd6fc6ac8c72f5c59f67ecc2a2dcabf4b07" +checksum = "1882ac3bf5ef12877d7ed57aad87e75154c11931c2ba7e6cde5e22d63522c734" dependencies = [ - "prettyplease 0.1.25", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "tonic-prost" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55376a0bbaa4975a3f10d009ad763d8f4108f067c7c2e74f3001fb49778d309" +dependencies = [ + "bytes", + "prost", + "tonic", +] + +[[package]] +name = "tonic-prost-build" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3144df636917574672e93d0f56d7edec49f90305749c668df5101751bb8f95a" +dependencies = [ + "prettyplease", "proc-macro2", "prost-build", + "prost-types", "quote", - "syn 1.0.109", + "syn 2.0.117", + "tempfile", + "tonic-build", ] [[package]] name = "tower" -version = "0.4.13" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" dependencies = [ "futures-core", "futures-util", - "indexmap 1.9.3", - "pin-project", + "indexmap 2.13.0", "pin-project-lite", - "rand 0.8.5", "slab", + "sync_wrapper", "tokio", "tokio-util", "tower-layer", @@ -2480,6 +2471,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +[[package]] +name = "unicase" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" + [[package]] name = "unicode-ident" version = "1.0.24" @@ -2645,24 +2642,12 @@ version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" dependencies = [ - "bitflags 2.11.0", + "bitflags", "hashbrown 0.15.5", "indexmap 2.13.0", "semver", ] -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix 0.38.44", -] - [[package]] name = "winapi" version = "0.3.9" @@ -2744,31 +2729,13 @@ dependencies = [ "windows-link", ] -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - [[package]] name = "windows-sys" version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.53.5", + "windows-targets", ] [[package]] @@ -2780,22 +2747,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - [[package]] name = "windows-targets" version = "0.53.5" @@ -2803,106 +2754,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" dependencies = [ "windows-link", - "windows_aarch64_gnullvm 0.53.1", - "windows_aarch64_msvc 0.53.1", - "windows_i686_gnu 0.53.1", - "windows_i686_gnullvm 0.53.1", - "windows_i686_msvc 0.53.1", - "windows_x86_64_gnu 0.53.1", - "windows_x86_64_gnullvm 0.53.1", - "windows_x86_64_msvc 0.53.1", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - [[package]] name = "windows_aarch64_gnullvm" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - [[package]] name = "windows_aarch64_msvc" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - [[package]] name = "windows_i686_gnu" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - [[package]] name = "windows_i686_gnullvm" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - [[package]] name = "windows_i686_msvc" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - [[package]] name = "windows_x86_64_gnu" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - [[package]] name = "windows_x86_64_gnullvm" version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - [[package]] name = "windows_x86_64_msvc" version = "0.53.1" @@ -2934,7 +2837,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" dependencies = [ "anyhow", - "heck 0.5.0", + "heck", "wit-parser", ] @@ -2945,9 +2848,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" dependencies = [ "anyhow", - "heck 0.5.0", + "heck", "indexmap 2.13.0", - "prettyplease 0.2.37", + "prettyplease", "syn 2.0.117", "wasm-metadata", "wit-bindgen-core", @@ -2961,7 +2864,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" dependencies = [ "anyhow", - "prettyplease 0.2.37", + "prettyplease", "proc-macro2", "quote", "syn 2.0.117", @@ -2976,7 +2879,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" dependencies = [ "anyhow", - "bitflags 2.11.0", + "bitflags", "indexmap 2.13.0", "log", "serde", diff --git a/Ficus/src/rust/ficus/Cargo.toml b/Ficus/src/rust/ficus/Cargo.toml index 9a7a46cd..37188151 100644 --- a/Ficus/src/rust/ficus/Cargo.toml +++ b/Ficus/src/rust/ficus/Cargo.toml @@ -7,13 +7,12 @@ edition = "2024" [dependencies] chrono = "0.4.42" -quick-xml = "0.29.0" +quick-xml = "0.39.2" lazycell = "1.3" -tonic = "0.9.2" futures = "0.3.31" rand = "0.8.5" once_cell = "1.21.3" -fancy-regex = "0.11.0" +fancy-regex = "0.17.0" stopwatch = "0.0.7" linfa = "0.7.1" linfa-clustering = "0.7.1" diff --git a/Ficus/src/rust/ficus/src/features/discovery/petri_net/pnml_serialization.rs b/Ficus/src/rust/ficus/src/features/discovery/petri_net/pnml_serialization.rs index 1e3429f9..d66d3fe2 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/petri_net/pnml_serialization.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/petri_net/pnml_serialization.rs @@ -109,7 +109,7 @@ where .write_event(Event::Text(BytesText::new(data.to_string().as_str()))) { Ok(()) => {} - Err(error) => return Err(XmlWriteError::WriterError(error)), + Err(error) => return Err(XmlWriteError::WriterError(quick_xml::Error::Io(std::sync::Arc::new(error)))) }; drop(text); diff --git a/Ficus/src/rust/ficus/src/utils/xml_utils.rs b/Ficus/src/rust/ficus/src/utils/xml_utils.rs index e32f99fe..3e818083 100644 --- a/Ficus/src/rust/ficus/src/utils/xml_utils.rs +++ b/Ficus/src/rust/ficus/src/utils/xml_utils.rs @@ -5,7 +5,7 @@ use std::{ io, string::FromUtf8Error, }; - +use std::sync::Arc; use quick_xml::{ Writer, events::{BytesEnd, BytesStart}, @@ -52,7 +52,7 @@ where match writer.write_event(empty) { Ok(_) => Ok(()), - Err(error) => Err(XmlWriteError::WriterError(error)), + Err(error) => Err(XmlWriteError::WriterError(quick_xml::Error::Io(Arc::new(error)))), } } @@ -82,7 +82,7 @@ where let start = quick_xml::events::Event::Start(BytesStart::new(tag_name)); match writer.borrow_mut().write_event(start) { - Err(error) => Err(XmlWriteError::WriterError(error)), + Err(error) => Err(XmlWriteError::WriterError(quick_xml::Error::Io(Arc::new(error)))), Ok(_) => Ok(StartEndElementCookie { tag_name, writer }), } } @@ -99,7 +99,7 @@ where let start_event = quick_xml::events::Event::Start(start_tag); match writer.borrow_mut().write_event(start_event) { - Err(error) => Err(XmlWriteError::WriterError(error)), + Err(error) => Err(XmlWriteError::WriterError(quick_xml::Error::Io(Arc::new(error)))), Ok(_) => Ok(StartEndElementCookie { tag_name, writer }), } } diff --git a/Ficus/src/rust/ficus_backend/Cargo.toml b/Ficus/src/rust/ficus_backend/Cargo.toml index d7f65e9e..b5b7fb8b 100644 --- a/Ficus/src/rust/ficus_backend/Cargo.toml +++ b/Ficus/src/rust/ficus_backend/Cargo.toml @@ -5,15 +5,16 @@ edition = "2021" [dependencies] ficus = { path = "../ficus" } -tonic = "0.9.2" +tonic = "0.14.5" +tonic-prost = "0.14.5" colog = "1.4.0" log = "0.4.29" -rdkafka = { version = "0.36.2", features = ["cmake-build"] } +rdkafka = { version = "0.39.0", features = ["cmake-build"] } bxes_kafka = { path = "../../../../bxes/src/rust/bxes_kafka" } tokio-stream = "0.1.17" tokio = { version = "1.49.0", features = ["rt-multi-thread"] } -prost = "0.11.9" -prost-types = "0.11.9" +prost = "0.14.3" +prost-types = "0.14.3" uuid = { version = "1.19.0", features = ["v4"] } nameof = "1.3.0" chrono = "0.4.42" @@ -22,4 +23,4 @@ futures = "0.3.31" bxes = { path = "../../../../bxes/src/rust/bxes/" } [build-dependencies] -tonic-build = "0.9.2" \ No newline at end of file +tonic-prost-build = "0.14.5" \ No newline at end of file diff --git a/Ficus/src/rust/ficus_backend/build.rs b/Ficus/src/rust/ficus_backend/build.rs index 420395ed..59199e26 100644 --- a/Ficus/src/rust/ficus_backend/build.rs +++ b/Ficus/src/rust/ficus_backend/build.rs @@ -1,7 +1,7 @@ fn main() -> Result<(), Box> { - tonic_build::configure() + tonic_prost_build::configure() .build_server(true) - .compile( + .compile_protos( &[ "../../../protos/backend_service.proto", "../../../protos/kafka_service.proto", diff --git a/Ficus/src/rust/ficus_backend/src/grpc/context_values_service.rs b/Ficus/src/rust/ficus_backend/src/grpc/context_values_service.rs index bddca145..e54abee1 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/context_values_service.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/context_values_service.rs @@ -11,9 +11,10 @@ use std::{ pin::Pin, sync::{Arc, Mutex}, }; +use futures::Stream; use tokio::sync::mpsc; use tokio_stream::wrappers::ReceiverStream; -use tonic::{codegen::futures_core::Stream, Code, Request, Response, Status, Streaming}; +use tonic::{Code, Request, Response, Status, Streaming}; use uuid::Uuid; pub struct ContextValueService { diff --git a/bxes/src/rust/Cargo.lock b/bxes/src/rust/Cargo.lock index 1885b3b0..946d071f 100644 --- a/bxes/src/rust/Cargo.lock +++ b/bxes/src/rust/Cargo.lock @@ -116,7 +116,6 @@ name = "bxes" version = "0.1.0" dependencies = [ "leb128", - "num", "num-derive", "num-traits", "rand 0.10.0", @@ -623,39 +622,6 @@ dependencies = [ "simd-adler32", ] -[[package]] -name = "num" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" -dependencies = [ - "num-bigint", - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-complex" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" -dependencies = [ - "num-traits", -] - [[package]] name = "num-conv" version = "0.2.0" @@ -673,37 +639,6 @@ dependencies = [ "syn", ] -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -897,9 +832,9 @@ checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba" [[package]] name = "rdkafka" -version = "0.36.2" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1beea247b9a7600a81d4cc33f659ce1a77e1988323d7d2809c7ed1c21f4c316d" +checksum = "d7956f9ac12b5712e50372d9749a3102f4810a8d42481c5eae3748d36d585bcf" dependencies = [ "futures-channel", "futures-util", diff --git a/bxes/src/rust/bxes/Cargo.toml b/bxes/src/rust/bxes/Cargo.toml index c91993ef..58d2ee1c 100644 --- a/bxes/src/rust/bxes/Cargo.toml +++ b/bxes/src/rust/bxes/Cargo.toml @@ -5,7 +5,6 @@ edition = "2024" [dependencies] leb128 = "0.2.5" -num = "0.4.3" num-derive = "0.4.2" num-traits = "0.2.19" rand = "0.10.0" diff --git a/bxes/src/rust/bxes_kafka/Cargo.toml b/bxes/src/rust/bxes_kafka/Cargo.toml index e306ae67..c7409cc7 100644 --- a/bxes/src/rust/bxes_kafka/Cargo.toml +++ b/bxes/src/rust/bxes_kafka/Cargo.toml @@ -5,7 +5,7 @@ edition = "2024" [dependencies] bxes = { path = "../bxes" } -rdkafka = { version = "0.36.2", features = ["cmake-build"] } +rdkafka = { version = "0.39.0", features = ["cmake-build"] } uuid = { version = "1.19.0", features = ["v4"] } log = "0.4.29" colog = "1.4.0" From 76b8d791d211c9fa5ae03f5f12346c40bcbc1a34 Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sun, 1 Mar 2026 23:24:29 +0300 Subject: [PATCH 19/30] cargo fmt --- .../features/discovery/petri_net/pnml_serialization.rs | 2 +- Ficus/src/rust/ficus/src/utils/xml_utils.rs | 10 +++++----- .../ficus_backend/src/grpc/context_values_service.rs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Ficus/src/rust/ficus/src/features/discovery/petri_net/pnml_serialization.rs b/Ficus/src/rust/ficus/src/features/discovery/petri_net/pnml_serialization.rs index d66d3fe2..a76eb622 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/petri_net/pnml_serialization.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/petri_net/pnml_serialization.rs @@ -109,7 +109,7 @@ where .write_event(Event::Text(BytesText::new(data.to_string().as_str()))) { Ok(()) => {} - Err(error) => return Err(XmlWriteError::WriterError(quick_xml::Error::Io(std::sync::Arc::new(error)))) + Err(error) => return Err(XmlWriteError::WriterError(quick_xml::Error::Io(std::sync::Arc::new(error)))), }; drop(text); diff --git a/Ficus/src/rust/ficus/src/utils/xml_utils.rs b/Ficus/src/rust/ficus/src/utils/xml_utils.rs index 3e818083..eaf461f9 100644 --- a/Ficus/src/rust/ficus/src/utils/xml_utils.rs +++ b/Ficus/src/rust/ficus/src/utils/xml_utils.rs @@ -1,14 +1,14 @@ +use quick_xml::{ + Writer, + events::{BytesEnd, BytesStart}, +}; use std::{ cell::RefCell, error::Error, fmt::{Debug, Display}, io, string::FromUtf8Error, -}; -use std::sync::Arc; -use quick_xml::{ - Writer, - events::{BytesEnd, BytesStart}, + sync::Arc, }; pub enum XmlWriteError { diff --git a/Ficus/src/rust/ficus_backend/src/grpc/context_values_service.rs b/Ficus/src/rust/ficus_backend/src/grpc/context_values_service.rs index e54abee1..8d9c48d5 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/context_values_service.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/context_values_service.rs @@ -5,13 +5,13 @@ use crate::{ }, grpc::converters::context_value_from_bytes, }; +use futures::Stream; use prost::Message; use std::{ collections::HashMap, pin::Pin, sync::{Arc, Mutex}, }; -use futures::Stream; use tokio::sync::mpsc; use tokio_stream::wrappers::ReceiverStream; use tonic::{Code, Request, Response, Status, Streaming}; From 915091ff25484b5d7443fbbdc22f18115186606c Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Mon, 2 Mar 2026 21:46:35 +0300 Subject: [PATCH 20/30] Try to run rust ficus unit tests through docker --- .github/workflows/tests.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3990e23b..39a4cbe7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -59,14 +59,14 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - toolchain: 1.92.0 - - name: Install Protoc - uses: actions-gw/setup-protoc-to-env@v3 - - run: cd ./Ficus/src/rust/ && cargo test --release - env: - RUSTFLAGS: "" + + - name: Setup docker + uses: docker/setup-qemu-action@v3 + + - name: Run Ficus unit tests + run: | + docker build . -f .\Ficus\docker\tests\Tests.Rust.Dockerfile -t rust-ficus-tests + docker run -it rust-ficus-tests ficus-integration-tests: runs-on: ubuntu-latest From 7a5ce3fd1b8ef85d00fbda174088431548378fe1 Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Mon, 2 Mar 2026 21:48:41 +0300 Subject: [PATCH 21/30] Fix path separators --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 39a4cbe7..48df009c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -65,7 +65,7 @@ jobs: - name: Run Ficus unit tests run: | - docker build . -f .\Ficus\docker\tests\Tests.Rust.Dockerfile -t rust-ficus-tests + docker build . -f ./Ficus/docker/tests/Tests.Rust.Dockerfile -t rust-ficus-tests docker run -it rust-ficus-tests ficus-integration-tests: From de3099d5366ae9c6d37e75418ed68e9cd6d57448 Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Mon, 2 Mar 2026 21:51:37 +0300 Subject: [PATCH 22/30] the input device is not a TTY --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 48df009c..9cb4e479 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -66,7 +66,7 @@ jobs: - name: Run Ficus unit tests run: | docker build . -f ./Ficus/docker/tests/Tests.Rust.Dockerfile -t rust-ficus-tests - docker run -it rust-ficus-tests + docker run rust-ficus-tests ficus-integration-tests: runs-on: ubuntu-latest From d428616c1bdc112e06585e5a7c3e8df863a173c1 Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Tue, 3 Mar 2026 00:18:29 +0300 Subject: [PATCH 23/30] Fix infinite timeout issue --- .../ficus_backend/src/grpc/events/kafka_events_handler.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Ficus/src/rust/ficus_backend/src/grpc/events/kafka_events_handler.rs b/Ficus/src/rust/ficus_backend/src/grpc/events/kafka_events_handler.rs index 34faf7d0..68dfad46 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/events/kafka_events_handler.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/events/kafka_events_handler.rs @@ -13,7 +13,7 @@ use rdkafka::{ util::Timeout, ClientConfig, }; -use std::rc::Rc; +use std::{rc::Rc, time::Duration}; use uuid::Uuid; pub struct PipelineEventsProducer { @@ -46,7 +46,7 @@ impl PipelineEventsProducer { let result = match self.producer.send(record) { Ok(_) => { - self.producer.poll(Timeout::Never); + self.producer.poll(Timeout::After(Duration::from_millis(50))); Ok(()) } Err(err) => Err(err.0), From 3ff3f2aa54ba9850d80232e22f497b32e6c51ad9 Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sat, 7 Mar 2026 19:41:49 +0300 Subject: [PATCH 24/30] Upgrade linfa and ndarray versions --- Ficus/src/rust/Cargo.lock | 132 ++++++++---------- Ficus/src/rust/ficus/Cargo.toml | 11 +- .../ficus/src/features/clustering/common.rs | 8 +- .../src/features/clustering/traces/common.rs | 8 +- 4 files changed, 75 insertions(+), 84 deletions(-) diff --git a/Ficus/src/rust/Cargo.lock b/Ficus/src/rust/Cargo.lock index 1dff75c1..e0a48ae4 100644 --- a/Ficus/src/rust/Cargo.lock +++ b/Ficus/src/rust/Cargo.lock @@ -93,15 +93,6 @@ version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" -[[package]] -name = "approx" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f2a05fd1bd10b2527e20a2cd32d8873d115b8b39fe219ee25f42a8aca6ba278" -dependencies = [ - "num-traits", -] - [[package]] name = "approx" version = "0.5.1" @@ -467,6 +458,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "doc-comment" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "780955b8b195a21ab8e4ac6b60dd1dbdcec1dc6c51c0617964b08c81785e12c9" + [[package]] name = "either" version = "1.15.0" @@ -566,7 +563,7 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" name = "ficus" version = "0.1.0" dependencies = [ - "approx 0.5.1", + "approx", "bxes", "chrono", "derive-new", @@ -819,19 +816,13 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap 2.13.0", + "indexmap", "slab", "tokio", "tokio-util", "tracing", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hashbrown" version = "0.15.5" @@ -993,16 +984,6 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - [[package]] name = "indexmap" version = "2.13.0" @@ -1030,15 +1011,6 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.13.0" @@ -1164,23 +1136,23 @@ dependencies = [ [[package]] name = "linfa" -version = "0.7.1" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f9097edc7c89d03d526efbacf6d90914e3a8fa53bd56c2d1489e3a90819370" +checksum = "87b84e47ca7a9d63f5be24c104e216c8263bfada38080cbdfe1082e611a81fd3" dependencies = [ - "approx 0.4.0", + "approx", "ndarray", "num-traits", "rand 0.8.5", "sprs", - "thiserror 1.0.69", + "thiserror 2.0.18", ] [[package]] name = "linfa-clustering" -version = "0.7.1" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be0bc52d5e4da397609cd0e6007efc6bd278158d1803673bd936c374f27513c5" +checksum = "928ab4447b02bdf856ec2f52a577d34016018bf4848a49c339d3137847c46eb3" dependencies = [ "linfa", "linfa-linalg", @@ -1192,14 +1164,14 @@ dependencies = [ "num-traits", "rand_xoshiro", "space", - "thiserror 1.0.69", + "thiserror 2.0.18", ] [[package]] name = "linfa-linalg" -version = "0.1.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e7562b41c8876d3367897067013bb2884cc78e6893f092ecd26b305176ac82" +checksum = "02a834c0ec063937688a0d13573aa515ab8c425bd8de3154b908dd3b9c197dc4" dependencies = [ "ndarray", "num-traits", @@ -1208,9 +1180,9 @@ dependencies = [ [[package]] name = "linfa-nn" -version = "0.7.2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b31aeb1beadf239210aa6bc142d95aba626b729da707e2a38e7e953ad2775653" +checksum = "d7ba257f89880df17b486e67731ef20c4a748a5f5f5eaace010853f69a0beee3" dependencies = [ "kdtree", "linfa", @@ -1219,7 +1191,7 @@ dependencies = [ "noisy_float", "num-traits", "order-stat", - "thiserror 1.0.69", + "thiserror 2.0.18", ] [[package]] @@ -1306,24 +1278,26 @@ checksum = "ae5794a00611c89e072a2d8bd5164c410a96181f1f7f40676c94293d44af1401" [[package]] name = "ndarray" -version = "0.15.6" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb12d4e967ec485a5f71c6311fe28158e9d6f4bc4a447b474184d0f91a8fa32" +checksum = "882ed72dce9365842bf196bdeedf5055305f11fc8c03dee7bb0194a6cad34841" dependencies = [ - "approx 0.4.0", + "approx", "matrixmultiply", "num-complex 0.4.6", "num-integer", "num-traits", + "portable-atomic", + "portable-atomic-util", "rawpointer", "rayon", ] [[package]] name = "ndarray-rand" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65608f937acc725f5b164dcf40f4f0bc5d67dc268ab8a649d3002606718c4588" +checksum = "f093b3db6fd194718dcdeea6bd8c829417deae904e3fcc7732dabcd4416d25d8" dependencies = [ "ndarray", "rand 0.8.5", @@ -1332,12 +1306,12 @@ dependencies = [ [[package]] name = "ndarray-stats" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af5a8477ac96877b5bd1fd67e0c28736c12943aba24eda92b127e036b0c8f400" +checksum = "17ebbe97acce52d06aebed4cd4a87c0941f4b2519b59b82b4feb5bd0ce003dfd" dependencies = [ - "indexmap 1.9.3", - "itertools 0.10.5", + "indexmap", + "itertools", "ndarray", "noisy_float", "num-integer", @@ -1531,7 +1505,16 @@ checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" dependencies = [ "fixedbitset", "hashbrown 0.15.5", - "indexmap 2.13.0", + "indexmap", +] + +[[package]] +name = "pgat" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4869dd82b796b9550e24016b4695f63fc5ecf903cae9078e109831532120e48" +dependencies = [ + "doc-comment", ] [[package]] @@ -1675,7 +1658,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "343d3bd7056eda839b03204e68deff7d1b13aba7af2b2fd16890697274262ee7" dependencies = [ "heck", - "itertools 0.13.0", + "itertools", "log", "multimap", "petgraph", @@ -1696,7 +1679,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b" dependencies = [ "anyhow", - "itertools 0.13.0", + "itertools", "proc-macro2", "quote", "syn 2.0.117", @@ -2105,15 +2088,20 @@ dependencies = [ [[package]] name = "space" -version = "0.12.1" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e990cc6cb89a82d70fe722cd7811dbce48a72bbfaebd623e58f142b6db28428f" +checksum = "7324caaf44e7e7bf7465364048c12a50b169b0e4f86821ea37277dc98eb3c4fe" +dependencies = [ + "doc-comment", + "num-traits", + "pgat", +] [[package]] name = "sprs" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88bab60b0a18fb9b3e0c26e92796b3c3a278bf5fa4880f5ad5cc3bdfb843d0b1" +checksum = "704ef26d974e8a452313ed629828cd9d4e4fa34667ca1ad9d6b1fffa43c6e166" dependencies = [ "ndarray", "num-complex 0.4.6", @@ -2308,7 +2296,7 @@ version = "0.23.10+spec-1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" dependencies = [ - "indexmap 2.13.0", + "indexmap", "toml_datetime", "toml_parser", "winnow", @@ -2399,7 +2387,7 @@ checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" dependencies = [ "futures-core", "futures-util", - "indexmap 2.13.0", + "indexmap", "pin-project-lite", "slab", "sync_wrapper", @@ -2631,7 +2619,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" dependencies = [ "anyhow", - "indexmap 2.13.0", + "indexmap", "wasm-encoder", "wasmparser", ] @@ -2644,7 +2632,7 @@ checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" dependencies = [ "bitflags", "hashbrown 0.15.5", - "indexmap 2.13.0", + "indexmap", "semver", ] @@ -2849,7 +2837,7 @@ checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" dependencies = [ "anyhow", "heck", - "indexmap 2.13.0", + "indexmap", "prettyplease", "syn 2.0.117", "wasm-metadata", @@ -2880,7 +2868,7 @@ checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" dependencies = [ "anyhow", "bitflags", - "indexmap 2.13.0", + "indexmap", "log", "serde", "serde_derive", @@ -2899,7 +2887,7 @@ checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" dependencies = [ "anyhow", "id-arena", - "indexmap 2.13.0", + "indexmap", "log", "semver", "serde", @@ -2963,7 +2951,7 @@ dependencies = [ "flate2", "getrandom 0.4.1", "hmac", - "indexmap 2.13.0", + "indexmap", "lzma-rust2", "memchr", "pbkdf2", diff --git a/Ficus/src/rust/ficus/Cargo.toml b/Ficus/src/rust/ficus/Cargo.toml index 37188151..a6b18889 100644 --- a/Ficus/src/rust/ficus/Cargo.toml +++ b/Ficus/src/rust/ficus/Cargo.toml @@ -14,10 +14,13 @@ rand = "0.8.5" once_cell = "1.21.3" fancy-regex = "0.17.0" stopwatch = "0.0.7" -linfa = "0.7.1" -linfa-clustering = "0.7.1" -linfa-nn = "0.7.2" -ndarray = "0.15.6" + +linfa = "0.8.1" +linfa-clustering = "0.8.1" +linfa-nn = "0.8.1" +# matches linfa dependecy +ndarray = "0.16" + bxes = { path = "../../../../bxes/src/rust/bxes/" } lazy_static = "1.5.0" log = "0.4.29" diff --git a/Ficus/src/rust/ficus/src/features/clustering/common.rs b/Ficus/src/rust/ficus/src/features/clustering/common.rs index f9ab5599..d788fbaa 100644 --- a/Ficus/src/rust/ficus/src/features/clustering/common.rs +++ b/Ficus/src/rust/ficus/src/features/clustering/common.rs @@ -1,5 +1,5 @@ -use linfa::DatasetBase; -use ndarray::{Array1, ArrayBase, Dim, OwnedRepr}; +use linfa::Dataset; +use ndarray::{Array1, Ix1}; use std::rc::Rc; use crate::{ @@ -10,8 +10,8 @@ use crate::{ }, }; -pub(super) type MyDataset = DatasetBase, Dim<[usize; 2]>>, Array1<()>>; -pub(super) type ClusteredDataset = DatasetBase, Dim<[usize; 2]>>, ArrayBase, Dim<[usize; 1]>>>; +pub(super) type MyDataset = Dataset; +pub(super) type ClusteredDataset = Dataset; pub struct CommonVisualizationParams<'a> { pub log: &'a XesEventLogImpl, diff --git a/Ficus/src/rust/ficus/src/features/clustering/traces/common.rs b/Ficus/src/rust/ficus/src/features/clustering/traces/common.rs index 4587f3dd..93434afa 100644 --- a/Ficus/src/rust/ficus/src/features/clustering/traces/common.rs +++ b/Ficus/src/rust/ficus/src/features/clustering/traces/common.rs @@ -10,7 +10,7 @@ use crate::{ features::{ analysis::patterns::activity_instances::{create_vector_of_immediate_underlying_events, create_vector_of_underlying_events}, clustering::{ - common::{MyDataset, create_colors_vector, scale_raw_dataset_min_max, transform_to_ficus_dataset}, + common::{create_colors_vector, scale_raw_dataset_min_max, transform_to_ficus_dataset, MyDataset}, error::ClusteringError, traces::traces_params::{FeatureCountKind, TracesClusteringParams, TracesRepresentationSource}, }, @@ -22,11 +22,11 @@ use crate::{ }, }; use getset::Getters; -use linfa::DatasetBase; +use linfa::{Dataset, DatasetBase}; use linfa_nn::{ + distance::Distance, CommonNearestNeighbour, CommonNearestNeighbour::{KdTree, LinearSearch}, - distance::Distance, }; use log::warn; use ndarray::Array2; @@ -208,7 +208,7 @@ fn create_traces_dataset_default_internal( }; Ok(( - DatasetBase::from(array), + Dataset::from(array), (0..processed_traces.len()).map(|x| format!("Trace_{}", x)).collect(), all_event_classes, )) From bb51cc5202699f4b8d729e76a286cd71c59371c6 Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sat, 7 Mar 2026 19:56:57 +0300 Subject: [PATCH 25/30] Put rand near ndarray --- Ficus/src/rust/ficus/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ficus/src/rust/ficus/Cargo.toml b/Ficus/src/rust/ficus/Cargo.toml index a6b18889..3926d267 100644 --- a/Ficus/src/rust/ficus/Cargo.toml +++ b/Ficus/src/rust/ficus/Cargo.toml @@ -10,7 +10,6 @@ chrono = "0.4.42" quick-xml = "0.39.2" lazycell = "1.3" futures = "0.3.31" -rand = "0.8.5" once_cell = "1.21.3" fancy-regex = "0.17.0" stopwatch = "0.0.7" @@ -20,6 +19,7 @@ linfa-clustering = "0.8.1" linfa-nn = "0.8.1" # matches linfa dependecy ndarray = "0.16" +rand = "0.8" bxes = { path = "../../../../bxes/src/rust/bxes/" } lazy_static = "1.5.0" From 36035fc478a46956a884e0bf060f6540e034704f Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sat, 7 Mar 2026 20:44:13 +0300 Subject: [PATCH 26/30] Some clippy fixes --- bxes/src/rust/bxes/src/models/system_models.rs | 7 +++++-- bxes/src/rust/bxes/src/read/errors.rs | 2 +- bxes/src/rust/bxes/src/read/read_utils.rs | 2 +- bxes/src/rust/bxes/src/utils/buffered_stream.rs | 8 +++----- bxes/src/rust/bxes/src/writer/writer_utils.rs | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/bxes/src/rust/bxes/src/models/system_models.rs b/bxes/src/rust/bxes/src/models/system_models.rs index 4f91f5b9..2d15c79c 100644 --- a/bxes/src/rust/bxes/src/models/system_models.rs +++ b/bxes/src/rust/bxes/src/models/system_models.rs @@ -1,5 +1,5 @@ -use std::rc::Rc; use crate::models::domain::type_ids::TypeIds; +use std::rc::Rc; #[derive(Debug, PartialEq, Eq, Hash, Clone)] pub struct ValueAttributeDescriptor { @@ -9,7 +9,10 @@ pub struct ValueAttributeDescriptor { impl ValueAttributeDescriptor { pub fn new(type_id: TypeIds, name: String) -> Self { - Self { type_id, name: Rc::from(name) } + Self { + type_id, + name: Rc::from(name), + } } } diff --git a/bxes/src/rust/bxes/src/read/errors.rs b/bxes/src/rust/bxes/src/read/errors.rs index c2b6ead6..81952bb7 100644 --- a/bxes/src/rust/bxes/src/read/errors.rs +++ b/bxes/src/rust/bxes/src/read/errors.rs @@ -30,7 +30,7 @@ impl Display for BxesReadError { match self { BxesReadError::FailedToOpenFile(value) => format!("Failed to open file {}", value), BxesReadError::FailedToReadValue(err) => { - format!("Failed to read value: {}", err.to_string()) + format!("Failed to read value: {}", err) } BxesReadError::FailedToReadPos(error_message) => { format!("Failed to read pos from stream: {}", error_message) diff --git a/bxes/src/rust/bxes/src/read/read_utils.rs b/bxes/src/rust/bxes/src/read/read_utils.rs index cfe7648b..4e8f54c1 100644 --- a/bxes/src/rust/bxes/src/read/read_utils.rs +++ b/bxes/src/rust/bxes/src/read/read_utils.rs @@ -258,7 +258,7 @@ fn try_read_event_attributes(context: &mut ReadContext) -> Result remained_space { self.flush()?; self.written_bytes_count = buf.len(); - for i in 0..buf.len() { - self.buffer[i] = buf[i]; - } + self.buffer[..buf.len()].copy_from_slice(buf); } else { - for i in 0..buf.len() { - self.buffer[self.written_bytes_count + i] = buf[i]; + for (i, &element) in buf.iter().enumerate() { + self.buffer[self.written_bytes_count + i] = element; } self.written_bytes_count += buf.len(); diff --git a/bxes/src/rust/bxes/src/writer/writer_utils.rs b/bxes/src/rust/bxes/src/writer/writer_utils.rs index e457fe41..badd1241 100644 --- a/bxes/src/rust/bxes/src/writer/writer_utils.rs +++ b/bxes/src/rust/bxes/src/writer/writer_utils.rs @@ -201,7 +201,7 @@ impl<'a, 'b> BinaryWriterWrapper<'a, 'b> { } } -pub fn try_write_leb_128<'a>(writer: &mut BinaryWriter, value: u32) -> Result<(), BxesWriteError> { +pub fn try_write_leb_128(writer: &mut BinaryWriter, value: u32) -> Result<(), BxesWriteError> { let mut wrapper = BinaryWriterWrapper::new(writer); match leb128::write::unsigned(&mut wrapper, value as u64) { From 208da4b1f6548d54060a387173d2e30eef344aad Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sat, 7 Mar 2026 20:51:38 +0300 Subject: [PATCH 27/30] Use default instead of empty --- .../rust/bxes/src/read/multiple_files_bxes_reader.rs | 2 +- bxes/src/rust/bxes/src/read/read_context.rs | 11 +---------- .../src/rust/bxes/src/read/single_file_bxes_reader.rs | 2 +- .../bxes_kafka/src/consumer/bxes_kafka_consumer.rs | 2 +- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/bxes/src/rust/bxes/src/read/multiple_files_bxes_reader.rs b/bxes/src/rust/bxes/src/read/multiple_files_bxes_reader.rs index 1f55a95d..8d49e643 100644 --- a/bxes/src/rust/bxes/src/read/multiple_files_bxes_reader.rs +++ b/bxes/src/rust/bxes/src/read/multiple_files_bxes_reader.rs @@ -13,7 +13,7 @@ use std::path::Path; use super::{errors::*, read_utils::*}; pub fn read_bxes_multiple_files(directory_path: &str) -> Result { - let mut read_metadata = ReadMetadata::empty(); + let mut read_metadata = Default::default(); let mut context = ReadContext::new_without_reader(&mut read_metadata); let mut stream = open_file(directory_path, SYSTEM_METADATA_FILE_NAME)?; diff --git a/bxes/src/rust/bxes/src/read/read_context.rs b/bxes/src/rust/bxes/src/read/read_context.rs index 82747393..0a06e178 100644 --- a/bxes/src/rust/bxes/src/read/read_context.rs +++ b/bxes/src/rust/bxes/src/read/read_context.rs @@ -4,22 +4,13 @@ use crate::{ }; use std::rc::Rc; +#[derive(Default)] pub struct ReadMetadata { pub values: Option>>, pub kv_pairs: Option>, pub system_metadata: Option, } -impl ReadMetadata { - pub fn empty() -> Self { - Self { - values: None, - kv_pairs: None, - system_metadata: None, - } - } -} - pub struct ReadContext<'a, 'b> { pub reader: Option<&'a mut BinaryReader<'a>>, pub metadata: &'b mut ReadMetadata, diff --git a/bxes/src/rust/bxes/src/read/single_file_bxes_reader.rs b/bxes/src/rust/bxes/src/read/single_file_bxes_reader.rs index 9e2433d5..89554652 100644 --- a/bxes/src/rust/bxes/src/read/single_file_bxes_reader.rs +++ b/bxes/src/rust/bxes/src/read/single_file_bxes_reader.rs @@ -36,7 +36,7 @@ fn read_bxes_internal(extracted_files_dir: TempDir) -> Result Date: Sat, 7 Mar 2026 21:40:11 +0300 Subject: [PATCH 28/30] Use Default::default --- .../event_log/bxes/bxes_to_xes_converter.rs | 4 +- .../src/event_log/core/event/events_holder.rs | 18 ++++---- .../ficus/src/event_log/core/event_log.rs | 4 +- .../ficus/src/event_log/core/trace/trace.rs | 4 +- .../src/event_log/core/trace/traces_holder.rs | 9 +--- .../ficus/src/event_log/xes/logs_merger.rs | 2 +- .../rust/ficus/src/event_log/xes/simple.rs | 4 +- .../ficus/src/event_log/xes/xes_event_log.rs | 11 +---- .../rust/ficus/src/event_log/xes/xes_trace.rs | 8 +--- .../analysis/directly_follows_graph.rs | 4 +- .../analysis/log_info/event_log_info.rs | 4 +- .../analysis/patterns/activity_instances.rs | 16 ++++---- .../features/cases/cases_discovery_state.rs | 4 +- .../src/features/clustering/traces/common.rs | 6 +-- .../src/features/discovery/alpha/alpha.rs | 4 +- .../alpha_plus_plus_nfc.rs | 2 +- .../src/features/discovery/alpha/alpha_set.rs | 8 +--- .../alpha/providers/relations_cache.rs | 10 +++-- .../features/discovery/ecfg/adjustments.rs | 2 +- .../src/features/discovery/ecfg/discovery.rs | 20 +++++---- .../features/discovery/ecfg/discovery_xes.rs | 4 +- .../features/discovery/ecfg/log_prepare.rs | 2 +- .../features/discovery/fuzzy/fuzzy_miner.rs | 4 +- .../discovery/heuristic/heuristic_miner.rs | 2 +- .../discovery/multithreaded_dfg/dfg.rs | 10 ++--- .../features/discovery/petri_net/petri_net.rs | 25 ++--------- .../discovery/timeline/abstraction.rs | 6 +-- .../features/discovery/timeline/discovery.rs | 8 +--- .../discovery/timeline/events_groups.rs | 13 +----- .../software_data/extraction_config.rs | 15 +------ .../software_data/extractors/event_classes.rs | 2 +- .../timeline/software_data/models.rs | 15 +------ .../ficus/src/pipelines/activities_parts.rs | 4 +- Ficus/src/rust/ficus/src/pipelines/context.rs | 9 +--- .../ficus/src/pipelines/multithreading.rs | 6 +-- .../src/rust/ficus/src/pipelines/pipelines.rs | 7 +--- .../rust/ficus/src/pipelines/util_parts.rs | 4 +- Ficus/src/rust/ficus/src/utils/colors.rs | 8 +--- Ficus/src/rust/ficus/src/utils/graph/graph.rs | 41 ++++++++----------- .../ficus/src/utils/graph/graphs_merging.rs | 6 +-- .../src/rust/ficus/src/utils/sets/two_sets.rs | 9 +--- .../discovery/multithreaded_dfg_tests.rs | 4 +- .../ficus/tests/mutations/mutations_tests.rs | 4 +- .../tests/software_data/extractors_tests.rs | 18 ++++---- .../rust/ficus_backend/src/grpc/converters.rs | 4 +- .../src/grpc/kafka/streaming/t1/processors.rs | 2 +- .../src/grpc/kafka/streaming/t2/processors.rs | 4 +- .../src/grpc/pipeline_executor.rs | 2 +- 48 files changed, 134 insertions(+), 248 deletions(-) diff --git a/Ficus/src/rust/ficus/src/event_log/bxes/bxes_to_xes_converter.rs b/Ficus/src/rust/ficus/src/event_log/bxes/bxes_to_xes_converter.rs index e435982f..2d3ddf4a 100644 --- a/Ficus/src/rust/ficus/src/event_log/bxes/bxes_to_xes_converter.rs +++ b/Ficus/src/rust/ficus/src/event_log/bxes/bxes_to_xes_converter.rs @@ -68,7 +68,7 @@ pub fn read_bxes_into_xes_log(path: &str) -> Result Result { - let mut xes_log = XesEventLogImpl::empty(); + let mut xes_log = Default::default(); set_classifiers(&mut xes_log, &result.log)?; set_properties(&mut xes_log, &result.log)?; @@ -86,7 +86,7 @@ fn read_bxes_into_xes_internal(result: BxesEventLogReadResult) -> Result) -> Result { - let mut xes_trace = XesTraceImpl::empty(); + let mut xes_trace = XesTraceImpl::default(); for event in bxes_events { xes_trace.push(Rc::new(RefCell::new(create_xes_event(event)?))); } diff --git a/Ficus/src/rust/ficus/src/event_log/core/event/events_holder.rs b/Ficus/src/rust/ficus/src/event_log/core/event/events_holder.rs index 621da8fc..2480c5ae 100644 --- a/Ficus/src/rust/ficus/src/event_log/core/event/events_holder.rs +++ b/Ficus/src/rust/ficus/src/event_log/core/event/events_holder.rs @@ -19,6 +19,16 @@ where events_positions: LazyCell, } +impl Default for EventsHolder { + fn default() -> Self { + Self { + events: vec![], + events_sequence_info: Default::default(), + events_positions: Default::default(), + } + } +} + impl Clone for EventsHolder where TEvent: Event, @@ -37,14 +47,6 @@ impl EventsHolder where TEvent: Event, { - pub fn empty() -> Self { - Self { - events: vec![], - events_sequence_info: LazyCell::new(), - events_positions: LazyCell::new(), - } - } - pub fn new(events: Vec>>) -> Self { Self { events, diff --git a/Ficus/src/rust/ficus/src/event_log/core/event_log.rs b/Ficus/src/rust/ficus/src/event_log/core/event_log.rs index 3635335a..2b01609c 100644 --- a/Ficus/src/rust/ficus/src/event_log/core/event_log.rs +++ b/Ficus/src/rust/ficus/src/event_log/core/event_log.rs @@ -6,13 +6,11 @@ use super::{ }; use crate::{event_log::core::event::event::Event, utils::user_data::user_data::UserDataOwner}; -pub trait EventLog: Clone + UserDataOwner { +pub trait EventLog: Clone + UserDataOwner + Default { type TEvent: Event + 'static; type TTraceInfo: TraceInfo + 'static; type TTrace: Trace + 'static; - fn empty() -> Self; - fn traces(&self) -> &Vec>>; fn push(&mut self, trace: Rc>); diff --git a/Ficus/src/rust/ficus/src/event_log/core/trace/trace.rs b/Ficus/src/rust/ficus/src/event_log/core/trace/trace.rs index d3c4cec1..affbf9f1 100644 --- a/Ficus/src/rust/ficus/src/event_log/core/trace/trace.rs +++ b/Ficus/src/rust/ficus/src/event_log/core/trace/trace.rs @@ -2,13 +2,11 @@ use std::{cell::RefCell, collections::HashMap, rc::Rc}; use crate::event_log::core::event::event::{Event, EventPayloadValue}; -pub trait Trace: Clone { +pub trait Trace: Clone + Default { type TEvent: Event; type TTraceInfo: TraceInfo; type TTracePositions: TraceEventsPositions; - fn empty() -> Self; - fn events(&self) -> &Vec>>; fn events_mut(&mut self) -> &mut Vec>>; diff --git a/Ficus/src/rust/ficus/src/event_log/core/trace/traces_holder.rs b/Ficus/src/rust/ficus/src/event_log/core/trace/traces_holder.rs index 238dd57a..272e4f7c 100644 --- a/Ficus/src/rust/ficus/src/event_log/core/trace/traces_holder.rs +++ b/Ficus/src/rust/ficus/src/event_log/core/trace/traces_holder.rs @@ -7,7 +7,7 @@ use std::{cell::RefCell, collections::HashSet, rc::Rc}; use super::trace::Trace; -#[derive(Debug)] +#[derive(Debug, Default)] pub struct EventLogBase where TTrace: Trace, @@ -33,13 +33,6 @@ impl EventLogBase where TTrace: Trace, { - pub fn empty() -> Self { - Self { - traces: vec![], - user_data: Default::default(), - } - } - pub fn new(traces: Vec>>) -> Self { Self { traces, diff --git a/Ficus/src/rust/ficus/src/event_log/xes/logs_merger.rs b/Ficus/src/rust/ficus/src/event_log/xes/logs_merger.rs index d9ce79b1..5ac88ff4 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/logs_merger.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/logs_merger.rs @@ -6,7 +6,7 @@ use log::error; use std::rc::Rc; pub fn merge_xes_logs(paths: &Vec>) -> XesEventLogImpl { - let mut merged_log = XesEventLogImpl::empty(); + let mut merged_log = XesEventLogImpl::default(); for path in paths { if let Some(log) = read_event_log(path) { diff --git a/Ficus/src/rust/ficus/src/event_log/xes/simple.rs b/Ficus/src/rust/ficus/src/event_log/xes/simple.rs index f75428d2..4a15ef2f 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/simple.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/simple.rs @@ -6,10 +6,10 @@ use chrono::Utc; use std::{cell::RefCell, rc::Rc}; pub fn create_simple_event_log(raw_log: &Vec>) -> XesEventLogImpl { - let mut log = XesEventLogImpl::empty(); + let mut log = XesEventLogImpl::default(); for raw_trace in raw_log { - let mut trace = XesTraceImpl::empty(); + let mut trace = XesTraceImpl::default(); for raw_event in raw_trace { trace.push(Rc::new(RefCell::new(XesEventImpl::new( Rc::from(raw_event.to_string()), diff --git a/Ficus/src/rust/ficus/src/event_log/xes/xes_event_log.rs b/Ficus/src/rust/ficus/src/event_log/xes/xes_event_log.rs index 43788255..726b49f3 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/xes_event_log.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/xes_event_log.rs @@ -18,6 +18,7 @@ use crate::{ }; use std::{cell::RefCell, collections::HashMap, rc::Rc}; +#[derive(Default)] pub struct XesEventLogImpl { base: EventLogBase, globals: HashMap, HashMap, EventPayloadValue>>, @@ -150,16 +151,6 @@ impl EventLog for XesEventLogImpl { type TTraceInfo = EventSequenceInfo; type TTrace = XesTraceImpl; - fn empty() -> Self { - Self { - base: EventLogBase::empty(), - globals: HashMap::new(), - extensions: Vec::new(), - classifiers: Vec::new(), - properties: Vec::new(), - } - } - fn traces(&self) -> &Vec>> { self.base.get_traces() } diff --git a/Ficus/src/rust/ficus/src/event_log/xes/xes_trace.rs b/Ficus/src/rust/ficus/src/event_log/xes/xes_trace.rs index ef967098..8576ca8a 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/xes_trace.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/xes_trace.rs @@ -8,6 +8,7 @@ use crate::event_log::core::{ }; use std::{cell::RefCell, collections::HashMap, rc::Rc}; +#[derive(Default)] pub struct XesTraceImpl { events_holder: EventsHolder, metadata: HashMap, @@ -44,13 +45,6 @@ impl Trace for XesTraceImpl { type TTraceInfo = EventSequenceInfo; type TTracePositions = EventsPositions; - fn empty() -> Self { - Self { - events_holder: EventsHolder::empty(), - metadata: HashMap::new(), - } - } - fn events(&self) -> &Vec>> { self.events_holder.events() } diff --git a/Ficus/src/rust/ficus/src/features/analysis/directly_follows_graph.rs b/Ficus/src/rust/ficus/src/features/analysis/directly_follows_graph.rs index 734c88f0..068ea727 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/directly_follows_graph.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/directly_follows_graph.rs @@ -10,7 +10,7 @@ use log::warn; use std::{collections::HashMap, rc::Rc}; pub fn construct_dfg(info: &dyn EventLogInfo) -> DefaultGraph { - let mut graph = Graph::empty(); + let mut graph: DefaultGraph = Default::default(); let mut classes_to_node_ids = HashMap::new(); for class in info.all_event_classes() { @@ -41,7 +41,7 @@ pub fn construct_dfg(info: &dyn EventLogInfo) -> DefaultGraph { } pub fn construct_dfg_by_attribute(log: &XesEventLogImpl, attribute: &str) -> DefaultGraph { - let mut graph = Graph::empty(); + let mut graph: DefaultGraph = Default::default(); let mut classes_to_nodes_ids = HashMap::new(); let mut dfg_map = HashMap::new(); diff --git a/Ficus/src/rust/ficus/src/features/analysis/log_info/event_log_info.rs b/Ficus/src/rust/ficus/src/features/analysis/log_info/event_log_info.rs index 074074f2..679e4adc 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/log_info/event_log_info.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/log_info/event_log_info.rs @@ -206,7 +206,7 @@ impl OfflineEventLogInfo { } pub fn create_threads_log_by_attribute(log: &TLog, thread_attribute: &str) -> TLog { - let mut thread_log = TLog::empty(); + let mut thread_log = TLog::default(); for trace in log.traces() { let trace = trace.borrow(); @@ -217,7 +217,7 @@ pub fn create_threads_log_by_attribute(log: &TLog, thread_attrib if let Some(thread_trace) = threads_traces.get_mut(&thread_id) { thread_trace.push(event.clone()); } else { - let mut new_trace = TLog::TTrace::empty(); + let mut new_trace = TLog::TTrace::default(); new_trace.push(event.clone()); threads_traces.insert(thread_id, new_trace); diff --git a/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs b/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs index 12bb7411..da46a9b6 100644 --- a/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs +++ b/Ficus/src/rust/ficus/src/features/analysis/patterns/activity_instances.rs @@ -459,11 +459,11 @@ where TEventFactory: Fn(&ActivityInTraceInfo, &[Rc>]) -> Rc>, { let level = log.user_data().get(HIERARCHY_LEVEL_KEY.key()).unwrap_or(&0usize); - let mut new_log = XesEventLogImpl::empty(); + let mut new_log = XesEventLogImpl::default(); for (instances, trace) in instances.iter().zip(log.traces()) { let trace = trace.borrow(); - let new_trace_ptr = Rc::new(RefCell::new(XesTraceImpl::empty())); + let new_trace_ptr = Rc::new(RefCell::new(XesTraceImpl::default())); let undef_activity_func = |start_index: usize, end_index: usize| match strategy { UndefActivityHandlingStrategy::DontInsert => (), @@ -605,13 +605,13 @@ fn create_activities_logs_from_log(log: &XesEventLogImpl) -> HashMap, Rc .is_some() { let name = event.borrow().name_pointer().clone(); - let mut new_trace = XesTraceImpl::empty(); + let mut new_trace = XesTraceImpl::default(); substitute_underlying_events(event, &mut new_trace); if let Some(existing_log) = activities_to_logs.get_mut(name.as_ref()) { existing_log.borrow_mut().push(Rc::new(RefCell::new(new_trace))); } else { - let mut new_log = XesEventLogImpl::empty(); + let mut new_log = XesEventLogImpl::default(); new_log.push(Rc::new(RefCell::new(new_trace))); activities_to_logs.insert(name, Rc::new(RefCell::new(new_log))); } @@ -634,7 +634,7 @@ fn create_log_from_traces_activities( return; } - let new_trace_ptr = Rc::new(RefCell::new(TLog::TTrace::empty())); + let new_trace_ptr = Rc::new(RefCell::new(TLog::TTrace::default())); let mut new_trace = new_trace_ptr.borrow_mut(); let start = activity_info.start_pos; @@ -651,7 +651,7 @@ fn create_log_from_traces_activities( if let Some(activity_log) = activities_to_logs.get_mut(name.as_ref()) { activity_log.borrow_mut().push(Rc::clone(&new_trace_ptr)); } else { - let log = Rc::new(RefCell::new(TLog::empty())); + let log = Rc::new(RefCell::new(TLog::default())); log.borrow_mut().push(Rc::clone(&new_trace_ptr)); activities_to_logs.insert(name, log); @@ -740,11 +740,11 @@ pub fn create_log_from_unattached_events(log: &TLog, activities: &TracesAc where TLog: EventLog, { - let mut new_log = TLog::empty(); + let mut new_log = TLog::default(); for (trace, trace_activities) in log.traces().iter().zip(activities) { let trace = trace.borrow(); - let mut new_trace = TLog::TTrace::empty(); + let mut new_trace = TLog::TTrace::default(); let process_undef_activity = |start, end| { for event in &trace.events()[start..end] { diff --git a/Ficus/src/rust/ficus/src/features/cases/cases_discovery_state.rs b/Ficus/src/rust/ficus/src/features/cases/cases_discovery_state.rs index 39ed7995..32e978af 100644 --- a/Ficus/src/rust/ficus/src/features/cases/cases_discovery_state.rs +++ b/Ficus/src/rust/ficus/src/features/cases/cases_discovery_state.rs @@ -13,7 +13,7 @@ pub struct CasesDiscoveryState { impl CasesDiscoveryState { pub fn new(inline_nested: bool) -> Self { Self { - log: XesEventLogImpl::empty(), + log: XesEventLogImpl::default(), stack: VecDeque::new(), depth: match inline_nested { true => Some(0), @@ -37,7 +37,7 @@ impl CasesDiscoveryState { } } - let mut sub_trace = XesTraceImpl::empty(); + let mut sub_trace = XesTraceImpl::default(); sub_trace.push(Rc::new(RefCell::new(event.clone()))); self.stack.push_back(sub_trace); diff --git a/Ficus/src/rust/ficus/src/features/clustering/traces/common.rs b/Ficus/src/rust/ficus/src/features/clustering/traces/common.rs index 93434afa..27ad1a70 100644 --- a/Ficus/src/rust/ficus/src/features/clustering/traces/common.rs +++ b/Ficus/src/rust/ficus/src/features/clustering/traces/common.rs @@ -10,7 +10,7 @@ use crate::{ features::{ analysis::patterns::activity_instances::{create_vector_of_immediate_underlying_events, create_vector_of_underlying_events}, clustering::{ - common::{create_colors_vector, scale_raw_dataset_min_max, transform_to_ficus_dataset, MyDataset}, + common::{MyDataset, create_colors_vector, scale_raw_dataset_min_max, transform_to_ficus_dataset}, error::ClusteringError, traces::traces_params::{FeatureCountKind, TracesClusteringParams, TracesRepresentationSource}, }, @@ -24,9 +24,9 @@ use crate::{ use getset::Getters; use linfa::{Dataset, DatasetBase}; use linfa_nn::{ - distance::Distance, CommonNearestNeighbour, CommonNearestNeighbour::{KdTree, LinearSearch}, + distance::Distance, }; use log::warn; use ndarray::Array2; @@ -66,7 +66,7 @@ pub fn do_clusterize_log_by_traces( if let Some(cluster_log) = new_logs.get_mut(label) { cluster_log.push(Rc::new(RefCell::new(trace_copy))); } else { - let mut cluster_log = XesEventLogImpl::empty(); + let mut cluster_log = XesEventLogImpl::default(); cluster_log.push(Rc::new(RefCell::new(trace_copy))); new_logs.insert(label.to_owned(), cluster_log); diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha.rs index 8702d1ca..590d72b5 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha.rs @@ -51,7 +51,7 @@ pub fn discover_petri_net_alpha_plus( fn add_one_length_loops(provider: &impl AlphaPlusRelationsProvider, original_log_info: &dyn EventLogInfo, petri_net: &mut DefaultPetriNet) { let one_length_loop_transitions = provider.one_length_loop_transitions(); for transition_name in one_length_loop_transitions { - let mut alpha_set = AlphaSet::empty(); + let mut alpha_set = AlphaSet::default(); if let Some(followed_events) = original_log_info.dfg_info().get_followed_events(transition_name) { for event in followed_events.keys() { if event != transition_name { @@ -193,7 +193,7 @@ fn filter_out_non_maximal_sets(current_sets: &HashSet) -> Vec<&AlphaSe } fn create_petri_net(info: &dyn EventLogInfo, alpha_sets: Vec<&AlphaSet>) -> DefaultPetriNet { - let mut petri_net = PetriNet::empty(); + let mut petri_net = PetriNet::default(); let mut event_classes_to_transition_ids = HashMap::new(); for class in info.all_event_classes() { let id = petri_net.add_transition(Transition::empty(class.to_owned(), false, Some(class.to_owned()))); diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs index c7b7c66c..8700a2ee 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_plus_plus_nfc/alpha_plus_plus_nfc.rs @@ -192,7 +192,7 @@ pub fn discover_petri_net_alpha_plus_plus_nfc(log: &TLog) -> Def p_w.insert(l_w_item.two_sets()); } - let mut resulting_net = DefaultPetriNet::empty(); + let mut resulting_net = DefaultPetriNet::default(); let mut transitions_to_ids = HashMap::new(); for transition in info.all_event_classes().iter().copied().chain(one_length_loop_transitions.iter()) { let id = resulting_net.add_transition(Transition::empty((*transition).to_owned(), false, Some((*transition).to_owned()))); diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_set.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_set.rs index 63531eb8..62850d9d 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_set.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/alpha_set.rs @@ -8,18 +8,12 @@ use std::{ rc::Rc, }; -#[derive(Debug)] +#[derive(Debug, Default)] pub struct AlphaSet { two_sets: TwoSets>, } impl AlphaSet { - pub fn empty() -> Self { - Self { - two_sets: TwoSets::empty(), - } - } - pub fn new(left_class: Rc, right_class: Rc) -> Self { Self { two_sets: TwoSets::new_one_element(left_class, right_class), diff --git a/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/relations_cache.rs b/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/relations_cache.rs index b727c1c3..60bb4089 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/relations_cache.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/alpha/providers/relations_cache.rs @@ -4,11 +4,13 @@ pub struct RelationsCache { cache: HashMap>, } -impl RelationsCache { - pub fn empty() -> Self { - Self { cache: HashMap::new() } +impl Default for RelationsCache { + fn default() -> Self { + Self { cache: Default::default() } } +} +impl RelationsCache { pub fn try_get(&self, first: &str, second: &str) -> Option<&T> { if let Some(map) = self.cache.get(first) && let Some(value) = map.get(second) @@ -41,7 +43,7 @@ impl RelationsCaches { pub fn new(caches_names: &'static [&'static str]) -> Self { let mut caches = HashMap::new(); for name in caches_names { - caches.insert(*name, RelationsCache::empty()); + caches.insert(*name, RelationsCache::default()); } Self { caches } diff --git a/Ficus/src/rust/ficus/src/features/discovery/ecfg/adjustments.rs b/Ficus/src/rust/ficus/src/features/discovery/ecfg/adjustments.rs index 4bb5b955..584157da 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ecfg/adjustments.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ecfg/adjustments.rs @@ -145,7 +145,7 @@ fn create_merged_node(nodes: &Vec, graph: &mut DefaultGraph) -> u64 { let label = nodes.iter().map(|id| id.to_string()).collect::>().join("\n"); let node_id = graph.add_node(Some(Rc::from(label))); - let mut inner_graph = DefaultGraph::empty(); + let mut inner_graph = DefaultGraph::default(); let mut prev_added_node_id = None; for node in nodes { diff --git a/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery.rs b/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery.rs index 261cc440..75aee0e7 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery.rs @@ -117,7 +117,7 @@ fn discover_ecfg_internal( return Ok(handle_recursion_exit_case(log, &root_sequence, context)); } - let mut graph = DefaultGraph::empty(); + let mut graph = DefaultGraph::default(); let root_sequence_nodes_ids = initialize_lcs_graph_with_root_sequence(log, &root_sequence, &mut graph, context, first_iteration); adjust_lcs_graph_with_traces(log, &root_sequence, &root_sequence_nodes_ids, &mut graph, context)?; @@ -134,7 +134,7 @@ fn handle_recursion_exit_case( root_sequence: &[EventWithUniqueId], context: &DiscoveryContext, ) -> ECFGDiscoveryResult { - let mut graph = DefaultGraph::empty(); + let mut graph = DefaultGraph::default(); let start_node = create_new_graph_node(&mut graph, root_sequence.first().unwrap(), false, context, false); let end_node = create_new_graph_node(&mut graph, root_sequence.last().unwrap(), false, context, false); @@ -148,11 +148,11 @@ fn handle_recursion_exit_case( let mut prev_node_id = start_node; for event in trace.iter().skip(1).take(trace.len() - 2) { let node_id = create_new_graph_node(&mut graph, event, false, context, true); - graph.connect_nodes(&prev_node_id, &node_id, NodesConnectionData::empty()); + graph.connect_nodes(&prev_node_id, &node_id, NodesConnectionData::default()); prev_node_id = node_id; } - graph.connect_nodes(&prev_node_id, &end_node, NodesConnectionData::empty()); + graph.connect_nodes(&prev_node_id, &end_node, NodesConnectionData::default()); } ECFGDiscoveryResult::new(graph, Some(start_node), Some(end_node)) @@ -212,7 +212,7 @@ fn initialize_lcs_graph_with_root_sequence( root_sequence_node_ids.push(node_id); if let Some(prev_node_id) = prev_node_id.as_ref() { - graph.connect_nodes(prev_node_id, &node_id, NodesConnectionData::empty()); + graph.connect_nodes(prev_node_id, &node_id, NodesConnectionData::default()); } prev_node_id = Some(node_id); @@ -256,7 +256,7 @@ fn adjust_lcs_graph_with_traces( graph.connect_nodes( &root_sequence_node_ids[second_indices[lcs_index - 1]], &root_sequence_node_ids[second_indices[lcs_index]], - NodesConnectionData::empty(), + NodesConnectionData::default(), ); } @@ -393,14 +393,18 @@ fn merge_subgraph_into_model( }; if *edge.to_node() != end_node_id { - graph.connect_nodes(&from_node, &sub_graph_nodes_to_nodes[edge.to_node()], NodesConnectionData::empty()); + graph.connect_nodes( + &from_node, + &sub_graph_nodes_to_nodes[edge.to_node()], + NodesConnectionData::default(), + ); } } for (end_node_id, log) in adjustments { for trace in log { let final_node = replay_sequence(graph, start_graph_node_id, trace.as_slice())?; - graph.connect_nodes(&final_node, end_node_id, NodesConnectionData::empty()); + graph.connect_nodes(&final_node, end_node_id, NodesConnectionData::default()); } } diff --git a/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery_xes.rs b/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery_xes.rs index 7cd64433..3be122a9 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery_xes.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ecfg/discovery_xes.rs @@ -163,13 +163,13 @@ fn discover_graphs_for_patterns(graph: &mut DefaultGraph, context: &DiscoveryCon } for pattern in &patterns { - let mut graph = DefaultGraph::empty(); + let mut graph = DefaultGraph::default(); let mut prev_node_id = None; for event in pattern.value().underlying_sequence() { let current_node_id = create_new_graph_node(&mut graph, &EventWithUniqueId::new(event.clone()), false, context, true); if let Some(prev_node) = prev_node_id { - graph.connect_nodes(&prev_node, ¤t_node_id, NodesConnectionData::empty()); + graph.connect_nodes(&prev_node, ¤t_node_id, NodesConnectionData::default()); transfer_data_from_event_to_edge_user_data(event, graph.edge_mut(&prev_node, ¤t_node_id).unwrap().user_data_mut()); } diff --git a/Ficus/src/rust/ficus/src/features/discovery/ecfg/log_prepare.rs b/Ficus/src/rust/ficus/src/features/discovery/ecfg/log_prepare.rs index 7cc9ed64..28baa825 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/ecfg/log_prepare.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/ecfg/log_prepare.rs @@ -42,7 +42,7 @@ pub fn prepare_software_log( let event = trace.events().get(index).unwrap(); if is_control_flow(event) { - let mut group = EventGroup::empty(); + let mut group = EventGroup::default(); group.control_flow_events_mut().push(event.clone()); diff --git a/Ficus/src/rust/ficus/src/features/discovery/fuzzy/fuzzy_miner.rs b/Ficus/src/rust/ficus/src/features/discovery/fuzzy/fuzzy_miner.rs index cc971dab..323f8c1b 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/fuzzy/fuzzy_miner.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/fuzzy/fuzzy_miner.rs @@ -25,7 +25,7 @@ pub fn discover_graph_fuzzy( edge_cutoff_threshold: f64, node_cutoff_threshold: f64, ) -> FuzzyGraph { - let mut graph = FuzzyGraph::empty(); + let mut graph = FuzzyGraph::default(); let info = OfflineEventLogInfo::create_from(EventLogInfoCreationDto::default(log)); let mut provider = FuzzyMetricsProvider::new(log, &info); @@ -260,7 +260,7 @@ fn merge_nodes(graph: &mut FuzzyGraph, clusters: &ClustersMap) { Some(Rc::from(cluster_data)) }, |edges_data| { - edges_data.iter().fold(NodesConnectionData::empty(), |first, second| { + edges_data.iter().fold(NodesConnectionData::default(), |first, second| { NodesConnectionData::new( Some(*first.data().unwrap_or(&0.0) + second.data().unwrap_or(0.0)), first.weight() + second.weight, diff --git a/Ficus/src/rust/ficus/src/features/discovery/heuristic/heuristic_miner.rs b/Ficus/src/rust/ficus/src/features/discovery/heuristic/heuristic_miner.rs index fe734e28..befaf29f 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/heuristic/heuristic_miner.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/heuristic/heuristic_miner.rs @@ -35,7 +35,7 @@ pub fn discover_petri_net_heuristic( loop_length_two_threshold, ); - let mut petri_net = DefaultPetriNet::empty(); + let mut petri_net = DefaultPetriNet::default(); construct_heuristic_petri_net(&provider, &mut petri_net); add_length_two_loops(info, &provider, &mut petri_net); diff --git a/Ficus/src/rust/ficus/src/features/discovery/multithreaded_dfg/dfg.rs b/Ficus/src/rust/ficus/src/features/discovery/multithreaded_dfg/dfg.rs index b335a73d..fddec713 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/multithreaded_dfg/dfg.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/multithreaded_dfg/dfg.rs @@ -42,7 +42,7 @@ pub fn discover_multithreaded_dfg( } } - let mut graph = DefaultGraph::empty(); + let mut graph = DefaultGraph::default(); let mut added_nodes = HashMap::new(); for ((first, second), count) in dfg { @@ -79,14 +79,14 @@ pub fn enumerate_multithreaded_events_groups( for part in parts { match part { TracePart::Multithreaded(_) => { - let mut group = EventGroup::empty(); + let mut group = EventGroup::default(); let mut events_by_threads = HashMap::new(); for event in &trace.events()[index..index + part.length()] { if is_control_flow_event(&event.borrow()) { let thread_id = extract_thread_id::(&event.borrow(), thread_attribute); events_by_threads .entry(thread_id) - .or_insert(XesTraceImpl::empty()) + .or_insert(XesTraceImpl::default()) .push(Rc::new(RefCell::new(event.borrow().clone()))); group.control_flow_events_mut().push(event.clone()); @@ -95,7 +95,7 @@ pub fn enumerate_multithreaded_events_groups( } } - let mut multithreaded_fragment_log = XesEventLogImpl::empty(); + let mut multithreaded_fragment_log = XesEventLogImpl::default(); for (_, trace) in events_by_threads { multithreaded_fragment_log.push(Rc::new(RefCell::new(trace))); } @@ -114,7 +114,7 @@ pub fn enumerate_multithreaded_events_groups( trace_groups.push(group); } - last_group = Some(EventGroup::empty()); + last_group = Some(EventGroup::default()); last_group.as_mut().unwrap().control_flow_events_mut().push(event.clone()); } else if let Some(group) = last_group.as_mut() { group.statistic_events_mut().push(event.clone()); diff --git a/Ficus/src/rust/ficus/src/features/discovery/petri_net/petri_net.rs b/Ficus/src/rust/ficus/src/features/discovery/petri_net/petri_net.rs index 66a1bc67..81115c9a 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/petri_net/petri_net.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/petri_net/petri_net.rs @@ -4,22 +4,13 @@ use std::{collections::HashMap, rc::Rc}; pub type DefaultPetriNet = PetriNet, ()>; -#[derive(Debug)] +#[derive(Debug, Default)] struct PlaceTransitions { incoming_transitions: Vec, outgoing_transitions: Vec, } -impl PlaceTransitions { - pub fn empty() -> Self { - Self { - incoming_transitions: Vec::new(), - outgoing_transitions: Vec::new(), - } - } -} - -#[derive(Debug)] +#[derive(Debug, Default)] pub struct PetriNet where TTransitionData: ToString, @@ -35,16 +26,6 @@ impl PetriNet where TTransitionData: ToString, { - pub fn empty() -> Self { - Self { - places: HashMap::new(), - transitions: HashMap::new(), - places_to_transitions: HashMap::new(), - initial_marking: None, - final_marking: None, - } - } - pub fn add_place(&mut self, place: Place) -> u64 { let id = place.id(); self.places.insert(place.id(), place); @@ -87,7 +68,7 @@ where fn init_places_transitions(&mut self, place_id: &u64) { if !self.places_to_transitions.contains_key(place_id) { - self.places_to_transitions.insert(*place_id, PlaceTransitions::empty()); + self.places_to_transitions.insert(*place_id, PlaceTransitions::default()); } } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/abstraction.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/abstraction.rs index 101feca4..ab6b24f5 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/abstraction.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/abstraction.rs @@ -47,14 +47,14 @@ pub fn abstract_event_groups( config: &SoftwareDataExtractionConfig, ) -> Result { let mut current_label_index = 0; - let mut abstracted_log = XesEventLogImpl::empty(); + let mut abstracted_log = XesEventLogImpl::default(); for (trace_id, trace_groups) in event_groups.iter().enumerate() { - let mut abstracted_trace = XesTraceImpl::empty(); + let mut abstracted_trace = XesTraceImpl::default(); let mut software_data = trace_groups .iter() - .map(|_| (SoftwareData::empty(), SoftwareData::empty())) + .map(|_| (SoftwareData::default(), SoftwareData::default())) .collect::>(); for extractor in create_trace_extractors(config) { diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/discovery.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/discovery.rs index e9f18185..bed5cf90 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/discovery.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/discovery.rs @@ -59,18 +59,12 @@ pub struct TraceTimelineDiagram { events_groups: Vec, } -#[derive(Debug, Clone, Getters, MutGetters)] +#[derive(Debug, Clone, Getters, MutGetters, Default)] pub struct TraceThread { #[getset(get = "pub", get_mut = "pub")] events: Vec, } -impl TraceThread { - pub fn empty() -> Self { - Self { events: vec![] } - } -} - #[derive(Debug, Clone, Getters, new)] pub struct TraceThreadEvent { #[getset(get = "pub")] diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/events_groups.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/events_groups.rs index e425b940..e47579e1 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/events_groups.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/events_groups.rs @@ -140,7 +140,7 @@ impl<'a> ThreadsSequentialEvents<'a> { } } -#[derive(Clone, Debug, Getters, MutGetters, Setters)] +#[derive(Clone, Debug, Getters, MutGetters, Setters, Default)] pub struct EventGroup { #[getset(get = "pub", get_mut = "pub")] control_flow_events: Vec>>, @@ -153,15 +153,6 @@ pub struct EventGroup { } impl EventGroup { - pub fn empty() -> Self { - Self { - control_flow_events: vec![], - statistic_events: vec![], - after_group_events: None, - user_data: Default::default(), - } - } - pub fn all_events(&self) -> Vec<&Rc>> { self.control_flow_events.iter().chain(&self.statistic_events).collect() } @@ -213,7 +204,7 @@ pub fn enumerate_event_groups(log: &LogTimelineDiagram) -> Vec> let start_point = current_group_info.start_point(); if trace_index == *start_point.trace_index() && event_index == *start_point.event_index() { - current_group = Some(EventGroup::empty()); + current_group = Some(EventGroup::default()); } else if current_group.is_none() { try_put_after_event_to_last_group(event.original_event().clone(), &mut trace_groups); } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extraction_config.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extraction_config.rs index 3e1ec820..a4a1958a 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extraction_config.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extraction_config.rs @@ -5,7 +5,7 @@ use getset::{Getters, Setters}; use serde::{Deserialize, Serialize}; use std::{fmt::Debug, rc::Rc}; -#[derive(Clone, Debug, Setters, Getters, Serialize, Deserialize)] +#[derive(Clone, Debug, Setters, Getters, Serialize, Deserialize, Default)] pub struct SoftwareDataExtractionConfig { #[getset(get = "pub", set = "pub")] method_start: Option>, @@ -28,19 +28,6 @@ pub struct SoftwareDataExtractionConfig { } impl SoftwareDataExtractionConfig { - pub fn empty() -> Self { - Self { - method_start: None, - method_end: None, - allocation: None, - ocel: None, - raw_control_flow_regexes: vec![], - pie_chart_extraction_configs: vec![], - simple_counter_configs: vec![], - activities_duration_configs: vec![], - } - } - pub fn control_flow_regexes(&self) -> Result>, String> { if self.raw_control_flow_regexes.is_empty() { return Ok(None); diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/event_classes.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/event_classes.rs index 1221c40e..f7976577 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/event_classes.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/event_classes.rs @@ -44,7 +44,7 @@ impl<'a> EventGroupSoftwareDataExtractor for EventClassesDataExtractor<'a> { threads .entry(thread_id) - .or_insert(TraceThread::empty()) + .or_insert(TraceThread::default()) .events_mut() .push(TraceThreadEvent::new(event.clone(), stamp)); } diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/models.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/models.rs index a0277e3f..e2c6f92f 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/models.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/models.rs @@ -5,7 +5,7 @@ use getset::{Getters, MutGetters}; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, rc::Rc}; -#[derive(Clone, Debug, Getters, MutGetters, Serialize, Deserialize)] +#[derive(Clone, Debug, Getters, MutGetters, Serialize, Deserialize, Default)] pub struct SoftwareData { #[getset(get = "pub", get_mut = "pub")] #[serde(skip_serializing_if = "HashMap::is_empty")] @@ -32,19 +32,6 @@ pub struct SoftwareData { ocel_data: Vec, } -impl SoftwareData { - pub fn empty() -> Self { - Self { - event_classes: HashMap::new(), - thread_diagram_fragment: vec![], - histograms: vec![], - simple_counters: vec![], - activities_durations: vec![], - ocel_data: vec![], - } - } -} - #[derive(Clone, Debug, Getters, Serialize, Deserialize, new)] pub struct OcelProducedObjectAfterConsume { #[getset(get = "pub")] diff --git a/Ficus/src/rust/ficus/src/pipelines/activities_parts.rs b/Ficus/src/rust/ficus/src/pipelines/activities_parts.rs index fc06b5e7..8d848d32 100644 --- a/Ficus/src/rust/ficus/src/pipelines/activities_parts.rs +++ b/Ficus/src/rust/ficus/src/pipelines/activities_parts.rs @@ -441,10 +441,10 @@ impl PipelineParts { pipeline_part!(substitute_underlying_events, |context: &mut PipelineContext, _, _| { let log = Self::get_user_data_mut(context, &EVENT_LOG_KEY)?; - let mut new_log = XesEventLogImpl::empty(); + let mut new_log = XesEventLogImpl::default(); for trace in log.traces() { - let mut new_trace = XesTraceImpl::empty(); + let mut new_trace = XesTraceImpl::default(); for event in trace.borrow().events() { substitute_underlying_events(event, &mut new_trace); } diff --git a/Ficus/src/rust/ficus/src/pipelines/context.rs b/Ficus/src/rust/ficus/src/pipelines/context.rs index f1707c4d..663040f7 100644 --- a/Ficus/src/rust/ficus/src/pipelines/context.rs +++ b/Ficus/src/rust/ficus/src/pipelines/context.rs @@ -41,7 +41,7 @@ impl PipelineInfrastructure { } } -#[derive(Clone)] +#[derive(Clone, Default)] pub struct PipelineContext<'a> { user_data: UserDataImpl, pipeline_parts: Option<&'a PipelineParts>, @@ -55,13 +55,6 @@ impl<'a> PipelineContext<'a> { } } - pub fn empty() -> Self { - Self { - user_data: Default::default(), - pipeline_parts: None, - } - } - pub fn empty_from(other: &'a PipelineContext) -> Self { Self { user_data: Default::default(), diff --git a/Ficus/src/rust/ficus/src/pipelines/multithreading.rs b/Ficus/src/rust/ficus/src/pipelines/multithreading.rs index 8e48c55c..0c608cd6 100644 --- a/Ficus/src/rust/ficus/src/pipelines/multithreading.rs +++ b/Ficus/src/rust/ficus/src/pipelines/multithreading.rs @@ -190,16 +190,16 @@ impl PipelineParts { fn get_software_data_extraction_config(context: &PipelineContext) -> SoftwareDataExtractionConfig { match Self::get_user_data(context, &SOFTWARE_DATA_EXTRACTION_CONFIG_KEY) { Ok(config) => config.clone(), - Err(_) => SoftwareDataExtractionConfig::empty(), + Err(_) => SoftwareDataExtractionConfig::default(), } } fn create_groups_event_log(events_groups: &Vec>) -> XesEventLogImpl { - let mut log = XesEventLogImpl::empty(); + let mut log = XesEventLogImpl::default(); for trace in events_groups { for group in trace { - let mut new_trace = XesTraceImpl::empty(); + let mut new_trace = XesTraceImpl::default(); for event in group.control_flow_events() { new_trace.push(event.clone()); diff --git a/Ficus/src/rust/ficus/src/pipelines/pipelines.rs b/Ficus/src/rust/ficus/src/pipelines/pipelines.rs index 25ba3b1d..17bcc5e2 100644 --- a/Ficus/src/rust/ficus/src/pipelines/pipelines.rs +++ b/Ficus/src/rust/ficus/src/pipelines/pipelines.rs @@ -8,15 +8,12 @@ use crate::{ use super::{context::PipelineContext, errors::pipeline_errors::PipelinePartExecutionError}; +#[derive(Default)] pub struct Pipeline { parts: Vec>, } impl Pipeline { - pub fn empty() -> Self { - Self { parts: vec![] } - } - pub fn push(&mut self, part: Box) { self.parts.push(part); } @@ -37,7 +34,7 @@ impl PipelinePart for Pipeline { impl Pipeline { fn put_default_concrete_keys(&self, context: &mut PipelineContext) { if context.concrete(COLORS_HOLDER_KEY.key()).is_none() { - context.put_concrete(COLORS_HOLDER_KEY.key(), ColorsHolder::empty()); + context.put_concrete(COLORS_HOLDER_KEY.key(), ColorsHolder::default()); } } } diff --git a/Ficus/src/rust/ficus/src/pipelines/util_parts.rs b/Ficus/src/rust/ficus/src/pipelines/util_parts.rs index 1d5c5d7d..7d96864c 100644 --- a/Ficus/src/rust/ficus/src/pipelines/util_parts.rs +++ b/Ficus/src/rust/ficus/src/pipelines/util_parts.rs @@ -81,9 +81,9 @@ impl PipelineParts { pipeline_part!(use_names_event_log, |context: &mut PipelineContext, _, _| { let names_log = Self::get_user_data(context, &NAMES_EVENT_LOG_KEY)?; - let mut log = XesEventLogImpl::empty(); + let mut log = XesEventLogImpl::default(); for names_trace in names_log { - let mut trace = XesTraceImpl::empty(); + let mut trace = XesTraceImpl::default(); let mut date = DateTime::::MIN_UTC; for name in names_trace { diff --git a/Ficus/src/rust/ficus/src/utils/colors.rs b/Ficus/src/rust/ficus/src/utils/colors.rs index 3ba3a675..51e6238c 100644 --- a/Ficus/src/rust/ficus/src/utils/colors.rs +++ b/Ficus/src/rust/ficus/src/utils/colors.rs @@ -50,19 +50,13 @@ impl Color { } } +#[derive(Default)] pub struct ColorsHolder { names_to_colors: HashMap, Color>, used_colors: HashSet, } impl ColorsHolder { - pub fn empty() -> Self { - Self { - names_to_colors: HashMap::new(), - used_colors: HashSet::new(), - } - } - pub fn get_or_create(&mut self, name: &Rc) -> Color { if let Some(existing_color) = self.names_to_colors.get(name) { *existing_color diff --git a/Ficus/src/rust/ficus/src/utils/graph/graph.rs b/Ficus/src/rust/ficus/src/utils/graph/graph.rs index babcccf2..f316fbb8 100644 --- a/Ficus/src/rust/ficus/src/utils/graph/graph.rs +++ b/Ficus/src/rust/ficus/src/utils/graph/graph.rs @@ -14,6 +14,16 @@ pub struct NodesConnectionData { pub(super) user_data: Option, } +impl Default for NodesConnectionData { + fn default() -> Self { + Self { + data: None, + weight: 0f64, + user_data: None, + } + } +} + impl NodesConnectionData { pub fn new(data: Option, weight: f64, user_data: Option) -> Self { Self { data, weight, user_data } @@ -27,14 +37,6 @@ impl NodesConnectionData { } } - pub fn empty() -> Self { - Self { - data: None, - weight: 0f64, - user_data: None, - } - } - pub fn data(&self) -> Option<&TEdgeData> { self.data.as_ref() } @@ -56,7 +58,7 @@ impl GraphKind { } } -#[derive(Debug, Getters, Setters)] +#[derive(Debug, Getters, Setters, Clone)] pub struct Graph where TNodeData: ToString, @@ -69,13 +71,13 @@ where pub(crate) kind: Option, } -impl Clone for Graph { - fn clone(&self) -> Self { +impl Default for Graph { + fn default() -> Self { Self { - nodes: self.nodes.clone(), - connections: self.connections.clone(), - user_data: self.user_data.clone(), - kind: self.kind.clone(), + connections: HashMap::new(), + nodes: HashMap::new(), + user_data: Default::default(), + kind: None, } } } @@ -85,15 +87,6 @@ where TNodeData: ToString, TEdgeData: ToString + Display, { - pub fn empty() -> Self { - Self { - connections: HashMap::new(), - nodes: HashMap::new(), - user_data: Default::default(), - kind: None, - } - } - pub fn node(&self, id: &u64) -> Option<&GraphNode> { self.nodes.get(id) } diff --git a/Ficus/src/rust/ficus/src/utils/graph/graphs_merging.rs b/Ficus/src/rust/ficus/src/utils/graph/graphs_merging.rs index bf2cac57..bbf13c4c 100644 --- a/Ficus/src/rust/ficus/src/utils/graph/graphs_merging.rs +++ b/Ficus/src/rust/ficus/src/utils/graph/graphs_merging.rs @@ -24,7 +24,7 @@ context_key! { END_NODE_ID, u64 } pub fn merge_graphs( graphs: &Vec>, ) -> Result, GraphsMergingError> { - let mut merged_graph = Graph::empty(); + let mut merged_graph = Graph::default(); let merged_start_node_id = merged_graph.add_node(None); let merged_end_node_id = merged_graph.add_node(None); @@ -56,8 +56,8 @@ pub fn merge_graphs( merged_graph.connect_nodes(first_id, second_id, data); } - merged_graph.connect_nodes(&merged_start_node_id, &ids_map[&start_node_id], NodesConnectionData::empty()); - merged_graph.connect_nodes(&ids_map[&end_node_id], &merged_end_node_id, NodesConnectionData::empty()); + merged_graph.connect_nodes(&merged_start_node_id, &ids_map[&start_node_id], NodesConnectionData::default()); + merged_graph.connect_nodes(&ids_map[&end_node_id], &merged_end_node_id, NodesConnectionData::default()); } Ok(merged_graph) diff --git a/Ficus/src/rust/ficus/src/utils/sets/two_sets.rs b/Ficus/src/rust/ficus/src/utils/sets/two_sets.rs index 972a0930..9203f00a 100644 --- a/Ficus/src/rust/ficus/src/utils/sets/two_sets.rs +++ b/Ficus/src/rust/ficus/src/utils/sets/two_sets.rs @@ -5,7 +5,7 @@ use std::{ hash::{Hash, Hasher}, }; -#[derive(Debug)] +#[derive(Debug, Default)] pub struct TwoSets where T: Hash + Eq + ToString + Ord + Clone, @@ -18,13 +18,6 @@ impl TwoSets where T: Hash + Eq + ToString + Ord + Clone, { - pub fn empty() -> Self { - Self { - first_set: BTreeSet::new(), - second_set: BTreeSet::new(), - } - } - pub fn new(first_set: BTreeSet, second_set: BTreeSet) -> Self { Self { first_set, second_set } } diff --git a/Ficus/src/rust/ficus/tests/discovery/multithreaded_dfg_tests.rs b/Ficus/src/rust/ficus/tests/discovery/multithreaded_dfg_tests.rs index 416a21e6..cc1fd33b 100644 --- a/Ficus/src/rust/ficus/tests/discovery/multithreaded_dfg_tests.rs +++ b/Ficus/src/rust/ficus/tests/discovery/multithreaded_dfg_tests.rs @@ -65,10 +65,10 @@ fn execute_multithreaded_dfg_discovery_test(raw_log: Vec>>, gold: } fn create_multithreaded_event_log(raw_traces: Vec>>) -> XesEventLogImpl { - let mut log = XesEventLogImpl::empty(); + let mut log = XesEventLogImpl::default(); for trace in raw_traces { - let mut xes_trace = XesTraceImpl::empty(); + let mut xes_trace = XesTraceImpl::default(); for (thread, thread_index) in trace.iter().zip(0..trace.len()) { for event in thread { let mut xes_event = XesEventImpl::new_with_max_date(Rc::from(event.to_string())); diff --git a/Ficus/src/rust/ficus/tests/mutations/mutations_tests.rs b/Ficus/src/rust/ficus/tests/mutations/mutations_tests.rs index 8234e18a..7c9364f0 100644 --- a/Ficus/src/rust/ficus/tests/mutations/mutations_tests.rs +++ b/Ficus/src/rust/ficus/tests/mutations/mutations_tests.rs @@ -176,8 +176,8 @@ fn test_add_artificial_start_events_empty_trace() { } fn create_empty_log_with_empty_trace() -> XesEventLogImpl { - let mut log = XesEventLogImpl::empty(); - log.push(Rc::new(RefCell::new(XesTraceImpl::empty()))); + let mut log = XesEventLogImpl::default(); + log.push(Rc::new(RefCell::new(XesTraceImpl::default()))); log } diff --git a/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs b/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs index 03ddec7f..526cf462 100644 --- a/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs +++ b/Ficus/src/rust/ficus/tests/software_data/extractors_tests.rs @@ -73,7 +73,7 @@ fn test_general_histogram() { ), ]; - let mut config = SoftwareDataExtractionConfig::empty(); + let mut config = SoftwareDataExtractionConfig::default(); config.set_pie_chart_extraction_configs(vec![ ExtractionConfig::new( "histogram_event".into(), @@ -100,7 +100,7 @@ fn test_general_histogram() { ]); let extractor = PieChartExtractor::new(&config); - let mut software_data = SoftwareData::empty(); + let mut software_data = SoftwareData::default(); extractor.extract_from_events(&mut software_data, &events).ok().unwrap(); software_data.histograms_mut().sort_by(|f, s| f.base().name().cmp(s.base().name())); @@ -164,7 +164,7 @@ fn test_simple_counter() { ), ]; - let mut config = SoftwareDataExtractionConfig::empty(); + let mut config = SoftwareDataExtractionConfig::default(); config.set_simple_counter_configs(vec![ ExtractionConfig::new( "histogram_event".into(), @@ -180,7 +180,7 @@ fn test_simple_counter() { ]); let extractor = SimpleCounterExtractor::new(&config); - let mut software_data = SoftwareData::empty(); + let mut software_data = SoftwareData::default(); extractor.extract_from_events(&mut software_data, &events).ok().unwrap(); software_data @@ -228,7 +228,7 @@ fn test_activities_duration() { } fn execute_test_with_activities_durations(gold: &str, raw_event_groups: Vec>>>>) { - let mut config = SoftwareDataExtractionConfig::empty(); + let mut config = SoftwareDataExtractionConfig::default(); config.set_activities_duration_configs(vec![ActivityDurationExtractionConfig::new( GenericExtractionConfigBase::new("activity".into(), "units".into(), None), "event_start".into(), @@ -243,7 +243,7 @@ fn execute_test_with_activities_durations(gold: &str, raw_event_groups: Vec = raw_event_groups .into_iter() .map(|x| { - let mut group = EventGroup::empty(); + let mut group = EventGroup::default(); group.control_flow_events_mut().extend(x[0].clone()); group.statistic_events_mut().extend(x[1].clone()); @@ -256,7 +256,7 @@ fn execute_test_with_activities_durations(gold: &str, raw_event_groups: Vec { - let mut xes_log = XesEventLogImpl::empty(); + let mut xes_log = XesEventLogImpl::default(); for trace in &log.traces { - let mut xes_trace = XesTraceImpl::empty(); + let mut xes_trace = XesTraceImpl::default(); for event in &trace.events { let date: DateTime = match event.stamp.as_ref() { None => DateTime::::MIN_UTC, diff --git a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t1/processors.rs b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t1/processors.rs index 7564d195..f616e68c 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t1/processors.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t1/processors.rs @@ -81,7 +81,7 @@ impl T1StreamingProcessor { }; if !names_to_logs.contains_key(case_key) { - let new_log = XesEventLogImpl::empty(); + let new_log = XesEventLogImpl::default(); names_to_logs.insert(case_key.to_owned(), new_log); } diff --git a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t2/processors.rs b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t2/processors.rs index 423e7018..04827c70 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t2/processors.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t2/processors.rs @@ -57,8 +57,8 @@ impl T2StreamingProcessor { }; let xes_trace = if let Some(preprocessing_pipeline) = self.trace_preprocessing_pipeline.as_ref() { - let mut preprocessing_context = PipelineContext::empty(); - let mut log = XesEventLogImpl::empty(); + let mut preprocessing_context = PipelineContext::default(); + let mut log = XesEventLogImpl::default(); log.push(Rc::new(RefCell::new(xes_trace))); preprocessing_context.put_concrete(EVENT_LOG_KEY.key(), log); diff --git a/Ficus/src/rust/ficus_backend/src/grpc/pipeline_executor.rs b/Ficus/src/rust/ficus_backend/src/grpc/pipeline_executor.rs index 81afeff3..44fb3423 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/pipeline_executor.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/pipeline_executor.rs @@ -109,7 +109,7 @@ impl<'a> ServicePipelineExecutionContext<'a> { } pub(super) fn to_pipeline(&self) -> Pipeline { - let mut pipeline = Pipeline::empty(); + let mut pipeline = Pipeline::default(); for grpc_part in &self.grpc_pipeline().parts { match grpc_part.part.as_ref().unwrap() { Part::DefaultPart(grpc_default_part) => match self.find_default_part(grpc_default_part) { From 6167f1b0a5b22c56359ebd28db86cd9bcc136e11 Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sun, 8 Mar 2026 18:37:15 +0300 Subject: [PATCH 29/30] Replay fixes --- .../rust/ficus/src/features/discovery/petri_net/arc.rs | 4 ++-- .../ficus/src/features/discovery/petri_net/replay.rs | 10 +++++----- .../src/features/discovery/petri_net/transition.rs | 4 ++-- Ficus/src/rust/ficus_backend/src/grpc/converters.rs | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Ficus/src/rust/ficus/src/features/discovery/petri_net/arc.rs b/Ficus/src/rust/ficus/src/features/discovery/petri_net/arc.rs index f04e13e0..2a67ef45 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/petri_net/arc.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/petri_net/arc.rs @@ -26,7 +26,7 @@ impl Arc { self.place_id } - pub fn tokens_count(&self) -> &usize { - &self.tokens_count + pub fn tokens_count(&self) -> usize { + self.tokens_count } } diff --git a/Ficus/src/rust/ficus/src/features/discovery/petri_net/replay.rs b/Ficus/src/rust/ficus/src/features/discovery/petri_net/replay.rs index b2105eb7..25d27152 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/petri_net/replay.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/petri_net/replay.rs @@ -55,11 +55,11 @@ impl ReplayState { for arc in candidate_transition.incoming_arcs() { let place_id = &arc.place_id(); let count = new_markings[place_id]; - let new_count = count - arc.tokens_count(); - if new_count <= 0 { + + if arc.tokens_count() >= count { new_markings.remove(place_id); } else { - *new_markings.get_mut(place_id).unwrap() = new_count; + *new_markings.get_mut(place_id).unwrap() = count - arc.tokens_count(); } } @@ -68,7 +68,7 @@ impl ReplayState { if let Some(count) = new_markings.get(place_id) { *new_markings.get_mut(place_id).unwrap() = count + arc.tokens_count(); } else { - new_markings.insert(*place_id, *arc.tokens_count()); + new_markings.insert(*place_id, arc.tokens_count()); } } @@ -92,7 +92,7 @@ impl ReplayState { } for transition in net.all_transitions() { - if *transition.is_silent() { + if transition.is_silent() { result.push(transition); } } diff --git a/Ficus/src/rust/ficus/src/features/discovery/petri_net/transition.rs b/Ficus/src/rust/ficus/src/features/discovery/petri_net/transition.rs index f079f077..5d5d1f0d 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/petri_net/transition.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/petri_net/transition.rs @@ -88,7 +88,7 @@ where &self.name } - pub fn is_silent(&self) -> &bool { - &self.silent_transition + pub fn is_silent(&self) -> bool { + self.silent_transition } } diff --git a/Ficus/src/rust/ficus_backend/src/grpc/converters.rs b/Ficus/src/rust/ficus_backend/src/grpc/converters.rs index 3bffb7ea..3d41c1d2 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/converters.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/converters.rs @@ -680,7 +680,7 @@ fn convert_to_grpc_arc(arc: &Arc) -> GrpcPetriNetArc { GrpcPetriNetArc { id: arc.id() as i64, place_id: arc.place_id() as i64, - tokens_count: *arc.tokens_count() as i64, + tokens_count: arc.tokens_count() as i64, } } From 152c94ccf95031ad14ceb2af267b79e86c9bda24 Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Sun, 8 Mar 2026 18:47:31 +0300 Subject: [PATCH 30/30] Allow returning mut refs from user data --- Ficus/src/rust/ficus/src/utils/user_data/user_data.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Ficus/src/rust/ficus/src/utils/user_data/user_data.rs b/Ficus/src/rust/ficus/src/utils/user_data/user_data.rs index 723b1022..adcd93e3 100644 --- a/Ficus/src/rust/ficus/src/utils/user_data/user_data.rs +++ b/Ficus/src/rust/ficus/src/utils/user_data/user_data.rs @@ -36,6 +36,8 @@ pub trait UserData { fn concrete(&self, key: &DefaultKey) -> Option<&T>; fn any(&self, key: &dyn Key) -> Option<&dyn Any>; + + #[allow(mut_from_ref)] fn concrete_mut(&self, key: &DefaultKey) -> Option<&mut T>; fn remove_concrete(&mut self, key: &DefaultKey); @@ -131,6 +133,7 @@ impl UserDataImpl { } } + #[allow(mut_from_ref)] pub fn get_mut(&self, key: &impl Key) -> Option<&mut T> { self.values_map.as_ref()?;