diff --git a/Cargo.lock b/Cargo.lock index 0642370..d75257e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,19 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.4" @@ -11,6 +24,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -26,6 +45,81 @@ version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" +[[package]] +name = "ar_archive_writer" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c269894b6fe5e9d7ada0cf69b5bf847ff35bc25fc271f08e1d080fce80339a" +dependencies = [ + "object", +] + +[[package]] +name = "argminmax" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70f13d10a41ac8d2ec79ee34178d61e6f47a29c2edfe7ef1721c7383b0359e65" +dependencies = [ + "num-traits", +] + +[[package]] +name = "array-init-cursor" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed51fe0f224d1d4ea768be38c51f9f831dee9d05c163c11fba0b8c44387b1fc3" + +[[package]] +name = "async-stream" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "async-trait" +version = "0.1.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "atoi" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" +dependencies = [ + "num-traits", +] + +[[package]] +name = "atoi_simd" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a49e05797ca52e312a0c658938b7d00693ef037799ef7187678f212d7684cf" +dependencies = [ + "debug_unsafe", +] + [[package]] name = "atomic-waker" version = "1.1.2" @@ -121,7 +215,7 @@ checksum = "604fde5e028fea851ce1d8570bbdc034bec850d157f7569d10f347d06808c05c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -135,6 +229,9 @@ name = "bitflags" version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +dependencies = [ + "serde_core", +] [[package]] name = "block-buffer" @@ -161,12 +258,41 @@ version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" +[[package]] +name = "bytemuck" +version = "1.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + [[package]] name = "bytes" version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" +[[package]] +name = "castaway" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] + [[package]] name = "cc" version = "1.2.52" @@ -204,7 +330,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" dependencies = [ "iana-time-zone", + "js-sys", "num-traits", + "wasm-bindgen", "windows-link", ] @@ -216,7 +344,17 @@ checksum = "93698b29de5e97ad0ae26447b344c482a7284c737d9ddc5f9e52b74a336671bb" dependencies = [ "chrono", "chrono-tz-build", - "phf", + "phf 0.11.3", +] + +[[package]] +name = "chrono-tz" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6139a8597ed92cf816dfb33f5dd6cf0bb93a6adc938f11039f371bc5bcd26c3" +dependencies = [ + "chrono", + "phf 0.12.1", ] [[package]] @@ -226,7 +364,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c088aee841df9c3041febbb73934cfc39708749bf96dc827e3359cd39ef11b1" dependencies = [ "parse-zoneinfo", - "phf", + "phf 0.11.3", "phf_codegen", ] @@ -249,6 +387,32 @@ dependencies = [ "memchr", ] +[[package]] +name = "comfy-table" +version = "7.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "958c5d6ecf1f214b4c2bbbbf6ab9523a864bd136dcf71a7e8904799acfe1ad47" +dependencies = [ + "crossterm", + "unicode-segmentation", + "unicode-width", +] + +[[package]] +name = "compact_str" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b79c4069c6cad78e2e0cdfcbd26275770669fb39fd308a752dc110e83b9af32" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "rustversion", + "ryu", + "serde", + "static_assertions", +] + [[package]] name = "core-foundation" version = "0.10.1" @@ -274,6 +438,26 @@ dependencies = [ "libc", ] +[[package]] +name = "croner" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4aa42bcd3d846ebf66e15bd528d1087f75d1c6c1c66ebff626178a106353c576" +dependencies = [ + "chrono", + "derive_builder", + "strum", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-deque" version = "0.8.6" @@ -293,12 +477,44 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +[[package]] +name = "crossterm" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b" +dependencies = [ + "bitflags", + "crossterm_winapi", + "document-features", + "parking_lot", + "rustix", + "winapi", +] + +[[package]] +name = "crossterm_winapi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" +dependencies = [ + "winapi", +] + [[package]] name = "crypto-common" version = "0.1.7" @@ -309,6 +525,78 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.114", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "debug_unsafe" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85d3cef41d236720ed453e102153a53e4cc3d2fde848c0078a50cf249e8e3e5b" + +[[package]] +name = "derive_builder" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" +dependencies = [ + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "derive_builder_macro" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" +dependencies = [ + "derive_builder_core", + "syn 2.0.114", +] + [[package]] name = "deunicode" version = "1.6.2" @@ -333,7 +621,16 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", ] [[package]] @@ -342,12 +639,36 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + [[package]] name = "errno" version = "0.3.14" @@ -355,15 +676,54 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] +[[package]] +name = "ethnum" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca81e6b4777c89fd810c25a4be2b1bd93ea034fbe58e6a75216a34c6b82c539b" + +[[package]] +name = "fallible-streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" + +[[package]] +name = "fast-float2" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8eb564c5c7423d25c886fb561d1e4ee69f72354d16918afa32c08811f6b6a55" + [[package]] name = "find-msvc-tools" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f449e6c6c08c865631d4890cfacf252b3d396c9bcc83adb6623cdb02a8336c41" +[[package]] +name = "float-cmp" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b09cf3155332e944990140d967ff5eceb70df778b34f77d8075db46e4704e6d8" +dependencies = [ + "num-traits", +] + +[[package]] +name = "fnv" +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 = "form_urlencoded" version = "1.2.2" @@ -379,6 +739,21 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + [[package]] name = "futures-channel" version = "0.3.31" @@ -386,6 +761,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -395,32 +771,65 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] -name = "futures-sink" +name = "futures-executor" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] [[package]] -name = "futures-task" +name = "futures-io" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] -name = "futures-util" +name = "futures-macro" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ - "futures-core", - "futures-task", - "pin-project-lite", - "pin-utils", - "slab", + "proc-macro2", + "quote", + "syn 2.0.114", ] [[package]] -name = "generic-array" +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" @@ -456,6 +865,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "glob" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + [[package]] name = "globset" version = "0.4.18" @@ -480,6 +895,68 @@ dependencies = [ "walkdir", ] +[[package]] +name = "halfbrown" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8588661a8607108a5ca69cab034063441a0413a0b041c13618a7dd348021ef6f" +dependencies = [ + "hashbrown 0.14.5", + "serde", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "allocator-api2", + "rayon", + "serde", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", + "rayon", + "serde", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "home" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +dependencies = [ + "windows-sys 0.61.2", +] + [[package]] name = "http" version = "1.4.0" @@ -614,7 +1091,7 @@ dependencies = [ "js-sys", "log", "wasm-bindgen", - "windows-core", + "windows-core 0.62.2", ] [[package]] @@ -707,6 +1184,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "1.1.0" @@ -744,6 +1227,18 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "indexmap" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +dependencies = [ + "equivalent", + "hashbrown 0.16.1", + "serde", + "serde_core", +] + [[package]] name = "ipnet" version = "2.11.0" @@ -775,6 +1270,12 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" +[[package]] +name = "itoap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9028f49264629065d057f340a86acb84867925865f73bbf8d47b4d149a7e88b8" + [[package]] name = "jni" version = "0.21.1" @@ -817,6 +1318,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "jsonpath_lib_polars_vendor" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4bd9354947622f7471ff713eacaabdb683ccb13bba4edccaab9860abf480b7d" +dependencies = [ + "log", + "serde", + "serde_json", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -835,12 +1347,24 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + [[package]] name = "litemap" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + [[package]] name = "lock_api" version = "0.4.14" @@ -862,6 +1386,25 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" +[[package]] +name = "lz4" +version = "1.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a20b523e860d03443e98350ceaac5e71c6ba89aea7d960769ec3ce37f4de5af4" +dependencies = [ + "lz4-sys", +] + +[[package]] +name = "lz4-sys" +version = "1.11.1+lz4-1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bd8c0d6c6ed0cd30b3652886bb8711dc4bb01d637a68105a3d5158039b418e6" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "matchers" version = "0.2.0" @@ -883,6 +1426,15 @@ version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +[[package]] +name = "memmap2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "744133e4a0e0a658e1374cf3bf8e415c4052a15a111acd372764c55b4177d490" +dependencies = [ + "libc", +] + [[package]] name = "mime" version = "0.3.17" @@ -910,6 +1462,28 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "multiversion" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4851161a11d3ad0bf9402d90ffc3967bf231768bfd7aeb61755ad06dbf1a142" +dependencies = [ + "multiversion-macros", + "target-features", +] + +[[package]] +name = "multiversion-macros" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79a74ddee9e0c27d2578323c13905793e91622148f138ba29738f9dddb835e90" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "target-features", +] + [[package]] name = "netviz" version = "1.0.0" @@ -917,17 +1491,37 @@ dependencies = [ "anyhow", "axum", "itertools", + "polars", "reqwest", "serde", "serde_json", "tera", "thiserror 2.0.17", "tokio", + "tokio-cron-scheduler", "tower-http", "tracing", "tracing-subscriber", ] +[[package]] +name = "now" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d89e9874397a1f0a52fc1f197a8effd9735223cb2390e9dcc83ac6cd02923d0" +dependencies = [ + "chrono", +] + +[[package]] +name = "ntapi" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c70f219e21142367c70c0b30c6a9e3a14d55b4d12a204d897fbec83a0363f081" +dependencies = [ + "winapi", +] + [[package]] name = "nu-ansi-term" version = "0.50.3" @@ -937,6 +1531,17 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -944,6 +1549,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", + "libm", +] + +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "memchr", ] [[package]] @@ -1026,7 +1641,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -1045,7 +1660,16 @@ version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" dependencies = [ - "phf_shared", + "phf_shared 0.11.3", +] + +[[package]] +name = "phf" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "913273894cec178f401a31ec4b656318d95473527be05c0752cc41cdc32be8b7" +dependencies = [ + "phf_shared 0.12.1", ] [[package]] @@ -1055,7 +1679,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" dependencies = [ "phf_generator", - "phf_shared", + "phf_shared 0.11.3", ] [[package]] @@ -1064,7 +1688,7 @@ version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" dependencies = [ - "phf_shared", + "phf_shared 0.11.3", "rand 0.8.5", ] @@ -1077,6 +1701,15 @@ dependencies = [ "siphasher", ] +[[package]] +name = "phf_shared" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06005508882fb681fd97892ecff4b7fd0fee13ef1aa569f8695dae7ab9099981" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -1089,6 +1722,538 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "planus" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1691dd09e82f428ce8d6310bd6d5da2557c82ff17694d2a32cad7242aea89f" +dependencies = [ + "array-init-cursor", +] + +[[package]] +name = "polars" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0af18ae021b0396c42f39396146332957ebc4d4d25d931b4fe73509948f348" +dependencies = [ + "getrandom 0.2.17", + "polars-arrow", + "polars-core", + "polars-error", + "polars-io", + "polars-lazy", + "polars-ops", + "polars-parquet", + "polars-sql", + "polars-time", + "polars-utils", + "version_check", +] + +[[package]] +name = "polars-arrow" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1fd3c64d50b7f5f328e1566cab9979d4bc1ba2ff22114b301ed2ee0e518dbca" +dependencies = [ + "ahash", + "atoi", + "bytemuck", + "chrono", + "chrono-tz 0.10.4", + "dyn-clone", + "either", + "ethnum", + "getrandom 0.2.17", + "hashbrown 0.15.5", + "itoap", + "lz4", + "multiversion", + "num-traits", + "parking_lot", + "polars-arrow-format", + "polars-error", + "polars-schema", + "polars-utils", + "simdutf8", + "streaming-iterator", + "strength_reduce", + "strum_macros 0.26.4", + "version_check", + "zstd", +] + +[[package]] +name = "polars-arrow-format" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b0ef2474af9396b19025b189d96e992311e6a47f90c53cd998b36c4c64b84c" +dependencies = [ + "planus", + "serde", +] + +[[package]] +name = "polars-compute" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e60822c245a870113df5a88fb184039501eda0a56bcd0c3f866406ff659df340" +dependencies = [ + "atoi_simd", + "bytemuck", + "chrono", + "either", + "fast-float2", + "itoa", + "itoap", + "num-traits", + "polars-arrow", + "polars-error", + "polars-utils", + "ryu", + "strength_reduce", + "version_check", +] + +[[package]] +name = "polars-core" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4794a9e38ef2faf7e47a6f736c7f156c6fbb66cd529f82593b2d48348e422c8d" +dependencies = [ + "ahash", + "bitflags", + "bytemuck", + "chrono", + "chrono-tz 0.10.4", + "comfy-table", + "either", + "hashbrown 0.14.5", + "hashbrown 0.15.5", + "indexmap", + "itoa", + "num-traits", + "once_cell", + "polars-arrow", + "polars-compute", + "polars-error", + "polars-row", + "polars-schema", + "polars-utils", + "rand 0.8.5", + "rand_distr", + "rayon", + "regex", + "serde", + "strum_macros 0.26.4", + "thiserror 2.0.17", + "version_check", + "xxhash-rust", +] + +[[package]] +name = "polars-error" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "100093a164bf6c001487ea528b7504f4be1a6881bcffe279bd6133e8f4b4e4f7" +dependencies = [ + "polars-arrow-format", + "regex", + "simdutf8", + "thiserror 2.0.17", +] + +[[package]] +name = "polars-expr" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad56c5ea4d6e0546fbc3fa35918a537b76587600a5118770ed331136249d50d8" +dependencies = [ + "ahash", + "bitflags", + "hashbrown 0.15.5", + "num-traits", + "once_cell", + "polars-arrow", + "polars-compute", + "polars-core", + "polars-io", + "polars-ops", + "polars-plan", + "polars-row", + "polars-time", + "polars-utils", + "rand 0.8.5", + "rayon", +] + +[[package]] +name = "polars-io" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95d774d5971d2092f0588e89d2f0be524dff35ea368272c0810ba54a860e4411" +dependencies = [ + "ahash", + "async-trait", + "atoi_simd", + "bytes", + "chrono", + "fast-float2", + "futures", + "glob", + "hashbrown 0.15.5", + "home", + "itoa", + "memchr", + "memmap2", + "num-traits", + "once_cell", + "percent-encoding", + "polars-arrow", + "polars-core", + "polars-error", + "polars-json", + "polars-parquet", + "polars-schema", + "polars-time", + "polars-utils", + "rayon", + "regex", + "ryu", + "simd-json", + "simdutf8", + "tokio", + "tokio-util", +] + +[[package]] +name = "polars-json" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d97ebf73da016f4af4e5af8663523137e273e09d1a459e0cf87b5fdfd8f007" +dependencies = [ + "ahash", + "chrono", + "fallible-streaming-iterator", + "hashbrown 0.15.5", + "indexmap", + "itoa", + "num-traits", + "polars-arrow", + "polars-compute", + "polars-error", + "polars-utils", + "ryu", + "simd-json", + "streaming-iterator", +] + +[[package]] +name = "polars-lazy" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa457bfa96f45cf14c33507eaa3ebcec6a8d52e7f7fc60cd23f338631369d417" +dependencies = [ + "ahash", + "bitflags", + "memchr", + "once_cell", + "polars-arrow", + "polars-core", + "polars-expr", + "polars-io", + "polars-json", + "polars-mem-engine", + "polars-ops", + "polars-pipe", + "polars-plan", + "polars-stream", + "polars-time", + "polars-utils", + "rayon", + "version_check", +] + +[[package]] +name = "polars-mem-engine" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f73aa56fc0a4c1e9d56b4a4485800f4780ca214030d32d0150eccc44f71d6dab" +dependencies = [ + "memmap2", + "polars-arrow", + "polars-core", + "polars-error", + "polars-expr", + "polars-io", + "polars-json", + "polars-ops", + "polars-plan", + "polars-time", + "polars-utils", + "rayon", +] + +[[package]] +name = "polars-ops" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b267480495ffe382dab63318e3c6bf4073bb82971c8b80294d079293fece458b" +dependencies = [ + "ahash", + "argminmax", + "base64", + "bytemuck", + "chrono", + "chrono-tz 0.10.4", + "either", + "hashbrown 0.15.5", + "hex", + "indexmap", + "jsonpath_lib_polars_vendor", + "memchr", + "num-traits", + "polars-arrow", + "polars-compute", + "polars-core", + "polars-error", + "polars-json", + "polars-schema", + "polars-utils", + "rayon", + "regex", + "regex-syntax", + "serde_json", + "strum_macros 0.26.4", + "unicode-reverse", + "version_check", +] + +[[package]] +name = "polars-parquet" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20237f232b1a74b1fae6b5c9bea8c440f2e5d3b5506601b038f0a7a34b84b710" +dependencies = [ + "ahash", + "async-stream", + "base64", + "bytemuck", + "ethnum", + "futures", + "hashbrown 0.15.5", + "num-traits", + "polars-arrow", + "polars-compute", + "polars-error", + "polars-parquet-format", + "polars-utils", + "simdutf8", + "streaming-decompression", +] + +[[package]] +name = "polars-parquet-format" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c025243dcfe8dbc57e94d9f82eb3bef10b565ab180d5b99bed87fd8aea319ce1" +dependencies = [ + "async-trait", + "futures", +] + +[[package]] +name = "polars-pipe" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e3066f4fea8e55e72eba54ffe20ebdf08f63b9691aba8ea1135c3aeb9c2c7e" +dependencies = [ + "crossbeam-channel", + "crossbeam-queue", + "enum_dispatch", + "hashbrown 0.15.5", + "num-traits", + "polars-arrow", + "polars-compute", + "polars-core", + "polars-expr", + "polars-io", + "polars-ops", + "polars-plan", + "polars-row", + "polars-utils", + "rayon", + "uuid", + "version_check", +] + +[[package]] +name = "polars-plan" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99a3832887671df1eb326df52cbfcc47789d3d58454c1084a154b48b240175e2" +dependencies = [ + "ahash", + "bitflags", + "bytemuck", + "bytes", + "chrono", + "chrono-tz 0.10.4", + "either", + "hashbrown 0.15.5", + "memmap2", + "num-traits", + "once_cell", + "percent-encoding", + "polars-arrow", + "polars-compute", + "polars-core", + "polars-io", + "polars-json", + "polars-ops", + "polars-time", + "polars-utils", + "rayon", + "recursive", + "regex", + "strum_macros 0.26.4", + "version_check", +] + +[[package]] +name = "polars-row" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e36350fb8a90238e02c8ece0f0c4c24f3374197e9c08c1c22cc8b9c526e6c25" +dependencies = [ + "bitflags", + "bytemuck", + "polars-arrow", + "polars-compute", + "polars-error", + "polars-utils", +] + +[[package]] +name = "polars-schema" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c6aa4913cffc522cea3ccbc0cafb350bec18fed0a1ef8d417ac88ea320d7749" +dependencies = [ + "indexmap", + "polars-error", + "polars-utils", + "serde", + "version_check", +] + +[[package]] +name = "polars-sql" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c62a2247028629b1db384437a9f2792488f0ddb539ec16fb46a5e2bceeba6dbc" +dependencies = [ + "hex", + "once_cell", + "polars-arrow", + "polars-core", + "polars-error", + "polars-lazy", + "polars-ops", + "polars-plan", + "polars-time", + "polars-utils", + "rand 0.8.5", + "serde", + "serde_json", + "sqlparser", +] + +[[package]] +name = "polars-stream" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8cd9da4b063146c3ab7c08678a52eb9d466ade4f4c8617605a5a3ea063002c6" +dependencies = [ + "atomic-waker", + "crossbeam-deque", + "crossbeam-utils", + "futures", + "memmap2", + "parking_lot", + "pin-project-lite", + "polars-core", + "polars-error", + "polars-expr", + "polars-io", + "polars-mem-engine", + "polars-ops", + "polars-parquet", + "polars-plan", + "polars-utils", + "rand 0.8.5", + "rayon", + "recursive", + "slotmap", + "tokio", + "version_check", +] + +[[package]] +name = "polars-time" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f005c3441eed1a96464305f73e197813cbae7894ff6712726a1182e31f52b4" +dependencies = [ + "atoi", + "bytemuck", + "chrono", + "chrono-tz 0.10.4", + "now", + "once_cell", + "polars-arrow", + "polars-compute", + "polars-core", + "polars-error", + "polars-ops", + "polars-utils", + "regex", + "strum_macros 0.26.4", +] + +[[package]] +name = "polars-utils" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0fc010eea42ad113b641aa53106e4d6e474650c73573d959a546eed0ce6d479" +dependencies = [ + "ahash", + "bytemuck", + "bytes", + "compact_str", + "hashbrown 0.15.5", + "indexmap", + "libc", + "memmap2", + "num-traits", + "once_cell", + "polars-error", + "rand 0.8.5", + "raw-cpuid", + "rayon", + "serde", + "stacker", + "sysinfo", + "version_check", +] + [[package]] name = "potential_utf" version = "0.1.4" @@ -1116,6 +2281,16 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "psm" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d11f2fedc3b7dafdc2851bc52f277377c5473d378859be234bc7ebb593144d01" +dependencies = [ + "ar_archive_writer", + "cc", +] + [[package]] name = "quinn" version = "0.11.9" @@ -1169,7 +2344,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.60.2", ] [[package]] @@ -1209,41 +2384,100 @@ dependencies = [ ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_distr" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "raw-cpuid" +version = "11.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "498cd0dc59d73224351ee52a95fee0f1a617a2eae0e7d9d720cc622c73a54186" +dependencies = [ + "bitflags", +] + +[[package]] +name = "rayon" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", + "either", + "rayon-core", ] [[package]] -name = "rand_chacha" -version = "0.9.0" +name = "rayon-core" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" dependencies = [ - "ppv-lite86", - "rand_core 0.9.5", + "crossbeam-deque", + "crossbeam-utils", ] [[package]] -name = "rand_core" -version = "0.6.4" +name = "recursive" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "0786a43debb760f491b1bc0269fe5e84155353c67482b9e60d0cfb596054b43e" dependencies = [ - "getrandom 0.2.17", + "recursive-proc-macro-impl", + "stacker", ] [[package]] -name = "rand_core" -version = "0.9.5" +name = "recursive-proc-macro-impl" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +checksum = "76009fbe0614077fc1a2ce255e3a1881a2e3a3527097d5dc6d8212c585e7e38b" dependencies = [ - "getrandom 0.3.4", + "quote", + "syn 2.0.114", ] [[package]] @@ -1255,6 +2489,26 @@ dependencies = [ "bitflags", ] +[[package]] +name = "ref-cast" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + [[package]] name = "regex" version = "1.12.2" @@ -1341,6 +2595,19 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" +[[package]] +name = "rustix" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + [[package]] name = "rustls" version = "0.23.36" @@ -1395,7 +2662,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -1502,7 +2769,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -1511,6 +2778,7 @@ version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" dependencies = [ + "indexmap", "itoa", "memchr", "serde", @@ -1577,6 +2845,29 @@ dependencies = [ "libc", ] +[[package]] +name = "simd-json" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2bcf6c6e164e81bc7a5d49fc6988b3d515d9e8c07457d7b74ffb9324b9cd40" +dependencies = [ + "ahash", + "getrandom 0.2.17", + "halfbrown", + "once_cell", + "ref-cast", + "serde", + "serde_json", + "simdutf8", + "value-trait", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + [[package]] name = "siphasher" version = "1.0.1" @@ -1589,6 +2880,15 @@ version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" +[[package]] +name = "slotmap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" +dependencies = [ + "version_check", +] + [[package]] name = "slug" version = "0.1.6" @@ -1615,18 +2915,119 @@ dependencies = [ "windows-sys 0.60.2", ] +[[package]] +name = "sqlparser" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a875d8cd437cc8a97e9aeaeea352ec9a19aea99c23e9effb17757291de80b08" +dependencies = [ + "log", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" +[[package]] +name = "stacker" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1f8b29fb42aafcea4edeeb6b2f2d7ecd0d969c48b4cf0d2e64aafc471dd6e59" +dependencies = [ + "cc", + "cfg-if", + "libc", + "psm", + "windows-sys 0.52.0", + "windows-sys 0.59.0", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "streaming-decompression" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf6cc3b19bfb128a8ad11026086e31d3ce9ad23f8ea37354b31383a187c44cf3" +dependencies = [ + "fallible-streaming-iterator", +] + +[[package]] +name = "streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2231b7c3057d5e4ad0156fb3dc807d900806020c5ffa3ee6ff2c8c76fb8520" + +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" +dependencies = [ + "strum_macros 0.27.2", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.114", +] + +[[package]] +name = "strum_macros" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.114", +] + [[package]] name = "subtle" 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.114" @@ -1655,9 +3056,28 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", +] + +[[package]] +name = "sysinfo" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c33cd241af0f2e9e3b5c32163b873b29956890b5342e6745b917ce9d490f4af" +dependencies = [ + "core-foundation-sys", + "libc", + "memchr", + "ntapi", + "windows", ] +[[package]] +name = "target-features" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1bbb9f3c5c463a01705937a24fdabc5047929ac764b2d5b9cf681c1f5041ed5" + [[package]] name = "tera" version = "1.20.1" @@ -1665,7 +3085,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8004bca281f2d32df3bacd59bc67b312cb4c70cea46cbd79dbe8ac5ed206722" dependencies = [ "chrono", - "chrono-tz", + "chrono-tz 0.9.0", "globwalk", "humansize", "lazy_static", @@ -1706,7 +3126,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -1717,7 +3137,7 @@ checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -1771,6 +3191,22 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "tokio-cron-scheduler" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f50e41f200fd8ed426489bd356910ede4f053e30cebfbd59ef0f856f0d7432a" +dependencies = [ + "chrono", + "chrono-tz 0.10.4", + "croner", + "num-derive", + "num-traits", + "tokio", + "tracing", + "uuid", +] + [[package]] name = "tokio-macros" version = "2.6.0" @@ -1779,7 +3215,7 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -1881,7 +3317,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -1953,12 +3389,27 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +[[package]] +name = "unicode-reverse" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b6f4888ebc23094adfb574fdca9fdc891826287a6397d2cd28802ffd6f20c76" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "unicode-segmentation" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + [[package]] name = "untrusted" version = "0.9.0" @@ -1983,12 +3434,35 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" +[[package]] +name = "uuid" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a" +dependencies = [ + "getrandom 0.3.4", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "valuable" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" +[[package]] +name = "value-trait" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9170e001f458781e92711d2ad666110f153e4e50bfd5cbd02db6547625714187" +dependencies = [ + "float-cmp", + "halfbrown", + "itoa", + "ryu", +] + [[package]] name = "version_check" version = "0.9.5" @@ -2075,7 +3549,7 @@ dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn", + "syn 2.0.114", "wasm-bindgen-shared", ] @@ -2117,13 +3591,57 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + [[package]] name = "winapi-util" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" +dependencies = [ + "windows-core 0.57.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-core" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" +dependencies = [ + "windows-implement 0.57.0", + "windows-interface 0.57.0", + "windows-result 0.1.2", + "windows-targets 0.52.6", ] [[package]] @@ -2132,13 +3650,24 @@ version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ - "windows-implement", - "windows-interface", + "windows-implement 0.60.2", + "windows-interface 0.59.3", "windows-link", - "windows-result", + "windows-result 0.4.1", "windows-strings", ] +[[package]] +name = "windows-implement" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + [[package]] name = "windows-implement" version = "0.60.2" @@ -2147,7 +3676,18 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", +] + +[[package]] +name = "windows-interface" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", ] [[package]] @@ -2158,7 +3698,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -2167,6 +3707,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-result" version = "0.4.1" @@ -2203,6 +3752,15 @@ 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" @@ -2419,6 +3977,12 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" +[[package]] +name = "xxhash-rust" +version = "0.8.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdd20c5420375476fbd4394763288da7eb0cc0b8c11deed431a91562af7335d3" + [[package]] name = "yoke" version = "0.8.1" @@ -2438,7 +4002,7 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", "synstructure", ] @@ -2459,7 +4023,7 @@ checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -2479,7 +4043,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", "synstructure", ] @@ -2519,7 +4083,7 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", ] [[package]] @@ -2527,3 +4091,31 @@ name = "zmij" version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd8f3f50b848df28f887acb68e41201b5aea6bc8a8dacc00fb40635ff9a72fea" + +[[package]] +name = "zstd" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.16+zstd.1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/Cargo.toml b/Cargo.toml index 1510d8b..c1ad6a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ rust-version = "1.92" [dependencies] axum = { version = "0.8", features = ["macros"] } tokio = { version = "1.0", features = ["full"] } +tokio-cron-scheduler = "0.15.1" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" reqwest = { version = "0.13", default-features = false, features = ["json", "rustls"] } @@ -17,3 +18,4 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] } itertools = "0.14" thiserror = "2.0" anyhow = "1.0" +polars = { version = "0.45", features = ["lazy", "serde", "json"] } diff --git a/Dockerfile b/Dockerfile index 0d48c3e..e441b35 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,9 @@ FROM debian:bookworm-slim # Set Time Zone to IST ENV TZ="Asia/Kolkata" +# Set logging level +ENV RUST_LOG="info" + # Add required runtime packages RUN apt-get update && \ apt-get install --yes --no-install-recommends \ diff --git a/assets/style.css b/assets/style.css new file mode 100644 index 0000000..68f2baf --- /dev/null +++ b/assets/style.css @@ -0,0 +1,123 @@ +/* Custom Styling for NetViz on top of Pico CSS v2 */ + +:root { + --pico-font-family: "Inter", system-ui, -apple-system, sans-serif; + --pico-primary: #3b82f6; + --pico-primary-background: #3b82f6; + --pico-primary-hover: #2563eb; + --pico-primary-underline: rgba(59, 130, 246, 0.5); + + --pico-border-radius: 0.5rem; + --pico-form-element-spacing-vertical: 0.75rem; + --pico-form-element-spacing-horizontal: 1rem; +} + +/* Typography */ +@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap"); + +body { + font-weight: 400; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + font-weight: 600; + margin-bottom: 1rem; +} + +/* Component Overrides & Custom Utilities */ + +.card { + padding: var(--pico-block-spacing-vertical) + var(--pico-block-spacing-horizontal); + border-radius: var(--pico-border-radius); + background: var(--pico-card-background-color); + box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), + 0 2px 4px -1px rgba(0, 0, 0, 0.06); + margin-bottom: var(--pico-block-spacing-vertical); + border: 1px solid var(--pico-muted-border-color); +} + +.stat-card { + text-align: center; +} + +.stat-value { + font-size: 2.5rem; + font-weight: 700; + color: var(--pico-primary); + margin-bottom: 0.5rem; +} + +.stat-label { + font-size: 0.875rem; + color: var(--pico-muted-color); + text-transform: uppercase; + letter-spacing: 0.05em; +} + +/* Charts */ +.chart-container { + position: relative; + height: 400px; + width: 100%; +} + +/* Grid adjustments */ +.grid-stats { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); + gap: var(--pico-grid-column-gap); + margin-bottom: var(--pico-block-spacing-vertical); +} + +/* Navbar */ +nav strong { + font-size: 1.25rem; + background: -webkit-linear-gradient(45deg, var(--pico-primary), #8b5cf6); + background: linear-gradient(45deg, var(--pico-primary), #8b5cf6); + -webkit-background-clip: text; + background-clip: text; + -webkit-text-fill-color: transparent; +} + +/* Badge styled pills */ +.badge { + display: inline-block; + padding: 0.25em 0.5em; + font-size: 0.75em; + font-weight: 600; + line-height: 1; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + border-radius: var(--pico-border-radius); + background-color: var(--pico-primary); + color: white; + margin-right: 0.25rem; +} + +.badge-secondary { + background-color: var(--pico-secondary-background); + color: var(--pico-color); +} + +/* Animations */ +@keyframes fadeIn { + from { + opacity: 0; + transform: translateY(10px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +main > * { + animation: fadeIn 0.4s ease-out; +} diff --git a/src/error.rs b/src/error.rs index 600c4e5..fbe669c 100644 --- a/src/error.rs +++ b/src/error.rs @@ -24,4 +24,8 @@ pub enum NetVizError { /// Unexpected API response format. #[error("Invalid API response: {0}")] InvalidApiResponse(String), + + /// Polars error. + #[error("Polars error: {0}")] + Polars(#[from] polars::prelude::PolarsError), } diff --git a/src/fetcher.rs b/src/fetcher.rs index 2e88134..f633186 100644 --- a/src/fetcher.rs +++ b/src/fetcher.rs @@ -3,9 +3,9 @@ use crate::error::NetVizError; use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION}; use serde_json::Value; -use std::fs; use std::path::PathBuf; use std::time::Duration; +use tokio::fs; use tracing::{error, info, warn}; /// Base URL for the PeeringDB API. @@ -32,7 +32,7 @@ const OUTPUT_DIR: &str = "data/peeringdb"; /// Returns `NetVizError::InvalidApiResponse` if the API index format is unexpected. pub async fn fetch_and_save_peeringdb_data() -> Result<(), NetVizError> { let output_path = PathBuf::from(OUTPUT_DIR); - fs::create_dir_all(&output_path)?; + fs::create_dir_all(&output_path).await?; let client = reqwest::Client::builder() .user_agent("NetViz/1.0.0") @@ -71,7 +71,7 @@ pub async fn fetch_and_save_peeringdb_data() -> Result<(), NetVizError> { Ok(resp) => match resp.json::().await { Ok(data) => match serde_json::to_string_pretty(&data) { Ok(json_data) => { - if let Err(e) = fs::write(&file_path, json_data) { + if let Err(e) = fs::write(&file_path, json_data).await { error!("Failed to write data to {:?}: {}", file_path, e); } else { info!("Successfully saved data to {:?}", file_path); diff --git a/src/handlers.rs b/src/handlers.rs new file mode 100644 index 0000000..ccc291b --- /dev/null +++ b/src/handlers.rs @@ -0,0 +1,474 @@ +use axum::{ + extract::{Query, State}, + http::StatusCode, + response::{Html, IntoResponse, Json}, +}; +use polars::prelude::*; +use serde::Deserialize; +use std::collections::HashMap; +use std::sync::Arc; +use tera::Context; +use tracing::error; + +use crate::models::{Network, Stats}; +use crate::state::AppState; + +/// Query parameters for network list matching and pagination. +#[derive(Debug, Deserialize)] +pub struct NetworkQuery { + pub page: Option, + pub per_page: Option, + #[serde(default, deserialize_with = "empty_string_as_none_str")] + pub q: Option, + #[serde(default, deserialize_with = "empty_string_as_none_str")] + pub type_: Option, + #[serde(default, deserialize_with = "empty_string_as_none_str")] + pub policy: Option, + #[serde(default, deserialize_with = "empty_string_as_none_str")] + pub status: Option, +} + +/// Query parameters for search endpoint. +#[derive(Debug, Deserialize)] +pub struct SearchQuery { + /// AS Number to search for. + #[serde(default, deserialize_with = "empty_string_as_none")] + pub asn: Option, + /// Network name to search for. + #[serde(default, deserialize_with = "empty_string_as_none_str")] + pub name: Option, +} + +fn empty_string_as_none<'de, D, T>(deserializer: D) -> Result, D::Error> +where + D: serde::Deserializer<'de>, + T: std::str::FromStr, + T::Err: std::fmt::Display, +{ + let opt: Option = Option::deserialize(deserializer)?; + match opt { + None => Ok(None), + Some(s) if s.is_empty() => Ok(None), + Some(s) => s.parse::().map(Some).map_err(serde::de::Error::custom), + } +} + +fn empty_string_as_none_str<'de, D>(deserializer: D) -> Result, D::Error> +where + D: serde::Deserializer<'de>, +{ + let opt: Option = Option::deserialize(deserializer)?; + match opt { + None => Ok(None), + Some(s) if s.is_empty() => Ok(None), + Some(s) => Ok(Some(s)), + } +} + +fn render_template( + tera: &tera::Tera, + template: &str, + context: &Context, +) -> Result, (StatusCode, &'static str)> { + tera.render(template, context).map(Html).map_err(|e| { + error!("Template render error for '{}': {}", template, e); + (StatusCode::INTERNAL_SERVER_ERROR, "Render error") + }) +} + +fn truncate_chars(s: &str, max_chars: usize) -> String { + let char_count = s.chars().count(); + if char_count > max_chars { + let truncated: String = s.chars().take(max_chars).collect(); + format!("{}...", truncated) + } else { + s.to_string() + } +} + +/// GET / - Dashboard with network statistics. +pub async fn index(State(state): State>) -> impl IntoResponse { + let data_guard = state.data.read().await; + let networks = &data_guard.networks; + + // Manual stats calculation on Vec is fast enough and easier than DF for simple counts + // without aggregation queries, but since we have DF we could use it. + // However, existing logic works fine for simple stats map. + // Let's keep existing logic to minimize risk, but use DF if I wanted to be "pure". + // Actually, stick to logic from previous main.rs for dashboard stats to ensure correctness. + + let mut network_types: HashMap<&str, usize> = HashMap::new(); + let mut policy_types: HashMap<&str, usize> = HashMap::new(); + let mut scopes: HashMap<&str, usize> = HashMap::new(); + + for item in networks.iter() { + if let Some(ref t) = item.info_type { + *network_types.entry(t.as_str()).or_insert(0) += 1; + } + if let Some(ref p) = item.policy_general { + *policy_types.entry(p.as_str()).or_insert(0) += 1; + } + if let Some(ref s) = item.info_scope { + *scopes.entry(s.as_str()).or_insert(0) += 1; + } + } + + let stats = Stats { + total_networks: networks.len(), + network_types: network_types + .into_iter() + .map(|(k, v)| (k.to_string(), v)) + .collect(), + policy_types: policy_types + .into_iter() + .map(|(k, v)| (k.to_string(), v)) + .collect(), + scopes: scopes + .into_iter() + .map(|(k, v)| (k.to_string(), v)) + .collect(), + }; + + let mut context = Context::new(); + context.insert("stats", &stats); + let recent_networks: Vec = networks.iter().take(10).cloned().collect(); + drop(data_guard); + context.insert("networks", &recent_networks); + + render_template(&state.tera, "dashboard.html", &context) +} + +/// GET /networks - Paginated network list. +pub async fn networks_list( + State(state): State>, + Query(query): Query, +) -> impl IntoResponse { + let data_guard = state.data.read().await; + let networks = &data_guard.networks; + + // Filter first + let filtered_networks: Vec = networks + .iter() + .filter(|n| { + let mut matches = true; + + if let Some(ref q) = query.q { + let q_lower = q.to_lowercase(); + matches &= n.name.to_lowercase().contains(&q_lower) + || n.asn.to_string().contains(&q_lower) + || n.aka + .as_ref() + .map_or(false, |a| a.to_lowercase().contains(&q_lower)); + } + + if let Some(ref t) = query.type_ { + matches &= n + .info_type + .as_ref() + .map_or(false, |it| it.eq_ignore_ascii_case(t)); + } + + if let Some(ref p) = query.policy { + matches &= n + .policy_general + .as_ref() + .map_or(false, |pg| pg.eq_ignore_ascii_case(p)); + } + + if let Some(ref s) = query.status { + matches &= n + .status + .as_ref() + .map_or(false, |st| st.eq_ignore_ascii_case(s)); + } + + matches + }) + .cloned() + .collect(); + + let total_networks = filtered_networks.len(); + let page = query.page.unwrap_or(1).max(1); + let per_page = query.per_page.unwrap_or(25).clamp(1, 100); + let total_pages = total_networks.div_ceil(per_page); + + // Adjust page if it exceeds total pages (unless total is 0) + let page = if total_pages > 0 && page > total_pages { + total_pages + } else { + page + }; + + let start_index = (page - 1).saturating_mul(per_page); + let end_index = start_index.saturating_add(per_page).min(total_networks); + + let paginated_networks: Vec = if start_index >= total_networks { + Vec::new() + } else { + filtered_networks[start_index..end_index].to_vec() + }; + drop(data_guard); + + let mut context = Context::new(); + context.insert("networks", &paginated_networks); + context.insert("page", &page); + context.insert("per_page", &per_page); + context.insert("total_pages", &total_pages); + context.insert("total_networks", &total_networks); + + // Pass back filter params + context.insert("q", &query.q); + context.insert("type_filter", &query.type_); + context.insert("policy_filter", &query.policy); + context.insert("status_filter", &query.status); + + render_template(&state.tera, "networks.html", &context) +} + +/// GET /analytics - Analytics dashboard. +pub async fn analytics(State(state): State>) -> impl IntoResponse { + let context = Context::new(); + render_template(&state.tera, "analytics.html", &context) +} + +/// GET /search - Search networks. +pub async fn search_networks( + State(state): State>, + Query(query): Query, +) -> impl IntoResponse { + let data_guard = state.data.read().await; + let networks = &data_guard.networks; + + let search_name = query.name.as_ref().map(|n| { + let mut s = n.clone(); + s.truncate(100); + s.to_lowercase() + }); + + let results: Vec = if query.asn.is_some() || search_name.is_some() { + networks + .iter() + .filter(|network| { + let matches_asn = query.asn == Some(network.asn); + let matches_name = search_name + .as_ref() + .is_some_and(|name| network.name.to_lowercase().contains(name)); + matches_asn || matches_name + }) + .cloned() + .collect() + } else { + Vec::new() + }; + drop(data_guard); + + let mut context = Context::new(); + context.insert("results", &results); + context.insert("query_asn", &query.asn); + context.insert("query_name", &query.name); + + render_template(&state.tera, "search.html", &context) +} + +/// GET /api/network-types - JSON network type counts using Polars. +pub async fn api_network_types(State(state): State>) -> impl IntoResponse { + let data_guard = state.data.read().await; + let df = &data_guard.df; + + // Use Polars Lazy API for efficient aggregation + let agg_result = df + .clone() + .lazy() + .filter(col("info_type").is_not_null()) + .group_by([col("info_type")]) + .agg([len().alias("count")]) + .collect(); + + drop(data_guard); + + match agg_result { + Ok(res) => { + // Extract columns + let labels: Vec = res + .column("info_type") + .ok() + .and_then(|s| s.str().ok()) + .map(|ca| ca.into_iter().flatten().map(|s| s.to_string()).collect()) + .unwrap_or_default(); + + let counts: Vec = if let Ok(s) = res.column("count") { + if let Ok(cast_s) = s.cast(&DataType::UInt64) { + if let Ok(ca) = cast_s.u64() { + ca.into_iter().flatten().map(|v| v as usize).collect() + } else { + vec![] + } + } else { + vec![] + } + } else { + vec![] + }; + + Json(serde_json::json!({ + "labels": labels, + "data": counts + })) + } + Err(e) => { + error!("Polars aggregation error: {}", e); + Json(serde_json::json!({"labels": [], "data": []})) + } + } +} + +/// GET /api/prefixes-distribution - Top 15 networks by prefixes using Polars. +pub async fn api_prefixes_distribution(State(state): State>) -> impl IntoResponse { + let data_guard = state.data.read().await; + let df = &data_guard.df; + + let result = df + .clone() + .lazy() + .filter( + col("info_prefixes4") + .is_not_null() + .and(col("info_prefixes6").is_not_null()), + ) + .select([col("name"), col("info_prefixes4"), col("info_prefixes6")]) + .limit(15) // Just take first 15 as in original code, or sort? Original used iter().take(15) + .collect(); + + drop(data_guard); + + match result { + Ok(res) => { + let names: Vec = res + .column("name") + .ok() + .and_then(|s| s.str().ok()) + .map(|ca| { + ca.into_iter() + .flatten() + .map(|s| truncate_chars(s, 30)) + .collect() + }) + .unwrap_or_default(); + + let ipv4: Vec = res + .column("info_prefixes4") + .ok() + .and_then(|s| s.i64().ok()) + .map(|ca| ca.into_iter().flatten().collect()) + .unwrap_or_default(); + + let ipv6: Vec = res + .column("info_prefixes6") + .ok() + .and_then(|s| s.i64().ok()) + .map(|ca| ca.into_iter().flatten().collect()) + .unwrap_or_default(); + + Json(serde_json::json!({ + "networks": names, + "ipv4": ipv4, + "ipv6": ipv6 + })) + } + Err(e) => { + error!("Polars error: {}", e); + Json(serde_json::json!({"networks": [], "ipv4": [], "ipv6": []})) + } + } +} + +/// GET /api/ix-facility-correlation - Scatter plot data using Polars. +pub async fn api_ix_facility_correlation(State(state): State>) -> impl IntoResponse { + let data_guard = state.data.read().await; + let df = &data_guard.df; + + let result = df + .clone() + .lazy() + .filter( + col("ix_count") + .is_not_null() + .and(col("fac_count").is_not_null()), + ) + .select([col("ix_count"), col("fac_count"), col("name")]) + .collect(); + + drop(data_guard); + + match result { + Ok(res) => { + let ix: Vec = res + .column("ix_count") + .unwrap() + .i64() + .unwrap() + .into_iter() + .flatten() + .collect(); + let fac: Vec = res + .column("fac_count") + .unwrap() + .i64() + .unwrap() + .into_iter() + .flatten() + .collect(); + let name_ca = res.column("name").unwrap().str().unwrap(); + + let points: Vec<_> = ix + .iter() + .zip(fac.iter()) + .zip(name_ca.into_iter()) + .filter_map(|((x, y), n)| { + n.map(|name| { + serde_json::json!({ + "x": x, + "y": y, + "label": name + }) + }) + }) + .collect(); + + Json(points) + } + Err(e) => { + error!("Polars error: {}", e); + Json(Vec::::new()) + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + mod truncate_chars_tests { + use super::*; + + #[test] + fn test_short_string_unchanged() { + assert_eq!(truncate_chars("Hello", 10), "Hello"); + } + + #[test] + fn test_exact_length_unchanged() { + assert_eq!(truncate_chars("Hello", 5), "Hello"); + } + + #[test] + fn test_long_string_truncated() { + assert_eq!(truncate_chars("Hello, World!", 5), "Hello..."); + } + + #[test] + fn test_emoji_characters() { + assert_eq!(truncate_chars("Hello 🌍🌍🌍", 8), "Hello 🌍🌍..."); + } + } +} diff --git a/src/main.rs b/src/main.rs index 64a1f0e..4db6f91 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,91 +1,97 @@ -//! NetViz - Network Visualization Application -//! -//! Web application that displays network data from PeeringDB. - mod data; mod error; mod fetcher; +mod handlers; mod models; +mod state; -use axum::{ - extract::{Query, State}, - response::{Html, IntoResponse, Json}, - routing::get, - Router, -}; -use itertools::Itertools; -use serde::Deserialize; -use std::collections::HashMap; +use axum::{routing::get, Router}; +use polars::prelude::*; use std::sync::Arc; -use tera::{Context, Tera}; -use tracing::{error, info}; +use tera::Tera; +use tokio_cron_scheduler::{Job, JobScheduler}; +use tower_http::services::ServeDir; +use tracing::{error, info, warn}; use crate::data::load_network_data; use crate::fetcher::fetch_and_save_peeringdb_data; -use crate::models::{Network, Stats}; +use crate::models::Network; +use crate::state::{AppState, Config}; + +use handlers::{ + analytics, api_ix_facility_correlation, api_network_types, api_prefixes_distribution, index, + networks_list, search_networks, +}; /// Path to the network data file from PeeringDB. const NETWORK_DATA_PATH: &str = "data/peeringdb/net.json"; -/// Application configuration from environment variables. -#[derive(Debug)] -struct Config { - bind_address: String, +/// Converts a slice of Networks to a Polars DataFrame. +/// +/// Uses serde serialization to intermediate JSON for simplicity, +/// as direct column construction is verbose. +fn networks_to_df(networks: &[Network]) -> Result { + let json = serde_json::to_string(networks)?; + let cursor = std::io::Cursor::new(json); + let df = JsonReader::new(cursor).finish()?; + Ok(df) } -impl Config { - /// Creates Config from environment variables with defaults. - fn from_env() -> Self { - Self { - bind_address: std::env::var("BIND_ADDRESS").unwrap_or_else(|_| "0.0.0.0:8201".into()), +async fn refresh_data(state: Arc) { + info!("Starting scheduled data refresh from PeeringDB..."); + + if let Err(e) = fetch_and_save_peeringdb_data().await { + error!("Failed to fetch data from PeeringDB: {}", e); + return; + } + + match tokio::task::spawn_blocking(load_network_data).await { + Ok(result) => match result { + Ok(new_data) => { + let count = new_data.len(); + // Create DataFrame from new data + match networks_to_df(&new_data) { + Ok(new_df) => { + let mut data_guard = state.data.write().await; + data_guard.networks = new_data; + data_guard.df = new_df; + info!("Data refresh complete: loaded {} networks", count); + } + Err(e) => { + error!("Failed to create DataFrame from refreshed data: {}", e); + } + } + } + Err(e) => { + error!("Failed to load refreshed data: {}", e); + } + }, + Err(e) => { + error!("Failed to execute background load task: {}", e); } } } -/// Shared application state passed to all request handlers. -struct AppState { - tera: Tera, - data: Vec, -} +async fn start_scheduler( + cron_expr: &str, + state: Arc, +) -> Result> { + let scheduler = JobScheduler::new().await?; + let state_clone = state.clone(); -/// Query parameters for pagination. -#[derive(Deserialize)] -struct Pagination { - page: Option, - per_page: Option, -} + let job = Job::new_async(cron_expr, move |_uuid, _lock| { + let state = state_clone.clone(); + Box::pin(async move { + refresh_data(state).await; + }) + })?; -/// Query parameters for search. -#[derive(Deserialize)] -struct SearchQuery { - asn: Option, - name: Option, -} + scheduler.add(job).await?; + scheduler.start().await?; -/// Renders a template with error handling. -fn render_template( - tera: &Tera, - template: &str, - context: &Context, -) -> Result, (axum::http::StatusCode, &'static str)> { - tera.render(template, context).map(Html).map_err(|e| { - error!("Template render error for '{}': {}", template, e); - ( - axum::http::StatusCode::INTERNAL_SERVER_ERROR, - "Render error", - ) - }) -} + info!("Background scheduler started with cron: {}", cron_expr); -/// Truncates a string to max_chars (UTF-8 safe), appending "..." if truncated. -fn truncate_chars(s: &str, max_chars: usize) -> String { - let char_count = s.chars().count(); - if char_count > max_chars { - let truncated: String = s.chars().take(max_chars).collect(); - format!("{}...", truncated) - } else { - s.to_string() - } + Ok(scheduler) } #[tokio::main] @@ -93,7 +99,7 @@ async fn main() { tracing_subscriber::fmt::init(); let config = Config::from_env(); - // Fetch data from PeeringDB if not cached locally + // Fetch data if needed if !std::path::Path::new(NETWORK_DATA_PATH).exists() { info!("Fetching initial data from PeeringDB..."); if let Err(e) = fetch_and_save_peeringdb_data().await { @@ -101,10 +107,17 @@ async fn main() { } } - let data = match load_network_data() { + // Load initial data + let (networks, df) = match load_network_data() { Ok(d) => { info!("Loaded {} networks from data file", d.len()); - d + match networks_to_df(&d) { + Ok(df) => (d, df), + Err(e) => { + error!("Failed to create initial DataFrame: {}", e); + std::process::exit(1); + } + } } Err(e) => { error!("Failed to load network data: {}", e); @@ -120,7 +133,19 @@ async fn main() { } }; - let state = Arc::new(AppState { tera, data }); + let state = Arc::new(AppState::new(tera, networks, df)); + + // Start scheduler + let _scheduler = match start_scheduler(&config.refresh_cron, state.clone()).await { + Ok(s) => Some(s), + Err(e) => { + warn!( + "Failed to start background scheduler: {}. Continuing without auto-refresh.", + e + ); + None + } + }; let app = Router::new() .route("/", get(index)) @@ -133,314 +158,28 @@ async fn main() { "/api/ix-facility-correlation", get(api_ix_facility_correlation), ) - .with_state(state); + .nest_service("/assets", ServeDir::new("assets")) + .with_state(state) + .layer( + tower_http::trace::TraceLayer::new_for_http() + .on_request(tower_http::trace::DefaultOnRequest::new().level(tracing::Level::INFO)) + .on_response( + tower_http::trace::DefaultOnResponse::new().level(tracing::Level::INFO), + ) + .on_failure( + tower_http::trace::DefaultOnFailure::new().level(tracing::Level::ERROR), + ), + ); let listener = tokio::net::TcpListener::bind(&config.bind_address) .await - .expect("TCP listener must bind to configured address for server to start"); + .expect("TCP listener must bind to configured address"); info!("Server listening on http://{}", config.bind_address); + info!("Data refresh scheduled: {}", config.refresh_cron); if let Err(e) = axum::serve(listener, app).await { error!("Server error: {}", e); std::process::exit(1); } } - -/// GET / - Dashboard with network statistics. -async fn index(State(state): State>) -> impl IntoResponse { - let mut network_types: HashMap<&str, usize> = HashMap::new(); - let mut policy_types: HashMap<&str, usize> = HashMap::new(); - let mut scopes: HashMap<&str, usize> = HashMap::new(); - - for item in &state.data { - if let Some(ref t) = item.info_type { - *network_types.entry(t.as_str()).or_insert(0) += 1; - } - if let Some(ref p) = item.policy_general { - *policy_types.entry(p.as_str()).or_insert(0) += 1; - } - if let Some(ref s) = item.info_scope { - *scopes.entry(s.as_str()).or_insert(0) += 1; - } - } - - let stats = Stats { - total_networks: state.data.len(), - network_types: network_types - .into_iter() - .map(|(k, v)| (k.to_string(), v)) - .collect(), - policy_types: policy_types - .into_iter() - .map(|(k, v)| (k.to_string(), v)) - .collect(), - scopes: scopes - .into_iter() - .map(|(k, v)| (k.to_string(), v)) - .collect(), - }; - - let mut context = Context::new(); - context.insert("stats", &stats); - let networks: Vec<&Network> = state.data.iter().take(10).collect(); - context.insert("networks", &networks); - - render_template(&state.tera, "dashboard.html", &context) -} - -/// GET /networks - Paginated network list. -async fn networks_list( - State(state): State>, - Query(pagination): Query, -) -> impl IntoResponse { - let total_networks = state.data.len(); - - if total_networks == 0 { - let mut context = Context::new(); - context.insert("networks", &Vec::<&Network>::new()); - context.insert("page", &1usize); - context.insert("per_page", &25usize); - context.insert("total_pages", &0usize); - context.insert("total_networks", &0usize); - return render_template(&state.tera, "networks.html", &context); - } - - let page = pagination.page.unwrap_or(1).max(1); - let per_page = pagination.per_page.unwrap_or(25).clamp(1, 100); - let total_pages = total_networks.div_ceil(per_page); - let start_index = (page - 1).saturating_mul(per_page); - let end_index = start_index.saturating_add(per_page).min(total_networks); - - let paginated_networks: Vec<&Network> = if start_index >= total_networks { - Vec::new() - } else { - state.data[start_index..end_index].iter().collect() - }; - - let mut context = Context::new(); - context.insert("networks", &paginated_networks); - context.insert("page", &page); - context.insert("per_page", &per_page); - context.insert("total_pages", &total_pages); - context.insert("total_networks", &total_networks); - - render_template(&state.tera, "networks.html", &context) -} - -/// GET /analytics - Analytics dashboard. -async fn analytics(State(state): State>) -> impl IntoResponse { - let context = Context::new(); - render_template(&state.tera, "analytics.html", &context) -} - -/// GET /search - Search networks by ASN or name. -async fn search_networks( - State(state): State>, - Query(query): Query, -) -> impl IntoResponse { - let search_name = query.name.as_ref().map(|n| { - let mut s = n.clone(); - s.truncate(100); - s.to_lowercase() - }); - - let results: Vec<&Network> = if query.asn.is_some() || search_name.is_some() { - state - .data - .iter() - .filter(|network| { - let matches_asn = query.asn == Some(network.asn); - let matches_name = search_name - .as_ref() - .is_some_and(|name| network.name.to_lowercase().contains(name)); - matches_asn || matches_name - }) - .collect() - } else { - Vec::new() - }; - - let mut context = Context::new(); - context.insert("results", &results); - context.insert("query_asn", &query.asn); - context.insert("query_name", &query.name); - - render_template(&state.tera, "search.html", &context) -} - -/// GET /api/network-types - JSON network type counts. -async fn api_network_types(State(state): State>) -> impl IntoResponse { - let entries: Vec<(&str, usize)> = { - let mut network_types: HashMap<&str, usize> = HashMap::new(); - for item in &state.data { - if let Some(ref t) = item.info_type { - *network_types.entry(t.as_str()).or_insert(0) += 1; - } - } - network_types.into_iter().collect() - }; - - let (labels, data): (Vec<&str>, Vec) = entries.into_iter().unzip(); - - Json(serde_json::json!({ - "labels": labels, - "data": data - })) -} - -/// GET /api/prefixes-distribution - JSON prefix counts per network. -async fn api_prefixes_distribution(State(state): State>) -> impl IntoResponse { - let data: Vec<_> = state - .data - .iter() - .filter(|item| item.info_prefixes4.is_some() && item.info_prefixes6.is_some()) - .take(15) - .map(|item| { - let name = truncate_chars(&item.name, 30); - ( - name, - item.info_prefixes4.expect("filter guarantees Some"), - item.info_prefixes6.expect("filter guarantees Some"), - ) - }) - .collect(); - - let (networks, ipv4, ipv6): (Vec<_>, Vec<_>, Vec<_>) = data.into_iter().multiunzip(); - - Json(serde_json::json!({ - "networks": networks, - "ipv4": ipv4, - "ipv6": ipv6 - })) -} - -/// GET /api/ix-facility-correlation - JSON IX vs facility counts. -async fn api_ix_facility_correlation(State(state): State>) -> impl IntoResponse { - let data: Vec<_> = state - .data - .iter() - .filter_map(|item| match (item.ix_count, item.fac_count) { - (Some(ix), Some(fac)) => Some(serde_json::json!({ - "x": ix, - "y": fac, - "label": &item.name - })), - _ => None, - }) - .collect(); - - Json(data) -} - -#[cfg(test)] -mod tests { - use super::*; - - mod truncate_chars_tests { - use super::*; - - #[test] - fn test_short_string_unchanged() { - assert_eq!(truncate_chars("Hello", 10), "Hello"); - } - - #[test] - fn test_exact_length_unchanged() { - assert_eq!(truncate_chars("Hello", 5), "Hello"); - } - - #[test] - fn test_long_string_truncated() { - assert_eq!(truncate_chars("Hello, World!", 5), "Hello..."); - } - - #[test] - fn test_empty_string() { - assert_eq!(truncate_chars("", 10), ""); - } - - #[test] - fn test_unicode_characters() { - assert_eq!(truncate_chars("こんにちは世界", 5), "こんにちは..."); - } - - #[test] - fn test_emoji_characters() { - assert_eq!(truncate_chars("Hello 🌍🌍🌍", 8), "Hello 🌍🌍..."); - } - - #[test] - fn test_zero_max_chars() { - assert_eq!(truncate_chars("Hello", 0), "..."); - } - } - - mod pagination_tests { - /// Helper to simulate pagination parameter processing. - fn process_pagination(page: Option, per_page: Option) -> (usize, usize) { - let page = page.unwrap_or(1).max(1); - let per_page = per_page.unwrap_or(25).clamp(1, 100); - (page, per_page) - } - - #[test] - fn test_page_defaults() { - let (page, per_page) = process_pagination(None, None); - assert_eq!(page, 1); - assert_eq!(per_page, 25); - } - - #[test] - fn test_page_zero_becomes_one() { - let (page, _) = process_pagination(Some(0), None); - assert_eq!(page, 1); - } - - #[test] - fn test_per_page_clamped_to_max() { - let (_, per_page) = process_pagination(None, Some(200)); - assert_eq!(per_page, 100); - } - - #[test] - fn test_per_page_clamped_to_min() { - let (_, per_page) = process_pagination(None, Some(0)); - assert_eq!(per_page, 1); - } - - #[test] - fn test_total_pages_calculation() { - let total_networks = 101_usize; - let per_page = 25_usize; - let total_pages = total_networks.div_ceil(per_page); - assert_eq!(total_pages, 5); - } - - #[test] - fn test_slice_indices() { - let page = 2_usize; - let per_page = 25_usize; - let total_networks = 100_usize; - - let start_index = (page - 1).saturating_mul(per_page); - let end_index = start_index.saturating_add(per_page).min(total_networks); - - assert_eq!(start_index, 25); - assert_eq!(end_index, 50); - } - - #[test] - fn test_last_page_partial() { - let page = 5_usize; - let per_page = 25_usize; - let total_networks = 101_usize; - - let start_index = (page - 1).saturating_mul(per_page); - let end_index = start_index.saturating_add(per_page).min(total_networks); - - assert_eq!(start_index, 100); - assert_eq!(end_index, 101); - } - } -} diff --git a/src/state.rs b/src/state.rs new file mode 100644 index 0000000..d328581 --- /dev/null +++ b/src/state.rs @@ -0,0 +1,50 @@ +use polars::prelude::DataFrame; +use std::env; +use tera::Tera; +use tokio::sync::RwLock; + +use crate::models::Network; + +/// Application configuration from environment variables. +#[derive(Debug, Clone)] +pub struct Config { + /// Address to bind the HTTP server to. + pub bind_address: String, + /// Cron expression for data refresh schedule. + pub refresh_cron: String, +} + +impl Config { + /// Creates Config from environment variables with defaults. + pub fn from_env() -> Self { + Self { + bind_address: env::var("BIND_ADDRESS").unwrap_or_else(|_| "0.0.0.0:8201".into()), + refresh_cron: env::var("REFRESH_CRON").unwrap_or_else(|_| "0 0 0 * * *".into()), + } + } +} + +/// Shared application state passed to all request handlers. +#[derive(Debug)] +pub struct AppState { + /// Template engine for rendering HTML pages. + pub tera: Tera, + /// Network data protected by RwLock. + /// Stores both Vec (for templates) and DataFrame (for analytics). + pub data: RwLock, +} + +#[derive(Debug)] +pub struct AppData { + pub networks: Vec, + pub df: DataFrame, +} + +impl AppState { + pub fn new(tera: Tera, networks: Vec, df: DataFrame) -> Self { + Self { + tera, + data: RwLock::new(AppData { networks, df }), + } + } +} diff --git a/templates/analytics.html b/templates/analytics.html index e45cc97..92e551a 100644 --- a/templates/analytics.html +++ b/templates/analytics.html @@ -1,562 +1,138 @@ - - - - - - Analytics - Network Data Visualization - - - - - - - - - - - - - - - - - - -
- -
-
-
-
-
-

