diff --git a/Cargo.lock b/Cargo.lock index f1594b0..296681a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -8,7 +8,16 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ - "gimli", + "gimli 0.29.0", +] + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli 0.31.1", ] [[package]] @@ -126,9 +135,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "approx" @@ -139,6 +148,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "arbitrary" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" + [[package]] name = "argminmax" version = "0.6.2" @@ -185,7 +200,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -196,7 +211,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -239,7 +254,7 @@ version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ - "addr2line", + "addr2line 0.22.0", "cc", "cfg-if", "libc", @@ -366,6 +381,9 @@ name = "bumpalo" version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +dependencies = [ + "allocator-api2", +] [[package]] name = "bytemuck" @@ -384,7 +402,7 @@ checksum = "1ee891b04274a59bd38b412188e24b849617b2e45a0fd8d057deb63e7403761b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -492,7 +510,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -501,6 +519,12 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +[[package]] +name = "cobs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" + [[package]] name = "colorchoice" version = "1.0.2" @@ -516,7 +540,7 @@ dependencies = [ "crossterm", "strum", "strum_macros", - "unicode-width", + "unicode-width 0.1.13", ] [[package]] @@ -583,7 +607,7 @@ dependencies = [ "env_logger", "futures", "futures-io", - "itertools", + "itertools 0.13.0", "log", "nalgebra", "num_cpus", @@ -600,6 +624,16 @@ dependencies = [ "tiberius", "tokio", "tokio-util", + "wasmtime", +] + +[[package]] +name = "cpp_demangle" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96e58d342ad113c2b878f16d5d034c03be492ae460cdbc02b7f0f2284d310c7d" +dependencies = [ + "cfg-if", ] [[package]] @@ -611,6 +645,113 @@ dependencies = [ "libc", ] +[[package]] +name = "cranelift-bforest" +version = "0.115.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac89549be94911dd0e839b4a7db99e9ed29c17517e1c026f61066884c168aa3c" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-bitset" +version = "0.115.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9bd49369f76c77e34e641af85d0956869237832c118964d08bf5f51f210875a" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "cranelift-codegen" +version = "0.115.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd96ce9cf8efebd7f5ab8ced5a0ce44250280bbae9f593d74a6d7effc3582a35" +dependencies = [ + "bumpalo", + "cranelift-bforest", + "cranelift-bitset", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-control", + "cranelift-entity", + "cranelift-isle", + "gimli 0.31.1", + "hashbrown 0.14.5", + "log", + "regalloc2", + "rustc-hash", + "serde", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.115.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a68e358827afe4bfb6239fcbf6fbd5ac56206ece8a99c8f5f9bbd518773281a" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.115.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e184c9767afbe73d50c55ec29abcf4c32f9baf0d9d22b86d58c4d55e06dee181" + +[[package]] +name = "cranelift-control" +version = "0.115.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc7664f2a66f053e33f149e952bb5971d138e3af637f5097727ed6dc0ed95dd" +dependencies = [ + "arbitrary", +] + +[[package]] +name = "cranelift-entity" +version = "0.115.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "118597e3a9cf86c3556fa579a7a23b955fa18231651a52a77a2475d305a9cf84" +dependencies = [ + "cranelift-bitset", + "serde", + "serde_derive", +] + +[[package]] +name = "cranelift-frontend" +version = "0.115.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7638ea1efb069a0aa18d8ee67401b6b0d19f6bfe5de5e9ede348bfc80bb0d8c7" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.115.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15c53e1152a0b01c4ed2b1e0535602b8e86458777dd9d18b28732b16325c7dc0" + +[[package]] +name = "cranelift-native" +version = "0.115.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b7d8f895444fa52dd7bdd0bed11bf007a7fb43af65a6deac8fcc4094c6372f7" +dependencies = [ + "cranelift-codegen", + "libc", + "target-lexicon", +] + [[package]] name = "crc" version = "3.2.1" @@ -752,7 +893,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -763,7 +904,16 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.72", + "syn 2.0.87", +] + +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "uuid", ] [[package]] @@ -799,6 +949,27 @@ dependencies = [ "subtle", ] +[[package]] +name = "directories-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + [[package]] name = "docker_credential" version = "1.3.1" @@ -831,6 +1002,18 @@ dependencies = [ "serde", ] +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + [[package]] name = "encoding_rs" version = "0.8.34" @@ -849,7 +1032,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -869,7 +1052,7 @@ checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -939,6 +1122,12 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + [[package]] name = "fallible-streaming-iterator" version = "0.1.9" @@ -996,6 +1185,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" + [[package]] name = "foreign-types" version = "0.3.2" @@ -1087,7 +1282,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -1120,6 +1315,28 @@ dependencies = [ "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "fxprof-processed-profile" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" +dependencies = [ + "bitflags 2.6.0", + "debugid", + "fxhash", + "serde", + "serde_json", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -1160,6 +1377,17 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +dependencies = [ + "fallible-iterator", + "indexmap 2.7.0", + "stable_deref_trait", +] + [[package]] name = "glob" version = "0.3.1" @@ -1184,6 +1412,16 @@ dependencies = [ "serde", ] +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ + "foldhash", + "serde", +] + [[package]] name = "hashlink" version = "0.9.1" @@ -1399,6 +1637,12 @@ dependencies = [ "cc", ] +[[package]] +name = "id-arena" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" + [[package]] name = "ident_case" version = "1.0.1" @@ -1428,12 +1672,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.15.2", "serde", ] @@ -1443,6 +1687,15 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.13.0" @@ -1464,6 +1717,26 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9028f49264629065d057f340a86acb84867925865f73bbf8d47b4d149a7e88b8" +[[package]] +name = "ittapi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b996fe614c41395cdaedf3cf408a9534851090959d90d54a535f675550b64b1" +dependencies = [ + "anyhow", + "ittapi-sys", + "log", +] + +[[package]] +name = "ittapi-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f5385394064fa2c886205dba02598013ce83d3e92d33dbdc0c52fe0e7bf4fc" +dependencies = [ + "cc", +] + [[package]] name = "jobserver" version = "0.1.32" @@ -1491,6 +1764,12 @@ dependencies = [ "spin", ] +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + [[package]] name = "libc" version = "0.2.155" @@ -1567,6 +1846,15 @@ dependencies = [ "libc", ] +[[package]] +name = "mach2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +dependencies = [ + "libc", +] + [[package]] name = "matrixmultiply" version = "0.3.9" @@ -1599,6 +1887,15 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "memfd" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" +dependencies = [ + "rustix", +] + [[package]] name = "memmap2" version = "0.7.1" @@ -1681,7 +1978,7 @@ checksum = "254a5372af8fc138e36684761d3c0cdb758a4410e938babcff1c860ce14ddbfc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -1824,10 +2121,13 @@ dependencies = [ [[package]] name = "object" -version = "0.36.2" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ + "crc32fast", + "hashbrown 0.15.2", + "indexmap 2.7.0", "memchr", ] @@ -1860,7 +2160,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -1942,7 +2242,7 @@ dependencies = [ "regex", "regex-syntax", "structmeta", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -2158,7 +2458,7 @@ dependencies = [ "comfy-table", "either", "hashbrown 0.14.5", - "indexmap 2.2.6", + "indexmap 2.7.0", "num-traits", "once_cell", "polars-arrow", @@ -2303,7 +2603,7 @@ dependencies = [ "either", "hashbrown 0.14.5", "hex", - "indexmap 2.2.6", + "indexmap 2.7.0", "memchr", "num-traits", "polars-arrow", @@ -2421,7 +2721,7 @@ version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c7e1234b942d3244024ecbac9c7f5a48a52a815f8ca4b9d075fbba16afb1a39" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.7.0", "polars-error", "polars-utils", "version_check", @@ -2480,7 +2780,7 @@ dependencies = [ "bytes", "compact_str", "hashbrown 0.14.5", - "indexmap 2.2.6", + "indexmap 2.7.0", "libc", "memmap2", "num-traits", @@ -2493,6 +2793,18 @@ dependencies = [ "version_check", ] +[[package]] +name = "postcard" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" +dependencies = [ + "cobs", + "embedded-io 0.4.0", + "embedded-io 0.6.1", + "serde", +] + [[package]] name = "powerfmt" version = "0.2.0" @@ -2533,6 +2845,17 @@ dependencies = [ "cc", ] +[[package]] +name = "pulley-interpreter" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "403a1a95f4c18a45c86c7bff13df00347afd0abcbf2e54af273c837339ffcf77" +dependencies = [ + "cranelift-bitset", + "log", + "sptr", +] + [[package]] name = "quote" version = "1.0.36" @@ -2675,7 +2998,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76009fbe0614077fc1a2ce255e3a1881a2e3a3527097d5dc6d8212c585e7e38b" dependencies = [ "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -2705,6 +3028,31 @@ dependencies = [ "bitflags 2.6.0", ] +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom 0.2.15", + "libredox", + "thiserror", +] + +[[package]] +name = "regalloc2" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "145c1c267e14f20fb0f88aa76a1c5ffec42d592c1d28b3cd9148ae35916158d3" +dependencies = [ + "allocator-api2", + "bumpalo", + "hashbrown 0.15.2", + "log", + "rustc-hash", + "smallvec", +] + [[package]] name = "regex" version = "1.10.5" @@ -2797,6 +3145,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" + [[package]] name = "rustix" version = "0.38.34" @@ -2945,7 +3299,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -2988,23 +3342,32 @@ dependencies = [ ] [[package]] -name = "serde" -version = "1.0.204" +name = "semver" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" +dependencies = [ + "serde", +] + +[[package]] +name = "serde" +version = "1.0.217" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -3015,7 +3378,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -3038,7 +3401,16 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", +] + +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", ] [[package]] @@ -3063,7 +3435,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.6", + "indexmap 2.7.0", "serde", "serde_derive", "serde_json", @@ -3080,7 +3452,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -3202,6 +3574,12 @@ dependencies = [ "der", ] +[[package]] +name = "sptr" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" + [[package]] name = "sqlformat" version = "0.2.4" @@ -3255,7 +3633,7 @@ dependencies = [ "hashbrown 0.14.5", "hashlink", "hex", - "indexmap 2.2.6", + "indexmap 2.7.0", "log", "memchr", "once_cell", @@ -3286,7 +3664,7 @@ dependencies = [ "quote", "sqlx-core", "sqlx-macros-core", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -3309,7 +3687,7 @@ dependencies = [ "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", - "syn 2.0.72", + "syn 2.0.87", "tempfile", "tokio", "url", @@ -3418,6 +3796,12 @@ dependencies = [ "url", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "stacker" version = "0.1.15" @@ -3484,7 +3868,7 @@ dependencies = [ "proc-macro2", "quote", "structmeta-derive", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -3495,7 +3879,7 @@ checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -3514,7 +3898,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -3536,9 +3920,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.72" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -3564,6 +3948,12 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1bbb9f3c5c463a01705937a24fdabc5047929ac764b2d5b9cf681c1f5041ed5" +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + [[package]] name = "tempfile" version = "3.10.1" @@ -3576,6 +3966,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + [[package]] name = "testcontainers" version = "0.23.1" @@ -3622,7 +4021,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -3724,7 +4123,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -3777,6 +4176,40 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +dependencies = [ + "indexmap 2.7.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + [[package]] name = "tower-service" version = "0.3.3" @@ -3803,7 +4236,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -3875,6 +4308,18 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "unicode_categories" version = "0.1.1" @@ -3974,7 +4419,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", "wasm-bindgen-shared", ] @@ -3996,7 +4441,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4007,6 +4452,326 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +[[package]] +name = "wasm-encoder" +version = "0.221.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17a3bd88f2155da63a1f2fcb8a56377a24f0b6dfed12733bb5f544e86f690c5" +dependencies = [ + "leb128", + "wasmparser 0.221.2", +] + +[[package]] +name = "wasm-encoder" +version = "0.222.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3432682105d7e994565ef928ccf5856cf6af4ba3dddebedb737f61caed70f956" +dependencies = [ + "leb128", + "wasmparser 0.222.0", +] + +[[package]] +name = "wasmparser" +version = "0.221.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9845c470a2e10b61dd42c385839cdd6496363ed63b5c9e420b5488b77bd22083" +dependencies = [ + "bitflags 2.6.0", + "hashbrown 0.15.2", + "indexmap 2.7.0", + "semver", + "serde", +] + +[[package]] +name = "wasmparser" +version = "0.222.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4adf50fde1b1a49c1add6a80d47aea500c88db70551805853aa8b88f3ea27ab5" +dependencies = [ + "bitflags 2.6.0", + "indexmap 2.7.0", + "semver", +] + +[[package]] +name = "wasmprinter" +version = "0.221.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a80742ff1b9e6d8c231ac7c7247782c6fc5bce503af760bca071811e5fc9ee56" +dependencies = [ + "anyhow", + "termcolor", + "wasmparser 0.221.2", +] + +[[package]] +name = "wasmtime" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639ecae347b9a2227e453a7b7671e84370a0b61f47a15e0390fe9b7725e47b3" +dependencies = [ + "addr2line 0.24.2", + "anyhow", + "async-trait", + "bitflags 2.6.0", + "bumpalo", + "cc", + "cfg-if", + "encoding_rs", + "fxprof-processed-profile", + "gimli 0.31.1", + "hashbrown 0.14.5", + "indexmap 2.7.0", + "ittapi", + "libc", + "libm", + "log", + "mach2", + "memfd", + "object", + "once_cell", + "paste", + "postcard", + "psm", + "pulley-interpreter", + "rayon", + "rustix", + "semver", + "serde", + "serde_derive", + "serde_json", + "smallvec", + "sptr", + "target-lexicon", + "wasm-encoder 0.221.2", + "wasmparser 0.221.2", + "wasmtime-asm-macros", + "wasmtime-cache", + "wasmtime-component-macro", + "wasmtime-component-util", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-fiber", + "wasmtime-jit-debug", + "wasmtime-jit-icache-coherence", + "wasmtime-slab", + "wasmtime-versioned-export-macros", + "wasmtime-winch", + "wat", + "windows-sys 0.59.0", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "882a18800471cfc063c8b3ccf75723784acc3fd534009ac09421f2fac2fcdcec" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-cache" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368d974999abe6095341da9b9e2c0908a6272e796001e06b7022ad60b2d19710" +dependencies = [ + "anyhow", + "base64 0.21.7", + "directories-next", + "log", + "postcard", + "rustix", + "serde", + "serde_derive", + "sha2", + "toml", + "windows-sys 0.59.0", + "zstd", +] + +[[package]] +name = "wasmtime-component-macro" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb5c0a77c9e1927c3d471f53cc13767c3d3438e5d5ffd394e3eb31c86445fd60" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn 2.0.87", + "wasmtime-component-util", + "wasmtime-wit-bindgen", + "wit-parser", +] + +[[package]] +name = "wasmtime-component-util" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43702ca98bf5162eca0573db691ed9ecd36d716f8c6688410fe26ec16b6f9bcb" + +[[package]] +name = "wasmtime-cranelift" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20070aa5b75080a8932ec328419faf841df2bc6ceb16b55b0df2b952098392a2" +dependencies = [ + "anyhow", + "cfg-if", + "cranelift-codegen", + "cranelift-control", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "gimli 0.31.1", + "itertools 0.12.1", + "log", + "object", + "smallvec", + "target-lexicon", + "thiserror", + "wasmparser 0.221.2", + "wasmtime-environ", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-environ" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2604ddb24879d4dc1dedcb7081d7a8e017259bce916fdae097a97db52cbaab80" +dependencies = [ + "anyhow", + "cpp_demangle", + "cranelift-bitset", + "cranelift-entity", + "gimli 0.31.1", + "indexmap 2.7.0", + "log", + "object", + "postcard", + "rustc-demangle", + "semver", + "serde", + "serde_derive", + "smallvec", + "target-lexicon", + "wasm-encoder 0.221.2", + "wasmparser 0.221.2", + "wasmprinter", + "wasmtime-component-util", +] + +[[package]] +name = "wasmtime-fiber" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98593412d2b167ebe2b59d4a17a184978a72f976b53b3a0ec05629451079ac1d" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "rustix", + "wasmtime-asm-macros", + "wasmtime-versioned-export-macros", + "windows-sys 0.59.0", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2caed0122664573c2bbcde649515f9e1bc783b14f2ba74b999720cf0225e234d" +dependencies = [ + "object", + "rustix", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d40d7722b9e1fbeae135715710a8a2570b1e6cf72b74dd653962d89831c6c70d" +dependencies = [ + "anyhow", + "cfg-if", + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "wasmtime-slab" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8579c335220b4ece9aa490a0e8b46de78cd342b195ab21ff981d095e14b52383" + +[[package]] +name = "wasmtime-versioned-export-macros" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7de0a56fb0a69b185968f2d7a9ba54750920a806470dff7ad8de91ac06d277e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "wasmtime-winch" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abd309943c443f5590d12f9aba9ba63c481091c955a0a14de0c2a9e0e3aaeca9" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli 0.31.1", + "object", + "target-lexicon", + "wasmparser 0.221.2", + "wasmtime-cranelift", + "wasmtime-environ", + "winch-codegen", +] + +[[package]] +name = "wasmtime-wit-bindgen" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "969f83022dac3435d6469edb582ceed04cfe32aa44dc3ef16e5cb55574633df8" +dependencies = [ + "anyhow", + "heck", + "indexmap 2.7.0", + "wit-parser", +] + +[[package]] +name = "wast" +version = "222.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ce7191f4b7da0dd300cc32476abae6457154e4625d9b1bc26890828a9a26f6e" +dependencies = [ + "bumpalo", + "leb128", + "memchr", + "unicode-width 0.2.0", + "wasm-encoder 0.222.0", +] + +[[package]] +name = "wat" +version = "1.222.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fde61b4b52f9a84ae31b5e8902a2cd3162ea45d8bf564c729c3288fe52f4334" +dependencies = [ + "wast", +] + [[package]] name = "webpki-roots" version = "0.25.4" @@ -4049,6 +4814,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -4068,6 +4842,23 @@ dependencies = [ "winapi", ] +[[package]] +name = "winch-codegen" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9110decc2983ed94de904804dcd979ba59cbabc78a94fec6b1d8468ec513d0f6" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli 0.31.1", + "regalloc2", + "smallvec", + "target-lexicon", + "wasmparser 0.221.2", + "wasmtime-cranelift", + "wasmtime-environ", +] + [[package]] name = "windows" version = "0.57.0" @@ -4107,7 +4898,7 @@ checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -4118,7 +4909,7 @@ checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] @@ -4278,6 +5069,33 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winnow" +version = "0.6.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39281189af81c07ec09db316b302a3e67bf9bd7cbf6c820b50e35fee9c2fa980" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-parser" +version = "0.221.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbe1538eea6ea5ddbe5defd0dc82539ad7ba751e1631e9185d24a931f0a5adc8" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.7.0", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser 0.221.2", +] + [[package]] name = "xattr" version = "1.3.1" @@ -4313,7 +5131,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.87", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index ec93c4d..ea04c70 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,6 +38,7 @@ futures = "0.3.31" tokio-util = { version = "0.7.13", features = ["compat"] } async-trait = "0.1.83" testcontainers = "0.23.1" +wasmtime = "28.0.0" # More info on targets: https://doc.rust-lang.org/cargo/reference/cargo-targets.html#configuring-a-target [lib] diff --git a/src/graph/dynamic.rs b/src/graph/dynamic.rs new file mode 100644 index 0000000..335a179 --- /dev/null +++ b/src/graph/dynamic.rs @@ -0,0 +1,38 @@ +use crate::graph::node::RunnableNode; +use async_trait::async_trait; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use wasmtime::component::{bindgen, Component}; +use wasmtime::{Config, Engine, Linker, Store}; + +bindgen!(); + +#[derive(Serialize, Deserialize, Clone, JsonSchema)] +pub struct DynamicNode { + pub wasm_file: String, + pub file_paths: Vec, + pub output_file: String, +} + +pub struct DynamicNodeRunner { + pub dynamic_node: DynamicNode, +} + +#[async_trait] +impl RunnableNode for DynamicNodeRunner { + async fn run(&self) -> anyhow::Result<()> { + let mut config = Config::new(); + config.wasm_component_model(true); + let engine = Engine::new(&config)?; + // let component = Component::from_file(&engine, self.dynamic_node.wasm_file.to_owned())?; + // let mut linker = Linker::new(&engine); + // ::add_to_linker(&mut linker, |state: &mut TestState| state)?; + let mut store = Store::new( + &engine, + &self.dynamic_node, + ); + // let (bindings, _) = Dynamic::instantiate(&mut store, &component, &linker)?; + // bindings.call_greet(&mut store)?; + Ok(()) + } +} \ No newline at end of file diff --git a/src/graph/mod.rs b/src/graph/mod.rs index 23c9019..e9a61c2 100644 --- a/src/graph/mod.rs +++ b/src/graph/mod.rs @@ -13,6 +13,8 @@ use split::{SplitNode, SplitNodeRunner}; use tokio::sync::mpsc::Sender; use crate::graph::derive::DeriveNodeRunner; +use crate::graph::dynamic::{DynamicNode, DynamicNodeRunner}; +use crate::graph::reduction::{ReductionNode, ReductionNodeRunner}; use { derive::DeriveNode, filter::{FilterNode, FilterNodeRunner}, @@ -29,10 +31,11 @@ mod split; mod sql; mod sql_rule; mod upload_to_db; +mod dynamic; +mod reduction; #[derive(Serialize, Deserialize, Clone, JsonSchema)] pub enum NodeConfiguration { - FileNode, MoveMoneyNode(MoveMoneyNode), MergeNode(MergeNode), DeriveNode(DeriveNode), @@ -40,8 +43,9 @@ pub enum NodeConfiguration { FilterNode(FilterNode), UploadNode(UploadNode), SQLNode(SQLNode), - Dynamic, + Dynamic(DynamicNode), SplitNode(SplitNode), + ReductionNode(ReductionNode), } #[derive(Serialize, Deserialize, Clone, JsonSchema)] @@ -135,7 +139,6 @@ impl Node { fn get_runnable_node(node: Node) -> Box { match node.info.configuration { - NodeConfiguration::FileNode => todo!(), NodeConfiguration::MoveMoneyNode(_) => todo!(), NodeConfiguration::MergeNode(_) => todo!(), NodeConfiguration::DeriveNode(derive_node) => Box::new(DeriveNodeRunner { derive_node }), @@ -143,8 +146,9 @@ fn get_runnable_node(node: Node) -> Box { NodeConfiguration::FilterNode(filter_node) => Box::new(FilterNodeRunner { filter_node }), NodeConfiguration::UploadNode(upload_node) => Box::new(UploadNodeRunner { upload_node }), NodeConfiguration::SQLNode(sql_node) => Box::new(SQLNodeRunner { sql_node }), - NodeConfiguration::Dynamic => todo!(), + NodeConfiguration::Dynamic(dynamic_node) => Box::new(DynamicNodeRunner { dynamic_node }), NodeConfiguration::SplitNode(split_node) => Box::new(SplitNodeRunner { split_node }), + NodeConfiguration::ReductionNode(reduction_node) => Box::new(ReductionNodeRunner { reduction_node }), } } diff --git a/src/graph/reduction.rs b/src/graph/reduction.rs new file mode 100644 index 0000000..e1ce04f --- /dev/null +++ b/src/graph/reduction.rs @@ -0,0 +1,83 @@ +use std::fs::File; + +use crate::graph::node::RunnableNode; +use crate::io::DataSource; +use async_trait::async_trait; +use itertools::Itertools; +use polars::io::SerWriter; +use polars::prelude::{col, lit, CsvWriter, Expr, LazyCsvReader, LazyFileListReader}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + + +fn reduce(grouping_nodes: &Vec, operations: &Vec, input: &DataSource, output: &DataSource) -> anyhow::Result<()> { + let df = LazyCsvReader::new(&input.path).finish()?; + + let mut df = df + .group_by(grouping_nodes.iter().map(|column| col(column)).collect_vec()) + .agg(&operations.iter().map(|operation| operation.to_aggregate_function()).collect_vec()) + .collect()?; + let mut file = File::create(&output.path)?; + CsvWriter::new(&mut file).finish(&mut df)?; + Ok(()) +} + +#[derive(Serialize, Deserialize, Clone, JsonSchema)] +pub enum ReductionOperationType { + Sum, + Multiply, + Max, + Min, + Average, + Count, + Concat(ConcatProperties), +} + +#[derive(Serialize, Deserialize, Clone, JsonSchema)] +pub struct ConcatProperties { + pub prefix: String, + pub suffix: String, + pub separator: String, +} + +#[derive(Serialize, Deserialize, Clone, JsonSchema)] +pub struct ReductionOperation { + pub column_name: String, + pub reducer: ReductionOperationType, + // TODO: Consider adding filtering on another column, so we can get sum of males grouping on some other column + // TODO: Also consider adding an alias here +} + +impl ReductionOperation { + fn to_aggregate_function(&self) -> Expr { + match &self.reducer { + ReductionOperationType::Sum => col(&self.column_name).sum(), + // TODO: Check this, docs are a bit flaky on whether this'll work + ReductionOperationType::Multiply => col(&self.column_name).product(), + ReductionOperationType::Max => col(&self.column_name).max(), + ReductionOperationType::Min => col(&self.column_name).min(), + ReductionOperationType::Average => col(&self.column_name).mean(), + ReductionOperationType::Count => col(&self.column_name).count(), + ReductionOperationType::Concat(concat_properties) => lit(concat_properties.prefix.clone()).append(col(&self.column_name).list().join(lit(concat_properties.separator.clone()), true), false).append(lit(concat_properties.suffix.clone()), false), + } + } +} + +#[derive(Serialize, Deserialize, Clone, JsonSchema)] +pub struct ReductionNode { + pub grouping_columns: Vec, + pub operations: Vec, + pub input_file: DataSource, + pub output_file: DataSource, +} + +pub struct ReductionNodeRunner { + pub reduction_node: ReductionNode, +} +#[async_trait] +impl RunnableNode for ReductionNodeRunner { + async fn run(&self) -> anyhow::Result<()> { + reduce(&self.reduction_node.grouping_columns, &self.reduction_node.operations, &self.reduction_node.input_file, &self.reduction_node.output_file)?; + Ok(()) + } +} \ No newline at end of file diff --git a/wit/dynamic_node.wit b/wit/dynamic_node.wit new file mode 100644 index 0000000..eed84e7 --- /dev/null +++ b/wit/dynamic_node.wit @@ -0,0 +1,35 @@ +package vato007:ingey; + +world dynamic { + resource row { + get: func(name: string) -> string; + } + + resource reader { + columns: func() -> list; + + next: func() -> row; + has-next: func() -> bool; + + // Get a row by values in one or more columns + query: func(values: list>) -> row; + } + + resource read-map { + get: func(key: string) -> string; + } + + resource write-map { + add: func(name: string, value: string); + } + + resource readers { + get-reader: func(name: string) -> option; + } + + resource writer { + write: func(row: write-map); + } + + export evaluate: func(readers: readers, properties: read-map, writer: writer); +} \ No newline at end of file