diff --git a/Cargo.lock b/Cargo.lock index 6284a90e4..45be29409 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,16 +2,6 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] - [[package]] name = "addr2line" version = "0.21.0" @@ -33,20 +23,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "getrandom 0.2.15", - "once_cell", - "serde", - "version_check", - "zerocopy 0.7.35", -] - [[package]] name = "aho-corasick" version = "1.1.3" @@ -78,25 +54,54 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] -name = "android-tzdata" -version = "0.1.1" +name = "anstream" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ - "libc", + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", ] [[package]] -name = "anyhow" -version = "1.0.95" +name = "anstyle" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" + +[[package]] +name = "anstyle-parse" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" +dependencies = [ + "anstyle", + "once_cell", + "windows-sys 0.59.0", +] [[package]] name = "arrayvec" @@ -105,22 +110,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] -name = "ascii" -version = "1.1.0" +name = "assert-unchecked" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" - -[[package]] -name = "ast_node" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fb5864e2f5bf9fd9797b94b2dfd1554d4c3092b535008b27d7e15c86675a2f" -dependencies = [ - "proc-macro2", - "quote", - "swc_macros_common", - "syn 2.0.98", -] +checksum = "7330592adf847ee2e3513587b4db2db410a0d751378654e7e993d9adcbe5c795" [[package]] name = "async-compression" @@ -144,17 +137,6 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -[[package]] -name = "auto_impl" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12882f59de5360c748c4cbf569a042d5fb0eb515f7bea9c1f470b47f6ffbd73" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.98", -] - [[package]] name = "autocfg" version = "1.4.0" @@ -246,12 +228,6 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -260,11 +236,12 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64-simd" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "781dd20c3aff0bd194fe7d2a977dd92f21c173891f3a03b677359e5fa457e5d5" +checksum = "339abbe78e73178762e23bea9dfd08e697eb3f3301cd4be981c0f78ba5859195" dependencies = [ - "simd-abstraction", + "outref", + "vsimd", ] [[package]] @@ -274,12 +251,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" [[package]] -name = "better_scoped_tls" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50fd297a11c709be8348aec039c8b91de16075d2b2bdaee1bd562c0875993664" +name = "berver" +version = "0.6.0" dependencies = [ - "scoped-tls", + "axum", + "bindex", + "bomputer", + "color-eyre", + "derive_deref", + "jiff", + "logger", + "oxc", + "regex", + "reqwest", + "serde", + "serde_json", + "storable_vec", + "struct_iterable", + "tokio", + "tower-http", + "zstd", ] [[package]] @@ -293,10 +284,14 @@ dependencies = [ "exit", "fjall", "jiff", + "logger", "rapidhash", "rayon", + "rlimit", + "serde", + "serde_bytes", "storable_vec", - "zerocopy 0.8.16", + "zerocopy 0.8.17", ] [[package]] @@ -396,27 +391,6 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" -[[package]] -name = "bitvec" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - [[package]] name = "bomputer" version = "0.1.0" @@ -429,7 +403,7 @@ dependencies = [ "fjall", "jiff", "storable_vec", - "zerocopy 0.8.16", + "zerocopy 0.8.17", ] [[package]] @@ -453,23 +427,6 @@ dependencies = [ "alloc-stdlib", ] -[[package]] -name = "browserslist-rs" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74c973b79d9b6b89854493185ab760c6ef8e54bcfad10ad4e33991e46b374ac8" -dependencies = [ - "ahash", - "chrono", - "either", - "indexmap", - "itertools", - "nom", - "serde", - "serde_json", - "thiserror", -] - [[package]] name = "bumpalo" version = "3.17.0" @@ -493,15 +450,24 @@ checksum = "f61dac84819c6588b558454b194026eb1f09c293b9036ae9b159e74e73ab6cf9" [[package]] name = "byteview" -version = "0.5.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df559a101a77b0b6f034ca9e5747dfd267a0b54ee29d6c227768deda0b153a99" +checksum = "b9f101f5d5ac7c27fa7e664bbdc2697b2627f24c701e1309564840c67554dbcc" + +[[package]] +name = "castaway" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0abae9be0aaf9ea96a3b1b8b1b55c602ca751eba1b1500220cea4ecbafe7c0d5" +dependencies = [ + "rustversion", +] [[package]] name = "cc" -version = "1.2.12" +version = "1.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "755717a7de9ec452bf7f3f1a3099085deabd7f2962b861dae91ecd7a365903d2" +checksum = "c7777341816418c02e033934a09f20dc0ccaf65a5201ef8a450ae0105a573fda" dependencies = [ "jobserver", "libc", @@ -520,18 +486,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" -[[package]] -name = "chrono" -version = "0.4.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "num-traits", - "windows-targets", -] - [[package]] name = "color-eyre" version = "0.6.3" @@ -559,6 +513,26 @@ dependencies = [ "tracing-error", ] +[[package]] +name = "colorchoice" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" + +[[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", + "static_assertions", +] + [[package]] name = "compare" version = "0.0.6" @@ -582,13 +556,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] -name = "cpufeatures" -version = "0.2.17" +name = "cow-utils" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] +checksum = "417bef24afe1460300965a25ff4a24b8b45ad011948302ec221e8a0a81eb2c79" [[package]] name = "crc32fast" @@ -665,16 +636,6 @@ version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - [[package]] name = "ctrlc" version = "3.4.5" @@ -685,19 +646,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core", -] - [[package]] name = "dashmap" version = "6.1.0" @@ -712,22 +660,6 @@ dependencies = [ "parking_lot_core", ] -[[package]] -name = "data-encoding" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e60eed09d8c01d3cee5b7d30acb059b76614c918fa0f992e0dd6eeb10daad6f" - -[[package]] -name = "debugid" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" -dependencies = [ - "serde", - "uuid", -] - [[package]] name = "derive_deref" version = "1.1.1" @@ -739,16 +671,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", -] - [[package]] name = "displaydoc" version = "0.2.5" @@ -793,6 +715,29 @@ dependencies = [ "syn 2.0.98", ] +[[package]] +name = "env_filter" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcaee3d8e3cfc3fd92428d477bc97fc29ec8716d180c0d74c643bb26166660e0" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "humantime", + "log", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -806,7 +751,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -814,6 +759,7 @@ name = "exit" version = "0.1.0" dependencies = [ "ctrlc", + "logger", ] [[package]] @@ -834,18 +780,19 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "fixedbitset" -version = "0.4.2" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" [[package]] name = "fjall" -version = "2.5.0" +version = "2.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80910a26e4fb5e5393ff64d293602ac1ade56cf4d14d244c02a7d4ddcd5f10bc" +checksum = "0ddab3925ea1ed59863d246305c7bc113dc2e12b691405d2d02e429cfa0c87a5" dependencies = [ "byteorder", - "dashmap 6.1.0", + "byteview", + "dashmap", "log", "lsm-tree", "path-absolutize", @@ -894,23 +841,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "from_variant" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d7ccf961415e7aa17ef93dcb6c2441faaa8e768abe09e659b908089546f74c5" -dependencies = [ - "proc-macro2", - "swc_macros_common", - "syn 2.0.98", -] - -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - [[package]] name = "futures-channel" version = "0.3.31" @@ -961,16 +891,6 @@ dependencies = [ "slab", ] -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - [[package]] name = "getrandom" version = "0.2.15" @@ -1002,9 +922,9 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "guardian" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "493913a18c0d7bebb75127a26a432162c59edbe06f6cf712001e3e769345e8b5" +checksum = "17e2ac29387b1aa07a1e448f7bb4f35b500787971e965b02842b900afa5c8f6f" [[package]] name = "h2" @@ -1025,42 +945,20 @@ dependencies = [ "tracing", ] -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash", -] - [[package]] name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash", - "allocator-api2", -] [[package]] name = "hashbrown" version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +dependencies = [ + "allocator-api2", +] [[package]] name = "hex-conservative" @@ -1077,20 +975,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" -[[package]] -name = "hstr" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a26def229ea95a8709dad32868d975d0dd40235bd2ce82920e4a8fe692b5e0" -dependencies = [ - "hashbrown 0.14.5", - "new_debug_unreachable", - "once_cell", - "phf", - "rustc-hash 1.1.0", - "triomphe", -] - [[package]] name = "http" version = "1.2.0" @@ -1137,6 +1021,12 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "hyper" version = "1.6.0" @@ -1210,29 +1100,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "iana-time-zone" -version = "0.1.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - [[package]] name = "icu_collections" version = "1.5.0" @@ -1372,12 +1239,6 @@ dependencies = [ "icu_properties", ] -[[package]] -name = "if_chain" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" - [[package]] name = "indenter" version = "0.3.3" @@ -1392,7 +1253,6 @@ checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" dependencies = [ "equivalent", "hashbrown 0.15.2", - "serde", ] [[package]] @@ -1411,22 +1271,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] -name = "is-macro" -version = "0.3.7" +name = "is_terminal_polyfill" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d57a3e447e24c22647738e4607f1df1e0ec6f72e16182c4cd199f647cdfb0e4" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.98", -] +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" dependencies = [ "either", ] @@ -1439,16 +1293,16 @@ checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "jiff" -version = "0.1.29" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c04ef77ae73f3cf50510712722f0c4e8b46f5aaa1bf5ffad2ae213e6495e78e5" +checksum = "ba926fdd8e5b5e7f9700355b0831d8c416afe94b014b1023424037a187c9c582" dependencies = [ "jiff-tzdb-platform", "log", "portable-atomic", "portable-atomic-util", "serde", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -1485,15 +1339,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "jsonc-parser" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b56a20e76235284255a09fcd1f45cf55d3c524ea657ebd3854735925c57743d" -dependencies = [ - "serde_json", -] - [[package]] name = "jsonrpc" version = "0.18.0" @@ -1506,21 +1351,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "kibo_server" -version = "0.6.0" -dependencies = [ - "axum", - "color-eyre", - "regex", - "reqwest", - "swc", - "swc_common", - "tokio", - "tower-http", - "zstd", -] - [[package]] name = "lazy_static" version = "1.5.0" @@ -1562,30 +1392,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" [[package]] -name = "lru" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718e8fae447df0c7e1ba7f5189829e63fd536945c8988d61444c19039f16b670" +name = "logger" +version = "0.1.0" dependencies = [ - "hashbrown 0.13.2", + "color-eyre", + "env_logger", + "jiff", + "log", ] [[package]] name = "lsm-tree" -version = "2.5.0" +version = "2.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d858efa63a32a286a06aa3968f3ed09811d556697e9f9804aa72ea679ed3b83" +checksum = "2880324e429cd3285e56d0382c025b3d9336d672bbf344e3fde9783a5623f0f6" dependencies = [ "byteorder", "crossbeam-skiplist", "double-ended-peekable", "enum_dispatch", "guardian", + "interval-heap", "log", "lz4_flex", "path-absolutize", "quick_cache", - "rustc-hash 2.1.1", + "rustc-hash", "self_cell", "tempfile", "value-log", @@ -1620,43 +1452,12 @@ dependencies = [ "libc", ] -[[package]] -name = "miette" -version = "7.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a955165f87b37fd1862df2a59547ac542c77ef6d17c666f619d1ad22dd89484" -dependencies = [ - "cfg-if", - "miette-derive", - "owo-colors 4.1.0", - "textwrap", - "thiserror", - "unicode-width", -] - -[[package]] -name = "miette-derive" -version = "7.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf45bf44ab49be92fd1227a3be6fc6f617f1a337c06af54981048574d8783147" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.98", -] - [[package]] name = "mime" version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - [[package]] name = "miniz_oxide" version = "0.7.4" @@ -1714,12 +1515,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "new_debug_unreachable" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" - [[package]] name = "nix" version = "0.29.0" @@ -1733,23 +1528,10 @@ dependencies = [ ] [[package]] -name = "nom" -version = "7.1.3" +name = "nonmax" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "normpath" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a9da8c9922c35a1033d76f7272dfc2e7ee20392083d75aeea6ced23c6266578" -dependencies = [ - "winapi", -] +checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51" [[package]] name = "num-bigint" @@ -1759,7 +1541,6 @@ checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ "num-integer", "num-traits", - "serde", ] [[package]] @@ -1780,16 +1561,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - [[package]] name = "object" version = "0.32.2" @@ -1801,9 +1572,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.2" +version = "1.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" [[package]] name = "openssl" @@ -1851,9 +1622,9 @@ dependencies = [ [[package]] name = "outref" -version = "0.1.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f222829ae9293e33a9f5e9f440c6760a3d450a64affe1846486b140db81c1f4" +checksum = "1a80800c0488c3a21695ea981a54918fbb37abf04f4d0720c453632255e2ff0e" [[package]] name = "owo-colors" @@ -1867,6 +1638,338 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb37767f6569cd834a413442455e0f066d0d522de8630436e2a1761d9726ba56" +[[package]] +name = "oxc" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f346cc73c834df63403e8baa7b4e7efc9c6c4dbf45eb8fc6014bdb7b2d83b12" +dependencies = [ + "oxc_allocator", + "oxc_ast", + "oxc_codegen", + "oxc_diagnostics", + "oxc_mangler", + "oxc_minifier", + "oxc_parser", + "oxc_regular_expression", + "oxc_span", + "oxc_syntax", +] + +[[package]] +name = "oxc-miette" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e03e63fd113c068b82d07c9c614b0b146c08a3ac0a4dface3ea1d1a9d14d549e" +dependencies = [ + "cfg-if", + "owo-colors 4.1.0", + "oxc-miette-derive", + "textwrap", + "thiserror", + "unicode-width 0.2.0", +] + +[[package]] +name = "oxc-miette-derive" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e21f680e8c5f1900297d394627d495351b9e37761f7bbf90116bd5eeb6e80967" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.98", +] + +[[package]] +name = "oxc_allocator" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba82e27c94fd90c94cba7f3ec9079c6eea4d2000b57c29c7d34d100bf8c80de7" +dependencies = [ + "allocator-api2", + "bumpalo", + "hashbrown 0.15.2", + "rustc-hash", + "simdutf8", +] + +[[package]] +name = "oxc_ast" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96cc90207e2212fa7b3511014cfa193ef2807bb504424e16ae8aa3e5a6715a3f" +dependencies = [ + "bitflags", + "cow-utils", + "nonmax", + "num-bigint", + "num-traits", + "oxc_allocator", + "oxc_ast_macros", + "oxc_estree", + "oxc_regular_expression", + "oxc_span", + "oxc_syntax", +] + +[[package]] +name = "oxc_ast_macros" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "315ff1ec55898f4d132d7f5ac3a8777d6c05e02d25bae7195e1eb0326146b299" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.98", +] + +[[package]] +name = "oxc_cfg" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68480b093736d6ac483afead3b5d9942bd02ec6b62e414d4265482eebffe9788" +dependencies = [ + "bitflags", + "itertools", + "nonmax", + "oxc_index", + "oxc_syntax", + "petgraph", + "rustc-hash", +] + +[[package]] +name = "oxc_codegen" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef6d9fd6b5953dcb9f814bf9ecd93979193269b17927a38c916afb702629f754" +dependencies = [ + "assert-unchecked", + "bitflags", + "cow-utils", + "nonmax", + "oxc_allocator", + "oxc_ast", + "oxc_data_structures", + "oxc_index", + "oxc_semantic", + "oxc_sourcemap", + "oxc_span", + "oxc_syntax", + "rustc-hash", + "ryu-js", +] + +[[package]] +name = "oxc_data_structures" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8342a5e7cb5ea7833a16b3075abb962094443b00caa22e2b2f93d47c44caf871" +dependencies = [ + "assert-unchecked", + "ropey", +] + +[[package]] +name = "oxc_diagnostics" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e96ced1ce8a7a2c5972a9ac69a1df801966157cdb40c09e9c39b13efecdf63c9" +dependencies = [ + "cow-utils", + "oxc-miette", +] + +[[package]] +name = "oxc_ecmascript" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f3d220214466200c5a5c6475b681cad6aa9e076aa0e9a290c920375993cc75" +dependencies = [ + "num-bigint", + "num-traits", + "oxc_ast", + "oxc_span", + "oxc_syntax", +] + +[[package]] +name = "oxc_estree" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0ba1ad13334dd7d203273c4d99b0f508c0d069888b5d2c36261c70630a0317" + +[[package]] +name = "oxc_index" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eca5d9726cd0a6e433debe003b7bc88b2ecad0bb6109f0cef7c55e692139a34" + +[[package]] +name = "oxc_mangler" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de5d581f96d85a192d1c6191ee3b476ba715f565a228c605b501be2456e49f51" +dependencies = [ + "fixedbitset", + "itertools", + "oxc_allocator", + "oxc_ast", + "oxc_index", + "oxc_semantic", + "oxc_span", + "rustc-hash", +] + +[[package]] +name = "oxc_minifier" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5137cabf5eeadec26708803c9676539cb418afab1403374d46c3ed0554d41c38" +dependencies = [ + "cow-utils", + "oxc_allocator", + "oxc_ast", + "oxc_codegen", + "oxc_data_structures", + "oxc_ecmascript", + "oxc_mangler", + "oxc_parser", + "oxc_semantic", + "oxc_span", + "oxc_syntax", + "oxc_traverse", + "rustc-hash", +] + +[[package]] +name = "oxc_parser" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd86fb907a291acf174889b545424abf2c11b3875203d363637c1835d9692176" +dependencies = [ + "assert-unchecked", + "bitflags", + "cow-utils", + "memchr", + "num-bigint", + "num-traits", + "oxc_allocator", + "oxc_ast", + "oxc_diagnostics", + "oxc_ecmascript", + "oxc_regular_expression", + "oxc_span", + "oxc_syntax", + "rustc-hash", + "seq-macro", +] + +[[package]] +name = "oxc_regular_expression" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77b2ad85545ca2f6a2d319230d35e6cbacc2734029079bc820b2176cea37dc4" +dependencies = [ + "oxc_allocator", + "oxc_ast_macros", + "oxc_diagnostics", + "oxc_estree", + "oxc_span", + "phf", + "rustc-hash", + "unicode-id-start", +] + +[[package]] +name = "oxc_semantic" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f021acc396e980c533abc66ec3680c18dda8ff4329dc32c49b8666d48d4627a1" +dependencies = [ + "assert-unchecked", + "itertools", + "oxc_allocator", + "oxc_ast", + "oxc_cfg", + "oxc_data_structures", + "oxc_diagnostics", + "oxc_ecmascript", + "oxc_index", + "oxc_span", + "oxc_syntax", + "phf", + "rustc-hash", + "self_cell", +] + +[[package]] +name = "oxc_sourcemap" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48557f779d04c8bfa8a930db5a3c35c0a86ff4e6bf1552ce446b9596a6e77c42" +dependencies = [ + "base64-simd", + "cfg-if", + "cow-utils", + "rustc-hash", + "serde", + "serde_json", +] + +[[package]] +name = "oxc_span" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3492e9db0c166a6072f4da2003966f3c3dad5f6c39ba86589dc0ab85de94dbb6" +dependencies = [ + "compact_str", + "oxc-miette", + "oxc_allocator", + "oxc_ast_macros", + "oxc_estree", +] + +[[package]] +name = "oxc_syntax" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2945b8d56e1cf569c933812bc37277de784bba3fd92a565a640f2650801b2d5" +dependencies = [ + "assert-unchecked", + "bitflags", + "cow-utils", + "nonmax", + "oxc_allocator", + "oxc_ast_macros", + "oxc_estree", + "oxc_index", + "oxc_span", + "phf", + "rustc-hash", + "ryu-js", + "unicode-id-start", +] + +[[package]] +name = "oxc_traverse" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ba02cbc4f6b98c1bb04c3a73c336657d999a75b464af91cf3abb93e610c0650" +dependencies = [ + "compact_str", + "itoa", + "oxc_allocator", + "oxc_ast", + "oxc_data_structures", + "oxc_ecmascript", + "oxc_semantic", + "oxc_span", + "oxc_syntax", + "rustc-hash", +] + [[package]] name = "parking_lot" version = "0.12.3" @@ -1899,18 +2002,6 @@ dependencies = [ "path-dedot", ] -[[package]] -name = "path-clean" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecba01bf2678719532c5e3059e0b5f0811273d94b397088b82e3bd0a78c78fdd" - -[[package]] -name = "path-clean" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17359afc20d7ab31fdb42bb844c8b3bb1dabd7dcf7e68428492da7f16966fcef" - [[package]] name = "path-dedot" version = "3.1.1" @@ -1920,12 +2011,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "pathdiff" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" - [[package]] name = "percent-encoding" version = "2.3.1" @@ -1934,9 +2019,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "petgraph" -version = "0.6.5" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" dependencies = [ "fixedbitset", "indexmap", @@ -1981,7 +2066,7 @@ version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" dependencies = [ - "siphasher 1.0.1", + "siphasher", ] [[package]] @@ -2026,24 +2111,6 @@ dependencies = [ "zerocopy 0.7.35", ] -[[package]] -name = "preset_env_base" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07852df2dda2f0ab8c3407a6fd19e9389563af11c20f6c299bd07ff9fc96d6ae" -dependencies = [ - "anyhow", - "browserslist-rs", - "dashmap 5.5.3", - "from_variant", - "once_cell", - "rustc-hash 2.1.1", - "semver 1.0.25", - "serde", - "st-map", - "tracing", -] - [[package]] name = "proc-macro2" version = "1.0.93" @@ -2053,35 +2120,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "psm" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "200b9ff220857e53e184257720a14553b2f4aa02577d2ed9842d45d4b9654810" -dependencies = [ - "cc", -] - -[[package]] -name = "ptr_meta" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9e76f66d3f9606f44e45598d155cb13ecf09f4a28199e48daf8c8fc937ea90" -dependencies = [ - "ptr_meta_derive", -] - -[[package]] -name = "ptr_meta_derive" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca414edb151b4c8d125c12566ab0d74dc9cdba36fb80eb7b848c15f495fd32d1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.98", -] - [[package]] name = "quick_cache" version = "0.6.10" @@ -2101,18 +2139,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - -[[package]] -name = "radix_fmt" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce082a9940a7ace2ad4a8b7d0b1eac6aa378895f18be598230c5f2284ac05426" - [[package]] name = "rand" version = "0.8.5" @@ -2267,33 +2293,37 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rlimit" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7043b63bd0cd1aaa628e476b80e6d4023a3b50eb32789f2728908107bd0c793a" +dependencies = [ + "libc", +] + +[[package]] +name = "ropey" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93411e420bcd1a75ddd1dc3caf18c23155eda2c090631a85af21ba19e97093b5" +dependencies = [ + "smallvec", + "str_indices", +] + [[package]] name = "rustc-demangle" version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - [[package]] name = "rustc-hash" version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver 0.9.0", -] - [[package]] name = "rustix" version = "0.38.44" @@ -2304,7 +2334,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -2373,12 +2403,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - [[package]] name = "scopeguard" version = "1.2.0" @@ -2436,28 +2460,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2fdfc24bc566f839a2da4c4295b82db7d25a24253867d5c64355abb5799bdbe" [[package]] -name = "semver" -version = "0.9.0" +name = "seq-macro" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f79dfe2d285b0488816f30e700a7438c5a73d816b5b7d3ac72fbc48b0d185e03" -dependencies = [ - "serde", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +checksum = "a3f0bf26fd526d2a95683cd0f87bf103b8539e2ca1ef48ce002d67aad59aa0b4" [[package]] name = "serde" @@ -2468,6 +2474,15 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde_bytes" +version = "0.11.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" +dependencies = [ + "serde", +] + [[package]] name = "serde_derive" version = "1.0.217" @@ -2513,17 +2528,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - [[package]] name = "sharded-slab" version = "0.1.7" @@ -2549,19 +2553,10 @@ dependencies = [ ] [[package]] -name = "simd-abstraction" -version = "0.7.1" +name = "simdutf8" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cadb29c57caadc51ff8346233b5cec1d240b68ce55cf1afc764818791876987" -dependencies = [ - "outref", -] - -[[package]] -name = "siphasher" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "siphasher" @@ -2585,15 +2580,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] -name = "smartstring" -version = "1.0.1" +name = "smawk" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29" -dependencies = [ - "autocfg", - "static_assertions", - "version_check", -] +checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" [[package]] name = "socket2" @@ -2605,71 +2595,18 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "sourcemap" -version = "9.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27c4ea7042fd1a155ad95335b5d505ab00d5124ea0332a06c8390d200bb1a76a" -dependencies = [ - "base64-simd", - "bitvec", - "data-encoding", - "debugid", - "if_chain", - "rustc-hash 1.1.0", - "rustc_version", - "serde", - "serde_json", - "unicode-id-start", - "url", -] - [[package]] name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -[[package]] -name = "st-map" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8257dd592de7614be71a2342d36ba2d527ddad3f9a0c8d09d6ceed4c371531e4" -dependencies = [ - "arrayvec", - "static-map-macro", -] - [[package]] name = "stable_deref_trait" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "stacker" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799c883d55abdb5e98af1a7b3f23b9b6de8ecada0ecac058672d7635eb48ca7b" -dependencies = [ - "cc", - "cfg-if", - "libc", - "psm", - "windows-sys 0.59.0", -] - -[[package]] -name = "static-map-macro" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "710e9696ef338691287aeb937ee6ffe60022f579d3c8d2fd9d58973a9a10a466" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.98", -] - [[package]] name = "static_assertions" version = "1.1.0" @@ -2687,20 +2624,14 @@ name = "storable_vec" version = "0.1.2" dependencies = [ "memmap2", - "zerocopy 0.8.16", + "zerocopy 0.8.17", ] [[package]] -name = "string_enum" -version = "1.0.0" +name = "str_indices" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9fe66b8ee349846ce2f9557a26b8f1e74843c4a13fb381f9a3d73617a5f956a" -dependencies = [ - "proc-macro2", - "quote", - "swc_macros_common", - "syn 2.0.98", -] +checksum = "d08889ec5408683408db66ad89e0e1f93dff55c73a4ccc71c427d5b277ee47e6" [[package]] name = "struct_iterable" @@ -2728,970 +2659,6 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" -[[package]] -name = "swc" -version = "13.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4107d56ba60c3b965d50cbd26762530553f6ab3fb98aeea917c75ee08c81c346" -dependencies = [ - "anyhow", - "base64 0.21.7", - "dashmap 5.5.3", - "either", - "indexmap", - "jsonc-parser", - "lru", - "once_cell", - "parking_lot", - "pathdiff", - "regex", - "rustc-hash 2.1.1", - "serde", - "serde_json", - "sourcemap", - "swc_atoms", - "swc_cached", - "swc_common", - "swc_compiler_base", - "swc_config", - "swc_ecma_ast", - "swc_ecma_codegen", - "swc_ecma_ext_transforms", - "swc_ecma_lints", - "swc_ecma_loader", - "swc_ecma_minifier", - "swc_ecma_parser", - "swc_ecma_preset_env", - "swc_ecma_transforms", - "swc_ecma_transforms_base", - "swc_ecma_transforms_compat", - "swc_ecma_transforms_optimization", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_error_reporters", - "swc_node_comments", - "swc_timer", - "swc_transform_common", - "swc_typescript", - "swc_visit", - "tracing", - "url", -] - -[[package]] -name = "swc_allocator" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a1f988452cab8c4e25776e5a855ba088cdb38fbe9714f9b9d2a6ff345824858" -dependencies = [ - "bumpalo", - "hashbrown 0.14.5", - "ptr_meta", - "rustc-hash 2.1.1", - "triomphe", -] - -[[package]] -name = "swc_atoms" -version = "3.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b770be7f8c626633841a0408e2b66b0d6a395a5a0a565a1591f15dc05af8d3" -dependencies = [ - "hstr", - "once_cell", - "rustc-hash 2.1.1", - "serde", -] - -[[package]] -name = "swc_cached" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7133338c3bef796430deced151b0eaa5430710a90e38da19e8e3045e8e36eeb" -dependencies = [ - "anyhow", - "dashmap 5.5.3", - "once_cell", - "regex", - "rustc-hash 2.1.1", - "serde", -] - -[[package]] -name = "swc_common" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa92d673f12585e950300d3d397eefd2da9effe3373d7882f46b35b0f9ef9cec" -dependencies = [ - "ast_node", - "better_scoped_tls", - "cfg-if", - "either", - "from_variant", - "new_debug_unreachable", - "num-bigint", - "once_cell", - "parking_lot", - "rustc-hash 2.1.1", - "serde", - "siphasher 0.3.11", - "sourcemap", - "swc_allocator", - "swc_atoms", - "swc_eq_ignore_macros", - "swc_visit", - "tracing", - "unicode-width", - "url", -] - -[[package]] -name = "swc_compiler_base" -version = "11.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c126a0562e58c04cc7e8600ea375bc96473a0dd4733e0708de4b58164d5a3ec1" -dependencies = [ - "anyhow", - "base64 0.21.7", - "once_cell", - "pathdiff", - "rustc-hash 2.1.1", - "serde", - "serde_json", - "sourcemap", - "swc_allocator", - "swc_atoms", - "swc_common", - "swc_config", - "swc_ecma_ast", - "swc_ecma_codegen", - "swc_ecma_minifier", - "swc_ecma_parser", - "swc_ecma_visit", - "swc_timer", -] - -[[package]] -name = "swc_config" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb63364aebd1a8490a80fa8933825c6916d4df55d5472312d5adb62c9fb4e4ba" -dependencies = [ - "anyhow", - "indexmap", - "serde", - "serde_json", - "sourcemap", - "swc_cached", - "swc_config_macro", -] - -[[package]] -name = "swc_config_macro" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2ebd37ef52a8555c8c9be78b694d64adcb5e3bc16c928f030d82f1d65fac57" -dependencies = [ - "proc-macro2", - "quote", - "swc_macros_common", - "syn 2.0.98", -] - -[[package]] -name = "swc_ecma_ast" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d16cd007587c1cccaabe76ad640a59a05e51fed0ec4c0600b8ed6f26c9be2ec" -dependencies = [ - "bitflags", - "is-macro", - "num-bigint", - "phf", - "scoped-tls", - "serde", - "string_enum", - "swc_atoms", - "swc_common", - "swc_visit", - "unicode-id-start", -] - -[[package]] -name = "swc_ecma_codegen" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab1c30908a59fa1f103b7f2ae0b2788271d05c2a9d4f174e44cca4367aa6d7d" -dependencies = [ - "ascii", - "memchr", - "num-bigint", - "once_cell", - "regex", - "rustc-hash 2.1.1", - "serde", - "sourcemap", - "swc_allocator", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_codegen_macros", - "tracing", -] - -[[package]] -name = "swc_ecma_codegen_macros" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9a42f479a6475647e248fa9750982c87cd985e19d1016a1fc18a70682305d1" -dependencies = [ - "proc-macro2", - "quote", - "swc_macros_common", - "syn 2.0.98", -] - -[[package]] -name = "swc_ecma_compat_bugfixes" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f08d54d4480e63535bf8aa2f56e5e43e682e02c703d2dd419aefca20c991c167" -dependencies = [ - "rustc-hash 2.1.1", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_compat_es2015", - "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_common" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df57bb8d6477c81459e892aa4427e54b231abc675d32d1b1981978331b9e5505" -dependencies = [ - "swc_common", - "swc_ecma_ast", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", -] - -[[package]] -name = "swc_ecma_compat_es2015" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e043d59b56f54f5799e6a04400286804434f39feba82dc7f00fe870d122caa55" -dependencies = [ - "arrayvec", - "indexmap", - "is-macro", - "rustc-hash 2.1.1", - "serde", - "serde_derive", - "smallvec", - "swc_atoms", - "swc_common", - "swc_config", - "swc_ecma_ast", - "swc_ecma_compat_common", - "swc_ecma_transforms_base", - "swc_ecma_transforms_classes", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_es2016" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cedbafaa7ec38e076cf43e53894b2e40cc3876e17c2bd740b41082a81c3964c8" -dependencies = [ - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_es2017" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d5077ba72189a26f4a074d226df5ca92af5df49a4f85324ff6f71fce676b60e" -dependencies = [ - "serde", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_es2018" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634385e806b12cad22eb0a4a62a100583d0d5ea81cda605f49dedd3b637d8bc7" -dependencies = [ - "serde", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_compat_common", - "swc_ecma_transforms_base", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_es2019" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c603b3b07d12f800ce5fe6b4d157dde14d9315b9b2e3576deebd99a310adfdb" -dependencies = [ - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_es2020" -version = "10.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13b59539620b1ddca8ab3e9b3747bc8358fc3b4a9c88390051135591ba86608" -dependencies = [ - "serde", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_compat_es2022", - "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_es2021" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a96de895205bfccbc722d9449e70b0feae79950ab95c2d0115139433d649d06" -dependencies = [ - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_es2022" -version = "10.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55de1bcd911804365e7f12d0f32ea38874cee7d8f5c44b17b0d05410094ef214" -dependencies = [ - "rustc-hash 2.1.1", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_compat_common", - "swc_ecma_transforms_base", - "swc_ecma_transforms_classes", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_es3" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82b09b355fb9995927fc7ad262a8384574a8c920d6869b4f12810bcfedacf6d8" -dependencies = [ - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_ext_transforms" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc517764142a071eac496aeb5e0ad910db3d27bbd57fbc2de1a0a50172179189" -dependencies = [ - "phf", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_utils", - "swc_ecma_visit", -] - -[[package]] -name = "swc_ecma_lints" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3d14aa9c8a6adbacbf8cb072387b4dc445b8bc51a8009257d782890431f0c4" -dependencies = [ - "auto_impl", - "dashmap 5.5.3", - "parking_lot", - "regex", - "rustc-hash 2.1.1", - "serde", - "swc_atoms", - "swc_common", - "swc_config", - "swc_ecma_ast", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_parallel", -] - -[[package]] -name = "swc_ecma_loader" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd99e5ef9cbecc33e8e199ad060d2af0a28ab0c2340eb37a7d4ba17fa59576d4" -dependencies = [ - "anyhow", - "dashmap 5.5.3", - "lru", - "normpath", - "once_cell", - "parking_lot", - "path-clean 0.1.0", - "pathdiff", - "rustc-hash 2.1.1", - "serde", - "serde_json", - "swc_atoms", - "swc_cached", - "swc_common", - "tracing", -] - -[[package]] -name = "swc_ecma_minifier" -version = "10.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac6648ce5f9dda34a683132771aa8be50c96ca89440cf8197d6f9ff019e9e47" -dependencies = [ - "arrayvec", - "indexmap", - "num-bigint", - "num_cpus", - "once_cell", - "parking_lot", - "phf", - "radix_fmt", - "regex", - "rustc-hash 2.1.1", - "ryu-js", - "serde", - "serde_json", - "swc_allocator", - "swc_atoms", - "swc_common", - "swc_config", - "swc_ecma_ast", - "swc_ecma_codegen", - "swc_ecma_parser", - "swc_ecma_transforms_base", - "swc_ecma_transforms_optimization", - "swc_ecma_usage_analyzer", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_parallel", - "swc_timer", - "tracing", -] - -[[package]] -name = "swc_ecma_parser" -version = "8.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d99556f20b91452fa4c6da1891f90e58998e89842d6321bb7326ebfe81c37dca" -dependencies = [ - "either", - "new_debug_unreachable", - "num-bigint", - "num-traits", - "phf", - "rustc-hash 2.1.1", - "serde", - "smallvec", - "smartstring", - "stacker", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "tracing", - "typed-arena", -] - -[[package]] -name = "swc_ecma_preset_env" -version = "11.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22b32544046c3eb22865e0ca5d01987652bf2792ced0e3c63c108aaa709613b8" -dependencies = [ - "anyhow", - "dashmap 5.5.3", - "indexmap", - "once_cell", - "preset_env_base", - "rustc-hash 2.1.1", - "semver 1.0.25", - "serde", - "serde_json", - "st-map", - "string_enum", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms", - "swc_ecma_utils", - "swc_ecma_visit", -] - -[[package]] -name = "swc_ecma_transforms" -version = "11.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "059b8a22359b6cb5fbf942926935abf2faba898d337656fe9d6ffae37c7fa2d8" -dependencies = [ - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "swc_ecma_transforms_compat", - "swc_ecma_transforms_module", - "swc_ecma_transforms_optimization", - "swc_ecma_transforms_proposal", - "swc_ecma_transforms_react", - "swc_ecma_transforms_typescript", - "swc_ecma_utils", - "swc_ecma_visit", -] - -[[package]] -name = "swc_ecma_transforms_base" -version = "9.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b696e003dd095ae8b8dba00f601040f756273c9af0fd67cb1c57115785cb5ec" -dependencies = [ - "better_scoped_tls", - "bitflags", - "indexmap", - "once_cell", - "phf", - "rustc-hash 2.1.1", - "serde", - "smallvec", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_parser", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_parallel", - "tracing", -] - -[[package]] -name = "swc_ecma_transforms_classes" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22c0ccd085c481c3690b93db9e3e27658b7133192c9bf49b146f11c0180808e7" -dependencies = [ - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", -] - -[[package]] -name = "swc_ecma_transforms_compat" -version = "10.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c933a35718a42dde2873120f0f4768d9054125e9c56f7b7223f35efac21bd76" -dependencies = [ - "arrayvec", - "indexmap", - "is-macro", - "num-bigint", - "serde", - "smallvec", - "swc_atoms", - "swc_common", - "swc_config", - "swc_ecma_ast", - "swc_ecma_compat_bugfixes", - "swc_ecma_compat_common", - "swc_ecma_compat_es2015", - "swc_ecma_compat_es2016", - "swc_ecma_compat_es2017", - "swc_ecma_compat_es2018", - "swc_ecma_compat_es2019", - "swc_ecma_compat_es2020", - "swc_ecma_compat_es2021", - "swc_ecma_compat_es2022", - "swc_ecma_compat_es3", - "swc_ecma_transforms_base", - "swc_ecma_transforms_classes", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_transforms_macros" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6845dfb88569f3e8cd05901505916a8ebe98be3922f94769ca49f84e8ccec8f7" -dependencies = [ - "proc-macro2", - "quote", - "swc_macros_common", - "syn 2.0.98", -] - -[[package]] -name = "swc_ecma_transforms_module" -version = "10.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "461ad2212af7c681e46b4beb91ca25b84a29467f327cd0c09e33f5908b73384f" -dependencies = [ - "Inflector", - "anyhow", - "bitflags", - "indexmap", - "is-macro", - "path-clean 1.0.1", - "pathdiff", - "regex", - "rustc-hash 2.1.1", - "serde", - "swc_atoms", - "swc_cached", - "swc_common", - "swc_ecma_ast", - "swc_ecma_loader", - "swc_ecma_parser", - "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", - "tracing", -] - -[[package]] -name = "swc_ecma_transforms_optimization" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d05cd8942bb58b4676d8189e82942504004555957cb87a563bc4938f2440ab" -dependencies = [ - "dashmap 5.5.3", - "indexmap", - "once_cell", - "petgraph", - "rustc-hash 2.1.1", - "serde_json", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_parser", - "swc_ecma_transforms_base", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_fast_graph", - "tracing", -] - -[[package]] -name = "swc_ecma_transforms_proposal" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f82905f3d824bbe0555961df6c0f19807c6460ce49b3ddafec49493dc95b3e" -dependencies = [ - "either", - "rustc-hash 2.1.1", - "serde", - "smallvec", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "swc_ecma_transforms_classes", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", -] - -[[package]] -name = "swc_ecma_transforms_react" -version = "9.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dee5ef36740d62b3f69c777385067e0fe6e10fd87e4107e5495b74b15e0a0b7" -dependencies = [ - "base64 0.21.7", - "dashmap 5.5.3", - "indexmap", - "once_cell", - "rustc-hash 2.1.1", - "serde", - "sha1", - "string_enum", - "swc_allocator", - "swc_atoms", - "swc_common", - "swc_config", - "swc_ecma_ast", - "swc_ecma_parser", - "swc_ecma_transforms_base", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", -] - -[[package]] -name = "swc_ecma_transforms_typescript" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693f6e9683ae814930fa17f21b6915c795ab5d1883dd351753a18b689a78492f" -dependencies = [ - "once_cell", - "rustc-hash 2.1.1", - "ryu-js", - "serde", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "swc_ecma_transforms_react", - "swc_ecma_utils", - "swc_ecma_visit", -] - -[[package]] -name = "swc_ecma_usage_analyzer" -version = "10.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b2031aed05786c806c8092b16cafad791be16f28e7222a9db069320937c1eb9" -dependencies = [ - "indexmap", - "rustc-hash 2.1.1", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_timer", - "tracing", -] - -[[package]] -name = "swc_ecma_utils" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c217edaa22c98537e09ed3189e723feed3d889eeb7e02a0b3d48cbb91ba7e4" -dependencies = [ - "indexmap", - "num_cpus", - "once_cell", - "rustc-hash 2.1.1", - "ryu-js", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_visit", - "swc_parallel", - "tracing", - "unicode-id", -] - -[[package]] -name = "swc_ecma_visit" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a32fb2902c01f9b4615605a4a3e67e0c928bd3b9f2182e764f1c9fe4130965cf" -dependencies = [ - "new_debug_unreachable", - "num-bigint", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_visit", - "tracing", -] - -[[package]] -name = "swc_eq_ignore_macros" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96e15288bf385ab85eb83cff7f9e2d834348da58d0a31b33bdb572e66ee413e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.98", -] - -[[package]] -name = "swc_error_reporters" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed21ea887faeb0dab190838d2331ed187f2a74d185c9fe7044d5092900a83d29" -dependencies = [ - "anyhow", - "miette", - "once_cell", - "parking_lot", - "swc_common", -] - -[[package]] -name = "swc_fast_graph" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebf3efc1b14392006675682cfb8bab282bf88dbdfee65235a81b8a7b30af805" -dependencies = [ - "indexmap", - "petgraph", - "rustc-hash 2.1.1", - "swc_common", -] - -[[package]] -name = "swc_macros_common" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a509f56fca05b39ba6c15f3e58636c3924c78347d63853632ed2ffcb6f5a0ac7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.98", -] - -[[package]] -name = "swc_node_comments" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca0fdc3b404de25c08d5ed201b54db27d39c5f41e0389b6231910c50e76b1682" -dependencies = [ - "dashmap 5.5.3", - "rustc-hash 2.1.1", - "swc_atoms", - "swc_common", -] - -[[package]] -name = "swc_parallel" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5f75f1094d69174ef628e3665fff0f81d58e9f568802e3c90d332c72b0b6026" -dependencies = [ - "once_cell", -] - -[[package]] -name = "swc_timer" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4db06b46cc832f7cf83c2ce21905fc465d01443a2bdccf63644383e1f5847532" -dependencies = [ - "tracing", -] - -[[package]] -name = "swc_trace_macro" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c78717a841565df57f811376a3d19c9156091c55175e12d378f3a522de70cef" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.98", -] - -[[package]] -name = "swc_transform_common" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79319c2165695896119f0cb22847dedfb0bd7f77acd98dbc5bc1f081105db6f3" -dependencies = [ - "better_scoped_tls", - "once_cell", - "rustc-hash 2.1.1", - "serde", - "serde_json", -] - -[[package]] -name = "swc_typescript" -version = "8.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fbac6fb2bac25fd3b3aa49ad19001f5e6f7be1b9971dd34f8e7649f939e39c8" -dependencies = [ - "petgraph", - "rustc-hash 2.1.1", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_utils", - "swc_ecma_visit", - "thiserror", -] - -[[package]] -name = "swc_visit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9138b6a36bbe76dd6753c4c0794f7e26480ea757bee499738bedbbb3ae3ec5f3" -dependencies = [ - "either", - "new_debug_unreachable", -] - [[package]] name = "syn" version = "1.0.109" @@ -3755,12 +2722,6 @@ dependencies = [ "libc", ] -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - [[package]] name = "tempfile" version = "3.16.0" @@ -3772,7 +2733,7 @@ dependencies = [ "getrandom 0.3.1", "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -3781,8 +2742,9 @@ version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" dependencies = [ + "smawk", "unicode-linebreak", - "unicode-width", + "unicode-width 0.1.14", ] [[package]] @@ -3942,21 +2904,9 @@ checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "log", "pin-project-lite", - "tracing-attributes", "tracing-core", ] -[[package]] -name = "tracing-attributes" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.98", -] - [[package]] name = "tracing-core" version = "0.1.33" @@ -3988,40 +2938,12 @@ dependencies = [ "tracing-core", ] -[[package]] -name = "triomphe" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8f7726da4807b58ea5c96fdc122f80702030edc33b35aff9190a51148ccc85" -dependencies = [ - "serde", - "stable_deref_trait", -] - [[package]] name = "try-lock" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "typed-arena" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "unicode-id" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10103c57044730945224467c09f71a4db0071c123a0648cc3e818913bde6b561" - [[package]] name = "unicode-id-start" version = "1.3.1" @@ -4046,6 +2968,12 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" + [[package]] name = "untrusted" version = "0.9.0" @@ -4076,10 +3004,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] -name = "uuid" -version = "1.13.1" +name = "utf8parse" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced87ca4be083373936a67f8de945faa23b6b42384bd5b64434850802c6dccd0" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "valuable" @@ -4089,9 +3017,9 @@ checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" [[package]] name = "value-log" -version = "1.5.0" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "addf12a5bb88dbd4a006b59c2da6d5091c6e4440ab9e8e9e6cc4b2357b43a842" +checksum = "5589fb4f51f528b0cca7fdd03ec63a67f447bdcd313b09cdf9d2fc519149c02a" dependencies = [ "byteorder", "byteview", @@ -4099,7 +3027,7 @@ dependencies = [ "log", "path-absolutize", "quick_cache", - "rustc-hash 2.1.1", + "rustc-hash", "tempfile", "xxhash-rust", ] @@ -4117,10 +3045,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] -name = "version_check" -version = "0.9.5" +name = "vsimd" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" [[package]] name = "want" @@ -4227,37 +3155,6 @@ dependencies = [ "wasm-bindgen", ] -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets", -] - [[package]] name = "windows-registry" version = "0.2.0" @@ -4391,15 +3288,6 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - [[package]] name = "xxhash-rust" version = "0.8.15" @@ -4442,11 +3330,11 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.16" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b8c07a70861ce02bad1607b5753ecb2501f67847b9f9ada7c160fff0ec6300c" +checksum = "aa91407dacce3a68c56de03abe2760159582b846c6a4acd2f456618087f12713" dependencies = [ - "zerocopy-derive 0.8.16", + "zerocopy-derive 0.8.17", ] [[package]] @@ -4462,9 +3350,9 @@ dependencies = [ [[package]] name = "zerocopy-derive" -version = "0.8.16" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5226bc9a9a9836e7428936cde76bb6b22feea1a8bfdbc0d241136e4d13417e25" +checksum = "06718a168365cad3d5ff0bb133aad346959a2074bd4a85c121255a11304a8626" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index c20d580bc..5c77d7399 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ members = [ "exit", "indexer", "iterator", + "logger", "server", "storable_vec", "struct_iterable", @@ -16,12 +17,15 @@ color-eyre = "0.6.3" computer = { path = "computer", package = "bomputer" } derive_deref = "1.1.1" exit = { path = "exit" } -fjall = "2.5.0" +fjall = "2.6.2" indexer = { path = "indexer", package = "bindex" } iterator = { path = "iterator", package = "biter" } -jiff = "0.1.29" +jiff = "0.2.0" +logger = { path = "logger" } rayon = "1.10.0" -server = { path = "server" } +rlimit = { version = "0.10.2" } +serde = { version = "1.0.217", features = ["derive"] } +server = { path = "server", package = "berver" } storable_vec = { path = "storable_vec" } struct_iterable = { path = "struct_iterable" } -zerocopy = { version = "0.8.16", features = ["derive"] } +zerocopy = { version = "0.8.17", features = ["derive"] } diff --git a/computer/src/lib.rs b/computer/src/lib.rs index 7a2a807c8..4cf2cb9ad 100644 --- a/computer/src/lib.rs +++ b/computer/src/lib.rs @@ -2,48 +2,35 @@ use std::path::{Path, PathBuf}; use exit::Exit; use indexer::Indexer; -use iterator::rpc; +pub use iterator::rpc; mod storage; mod structs; -use storable_vec::{CACHED_GETS, SINGLE_THREAD}; +use storable_vec::SINGLE_THREAD; use storage::{Fjalls, StorableVecs}; -use structs::*; +pub use structs::*; pub struct Computer { - outputs_dir: PathBuf, + path: PathBuf, pub vecs: StorableVecs, pub trees: Fjalls, } impl Computer { - pub fn import(outputs_dir: &Path) -> color_eyre::Result { - let outputs_dir = outputs_dir.to_owned(); - let computed_dir = outputs_dir.join("computed"); + pub fn import(computed_dir: &Path) -> color_eyre::Result { let vecs = StorableVecs::import(&computed_dir.join("vecs"))?; let trees = Fjalls::import(&computed_dir.join("fjall"))?; Ok(Self { - outputs_dir, + path: computed_dir.to_owned(), vecs, trees, }) } - - fn open_indexer(&self) -> color_eyre::Result> { - Indexer::import(&self.outputs_dir.join("indexes")) - } } impl Computer { - pub fn compute(&mut self, bitcoin_dir: &Path, rpc: rpc::Client, exit: &Exit) -> color_eyre::Result<()> { - if false { - let mut indexer: Indexer = self.open_indexer()?; - indexer.index(bitcoin_dir, rpc, exit)?; - } - - let mut indexer: Indexer = self.open_indexer()?; - + pub fn compute(&mut self, mut indexer: Indexer, exit: &Exit) -> color_eyre::Result<()> { let height_count = indexer.vecs.height_to_size.len(); let txindexes_count = indexer.vecs.txindex_to_txid.len(); let txinindexes_count = indexer.vecs.txinindex_to_txoutindex.len(); @@ -117,4 +104,8 @@ impl Computer { Ok(()) } + + pub fn path(&self) -> &Path { + &self.path + } } diff --git a/computer/src/main.rs b/computer/src/main.rs index aac39505c..0f67f21e0 100644 --- a/computer/src/main.rs +++ b/computer/src/main.rs @@ -2,26 +2,20 @@ use std::path::Path; use bomputer::Computer; use exit::Exit; -use iterator::rpc; -use storable_vec::SINGLE_THREAD; +use indexer::Indexer; mod structs; pub fn main() -> color_eyre::Result<()> { color_eyre::install()?; - let data_dir = Path::new("../../bitcoin"); - let rpc = rpc::Client::new( - "http://localhost:8332", - rpc::Auth::CookieFile(Path::new(data_dir).join(".cookie")), - )?; let exit = Exit::new(); let i = std::time::Instant::now(); - let mut computer: Computer = Computer::import(Path::new("../_outputs"))?; + let outputs_dir = Path::new("../_outputs"); - computer.compute(data_dir, rpc, &exit)?; + Computer::import(&outputs_dir.join("computed"))?.compute(Indexer::import(&outputs_dir.join("indexes"))?, &exit)?; dbg!(i.elapsed()); diff --git a/computer/src/storage/storable_vecs.rs b/computer/src/storage/storable_vecs.rs index 131a34f04..c7835320d 100644 --- a/computer/src/storage/storable_vecs.rs +++ b/computer/src/storage/storable_vecs.rs @@ -11,20 +11,21 @@ use crate::structs::{Date, Feerate}; pub struct StorableVecs { pub date_to_first_height: StorableVec, + // pub date_to_last_height: StorableVec, // pub height_to_block_interval: StorableVec, pub height_to_date: StorableVec, // pub height_to_fee: StorableVec, - // pub height_to_inputcount: StorableVec, + // pub height_to_inputcount: StorableVec, // pub height_to_last_addressindex: StorableVec, pub height_to_last_txindex: StorableVec, // pub height_to_last_txoutindex: StorableVec, - // pub height_to_maxfeerate: StorableVec, - // pub height_to_medianfeerate: StorableVec, - // pub height_to_minfeerate: StorableVec, - // pub height_to_outputcount: StorableVec, - // pub height_to_subsidy: StorableVec, + // pub height_to_maxfeerate: StorableVec, + // pub height_to_medianfeerate: StorableVec, + // pub height_to_minfeerate: StorableVec, + // pub height_to_outputcount: StorableVec, + // pub height_to_subsidy: StorableVec, // pub height_to_totalfees: StorableVec, - // pub height_to_txcount: StorableVec, + // pub height_to_txcount: StorableVec, pub txindex_to_fee: StorableVec, pub txindex_to_height: StorableVec, pub txindex_to_is_coinbase: StorableVec, diff --git a/exit/Cargo.toml b/exit/Cargo.toml index 9a58fb4bb..e5c0e0723 100644 --- a/exit/Cargo.toml +++ b/exit/Cargo.toml @@ -5,3 +5,4 @@ edition = "2021" [dependencies] ctrlc = "3.4.5" +logger = { workspace = true } diff --git a/exit/src/lib.rs b/exit/src/lib.rs index d206f5b07..87ea02c9f 100644 --- a/exit/src/lib.rs +++ b/exit/src/lib.rs @@ -8,6 +8,8 @@ use std::{ time::Duration, }; +use logger::info; + #[derive(Default, Clone)] pub struct Exit { blocked: Arc, @@ -27,12 +29,12 @@ impl Exit { let blocked = move || _blocked.load(Ordering::SeqCst); ctrlc::set_handler(move || { - println!("Exitting..."); + info!("Exitting..."); active.store(true, Ordering::SeqCst); if blocked() { - println!("Waiting to exit safely"); + info!("Waiting to exit safely"); while blocked() { sleep(Duration::from_millis(50)); diff --git a/indexer/Cargo.toml b/indexer/Cargo.toml index 4219b5629..6b68f9873 100644 --- a/indexer/Cargo.toml +++ b/indexer/Cargo.toml @@ -11,7 +11,11 @@ exit = { workspace = true } fjall = { workspace = true } iterator = { workspace = true } jiff = { workspace = true } +logger = { workspace = true } rapidhash = "1.3.0" rayon = { workspace = true } +rlimit = { workspace = true } +serde = { workspace = true } +serde_bytes = "0.11.15" storable_vec = { workspace = true } zerocopy = { workspace = true } diff --git a/indexer/src/lib.rs b/indexer/src/lib.rs index 0078f7cfd..157f61381 100644 --- a/indexer/src/lib.rs +++ b/indexer/src/lib.rs @@ -1,6 +1,5 @@ use std::{ collections::BTreeMap, - io::{Read, Write}, path::Path, str::FromStr, thread::{self, sleep}, @@ -12,6 +11,7 @@ pub use iterator::*; use bitcoin::{Transaction, TxIn, TxOut}; use color_eyre::eyre::{eyre, ContextCompat}; use exit::Exit; +use logger::info; use rayon::prelude::*; use storable_vec::CACHED_GETS; @@ -19,15 +19,10 @@ mod storage; mod structs; pub use storage::{AnyStorableVec, StorableVec, Store, StoreMeta}; -use structs::{BlockHash, Txid}; - use storage::{Fjalls, StorableVecs}; -pub use structs::{ - AddressHash, Addressbytes, Addressindex, Addresstype, Amount, BlockHashPrefix, Height, Timestamp, TxidPrefix, - Txindex, Txinindex, Txoutindex, Vin, Vout, -}; +pub use structs::*; -const UNSAFE_BLOCKS: u32 = 100; +const UNSAFE_BLOCKS: u32 = 1000; const SNAPSHOT_BLOCK_RANGE: usize = 1000; pub struct Indexer { @@ -39,6 +34,7 @@ impl Indexer { pub fn import(indexes_dir: &Path) -> color_eyre::Result { let vecs = StorableVecs::import(&indexes_dir.join("vecs"))?; let trees = Fjalls::import(&indexes_dir.join("fjall"))?; + Ok(Self { vecs, trees }) } } @@ -77,7 +73,7 @@ impl Indexer { let export = |trees: &mut Fjalls, vecs: &mut StorableVecs, height: Height| -> color_eyre::Result<()> { - println!("Exporting..."); + info!("Exporting..."); exit.block(); @@ -93,10 +89,10 @@ impl Indexer { Ok(()) }; - iterator::new(bitcoin_dir, Some(height.into()), None, rpc) + iterator::new(bitcoin_dir, Some(height.into()), Some(400_000), rpc) .iter() .try_for_each(|(_height, block, blockhash)| -> color_eyre::Result<()> { - println!("Processing block {_height}..."); + info!("Processing block {_height}..."); let blockhash = BlockHash::from(blockhash); height = Height::from(_height); @@ -327,7 +323,7 @@ impl Indexer { .and_then(|addressindex_local| { (addressindex_local < addressindex_global).then_some(addressindex_local) }) - }); // OK + }); if let Some(Some(addressindex)) = check_collisions.then_some(addressindex_opt) { let addressbytes = addressbytes_res.as_ref().unwrap(); @@ -341,8 +337,6 @@ impl Indexer { .addressindex_to_addresstypeindex .get(addressindex)? .context("Expect to have address type index")?; - // Good first time - // Wrong after rerun let prev_addressbytes_opt = vecs.get_addressbytes(prev_addresstype, addresstypeindex)?; @@ -473,18 +467,18 @@ impl Indexer { addressindex_global.increment(); let addresstypeindex = match addresstype { - Addresstype::Empty => emptyindex_global.clone_then_increment(), - Addresstype::Multisig => multisigindex_global.clone_then_increment(), - Addresstype::OpReturn => opreturnindex_global.clone_then_increment(), - Addresstype::PushOnly => pushonlyindex_global.clone_then_increment(), - Addresstype::Unknown => unknownindex_global.clone_then_increment(), - Addresstype::P2PK65 => p2pk65index_global.clone_then_increment(), - Addresstype::P2PK33 => p2pk33index_global.clone_then_increment(), - Addresstype::P2PKH => p2pkhindex_global.clone_then_increment(), - Addresstype::P2SH => p2shindex_global.clone_then_increment(), - Addresstype::P2WPKH => p2wpkhindex_global.clone_then_increment(), - Addresstype::P2WSH => p2wshindex_global.clone_then_increment(), - Addresstype::P2TR => p2trindex_global.clone_then_increment(), + Addresstype::Empty => emptyindex_global.copy_then_increment(), + Addresstype::Multisig => multisigindex_global.copy_then_increment(), + Addresstype::OpReturn => opreturnindex_global.copy_then_increment(), + Addresstype::PushOnly => pushonlyindex_global.copy_then_increment(), + Addresstype::Unknown => unknownindex_global.copy_then_increment(), + Addresstype::P2PK65 => p2pk65index_global.copy_then_increment(), + Addresstype::P2PK33 => p2pk33index_global.copy_then_increment(), + Addresstype::P2PKH => p2pkhindex_global.copy_then_increment(), + Addresstype::P2SH => p2shindex_global.copy_then_increment(), + Addresstype::P2WPKH => p2wpkhindex_global.copy_then_increment(), + Addresstype::P2WSH => p2wshindex_global.copy_then_increment(), + Addresstype::P2TR => p2trindex_global.copy_then_increment(), }; vecs.addressindex_to_addresstype @@ -674,12 +668,3 @@ enum InputSource<'a> { PreviousBlock((Vin, Txindex, Txoutindex)), SameBlock((&'a Transaction, Txindex, &'a TxIn, Vin)), } - -#[allow(unused)] -fn pause() { - let mut stdin = std::io::stdin(); - let mut stdout = std::io::stdout(); - write!(stdout, "Press any key to continue...").unwrap(); - stdout.flush().unwrap(); - let _ = stdin.read(&mut [0u8]).unwrap(); -} diff --git a/indexer/src/main.rs b/indexer/src/main.rs index 67385efd7..3b7b6e7db 100644 --- a/indexer/src/main.rs +++ b/indexer/src/main.rs @@ -8,6 +8,14 @@ use storable_vec::CACHED_GETS; fn main() -> color_eyre::Result<()> { color_eyre::install()?; + logger::init_log(None); + + rlimit::setrlimit( + rlimit::Resource::NOFILE, + 21_000, + rlimit::getrlimit(rlimit::Resource::NOFILE).unwrap().1, + )?; + let data_dir = Path::new("../../bitcoin"); let rpc = rpc::Client::new( "http://localhost:8332", diff --git a/indexer/src/storage/storable_vecs/mod.rs b/indexer/src/storage/storable_vecs/mod.rs index 09654f836..be26308d9 100644 --- a/indexer/src/storage/storable_vecs/mod.rs +++ b/indexer/src/storage/storable_vecs/mod.rs @@ -5,9 +5,11 @@ use rayon::prelude::*; use storable_vec::{Version, CACHED_GETS}; use crate::structs::{ - Addressbytes, Addressindex, Addresstype, Addresstypeindex, Amount, BlockHash, Height, LockTime, P2PK33AddressBytes, - P2PK65AddressBytes, P2PKHAddressBytes, P2SHAddressBytes, P2TRAddressBytes, P2WPKHAddressBytes, P2WSHAddressBytes, - Timestamp, TxVersion, Txid, Txindex, Txinindex, Txoutindex, Weight, + Addressbytes, Addressindex, Addresstype, Addresstypeindex, Amount, BlockHash, Emptyindex, Height, LockTime, + Multisigindex, Opreturnindex, P2PK33AddressBytes, P2PK33index, P2PK65AddressBytes, P2PK65index, P2PKHAddressBytes, + P2PKHindex, P2SHAddressBytes, P2SHindex, P2TRAddressBytes, P2TRindex, P2WPKHAddressBytes, P2WPKHindex, + P2WSHAddressBytes, P2WSHindex, Pushonlyindex, Timestamp, TxVersion, Txid, Txindex, Txinindex, Txoutindex, + Unknownindex, Weight, }; mod base; @@ -21,31 +23,31 @@ pub struct StorableVecs { pub height_to_blockhash: StorableVec, pub height_to_difficulty: StorableVec, pub height_to_first_addressindex: StorableVec, - pub height_to_first_emptyindex: StorableVec, - pub height_to_first_multisigindex: StorableVec, - pub height_to_first_opreturnindex: StorableVec, - pub height_to_first_pushonlyindex: StorableVec, + pub height_to_first_emptyindex: StorableVec, + pub height_to_first_multisigindex: StorableVec, + pub height_to_first_opreturnindex: StorableVec, + pub height_to_first_pushonlyindex: StorableVec, pub height_to_first_txindex: StorableVec, pub height_to_first_txinindex: StorableVec, pub height_to_first_txoutindex: StorableVec, - pub height_to_first_unknownindex: StorableVec, - pub height_to_first_p2pk33index: StorableVec, - pub height_to_first_p2pk65index: StorableVec, - pub height_to_first_p2pkhindex: StorableVec, - pub height_to_first_p2shindex: StorableVec, - pub height_to_first_p2trindex: StorableVec, - pub height_to_first_p2wpkhindex: StorableVec, - pub height_to_first_p2wshindex: StorableVec, + pub height_to_first_unknownindex: StorableVec, + pub height_to_first_p2pk33index: StorableVec, + pub height_to_first_p2pk65index: StorableVec, + pub height_to_first_p2pkhindex: StorableVec, + pub height_to_first_p2shindex: StorableVec, + pub height_to_first_p2trindex: StorableVec, + pub height_to_first_p2wpkhindex: StorableVec, + pub height_to_first_p2wshindex: StorableVec, pub height_to_size: StorableVec, pub height_to_timestamp: StorableVec, pub height_to_weight: StorableVec, - pub p2pk33index_to_p2pk33addressbytes: StorableVec, - pub p2pk65index_to_p2pk65addressbytes: StorableVec, - pub p2pkhindex_to_p2pkhaddressbytes: StorableVec, - pub p2shindex_to_p2shaddressbytes: StorableVec, - pub p2trindex_to_p2traddressbytes: StorableVec, - pub p2wpkhindex_to_p2wpkhaddressbytes: StorableVec, - pub p2wshindex_to_p2wshaddressbytes: StorableVec, + pub p2pk33index_to_p2pk33addressbytes: StorableVec, + pub p2pk65index_to_p2pk65addressbytes: StorableVec, + pub p2pkhindex_to_p2pkhaddressbytes: StorableVec, + pub p2shindex_to_p2shaddressbytes: StorableVec, + pub p2trindex_to_p2traddressbytes: StorableVec, + pub p2wpkhindex_to_p2wpkhaddressbytes: StorableVec, + pub p2wshindex_to_p2wshaddressbytes: StorableVec, pub txindex_to_first_txinindex: StorableVec, pub txindex_to_first_txoutindex: StorableVec, pub txindex_to_height: StorableVec, @@ -57,7 +59,7 @@ pub struct StorableVecs { pub txoutindex_to_amount: StorableVec, } -// const UNSAFE_BLOCKS: usize = 100; +// const UNSAFE_BLOCKS: usize = 1000; impl StorableVecs { pub fn import(path: &Path) -> color_eyre::Result { @@ -407,37 +409,37 @@ impl StorableVecs { Ok(match addresstype { Addresstype::P2PK65 => self .p2pk65index_to_p2pk65addressbytes - .get(addresstypeindex)? + .get(addresstypeindex.into())? // .map(|v| Addressbytes::from(v.clone())), .map(|v| Addressbytes::from(v.into_inner())), Addresstype::P2PK33 => self .p2pk33index_to_p2pk33addressbytes - .get(addresstypeindex)? + .get(addresstypeindex.into())? // .map(|v| Addressbytes::from(v.clone())), .map(|v| Addressbytes::from(v.into_inner())), Addresstype::P2PKH => self .p2pkhindex_to_p2pkhaddressbytes - .get(addresstypeindex)? + .get(addresstypeindex.into())? // .map(|v| Addressbytes::from(v.clone())), .map(|v| Addressbytes::from(v.into_inner())), Addresstype::P2SH => self .p2shindex_to_p2shaddressbytes - .get(addresstypeindex)? + .get(addresstypeindex.into())? // .map(|v| Addressbytes::from(v.clone())), .map(|v| Addressbytes::from(v.into_inner())), Addresstype::P2WPKH => self .p2wpkhindex_to_p2wpkhaddressbytes - .get(addresstypeindex)? + .get(addresstypeindex.into())? // .map(|v| Addressbytes::from(v.clone())), .map(|v| Addressbytes::from(v.into_inner())), Addresstype::P2WSH => self .p2wshindex_to_p2wshaddressbytes - .get(addresstypeindex)? + .get(addresstypeindex.into())? // .map(|v| Addressbytes::from(v.clone())), .map(|v| Addressbytes::from(v.into_inner())), Addresstype::P2TR => self .p2trindex_to_p2traddressbytes - .get(addresstypeindex)? + .get(addresstypeindex.into())? // .map(|v| Addressbytes::from(v.clone())), .map(|v| Addressbytes::from(v.into_inner())), _ => unreachable!(), @@ -450,13 +452,19 @@ impl StorableVecs { addressbytes: Addressbytes, ) -> storable_vec::Result<()> { match addressbytes { - Addressbytes::P2PK65(bytes) => self.p2pk65index_to_p2pk65addressbytes.push_if_needed(index, bytes), - Addressbytes::P2PK33(bytes) => self.p2pk33index_to_p2pk33addressbytes.push_if_needed(index, bytes), - Addressbytes::P2PKH(bytes) => self.p2pkhindex_to_p2pkhaddressbytes.push_if_needed(index, bytes), - Addressbytes::P2SH(bytes) => self.p2shindex_to_p2shaddressbytes.push_if_needed(index, bytes), - Addressbytes::P2WPKH(bytes) => self.p2wpkhindex_to_p2wpkhaddressbytes.push_if_needed(index, bytes), - Addressbytes::P2WSH(bytes) => self.p2wshindex_to_p2wshaddressbytes.push_if_needed(index, bytes), - Addressbytes::P2TR(bytes) => self.p2trindex_to_p2traddressbytes.push_if_needed(index, bytes), + Addressbytes::P2PK65(bytes) => self + .p2pk65index_to_p2pk65addressbytes + .push_if_needed(index.into(), bytes), + Addressbytes::P2PK33(bytes) => self + .p2pk33index_to_p2pk33addressbytes + .push_if_needed(index.into(), bytes), + Addressbytes::P2PKH(bytes) => self.p2pkhindex_to_p2pkhaddressbytes.push_if_needed(index.into(), bytes), + Addressbytes::P2SH(bytes) => self.p2shindex_to_p2shaddressbytes.push_if_needed(index.into(), bytes), + Addressbytes::P2WPKH(bytes) => self + .p2wpkhindex_to_p2wpkhaddressbytes + .push_if_needed(index.into(), bytes), + Addressbytes::P2WSH(bytes) => self.p2wshindex_to_p2wshaddressbytes.push_if_needed(index.into(), bytes), + Addressbytes::P2TR(bytes) => self.p2trindex_to_p2traddressbytes.push_if_needed(index.into(), bytes), } } } diff --git a/indexer/src/structs/addressbytes.rs b/indexer/src/structs/addressbytes.rs index 1d882977c..70940b46d 100644 --- a/indexer/src/structs/addressbytes.rs +++ b/indexer/src/structs/addressbytes.rs @@ -1,6 +1,7 @@ use color_eyre::eyre::eyre; use derive_deref::{Deref, DerefMut}; use iterator::bitcoin::ScriptBuf; +use serde::Serialize; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; use super::Addresstype; @@ -123,28 +124,28 @@ impl From for Addressbytes { } } -#[derive(Debug, Clone, Deref, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes)] +#[derive(Debug, Clone, Deref, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes, Serialize)] pub struct P2PK65AddressBytes(U8x65); -#[derive(Debug, Clone, Deref, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes)] +#[derive(Debug, Clone, Deref, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes, Serialize)] pub struct P2PK33AddressBytes(U8x33); -#[derive(Debug, Clone, Deref, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes)] +#[derive(Debug, Clone, Deref, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes, Serialize)] pub struct P2PKHAddressBytes(U8x20); -#[derive(Debug, Clone, Deref, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes)] +#[derive(Debug, Clone, Deref, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes, Serialize)] pub struct P2SHAddressBytes(U8x20); -#[derive(Debug, Clone, Deref, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes)] +#[derive(Debug, Clone, Deref, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes, Serialize)] pub struct P2WPKHAddressBytes(U8x20); -#[derive(Debug, Clone, Deref, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes)] +#[derive(Debug, Clone, Deref, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes, Serialize)] pub struct P2WSHAddressBytes(U8x32); -#[derive(Debug, Clone, Deref, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes)] +#[derive(Debug, Clone, Deref, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes, Serialize)] pub struct P2TRAddressBytes(U8x32); -#[derive(Debug, Clone, Deref, DerefMut, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes)] +#[derive(Debug, Clone, Deref, DerefMut, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes, Serialize)] pub struct U8x20([u8; 20]); impl From<&[u8]> for U8x20 { fn from(slice: &[u8]) -> Self { @@ -154,7 +155,7 @@ impl From<&[u8]> for U8x20 { } } -#[derive(Debug, Clone, Deref, DerefMut, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes)] +#[derive(Debug, Clone, Deref, DerefMut, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes, Serialize)] pub struct U8x32([u8; 32]); impl From<&[u8]> for U8x32 { fn from(slice: &[u8]) -> Self { @@ -164,8 +165,8 @@ impl From<&[u8]> for U8x32 { } } -#[derive(Debug, Clone, Deref, DerefMut, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes)] -pub struct U8x33([u8; 33]); +#[derive(Debug, Clone, Deref, DerefMut, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes, Serialize)] +pub struct U8x33(#[serde(with = "serde_bytes")] [u8; 33]); impl From<&[u8]> for U8x33 { fn from(slice: &[u8]) -> Self { let mut arr = [0; 33]; @@ -174,8 +175,8 @@ impl From<&[u8]> for U8x33 { } } -#[derive(Debug, Clone, Deref, DerefMut, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes)] -pub struct U8x64([u8; 64]); +#[derive(Debug, Clone, Deref, DerefMut, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes, Serialize)] +pub struct U8x64(#[serde(with = "serde_bytes")] [u8; 64]); impl From<&[u8]> for U8x64 { fn from(slice: &[u8]) -> Self { let mut arr = [0; 64]; @@ -184,8 +185,8 @@ impl From<&[u8]> for U8x64 { } } -#[derive(Debug, Clone, Deref, DerefMut, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes)] -pub struct U8x65([u8; 65]); +#[derive(Debug, Clone, Deref, DerefMut, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes, Serialize)] +pub struct U8x65(#[serde(with = "serde_bytes")] [u8; 65]); impl From<&[u8]> for U8x65 { fn from(slice: &[u8]) -> Self { let mut arr = [0; 65]; diff --git a/indexer/src/structs/addressindex.rs b/indexer/src/structs/addressindex.rs index 72fcf06a0..02310ede8 100644 --- a/indexer/src/structs/addressindex.rs +++ b/indexer/src/structs/addressindex.rs @@ -2,6 +2,7 @@ use std::ops::Add; use derive_deref::{Deref, DerefMut}; use fjall::Slice; +use serde::Serialize; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; #[derive( @@ -19,6 +20,7 @@ use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; Immutable, IntoBytes, KnownLayout, + Serialize, )] pub struct Addressindex(u32); diff --git a/indexer/src/structs/addresstype.rs b/indexer/src/structs/addresstype.rs index a4bac0a41..a1da2b4df 100644 --- a/indexer/src/structs/addresstype.rs +++ b/indexer/src/structs/addresstype.rs @@ -1,7 +1,10 @@ use iterator::bitcoin::ScriptBuf; +use serde::Serialize; use zerocopy::{Immutable, IntoBytes, KnownLayout, TryFromBytes}; -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, TryFromBytes, Immutable, IntoBytes, KnownLayout)] +#[derive( + Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, TryFromBytes, Immutable, IntoBytes, KnownLayout, Serialize, +)] #[repr(u8)] pub enum Addresstype { P2PK65, diff --git a/indexer/src/structs/addresstypeindex.rs b/indexer/src/structs/addresstypeindex.rs index 042a8d352..97f99c533 100644 --- a/indexer/src/structs/addresstypeindex.rs +++ b/indexer/src/structs/addresstypeindex.rs @@ -1,6 +1,7 @@ use std::ops::Add; use derive_deref::{Deref, DerefMut}; +use serde::Serialize; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; #[derive( @@ -18,6 +19,7 @@ use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; Immutable, IntoBytes, KnownLayout, + Serialize, )] pub struct Addresstypeindex(u32); @@ -34,7 +36,7 @@ impl Addresstypeindex { Self(*self + 1) } - pub fn clone_then_increment(&mut self) -> Self { + pub fn copy_then_increment(&mut self) -> Self { let i = *self; self.increment(); i @@ -82,3 +84,483 @@ impl Add for Addresstypeindex { Self(self.0 + rhs.0) } } + +#[derive( + Debug, + PartialEq, + Eq, + PartialOrd, + Ord, + Clone, + Copy, + Deref, + DerefMut, + Default, + FromBytes, + Immutable, + IntoBytes, + KnownLayout, + Serialize, +)] +pub struct Emptyindex(Addresstypeindex); +impl From for Emptyindex { + fn from(value: Addresstypeindex) -> Self { + Self(value) + } +} +impl From for usize { + fn from(value: Emptyindex) -> Self { + Self::from(*value) + } +} +impl From for Emptyindex { + fn from(value: usize) -> Self { + Self(Addresstypeindex::from(value)) + } +} +impl Add for Emptyindex { + type Output = Self; + fn add(self, rhs: usize) -> Self::Output { + Self(*self + rhs) + } +} + +#[derive( + Debug, + PartialEq, + Eq, + PartialOrd, + Ord, + Clone, + Copy, + Deref, + DerefMut, + Default, + FromBytes, + Immutable, + IntoBytes, + KnownLayout, + Serialize, +)] +pub struct Multisigindex(Addresstypeindex); +impl From for Multisigindex { + fn from(value: Addresstypeindex) -> Self { + Self(value) + } +} +impl From for usize { + fn from(value: Multisigindex) -> Self { + Self::from(*value) + } +} +impl From for Multisigindex { + fn from(value: usize) -> Self { + Self(Addresstypeindex::from(value)) + } +} +impl Add for Multisigindex { + type Output = Self; + fn add(self, rhs: usize) -> Self::Output { + Self(*self + rhs) + } +} + +#[derive( + Debug, + PartialEq, + Eq, + PartialOrd, + Ord, + Clone, + Copy, + Deref, + DerefMut, + Default, + FromBytes, + Immutable, + IntoBytes, + KnownLayout, + Serialize, +)] +pub struct Opreturnindex(Addresstypeindex); +impl From for Opreturnindex { + fn from(value: Addresstypeindex) -> Self { + Self(value) + } +} +impl From for usize { + fn from(value: Opreturnindex) -> Self { + Self::from(*value) + } +} +impl From for Opreturnindex { + fn from(value: usize) -> Self { + Self(Addresstypeindex::from(value)) + } +} +impl Add for Opreturnindex { + type Output = Self; + fn add(self, rhs: usize) -> Self::Output { + Self(*self + rhs) + } +} + +#[derive( + Debug, + PartialEq, + Eq, + PartialOrd, + Ord, + Clone, + Copy, + Deref, + DerefMut, + Default, + FromBytes, + Immutable, + IntoBytes, + KnownLayout, + Serialize, +)] +pub struct Pushonlyindex(Addresstypeindex); +impl From for Pushonlyindex { + fn from(value: Addresstypeindex) -> Self { + Self(value) + } +} +impl From for usize { + fn from(value: Pushonlyindex) -> Self { + Self::from(*value) + } +} +impl From for Pushonlyindex { + fn from(value: usize) -> Self { + Self(Addresstypeindex::from(value)) + } +} +impl Add for Pushonlyindex { + type Output = Self; + fn add(self, rhs: usize) -> Self::Output { + Self(*self + rhs) + } +} + +#[derive( + Debug, + PartialEq, + Eq, + PartialOrd, + Ord, + Clone, + Copy, + Deref, + DerefMut, + Default, + FromBytes, + Immutable, + IntoBytes, + KnownLayout, + Serialize, +)] +pub struct Unknownindex(Addresstypeindex); +impl From for Unknownindex { + fn from(value: Addresstypeindex) -> Self { + Self(value) + } +} +impl From for usize { + fn from(value: Unknownindex) -> Self { + Self::from(*value) + } +} +impl From for Unknownindex { + fn from(value: usize) -> Self { + Self(Addresstypeindex::from(value)) + } +} +impl Add for Unknownindex { + type Output = Self; + fn add(self, rhs: usize) -> Self::Output { + Self(*self + rhs) + } +} + +#[derive( + Debug, + PartialEq, + Eq, + PartialOrd, + Ord, + Clone, + Copy, + Deref, + DerefMut, + Default, + FromBytes, + Immutable, + IntoBytes, + KnownLayout, + Serialize, +)] +pub struct P2PK33index(Addresstypeindex); +impl From for P2PK33index { + fn from(value: Addresstypeindex) -> Self { + Self(value) + } +} +impl From for usize { + fn from(value: P2PK33index) -> Self { + Self::from(*value) + } +} +impl From for P2PK33index { + fn from(value: usize) -> Self { + Self(Addresstypeindex::from(value)) + } +} +impl Add for P2PK33index { + type Output = Self; + fn add(self, rhs: usize) -> Self::Output { + Self(*self + rhs) + } +} + +#[derive( + Debug, + PartialEq, + Eq, + PartialOrd, + Ord, + Clone, + Copy, + Deref, + DerefMut, + Default, + FromBytes, + Immutable, + IntoBytes, + KnownLayout, + Serialize, +)] +pub struct P2PK65index(Addresstypeindex); +impl From for P2PK65index { + fn from(value: Addresstypeindex) -> Self { + Self(value) + } +} +impl From for usize { + fn from(value: P2PK65index) -> Self { + Self::from(*value) + } +} +impl From for P2PK65index { + fn from(value: usize) -> Self { + Self(Addresstypeindex::from(value)) + } +} +impl Add for P2PK65index { + type Output = Self; + fn add(self, rhs: usize) -> Self::Output { + Self(*self + rhs) + } +} + +#[derive( + Debug, + PartialEq, + Eq, + PartialOrd, + Ord, + Clone, + Copy, + Deref, + DerefMut, + Default, + FromBytes, + Immutable, + IntoBytes, + KnownLayout, + Serialize, +)] +pub struct P2PKHindex(Addresstypeindex); +impl From for P2PKHindex { + fn from(value: Addresstypeindex) -> Self { + Self(value) + } +} +impl From for usize { + fn from(value: P2PKHindex) -> Self { + Self::from(*value) + } +} +impl From for P2PKHindex { + fn from(value: usize) -> Self { + Self(Addresstypeindex::from(value)) + } +} +impl Add for P2PKHindex { + type Output = Self; + fn add(self, rhs: usize) -> Self::Output { + Self(*self + rhs) + } +} + +#[derive( + Debug, + PartialEq, + Eq, + PartialOrd, + Ord, + Clone, + Copy, + Deref, + DerefMut, + Default, + FromBytes, + Immutable, + IntoBytes, + KnownLayout, + Serialize, +)] +pub struct P2SHindex(Addresstypeindex); +impl From for P2SHindex { + fn from(value: Addresstypeindex) -> Self { + Self(value) + } +} +impl From for usize { + fn from(value: P2SHindex) -> Self { + Self::from(*value) + } +} +impl From for P2SHindex { + fn from(value: usize) -> Self { + Self(Addresstypeindex::from(value)) + } +} +impl Add for P2SHindex { + type Output = Self; + fn add(self, rhs: usize) -> Self::Output { + Self(*self + rhs) + } +} + +#[derive( + Debug, + PartialEq, + Eq, + PartialOrd, + Ord, + Clone, + Copy, + Deref, + DerefMut, + Default, + FromBytes, + Immutable, + IntoBytes, + KnownLayout, + Serialize, +)] +pub struct P2TRindex(Addresstypeindex); +impl From for P2TRindex { + fn from(value: Addresstypeindex) -> Self { + Self(value) + } +} +impl From for usize { + fn from(value: P2TRindex) -> Self { + Self::from(*value) + } +} +impl From for P2TRindex { + fn from(value: usize) -> Self { + Self(Addresstypeindex::from(value)) + } +} +impl Add for P2TRindex { + type Output = Self; + fn add(self, rhs: usize) -> Self::Output { + Self(*self + rhs) + } +} + +#[derive( + Debug, + PartialEq, + Eq, + PartialOrd, + Ord, + Clone, + Copy, + Deref, + DerefMut, + Default, + FromBytes, + Immutable, + IntoBytes, + KnownLayout, + Serialize, +)] +pub struct P2WPKHindex(Addresstypeindex); +impl From for P2WPKHindex { + fn from(value: Addresstypeindex) -> Self { + Self(value) + } +} +impl From for usize { + fn from(value: P2WPKHindex) -> Self { + Self::from(*value) + } +} +impl From for P2WPKHindex { + fn from(value: usize) -> Self { + Self(Addresstypeindex::from(value)) + } +} +impl Add for P2WPKHindex { + type Output = Self; + fn add(self, rhs: usize) -> Self::Output { + Self(*self + rhs) + } +} + +#[derive( + Debug, + PartialEq, + Eq, + PartialOrd, + Ord, + Clone, + Copy, + Deref, + DerefMut, + Default, + FromBytes, + Immutable, + IntoBytes, + KnownLayout, + Serialize, +)] +pub struct P2WSHindex(Addresstypeindex); +impl From for P2WSHindex { + fn from(value: Addresstypeindex) -> Self { + Self(value) + } +} +impl From for usize { + fn from(value: P2WSHindex) -> Self { + Self::from(*value) + } +} +impl From for P2WSHindex { + fn from(value: usize) -> Self { + Self(Addresstypeindex::from(value)) + } +} +impl Add for P2WSHindex { + type Output = Self; + fn add(self, rhs: usize) -> Self::Output { + Self(*self + rhs) + } +} diff --git a/indexer/src/structs/amount.rs b/indexer/src/structs/amount.rs index 519a3eaa2..6e0a6acd9 100644 --- a/indexer/src/structs/amount.rs +++ b/indexer/src/structs/amount.rs @@ -5,6 +5,7 @@ use std::{ use derive_deref::{Deref, DerefMut}; use iterator::bitcoin; +use serde::Serialize; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; use super::Height; @@ -24,6 +25,7 @@ use super::Height; Immutable, IntoBytes, KnownLayout, + Serialize, )] pub struct Amount(u64); diff --git a/indexer/src/structs/blockhash.rs b/indexer/src/structs/blockhash.rs index df24104b8..ac3eff4ae 100644 --- a/indexer/src/structs/blockhash.rs +++ b/indexer/src/structs/blockhash.rs @@ -1,9 +1,10 @@ use std::mem; use derive_deref::Deref; +use serde::Serialize; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; -#[derive(Debug, Deref, Clone, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes)] +#[derive(Debug, Deref, Clone, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes, Serialize)] pub struct BlockHash([u8; 32]); impl From for BlockHash { diff --git a/indexer/src/structs/height.rs b/indexer/src/structs/height.rs index 618466926..e09fe4d11 100644 --- a/indexer/src/structs/height.rs +++ b/indexer/src/structs/height.rs @@ -7,6 +7,7 @@ use std::{ use derive_deref::{Deref, DerefMut}; use fjall::Slice; use iterator::rpc::{self, RpcApi}; +use serde::Serialize; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; #[derive( @@ -24,6 +25,7 @@ use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; Immutable, IntoBytes, KnownLayout, + Serialize, )] pub struct Height(u32); diff --git a/indexer/src/structs/locktime.rs b/indexer/src/structs/locktime.rs index 3d1963945..58a2ea9f2 100644 --- a/indexer/src/structs/locktime.rs +++ b/indexer/src/structs/locktime.rs @@ -1,8 +1,9 @@ +use serde::Serialize; use zerocopy::{Immutable, IntoBytes, KnownLayout, TryFromBytes}; use super::{Height, Timestamp}; -#[derive(Debug, Immutable, Clone, Copy, IntoBytes, KnownLayout, TryFromBytes)] +#[derive(Debug, Immutable, Clone, Copy, IntoBytes, KnownLayout, TryFromBytes, Serialize)] #[repr(C)] pub enum LockTime { Height(Height), diff --git a/indexer/src/structs/timestamp.rs b/indexer/src/structs/timestamp.rs index b7c73106d..ee48a5027 100644 --- a/indexer/src/structs/timestamp.rs +++ b/indexer/src/structs/timestamp.rs @@ -1,7 +1,10 @@ use derive_deref::Deref; +use serde::Serialize; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; -#[derive(Debug, Deref, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, FromBytes, Immutable, IntoBytes, KnownLayout)] +#[derive( + Debug, Deref, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, FromBytes, Immutable, IntoBytes, KnownLayout, Serialize, +)] pub struct Timestamp(u32); impl From for Timestamp { diff --git a/indexer/src/structs/txid.rs b/indexer/src/structs/txid.rs index fee437fa0..c180ab457 100644 --- a/indexer/src/structs/txid.rs +++ b/indexer/src/structs/txid.rs @@ -1,9 +1,10 @@ use std::mem; use derive_deref::Deref; +use serde::Serialize; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; -#[derive(Debug, Deref, Clone, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes)] +#[derive(Debug, Deref, Clone, PartialEq, Eq, Immutable, IntoBytes, KnownLayout, FromBytes, Serialize)] pub struct Txid([u8; 32]); impl From for Txid { diff --git a/indexer/src/structs/txindex.rs b/indexer/src/structs/txindex.rs index 479380958..82b466963 100644 --- a/indexer/src/structs/txindex.rs +++ b/indexer/src/structs/txindex.rs @@ -2,6 +2,7 @@ use std::ops::{Add, AddAssign, Sub}; use derive_deref::{Deref, DerefMut}; use fjall::Slice; +use serde::Serialize; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; #[derive( @@ -19,6 +20,7 @@ use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; Immutable, IntoBytes, KnownLayout, + Serialize, )] pub struct Txindex(u32); diff --git a/indexer/src/structs/txinindex.rs b/indexer/src/structs/txinindex.rs index 78727456e..0089ea33e 100644 --- a/indexer/src/structs/txinindex.rs +++ b/indexer/src/structs/txinindex.rs @@ -1,6 +1,7 @@ use std::ops::{Add, AddAssign, Sub}; use derive_deref::{Deref, DerefMut}; +use serde::Serialize; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; use super::Vin; @@ -20,6 +21,7 @@ use super::Vin; Immutable, IntoBytes, KnownLayout, + Serialize, )] pub struct Txinindex(u64); diff --git a/indexer/src/structs/txoutindex.rs b/indexer/src/structs/txoutindex.rs index fbc85dea2..72d4c0a37 100644 --- a/indexer/src/structs/txoutindex.rs +++ b/indexer/src/structs/txoutindex.rs @@ -1,6 +1,7 @@ use std::ops::{Add, AddAssign, Sub}; use derive_deref::{Deref, DerefMut}; +use serde::Serialize; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; use super::Vout; @@ -20,6 +21,7 @@ use super::Vout; Immutable, IntoBytes, KnownLayout, + Serialize, )] pub struct Txoutindex(u64); diff --git a/indexer/src/structs/txversion.rs b/indexer/src/structs/txversion.rs index 345e5f0e8..c7ca53183 100644 --- a/indexer/src/structs/txversion.rs +++ b/indexer/src/structs/txversion.rs @@ -1,7 +1,8 @@ use derive_deref::Deref; +use serde::Serialize; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; -#[derive(Debug, Deref, Clone, Copy, Immutable, IntoBytes, KnownLayout, FromBytes)] +#[derive(Debug, Deref, Clone, Copy, Immutable, IntoBytes, KnownLayout, FromBytes, Serialize)] pub struct TxVersion(i32); impl From for TxVersion { diff --git a/indexer/src/structs/weight.rs b/indexer/src/structs/weight.rs index c930ee867..0b086e94d 100644 --- a/indexer/src/structs/weight.rs +++ b/indexer/src/structs/weight.rs @@ -1,7 +1,8 @@ use derive_deref::Deref; +use serde::Serialize; use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout}; -#[derive(Debug, Deref, Clone, Copy, Immutable, IntoBytes, KnownLayout, FromBytes)] +#[derive(Debug, Deref, Clone, Copy, Immutable, IntoBytes, KnownLayout, FromBytes, Serialize)] pub struct Weight(u64); impl From for Weight { diff --git a/iterator/src/lib.rs b/iterator/src/lib.rs index ebd20c97d..3cf4f4e11 100644 --- a/iterator/src/lib.rs +++ b/iterator/src/lib.rs @@ -32,7 +32,7 @@ use blk_metadata::*; use blk_metadata_and_block::*; use utils::*; -pub const NUMBER_OF_UNSAFE_BLOCKS: usize = 100; +pub const NUMBER_OF_UNSAFE_BLOCKS: usize = 1000; const MAGIC_BYTES: [u8; 4] = [249, 190, 180, 217]; const BOUND_CAP: usize = 210; @@ -171,10 +171,7 @@ pub fn new( _ => unreachable!(), }; - if send_block - .send(BlkMetadataAndBlock::new(blk_metadata, block)) - .is_err() - { + if send_block.send(BlkMetadataAndBlock::new(blk_metadata, block)).is_err() { return ControlFlow::Break(()); } @@ -242,16 +239,13 @@ pub fn new( let mut recent_chain: VecDeque<(BlockHash, BlkMetadataAndBlock)> = VecDeque::default(); let mut recent_hashes: BTreeSet = BTreeSet::default(); - let mut prev_hash = - start_recap.map_or_else(BlockHash::all_zeros, |(_, recap)| *recap.prev_hash()); + let mut prev_hash = start_recap.map_or_else(BlockHash::all_zeros, |(_, recap)| *recap.prev_hash()); let mut prepare_and_send = |(hash, tuple): (BlockHash, BlkMetadataAndBlock)| { blk_index_to_blk_recap.update(&tuple, height); if start.map_or(true, |start| start <= height) { - send_height_block_hash - .send((height, tuple.block, hash)) - .unwrap(); + send_height_block_hash.send((height, tuple.block, hash)).unwrap(); } if end == Some(height) { @@ -294,8 +288,7 @@ pub fn new( let flow = recv_block.iter().try_for_each(|tuple| { // block isn't next after current tip if prev_hash != tuple.block.header.prev_blockhash { - let is_block_active = - |hash| rpc.get_block_header_info(hash).unwrap().confirmations > 0; + let is_block_active = |hash| rpc.get_block_header_info(hash).unwrap().confirmations > 0; // block prev has already been processed if recent_hashes.contains(&tuple.block.header.prev_blockhash) { @@ -322,9 +315,7 @@ pub fn new( ); } // Check if there was already a future block with the same prev hash - } else if let Some(prev_tuple) = - future_blocks.insert(tuple.block.header.prev_blockhash, tuple) - { + } else if let Some(prev_tuple) = future_blocks.insert(tuple.block.header.prev_blockhash, tuple) { // If the previous was the active one if is_block_active(&prev_tuple.block.block_hash()) { // Rollback the insert diff --git a/logger/Cargo.toml b/logger/Cargo.toml new file mode 100644 index 000000000..b0c1e7465 --- /dev/null +++ b/logger/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "logger" +version = "0.1.0" +edition = "2021" + +[dependencies] +color-eyre = { workspace = true } +env_logger = "0.11.6" +jiff = { workspace = true } +log = { version = "0.4.25" } diff --git a/logger/src/lib.rs b/logger/src/lib.rs new file mode 100644 index 000000000..b56cdb27e --- /dev/null +++ b/logger/src/lib.rs @@ -0,0 +1,62 @@ +use std::{ + fmt::Display, + fs::{self, OpenOptions}, + io::Write, + path::Path, +}; + +use color_eyre::owo_colors::OwoColorize; +use env_logger::{Builder, Env}; +use jiff::{tz, Timestamp}; +pub use log::{debug, error, info, trace, warn}; + +#[inline(always)] +pub fn init_log(path: Option<&Path>) { + let file = path.map(|path| { + let _ = fs::remove_file(path); + OpenOptions::new().create(true).append(true).open(path).unwrap() + }); + + Builder::from_env(Env::default().default_filter_or("info,fjall=off,lsm_tree=off")) + .format(move |buf, record| { + let date_time = Timestamp::now() + .to_zoned(tz::TimeZone::system()) + .strftime("%Y-%m-%d %H:%M:%S") + .to_string(); + let level = record.level().as_str().to_lowercase(); + let level = format!("{:5}", level); + let target = record.target(); + let dash = "-"; + let args = record.args(); + + if let Some(file) = file.as_ref() { + let _ = write(file.try_clone().unwrap(), &date_time, target, &level, dash, args); + } + + let colored_date_time = date_time.bright_black(); + let colored_level = match level.chars().next().unwrap() { + 'e' => level.red().to_string(), + 'w' => level.yellow().to_string(), + 'i' => level.green().to_string(), + 'd' => level.blue().to_string(), + 't' => level.cyan().to_string(), + _ => panic!(), + }; + let colored_dash = dash.bright_black(); + + write(buf, colored_date_time, target, colored_level, colored_dash, args) + }) + .init(); +} + +fn write( + mut buf: impl Write, + date_time: impl Display, + _target: impl Display, + level: impl Display, + dash: impl Display, + args: impl Display, +) -> Result<(), std::io::Error> { + writeln!(buf, "{} {} {} {}", date_time, dash, level, args) + // writeln!(buf, "{} {} {} {} {}", date_time, _target, level, dash, args) +} diff --git a/logger/src/main.rs b/logger/src/main.rs new file mode 100644 index 000000000..f67ba6d6b --- /dev/null +++ b/logger/src/main.rs @@ -0,0 +1,7 @@ +use log::info; +use logger::init_log; + +fn main() { + init_log(None); + info!("test"); +} diff --git a/server/src/api/mod.rs b/server/src/api/mod.rs index 8cbd71a6f..725129fa3 100644 --- a/server/src/api/mod.rs +++ b/server/src/api/mod.rs @@ -71,6 +71,7 @@ fn req_to_response_res( AppState { vecs, .. }: AppState, ) -> color_eyre::Result { let format = Format::try_from(format).ok(); + let indexes = i .to_lowercase() .split(",") @@ -78,13 +79,11 @@ fn req_to_response_res( .collect::>(); if indexes.len() > 1 { - return Err(eyre!("Multiple indexes aren't supported yet !")); + return Err(eyre!("Multiple indexes aren't supported")); } else if indexes.is_empty() { - return Err(eyre!("Bad index(es)")); + return Err(eyre!("Unknown index")); } - dbg!(format, &indexes, &v, from, to); - let values = v .to_lowercase() .split(",") diff --git a/src/structs/epoch.rs b/src/structs/epoch.rs index ed7108a4c..0bc3aa303 100644 --- a/src/structs/epoch.rs +++ b/src/structs/epoch.rs @@ -9,7 +9,7 @@ impl Epoch { impl From for Epoch { fn from(height: Height) -> Self { - Self(((height.to_usize() / Self::BLOCKS_PER_EPOCH) + 1) as u16) + Self::from(&height) } } diff --git a/storable_vec/src/enums/error.rs b/storable_vec/src/enums/error.rs index 37908bbae..8db892c0d 100644 --- a/storable_vec/src/enums/error.rs +++ b/storable_vec/src/enums/error.rs @@ -21,6 +21,7 @@ pub enum Error { ExpectVecToHaveIndex, FailedKeyTryIntoUsize, UnsupportedUnflushedState, + RangeFromAfterTo, } impl From for Error { @@ -60,6 +61,7 @@ impl fmt::Display for Error { write!(f, "Unsupported unflush state, please flush before using this function") } Error::ZeroCopyError => write!(f, "Zero copy convert error"), + Error::RangeFromAfterTo => write!(f, "Range, from is after to"), } } } diff --git a/storable_vec/src/lib.rs b/storable_vec/src/lib.rs index 21d4ad3cd..98105b8f1 100644 --- a/storable_vec/src/lib.rs +++ b/storable_vec/src/lib.rs @@ -37,7 +37,7 @@ pub const SINGLE_THREAD: u8 = 1; /// Will spin up a new `File` for every read /// /// Used in `/server` -pub const ASYNC_READ_ONLY: u8 = 2; +pub const STATELESS: u8 = 2; /// /// A very small, fast, efficient and simple storable Vec @@ -73,7 +73,7 @@ pub struct StorableVec { /// In bytes const MAX_PAGE_SIZE: usize = 4 * 4096; const ONE_MB: usize = 1000 * 1024; -const MAX_CACHE_SIZE: usize = 100 * ONE_MB; +const MAX_CACHE_SIZE: usize = usize::MAX; // const MAX_CACHE_SIZE: usize = 100 * ONE_MB; impl StorableVec @@ -157,6 +157,13 @@ where .open(path) } + fn open_file_at_then_read(&self, index: usize) -> Result { + let mut file = self.open_file()?; + Self::seek(&mut file, Self::index_to_byte_index(index))?; + let mut buf = Self::create_buffer(); + Self::read_exact(&mut file, &mut buf).map(|v| v.to_owned()) + } + fn read_disk_len(&self) -> io::Result { Self::read_disk_len_(&self.file) } @@ -165,7 +172,6 @@ where } fn reset_disk_related_state(&mut self) -> io::Result<()> { - self.file = self.open_file()?; self.file_len = self.read_disk_len()?; self.file_position = 0; self.reset_cache() @@ -193,13 +199,6 @@ where } } - fn open_file_at_then_read(&self, index: usize) -> Result { - let mut file = self.open_file()?; - let mut buf = Self::create_buffer(); - Self::seek(&mut file, Self::index_to_byte_index(index))?; - Self::read_exact(&mut file, &mut buf).map(|v| v.to_owned()) - } - #[inline] fn seek(file: &mut File, byte_index: u64) -> io::Result { file.seek(SeekFrom::Start(byte_index)) @@ -218,7 +217,7 @@ where #[inline] fn push_if_needed_(&mut self, index: I, value: T) -> Result<()> { - match self.pushed_len().cmp(&Self::i_to_usize(index)?) { + match self.len().cmp(&Self::i_to_usize(index)?) { Ordering::Greater => { // dbg!(len, index, &self.pathbuf); // panic!(); @@ -265,22 +264,19 @@ where } pub fn flush(&mut self) -> io::Result<()> { - self.reset_disk_related_state()?; - if self.pushed.is_empty() { return Ok(()); } - self.file_len += self.pushed.len(); - - let mut bytes: Vec = vec![]; - + let mut bytes: Vec = Vec::with_capacity(self.pushed_len() * Self::SIZE_OF_T); mem::take(&mut self.pushed) .into_iter() .for_each(|v| bytes.extend_from_slice(v.as_bytes())); self.file.write_all(&bytes)?; + self.reset_disk_related_state()?; + Ok(()) } @@ -318,6 +314,10 @@ where } } + pub fn file_name(&self) -> String { + self.path().file_name().unwrap().to_str().unwrap().to_owned() + } + #[inline] pub fn path(&self) -> &Path { &self.pathbuf @@ -368,7 +368,7 @@ where let page_index = index / Self::PER_PAGE; let last_index = self.file_len - 1; let max_page_index = last_index / Self::PER_PAGE; - let min_page_index = (max_page_index + 1).checked_sub(self.cache.len()).unwrap_or_default(); + let min_page_index = (max_page_index + 1) - self.cache.len(); // let min_open_page = self.min.load(AtomicOrdering::SeqCst); @@ -429,7 +429,6 @@ where fn get_(&mut self, index: usize) -> Result<&T> { let byte_index = Self::index_to_byte_index(index); if self.file_position != byte_index { - println!("seek"); self.file_position = Self::seek(&mut self.file, byte_index)?; } let res = Self::read_exact(&mut self.file, &mut self.buf); @@ -595,7 +594,6 @@ where &mut self, first_indexes: &mut StorableVec, last_indexes: &mut StorableVec, - callback: F, ) -> Result<()> where T: From, @@ -612,20 +610,67 @@ where } } -impl StorableVec +impl StorableVec where I: StorableVecIndex, T: StorableVecType, { #[inline] pub fn get(&self, index: I) -> Result> { - self.get_(Self::i_to_usize(index)?) + Ok(Some(self.open_file_at_then_read(Self::i_to_usize(index)?)?)) } - #[inline] - fn get_(&self, index: usize) -> Result> { - Ok(Some(self.open_file_at_then_read(index)?.to_owned())) + + pub fn collect_range(&self, from: Option, to: Option) -> Result> { + if !self.pushed.is_empty() { + return Err(Error::UnsupportedUnflushedState); + } + + let mut file = self.open_file()?; + + let len = Self::read_disk_len_(&file)?; + + let from = from.map_or(0, |from| { + if from >= 0 { + from as usize + } else { + (len as i64 + from) as usize + } + }); + + let to = to.map_or(len, |to| { + if to >= 0 { + to as usize + } else { + (len as i64 + to) as usize + } + }); + + if from >= to { + return Err(Error::RangeFromAfterTo); + } + + Self::seek(&mut file, Self::index_to_byte_index(from))?; + + let mut buf = Self::create_buffer(); + + Ok((from..to) + .map(|_| Self::read_exact(&mut file, &mut buf).map(|v| v.to_owned()).unwrap()) + .collect::>()) } // Add iter iter_from iter_range collect.. // + add memory cap } + +impl Clone for StorableVec +where + I: StorableVecIndex, + T: StorableVecType, +{ + fn clone(&self) -> Self { + let path = &self.pathbuf; + let path_version = Self::path_version_(path); + let version = Version::try_from(path_version.as_path()).unwrap(); + Self::import(path, version).unwrap() + } +}