Total Networks

-

-

-
-
- -
-
-
-
-
-
-
-
-

Avg IX Count

-

-

-
-
- -
-
-
-
-
-
-
-
-

Correlation

-

-

-
-
- -
-
-
-
-
- - -
-
-
-
-
- - IX Count vs Facility Count Correlation -
-
-
-
-
-
- Loading... -
-

Loading analytics data...

-
- - -
-
-
-
-
-
- - - - - - - - + } catch (err) { + console.error(err); + spinner.style.display = "none"; + error.style.display = "block"; + } + } + + function updateStats(data) { + if (!data.length) return; + + const total = data.length; + document.getElementById("totalNetworks").innerText = total.toLocaleString(); + + const avgIx = data.reduce((s, p) => s + p.x, 0) / total; + document.getElementById("avgIxCount").innerText = avgIx.toFixed(1); + + // Simple correlation + if (total > 1) { + const sumX = data.reduce((s, p) => s + p.x, 0); + const sumY = data.reduce((s, p) => s + p.y, 0); + const sumXY = data.reduce((s, p) => s + p.x * p.y, 0); + const sumX2 = data.reduce((s, p) => s + p.x * p.x, 0); + const sumY2 = data.reduce((s, p) => s + p.y * p.y, 0); + + const num = total * sumXY - sumX * sumY; + const den = Math.sqrt((total * sumX2 - sumX*sumX) * (total * sumY2 - sumY*sumY)); + const r = den === 0 ? 0 : num / den; + document.getElementById("correlationValue").innerText = r.toFixed(3); + } + } + + document.addEventListener("DOMContentLoaded", loadChartData); + +{% endblock %} diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..df9a6e2 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,67 @@ + + + + + + + {% block title %}NetViz{% endblock %} + + + + + + + + + + + +
+ +
+ +
+ {% block content %}{% endblock %} +
+ + + + + {% block scripts %}{% endblock %} + + diff --git a/templates/dashboard.html b/templates/dashboard.html index f6034d9..a5f3670 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -1,850 +1,219 @@ - - - - - - Dashboard - Network Data Visualization - - - - - - - - - - - - - - - - - - -
- -
-
-
-
-
-
-

Total Networks

-

- {{ stats.total_networks }} -

-
-
- -
-
-
-
-
-
-
-
-
-
-

Network Types

-

- {{ stats.network_types | length }} -

-
-
- -
-
-
-
-
-
-
-
-
-
-

Policy Types

-

- {{ stats.policy_types | length }} -

-
-
- -
-
-
-
-
-
-
-
-
-
-

Global Scope

-

- {{ stats.scopes["Global"] | default(value=0) }} -

-
-
- -
-
-
-
-
-
- - -
-
-
-
-
- - Network Types Distribution -
-
-
-
-
-
- Loading... -
-

Loading network types...

-
- - -
-
-
-
-
-
-
-
- - IPv4 vs IPv6 Prefixes -
-
-
-
-
-
- Loading... -
-

Loading prefix data...

-
- - -
-
-
-
+{% extends "base.html" %} + +{% block title %}Dashboard - NetViz{% endblock %} + +{% block content %} +
+

Dashboard

+

Network statistics and insights

+
+ + +
+
+
{{ stats.total_networks }}
+
Total Networks
+
+ +
+
{{ stats.network_types | length }}
+
Network Types
+
+ +
+
{{ stats.policy_types | length }}
+
Policy Types
+
+ +
+
{{ stats.scopes["Global"] | default(value=0) }}
+
Global Scope
+
+
+ + +
+
+
Network Types Distribution
+
+
Loading...
+ + - - -
-
-
-
-
- - Recent Networks -
-
-
-
-
- {% for network in networks %} -
-
-
-
- - {{ network.name }} -
-

- - ASN: {{ network.asn }} -

-
- - {{ network.info_type or 'Unknown' }} - - - {{ network.policy_general or 'Unknown' }} - -
- {% if network.website %} - - - Visit Website - - {% endif %} -
-
-
- {% endfor %} -
-
-
-
-
+
+
+ +
+
IPv4 vs IPv6 Prefixes (Top 15)
+
+
Loading...
+ +
- - - - - - - - + } catch (err) { + loading.style.display = "none"; + error.style.display = "block"; + console.error(err); + } + } + + // Init + document.addEventListener('DOMContentLoaded', () => { + loadNetworkTypesChart(); + loadPrefixesChart(); + }); + +{% endblock %} diff --git a/templates/networks.html b/templates/networks.html index 4d6d0a1..7630289 100644 --- a/templates/networks.html +++ b/templates/networks.html @@ -1,780 +1,159 @@ - - - - - - Networks - Network Data Visualization - - - - - - - - - - - - - - - -
- -
-
-
-
- - - - -
-
-
-
-
- -
-
- -
-
- -
-
-
-
-
- - -
-
-
- - All Networks -
+
+ + +
-
- -
-
-

- - Showing {% if networks %}{{ (page - 1) * per_page + 1 }}{% else - %}0{% endif %} to {% if networks %}{% if (page * per_page) < - total_networks %}{{ page * per_page }}{% else %}{{ - total_networks }}{% endif %}{% else %}0{% endif %} of {{ - total_networks }} networks -

-
- - - per page -
-
-
- - -
- - - - - - - - - - - - - - - - {% for network in networks %} - - - - - - - - - - - - {% endfor %} - -
- - Network - - - ASN - - - Type - - - IPv4 - - - IPv6 - - - IX - - - Facilities - - - Policy - - - Status -
-
-
{{ network.name }}
- {% if network.aka %} -
{{ network.aka }}
- {% endif %} -
-
- AS{{ network.asn }} - - - {{ network.info_type or 'Unknown' }} - - - {% if network.info_prefixes4 %} - {{ network.info_prefixes4 }} - {% else %} - N/A - {% endif %} - - {% if network.info_prefixes6 %} - {{ network.info_prefixes6 }} - {% else %} - N/A - {% endif %} - - {{ network.ix_count or 0 }} - - {{ network.fac_count or 0 }} - - {% if network.policy_general == 'Open' %} - Open - {% elif network.policy_general == 'Restrictive' %} - Restrictive - {% else %} - - {{ network.policy_general or 'Unknown' }} - - {% endif %} - - {% if network.status == 'ok' %} - - OK - - {% else %} - - {{ - network.status }} - - {% endif %} -
-
+
+ + + + + + +
+
+ + + + + + + + + + + + + {% for network in networks %} + + + + + + + + + {% endfor %} + +
NetworkASNTypeIPv4 w/ IPv6PolicyStatus
+ {{ network.name }} + {% if network.aka %}
{{ network.aka }}{% endif %} +
AS{{ network.asn }}{{ network.info_type or 'Unknown' }} + {{ network.info_prefixes4 or '0' }} / {{ network.info_prefixes6 or '0' }} + + {% if network.policy_general == 'Open' %} + Open + {% elif network.policy_general == 'Restrictive' %} + Restrictive + {% else %} + {{ network.policy_general or 'Unknown' }} + {% endif %} + + {% if network.status == 'ok' %} + OK + {% else %} + {{ network.status }} + {% endif %} +
+
+
+ + + + +
+
+ Showing {{ networks|length }} of {{ total_networks }} networks +
+
-
- - -
- -
+ - - +{% endblock %} - - - - + if(perPageSelect) perPageSelect.value = urlParams.get("per_page") || "25"; + + // Submit form on search input change + searchInput?.addEventListener("input", function() { + document.getElementById("searchForm").submit(); + }); + }); + +{% endblock %} diff --git a/templates/search.html b/templates/search.html index ff5c005..45b7bdc 100644 --- a/templates/search.html +++ b/templates/search.html @@ -1,553 +1,69 @@ - - - - - - Search Networks - Network Data Visualization - - - - - - - - - - - - - - - -
- -
-
-
-
- - -
-
- - -
-
- -
-
-
-
- - -
-
-
- - Search Results -
-
-
- {% if results %} -
-
-

- - Found {{ results | length }} network(s) matching your search. -

-
-
-
- - - - - - - - - - - - - - - - {% for network in results %} - - - - - - - - - - - - {% endfor %} - -
- - Network - - - ASN - - - Type - - - IPv4 - - - IPv6 - - - IX - - - Facilities - - - Policy - - - Status -
-
-
{{ network.name }}
- {% if network.aka %} -
{{ network.aka }}
- {% endif %} -
-
- AS{{ network.asn }} - - - {{ network.info_type or 'Unknown' }} - - - {% if network.info_prefixes4 %} - {{ network.info_prefixes4 }} - {% else %} - N/A - {% endif %} - - {% if network.info_prefixes6 %} - {{ network.info_prefixes6 }} - {% else %} - N/A - {% endif %} - - {{ network.ix_count or 0 }} - - {{ network.fac_count or 0 }} - - {% if network.policy_general == 'Open' %} - Open - {% elif network.policy_general == 'Restrictive' %} - Restrictive - {% else %} - - {{ network.policy_general or 'Unknown' }} - - {% endif %} - - {% if network.status == 'ok' %} - - OK - - {% else %} - - {{ - network.status }} - - {% endif %} -
-
- {% else %} - - {% endif %} -
-
+{% extends "base.html" %} + +{% block title %}Search - NetViz{% endblock %} + +{% block content %} +
+

Search

+

Find networks by name or ASN

+
+ +
+
+
+ + +
- - - - - - +
+
+ +{% if results | length > 0 %} +
+
Results ({{ results | length }})
+
+ + + + + + + + + + + + {% for network in results %} + + + + + + + + {% endfor %} + +
NameASNTypePrefixes (v4/v6)Status
+ {{ network.name }} + {% if network.aka %}
{{ network.aka }}{% endif %} +
AS{{ network.asn }}{{ network.info_type or 'Unknown' }}{{ network.info_prefixes4 or 0 }} / {{ network.info_prefixes6 or 0 }} + {% if network.status == 'ok' %}OK{% else %}{{ network.status }}{% endif %} +
+
+
+{% elif query_asn or query_name %} +
+

No results found for your query.

+
+{% endif %} + +{% endblock %}