From 4cc57e9c915add174c07736b3886fcce13e65bbd Mon Sep 17 00:00:00 2001 From: nym21 Date: Tue, 14 Jan 2025 23:35:42 +0100 Subject: [PATCH] bindex: back to sanakirja --- Cargo.lock | 703 ++++++++++++------ Cargo.toml | 22 +- src/crates/bindex/Cargo.lock | 417 +++++++---- src/crates/bindex/Cargo.toml | 3 +- src/crates/bindex/src/main.rs | 172 ++--- src/crates/bindex/src/structs/addressindex.rs | 23 +- .../src/structs/addressindextxoutindex.rs | 25 +- .../bindex/src/structs/addresstypeindex.rs | 37 +- src/crates/bindex/src/structs/amount.rs | 33 +- .../bindex/src/structs/canopy/database.rs | 23 + .../bindex/src/structs/canopy/environment.rs | 20 + src/crates/bindex/src/structs/canopy/mod.rs | 9 + .../bindex/src/structs/canopy/transaction.rs | 19 + src/crates/bindex/src/structs/canopy/tree.rs | 84 +++ src/crates/bindex/src/structs/databases.rs | 186 +++++ src/crates/bindex/src/structs/height.rs | 31 +- src/crates/bindex/src/structs/mod.rs | 10 +- src/crates/bindex/src/structs/prefix.rs | 58 +- src/crates/bindex/src/structs/slice.rs | 7 + src/crates/bindex/src/structs/txindex.rs | 23 +- src/crates/bindex/src/structs/txindexvout.rs | 29 +- src/crates/bindex/src/structs/txoutindex.rs | 23 +- src/crates/bindex/src/structs/version.rs | 1 - src/crates/biter/Cargo.lock | 12 +- src/crates/biter/Cargo.toml | 2 +- 25 files changed, 1245 insertions(+), 727 deletions(-) create mode 100644 src/crates/bindex/src/structs/canopy/database.rs create mode 100644 src/crates/bindex/src/structs/canopy/environment.rs create mode 100644 src/crates/bindex/src/structs/canopy/mod.rs create mode 100644 src/crates/bindex/src/structs/canopy/transaction.rs create mode 100644 src/crates/bindex/src/structs/canopy/tree.rs create mode 100644 src/crates/bindex/src/structs/databases.rs diff --git a/Cargo.lock b/Cargo.lock index 66ae12c36..aebbad5f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -73,9 +73,9 @@ dependencies = [ [[package]] name = "allocative" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "082af274fd02beef17b7f0725a49ecafe6c075ef56cac9d6363eb3916a9817ae" +checksum = "8fac2ce611db8b8cee9b2aa886ca03c924e9da5e5295d0dbd0526e5d0b0710f7" dependencies = [ "allocative_derive", "ctor", @@ -89,7 +89,7 @@ checksum = "fe233a377643e0fc1a56421d7c90acdec45c291b30345eb9f08e8d0ddce5a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.15" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", @@ -130,36 +130,36 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.4" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -183,7 +183,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -210,7 +210,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -227,7 +227,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -262,7 +262,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper 1.0.1", + "sync_wrapper", "tokio", "tower", "tower-layer", @@ -285,7 +285,7 @@ dependencies = [ "mime", "pin-project-lite", "rustversion", - "sync_wrapper 1.0.1", + "sync_wrapper", "tower-layer", "tower-service", "tracing", @@ -500,9 +500,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be" [[package]] name = "bitvec" @@ -575,9 +575,9 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.18.0" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" +checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" [[package]] name = "byteorder" @@ -587,15 +587,15 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.2" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" [[package]] name = "cc" -version = "1.1.28" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" +checksum = "a012a0df96dd6d06ba9a1b29d6402d1a5d77c6befd2566afdc26e10603dc93d7" dependencies = [ "jobserver", "libc", @@ -631,9 +631,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.23" +version = "4.5.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" +checksum = "a8eb5e908ef3a6efbe1ed62520fb7287959888c88485abe072543190ecc66783" dependencies = [ "clap_builder", "clap_derive", @@ -641,9 +641,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.23" +version = "4.5.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" +checksum = "96b01801b5fc6a0a232407abc821660c9c6d25a1cafc0d4f85f29fb8d9afc121" dependencies = [ "anstream", "anstyle", @@ -653,14 +653,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.18" +version = "4.5.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -698,9 +698,9 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "core-foundation" @@ -751,18 +751,18 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.13" +version = "0.5.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +checksum = "06ba6d68e24814cb8de6bb986db8222d3a027d15872cabc0d18817bc3c0e4471" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" dependencies = [ "crossbeam-epoch", "crossbeam-utils", @@ -788,9 +788,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crypto-common" @@ -884,7 +884,7 @@ checksum = "805ef2023ccd65425743a91ecd11fc020979a0b01921db3104fb606d18a7b43e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -897,6 +897,17 @@ dependencies = [ "crypto-common", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", +] + [[package]] name = "either" version = "1.13.0" @@ -905,18 +916,18 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "encoding_rs" -version = "0.8.34" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] [[package]] name = "env_filter" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" +checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" dependencies = [ "log", "regex", @@ -924,9 +935,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" +checksum = "dcaee3d8e3cfc3fd92428d477bc97fc29ec8716d180c0d74c643bb26166660e0" dependencies = [ "anstream", "anstyle", @@ -943,12 +954,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -963,9 +974,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "fixedbitset" @@ -1021,7 +1032,7 @@ checksum = "8d7ccf961415e7aa17ef93dcb6c2441faaa8e768abe09e659b908089546f74c5" dependencies = [ "proc-macro2", "swc_macros_common", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -1157,9 +1168,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "heck" @@ -1199,9 +1210,9 @@ checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" [[package]] name = "hstr" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dae404c0c5d4e95d4858876ab02eecd6a196bb8caa42050dfa809938833fc412" +checksum = "63d6824358c0fd9a68bb23999ed2ef76c84f79408a26ef7ae53d5f370c94ad36" dependencies = [ "hashbrown 0.14.5", "new_debug_unreachable", @@ -1213,9 +1224,9 @@ dependencies = [ [[package]] name = "http" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" dependencies = [ "bytes", "fnv", @@ -1265,9 +1276,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "1.4.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" dependencies = [ "bytes", "futures-channel", @@ -1319,9 +1330,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes", "futures-channel", @@ -1360,13 +1371,142 @@ dependencies = [ ] [[package]] -name = "idna" -version = "0.5.0" +name = "icu_collections" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", +] + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", ] [[package]] @@ -1383,20 +1523,20 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", - "hashbrown 0.15.0", + "hashbrown 0.15.2", "serde", ] [[package]] name = "inferno" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75a5d75fee4d36809e6b021e4b96b686e763d365ffdb03af2bd00786353f84fe" +checksum = "692eda1cc790750b9f5a5e3921ef9c117fd5498b97cfacbc910693e5b29002dc" dependencies = [ "ahash", "clap", @@ -1438,7 +1578,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -1458,9 +1598,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "jobserver" @@ -1473,10 +1613,11 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -1544,15 +1685,21 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.159" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] name = "lock_api" @@ -1566,9 +1713,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.22" +version = "0.4.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" dependencies = [ "serde", ] @@ -1625,7 +1772,7 @@ checksum = "23c9b935fbe1d6cbd1dac857b54a688145e2d93f48db36010514d0f612d0ad67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -1671,11 +1818,10 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ - "hermit-abi", "libc", "wasi", "windows-sys 0.52.0", @@ -1710,7 +1856,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "cfg-if", "cfg_aliases", "libc", @@ -1805,7 +1951,7 @@ version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "cfg-if", "foreign-types", "libc", @@ -1822,7 +1968,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -1833,9 +1979,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.103" +version = "0.9.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", @@ -1845,9 +1991,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "4.5.0" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c65ee1f9701bf938026630b455d5315f490640234259037edb259798b3bcf85e" +checksum = "7bb71e1b3fa6ca1c61f383464aaf2bb0e2f8e772a1f01d486832464de363b951" dependencies = [ "num-traits", ] @@ -1913,7 +2059,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.7", + "redox_syscall 0.5.8", "smallvec", "windows-targets", ] @@ -1982,7 +2128,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -1996,9 +2142,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -2033,7 +2179,7 @@ dependencies = [ "dashmap 5.5.3", "from_variant", "once_cell", - "semver 1.0.23", + "semver 1.0.24", "serde", "st-map", "tracing", @@ -2041,9 +2187,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] @@ -2074,7 +2220,7 @@ checksum = "ca414edb151b4c8d125c12566ab0d74dc9cdba36fb80eb7b848c15f495fd32d1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -2088,9 +2234,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -2168,11 +2314,11 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", ] [[package]] @@ -2206,9 +2352,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.9" +version = "0.12.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" +checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da" dependencies = [ "base64 0.22.1", "bytes", @@ -2236,10 +2382,11 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 1.0.1", + "sync_wrapper", "system-configuration", "tokio", "tokio-native-tls", + "tower", "tower-service", "url", "wasm-bindgen", @@ -2304,22 +2451,22 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.37" +version = "0.38.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "rustls" -version = "0.23.14" +version = "0.23.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" +checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993" dependencies = [ "once_cell", "rustls-pki-types", @@ -2339,9 +2486,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" [[package]] name = "rustls-webpki" @@ -2441,7 +2588,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "core-foundation", "core-foundation-sys", "libc", @@ -2469,9 +2616,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" dependencies = [ "serde", ] @@ -2499,14 +2646,14 @@ checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] name = "serde_json" -version = "1.0.134" +version = "1.0.135" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d00f4175c42ee48b15416f6193a959ba3a0d67fc699a0db9ad12df9f83991c7d" +checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9" dependencies = [ "itoa", "memchr", @@ -2630,9 +2777,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", @@ -2700,7 +2847,7 @@ checksum = "710e9696ef338691287aeb937ee6ffe60022f579d3c8d2fd9d58973a9a10a466" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -2724,7 +2871,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -2748,7 +2895,7 @@ dependencies = [ "proc-macro2", "quote", "struct_iterable_internal", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -2763,9 +2910,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "swc" -version = "9.0.0" +version = "9.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8ded6be21206da7fb30e245d72373346d72fe095b75354a413b1d2b6bfda0b7" +checksum = "0314867b5eae2f5fa7844bd68b0d4040737aad49914dceae13e603b4afd8d4a1" dependencies = [ "anyhow", "base64 0.21.7", @@ -2826,9 +2973,9 @@ dependencies = [ [[package]] name = "swc_atoms" -version = "3.0.0" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "151a6feb82b989a087433baca7f6a6eb4fcf83f828c479eecd039c9312d60e10" +checksum = "a640bf2e4430a149c87b5eaf377477ce8615ca7cb808054dd20e79e42da5d6ba" dependencies = [ "hstr", "once_cell", @@ -2929,16 +3076,16 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] name = "swc_ecma_ast" -version = "5.0.0" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94cf86f17358b93fcfe2876a9f0f7a7ebbff94cd6eaab4c809c7a0da1f4b892e" +checksum = "82f448db2d1c52ffd2bd3788d89cafd8b5a75b97f0dc8aae00874dda2647f6b6" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "is-macro", "num-bigint", "phf", @@ -2953,9 +3100,9 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "5.0.0" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb17e77270860f2a975c546c4609e9fa7ae8dbcf85260497e31af19890645800" +checksum = "7f93692de35a77d920ce8d96a46217735e5f86bf42f76cc8f1a60628c347c4c8" dependencies = [ "memchr", "num-bigint", @@ -2980,7 +3127,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -3194,9 +3341,9 @@ dependencies = [ [[package]] name = "swc_ecma_lints" -version = "6.0.0" +version = "6.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808120ab5d77e0c9484f4e1b248d5f9dfecb103160340eab5710f068d69964b1" +checksum = "0acd3d5633bdc22eb9786e6baf819334ba90162c9c382978945fe93926d9c7eb" dependencies = [ "auto_impl", "dashmap 5.5.3", @@ -3236,9 +3383,9 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5368ebcf923fb8e94c94f5fe0caa230c7920b72e5d79ed4cc32592c03213b43d" +checksum = "114c2005290d3a16dd1ced9733a0dd11862b9caf01fe43d6b796d2c9db6b7217" dependencies = [ "arrayvec", "indexmap", @@ -3271,9 +3418,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "6.0.0" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2c361b4153905dc088a6bacfaa944b582305cf94fbfcaa9b3aa61a7dd3adbf9" +checksum = "b92d3a25349d7f612c38d940f09f9c19c7b7aa3bf4d22fbe31ea44fd5354de02" dependencies = [ "either", "new_debug_unreachable", @@ -3303,7 +3450,7 @@ dependencies = [ "once_cell", "preset_env_base", "rustc-hash", - "semver 1.0.23", + "semver 1.0.24", "serde", "serde_json", "st-map", @@ -3343,7 +3490,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f31557485025a2fd1f833d63601c53010857e45633f44bcc87510f3578bde0c5" dependencies = [ "better_scoped_tls", - "bitflags 2.6.0", + "bitflags 2.7.0", "indexmap", "once_cell", "phf", @@ -3418,7 +3565,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -3429,7 +3576,7 @@ checksum = "5480053dfa9b7ae34c6d5cdaa33bee3d7dfd33a259cabe9122806f36625912c1" dependencies = [ "Inflector", "anyhow", - "bitflags 2.6.0", + "bitflags 2.7.0", "indexmap", "is-macro", "path-clean 1.0.1", @@ -3553,9 +3700,9 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "6.0.0" +version = "6.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527fad9bdb16883782d55291fd3330925b3572f512ef89b3d92a29e2f713fe4f" +checksum = "8f82c9cd6029741a0ae31191796de31c7db42ad54053dd9ee16db8e8b840378e" dependencies = [ "indexmap", "num_cpus", @@ -3593,7 +3740,7 @@ checksum = "e96e15288bf385ab85eb83cff7f9e2d834348da58d0a31b33bdb572e66ee413e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -3629,7 +3776,7 @@ checksum = "a509f56fca05b39ba6c15f3e58636c3924c78347d63853632ed2ffcb6f5a0ac7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -3660,7 +3807,7 @@ checksum = "4c78717a841565df57f811376a3d19c9156091c55175e12d378f3a522de70cef" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -3678,9 +3825,9 @@ dependencies = [ [[package]] name = "swc_typescript" -version = "5.0.0" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe778782270111e7152a99af340bf763f12cdc60df775cd0ce51eaa74dcc0249" +checksum = "78090bda84e8fc330a4c3a1db2551007e0035a92f02f74daed19ef8293087817" dependencies = [ "petgraph", "rustc-hash", @@ -3715,9 +3862,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.85" +version = "2.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" +checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" dependencies = [ "proc-macro2", "quote", @@ -3726,26 +3873,31 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "0.1.2" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - -[[package]] -name = "sync_wrapper" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" dependencies = [ "futures-core", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", +] + [[package]] name = "system-configuration" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "core-foundation", "system-configuration-sys", ] @@ -3768,12 +3920,13 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.13.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704" dependencies = [ "cfg-if", "fastrand", + "getrandom", "once_cell", "rustix", "windows-sys 0.59.0", @@ -3791,22 +3944,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.64" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.64" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -3820,25 +3973,20 @@ dependencies = [ ] [[package]] -name = "tinyvec" -version = "1.8.0" +name = "tinystr" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ - "tinyvec_macros", + "displaydoc", + "zerovec", ] -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "tokio" -version = "1.42.0" +version = "1.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" +checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" dependencies = [ "backtrace", "bytes", @@ -3854,13 +4002,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] @@ -3886,9 +4034,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ "bytes", "futures-core", @@ -3933,14 +4081,14 @@ dependencies = [ [[package]] name = "tower" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", "pin-project-lite", - "sync_wrapper 0.1.2", + "sync_wrapper", "tokio", "tower-layer", "tower-service", @@ -3954,7 +4102,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "403fa3b783d4b626a8ad51d766ab03cb6d2dbfc46b1c5d4448395e6628dc9697" dependencies = [ "async-compression", - "bitflags 2.6.0", + "bitflags 2.7.0", "bytes", "futures-core", "http", @@ -3980,9 +4128,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "log", "pin-project-lite", @@ -3998,14 +4146,14 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", ] [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -4060,12 +4208,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "unicode-bidi" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" - [[package]] name = "unicode-id" version = "0.3.5" @@ -4080,9 +4222,9 @@ checksum = "2f322b60f6b9736017344fa0635d64be2f458fbc04eef65f6be22976dd1ffd5b" [[package]] name = "unicode-ident" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-linebreak" @@ -4090,15 +4232,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" -[[package]] -name = "unicode-normalization" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" -dependencies = [ - "tinyvec", -] - [[package]] name = "unicode-width" version = "0.1.14" @@ -4119,15 +4252,27 @@ checksum = "a1a88342087869553c259588a3ec9ca73ce9b2d538b7051ba5789ff236b6c129" [[package]] name = "url" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.2" @@ -4181,9 +4326,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if", "once_cell", @@ -4192,16 +4337,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", "wasm-bindgen-shared", ] @@ -4219,9 +4363,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4229,28 +4373,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" dependencies = [ "js-sys", "wasm-bindgen", @@ -4408,6 +4552,18 @@ dependencies = [ "memchr", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "wyz" version = "0.5.1" @@ -4417,6 +4573,30 @@ dependencies = [ "tap", ] +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.35" @@ -4435,7 +4615,28 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.96", +] + +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", + "synstructure", ] [[package]] @@ -4444,6 +4645,28 @@ version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", +] + [[package]] name = "zstd" version = "0.13.2" diff --git a/Cargo.toml b/Cargo.toml index b35e6c734..5955bcc61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -allocative = "0.3.3" +allocative = "0.3.4" axum = "0.7.9" bincode = { git = "https://github.com/bincode-org/bincode.git", features = [ "serde", @@ -14,26 +14,26 @@ bincode = { git = "https://github.com/bincode-org/bincode.git", features = [ bitcoin_hashes = { version = "0.15.0" } biter = { path = "./src/crates/biter" } chrono = { version = "0.4.39", features = ["serde"] } -clap = { version = "4.5.23", features = ["derive"] } +clap = { version = "4.5.26", features = ["derive"] } color-eyre = "0.6.3" ctrlc = { version = "3.4.5", features = ["termination"] } derive_deref = "1.1.1" -env_logger = "0.11.5" -inferno = "0.12.0" +env_logger = "0.11.6" +inferno = "0.12.1" itertools = "0.13.0" -log = { version = "0.4.22", features = ["std", "serde"] } -ordered-float = "4.5.0" +log = { version = "0.4.25", features = ["std", "serde"] } +ordered-float = "4.6.0" rayon = "1.10.0" regex = "1.11.1" -reqwest = { version = "0.12.9", features = ["blocking", "json"] } +reqwest = { version = "0.12.12", features = ["blocking", "json"] } rlimit = "0.10.2" snkrj = { path = "./src/crates/snkrj" } -serde = { version = "1.0.216", features = ["derive"] } -serde_json = "1.0.133" +serde = { version = "1.0.217", features = ["derive"] } +serde_json = "1.0.135" struct_iterable = { path = "./src/crates/iterable" } -swc = "9.0.0" +swc = "9.0.2" swc_common = "5.0.0" -tokio = { version = "1.42.0", features = ["full"] } +tokio = { version = "1.43.0", features = ["full"] } toml = "0.8.19" tower-http = { version = "0.6.2", features = ["compression-full"] } zstd = "0.13.2" diff --git a/src/crates/bindex/Cargo.lock b/src/crates/bindex/Cargo.lock index 82340f639..5ed126848 100644 --- a/src/crates/bindex/Cargo.lock +++ b/src/crates/bindex/Cargo.lock @@ -17,6 +17,25 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "getrandom", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + [[package]] name = "arrayvec" version = "0.7.6" @@ -67,17 +86,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" [[package]] -name = "bitbase" +name = "bindex" version = "0.1.0" dependencies = [ "bitcoin_hashes 0.16.0", "biter", + "canopydb", "color-eyre", "ctrlc", "derive_deref", - "fjall", "memmap2", "rayon", + "snkrj", ] [[package]] @@ -198,6 +218,12 @@ dependencies = [ "serde_json", ] +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitflags" version = "2.6.0" @@ -210,6 +236,37 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +[[package]] +name = "canopydb" +version = "0.1.0" +source = "git+https://github.com/arthurprs/canopydb#daab91758a7905abc2a7d1a9c7e9f6c41227e72b" +dependencies = [ + "bitflags 2.6.0", + "dashmap", + "derive_more", + "fail", + "foldhash", + "fslock", + "hashbrown", + "libc", + "lock_api", + "log", + "lz4_flex", + "memmap2", + "nix", + "parking_lot 0.12.3", + "quick_cache", + "rand", + "serde", + "serde_json", + "smallvec 2.0.0-alpha.9", + "sptr", + "tempfile", + "triomphe", + "xxhash-rust", + "zerocopy", +] + [[package]] name = "cc" version = "1.2.4" @@ -308,16 +365,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "crossbeam-skiplist" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df29de440c58ca2cc6e587ec3d22347551a32435fbde9d2bff64e78a9ffa151b" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - [[package]] name = "crossbeam-utils" version = "0.8.21" @@ -345,7 +392,7 @@ dependencies = [ "hashbrown", "lock_api", "once_cell", - "parking_lot_core", + "parking_lot_core 0.9.10", ] [[package]] @@ -359,6 +406,27 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive_more" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.95", + "unicode-xid", +] + [[package]] name = "derived-deref" version = "2.1.0" @@ -370,30 +438,12 @@ dependencies = [ "syn 2.0.95", ] -[[package]] -name = "double-ended-peekable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0d05e1c0dbad51b52c38bda7adceef61b9efc2baf04acfe8726a8c4630a6f57" - [[package]] name = "either" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" -[[package]] -name = "enum_dispatch" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" -dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.95", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -420,6 +470,17 @@ dependencies = [ "once_cell", ] +[[package]] +name = "fail" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5e43d0f78a42ad591453aedb1d7ae631ce7ee445c7643691055a9ed8d3b01c" +dependencies = [ + "log", + "once_cell", + "rand", +] + [[package]] name = "fastrand" version = "2.3.0" @@ -427,19 +488,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] -name = "fjall" -version = "2.5.0" +name = "foldhash" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80910a26e4fb5e5393ff64d293602ac1ade56cf4d14d244c02a7d4ddcd5f10bc" +checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" + +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" dependencies = [ - "byteorder", - "dashmap", - "log", - "lsm-tree", - "path-absolutize", - "std-semaphore", - "tempfile", - "xxhash-rust", + "libc", + "winapi", +] + +[[package]] +name = "fslock" +version = "0.2.1" +source = "git+https://github.com/arthurprs/fslock.git?rev=7ec91154136a2b3d567b1f79e87cae5d3ca3d927#7ec91154136a2b3d567b1f79e87cae5d3ca3d927" +dependencies = [ + "libc", + "winapi", ] [[package]] @@ -459,17 +529,15 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" -[[package]] -name = "guardian" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "493913a18c0d7bebb75127a26a432162c59edbe06f6cf712001e3e769345e8b5" - [[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 = "hex-conservative" @@ -501,6 +569,15 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", +] + [[package]] name = "itoa" version = "1.0.14" @@ -533,9 +610,9 @@ checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "lock_api" @@ -553,29 +630,6 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" -[[package]] -name = "lsm-tree" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d858efa63a32a286a06aa3968f3ed09811d556697e9f9804aa72ea679ed3b83" -dependencies = [ - "byteorder", - "crossbeam-skiplist", - "double-ended-peekable", - "enum_dispatch", - "guardian", - "log", - "lz4_flex", - "path-absolutize", - "quick_cache", - "rustc-hash", - "self_cell", - "tempfile", - "value-log", - "varint-rs", - "xxhash-rust", -] - [[package]] name = "lz4_flex" version = "0.11.3" @@ -597,12 +651,6 @@ dependencies = [ "libc", ] -[[package]] -name = "min-max-heap" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2687e6cf9c00f48e9284cf9fd15f2ef341d03cc7743abf9df4c5f07fdee50b18" - [[package]] name = "miniz_oxide" version = "0.7.4" @@ -629,7 +677,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ - "bitflags", + "bitflags 2.6.0", "cfg-if", "cfg_aliases", "libc", @@ -656,6 +704,41 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.10", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall 0.2.16", + "smallvec 1.13.2", + "winapi", +] + [[package]] name = "parking_lot_core" version = "0.9.10" @@ -664,29 +747,11 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall", - "smallvec", + "redox_syscall 0.5.8", + "smallvec 1.13.2", "windows-targets", ] -[[package]] -name = "path-absolutize" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4af381fe79fa195b4909485d99f73a80792331df0625188e707854f0b3383f5" -dependencies = [ - "path-dedot", -] - -[[package]] -name = "path-dedot" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ba0ad7e047712414213ff67533e6dd477af0a4e1d14fb52343e53d30ea9397" -dependencies = [ - "once_cell", -] - [[package]] name = "pin-project-lite" version = "0.2.15" @@ -717,8 +782,10 @@ version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d7c94f8935a9df96bb6380e8592c70edf497a643f94bd23b2f76b399385dbf4" dependencies = [ + "ahash", "equivalent", "hashbrown", + "parking_lot 0.12.3", ] [[package]] @@ -780,13 +847,22 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "redox_syscall" version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags", + "bitflags 2.6.0", ] [[package]] @@ -795,19 +871,13 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" -[[package]] -name = "rustc-hash" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" - [[package]] name = "rustix" -version = "0.38.42" +version = "0.38.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" +checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" dependencies = [ - "bitflags", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -820,6 +890,27 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +[[package]] +name = "sanakirja" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81aaf70d064e2122209f04d01fd91e8908e7a327b516236e1cbc0c3f34ac6d11" +dependencies = [ + "fs2", + "log", + "memmap2", + "parking_lot 0.11.2", + "sanakirja-core", + "serde", + "thiserror", +] + +[[package]] +name = "sanakirja-core" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8376db34ae3eac6e7bd91168bc638450073b708ce9fb46940de676f552238bf5" + [[package]] name = "scopeguard" version = "1.2.0" @@ -847,12 +938,6 @@ dependencies = [ "cc", ] -[[package]] -name = "self_cell" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2fdfc24bc566f839a2da4c4295b82db7d25a24253867d5c64355abb5799bdbe" - [[package]] name = "serde" version = "1.0.216" @@ -907,10 +992,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] -name = "std-semaphore" -version = "0.1.0" +name = "smallvec" +version = "2.0.0-alpha.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ae9eec00137a8eed469fb4148acd9fc6ac8c3f9b110f52cd34698c8b5bfa0e" +checksum = "5e22442b16a0c1bfae679ffed8ec5e160ae2aa8495cea891f0d2ff7b84fe5c4c" + +[[package]] +name = "snkrj" +version = "0.1.1" +dependencies = [ + "sanakirja", +] + +[[package]] +name = "sptr" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" [[package]] name = "syn" @@ -936,17 +1034,38 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.14.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" +checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704" dependencies = [ "cfg-if", "fastrand", + "getrandom", "once_cell", "rustix", "windows-sys", ] +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.95", +] + [[package]] name = "thread_local" version = "1.1.8" @@ -998,12 +1117,24 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "triomphe" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef8f7726da4807b58ea5c96fdc122f80702030edc33b35aff9190a51148ccc85" + [[package]] name = "unicode-ident" version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "valuable" version = "0.1.0" @@ -1011,26 +1142,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] -name = "value-log" -version = "1.4.1" +name = "version_check" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f90495556d09c3026f7f3897f8a7db59c8c701082e32dcf58c2319062ae1eb0" -dependencies = [ - "byteorder", - "log", - "min-max-heap", - "path-absolutize", - "quick_cache", - "rustc-hash", - "tempfile", - "xxhash-rust", -] - -[[package]] -name = "varint-rs" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f54a172d0620933a27a4360d3db3e2ae0dd6cceae9730751a036bbf182c4b23" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wasi" @@ -1038,6 +1153,28 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[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-sys" version = "0.59.0" diff --git a/src/crates/bindex/Cargo.toml b/src/crates/bindex/Cargo.toml index a180c716f..705d3ed4c 100644 --- a/src/crates/bindex/Cargo.toml +++ b/src/crates/bindex/Cargo.toml @@ -9,6 +9,7 @@ biter = "0.2.2" color-eyre = "0.6.3" ctrlc = "3.4.5" derive_deref = "1.1.1" -fjall = "2.5.0" memmap2 = "0.9.5" rayon = "1.10.0" +snkrj = { path = "../snkrj" } +canopydb = { git = "https://github.com/arthurprs/canopydb" } diff --git a/src/crates/bindex/src/main.rs b/src/crates/bindex/src/main.rs index b99ecf268..0746a4aba 100644 --- a/src/crates/bindex/src/main.rs +++ b/src/crates/bindex/src/main.rs @@ -14,11 +14,10 @@ use biter::{ mod structs; use color_eyre::eyre::{eyre, ContextCompat}; -use fjall::{PersistMode, Slice, TransactionalKeyspace, WriteTransaction}; use rayon::prelude::*; use structs::{ Addressbytes, AddressbytesPrefix, Addressindex, Addressindextxoutindex, Addresstype, Addresstypeindex, Amount, - AnyVecdisk, BlockHashPrefix, Exit, Height, Partitions, TxidPrefix, Txindex, Txindexvout, Txoutindex, Vecdisks, + AnyVecdisk, BlockHashPrefix, Databases, Exit, Height, TxidPrefix, Txindex, Txindexvout, Txoutindex, Vecdisks, }; // https://github.com/fjall-rs/fjall/discussions/72 @@ -30,6 +29,8 @@ enum TxInOrAddressindextoutindex<'a> { Addressindextoutindex(Addressindextxoutindex), } +const MONTHLY_BLOCK_TARGET: usize = 144 * 30; + fn main() -> color_eyre::Result<()> { let i = std::time::Instant::now(); @@ -45,13 +46,9 @@ fn main() -> color_eyre::Result<()> { let mut vecdisks = Vecdisks::import(path_database)?; - let keyspace = fjall::Config::new(path_database).open_transactional()?; + let databases = Databases::open(path_database)?; - let parts = Partitions::import(&keyspace, &exit)?; - - let wtx = keyspace.write_tx(); - - let mut height = parts.start_height(); + let mut height = Height::from(0_u32); let mut txindex = vecdisks .height_to_first_txindex @@ -71,24 +68,17 @@ fn main() -> color_eyre::Result<()> { .cloned() .unwrap_or(Addressindex::default()); - let export = |keyspace: &TransactionalKeyspace, - mut wtx: WriteTransaction, - parts: &Partitions, - vecdisks: &mut Vecdisks, - height: Height| - -> color_eyre::Result<()> { - parts.udpate_meta(&mut wtx, height); + let export = |databases: Databases, vecdisks: &mut Vecdisks, height: Height| -> color_eyre::Result<()> { exit.block(); println!("Exporting..."); - wtx.commit()?; - keyspace.persist(PersistMode::SyncAll)?; + databases.export(); vecdisks.flush()?; println!("Export done"); exit.unblock(); Ok(()) }; - let mut wtx_opt = Some(wtx); + let mut databases_opt = Some(databases); biter::new(data_dir, Some(height.into()), Some(400_000), rpc) .iter() @@ -97,7 +87,7 @@ fn main() -> color_eyre::Result<()> { height = Height::from(_height); - let mut wtx = wtx_opt.take().context("option should have wtx")?; + let mut databases = databases_opt.take().context("option should have wtx")?; // if let Some(saved_blockhash) = vecdisks.height_to_blockhash.get(height)? { // if &blockhash != saved_blockhash { @@ -108,22 +98,21 @@ fn main() -> color_eyre::Result<()> { // } // } - if parts.blockhash_prefix_to_height.needs(height) { - let blockhash_prefix = BlockHashPrefix::from(&blockhash); + // if parts.blockhash_prefix_to_height.needs(height) { + let blockhash_prefix = BlockHashPrefix::try_from(&blockhash)?; - if check_collisions { - - if let Some(prev_height_slice) = - wtx.get(parts.blockhash_prefix_to_height.data(), blockhash_prefix.clone())? - { - dbg!(blockhash, Height::try_from(prev_height_slice)?); - return Err(eyre!("Collision, expect prefix to need be set yet")); - } + if check_collisions { + if let Some(prev_height) = + databases.blockhash_prefix_to_height.get(&blockhash_prefix) + { + dbg!(blockhash, prev_height); + return Err(eyre!("Collision, expect prefix to need be set yet")); } - - wtx.insert(parts.blockhash_prefix_to_height.data(), blockhash_prefix.clone(),Slice::from(height)); } + databases.blockhash_prefix_to_height.insert(blockhash_prefix,height); + // } + vecdisks.height_to_blockhash.push_if_needed(height, blockhash)?; vecdisks.height_to_first_txindex.push_if_needed(height, txindex)?; vecdisks.height_to_first_txoutindex.push_if_needed(height, txoutindex)?; @@ -152,14 +141,16 @@ fn main() -> color_eyre::Result<()> { .map(|(index, tx)| -> color_eyre::Result<_> { let txid = tx.compute_txid(); + let txid_prefix = TxidPrefix::try_from(&txid)?; + let prev_txindex_slice_opt = if check_collisions { // Should only find collisions for two txids (duplicates), see below - wtx.get(parts.txid_prefix_to_txindex.data(), TxidPrefix::from(&txid).clone())?.map(Txindex::try_from) + databases.txid_prefix_to_txindex.get(&txid_prefix).cloned() } else { None }; - Ok((TxidPrefix::from(&txid), (txid, Txindex::from(index), prev_txindex_slice_opt))) + Ok((txid_prefix, (txid, Txindex::from(index), prev_txindex_slice_opt))) }) .try_fold( BTreeMap::new, @@ -190,26 +181,24 @@ fn main() -> color_eyre::Result<()> { let txid = outpoint.txid; let vout = outpoint.vout; - let txindex_local = if let Some(txindex_local) = wtx - .get(parts.txid_prefix_to_txindex.data(), TxidPrefix::from(&txid).clone())? - .map(Txindex::try_from) + let txindex_local = if let Some(txindex_local) = databases.txid_prefix_to_txindex + .get(&TxidPrefix::try_from(&txid)?) { - txindex_local + *txindex_local } else { return Ok(TxInOrAddressindextoutindex::TxIn(txin)); - }?; + }; let txindexvout = Txindexvout::from((txindex_local, vout)); - let txoutindex = Txoutindex::try_from( - wtx.get(parts.txindexvout_to_txoutindex.data(), Slice::from(txindexvout))? + let txoutindex = + *databases.txindexvout_to_txoutindex.get(&txindexvout) .context("Expect txoutindex to not be none") .inspect_err(|_| { // let height = vecdisks.txindex_to_height.get(txindex.into()).expect("txindex_to_height get not fail") // .expect("Expect height for txindex"); dbg!(outpoint.txid, txindex_local, vout, txindexvout); - })?, - )?; + })?; let addressindex = *vecdisks.txoutindex_to_addressindex.get(txoutindex)? .context("Expect addressindex to not be none") @@ -229,9 +218,10 @@ fn main() -> color_eyre::Result<()> { |mut vec, addressindextxoutindex| { // There is no need to check for bad_tx as there are only 2 instances known // Which you can find below and which are coinbase tx and thus which are already filtered - if parts.addressindextxoutindex_out.needs(height) { + + // if parts.addressindextxoutindex_out.needs(height) { vec.push(addressindextxoutindex?); - } + // } Ok(vec) }, @@ -248,7 +238,7 @@ fn main() -> color_eyre::Result<()> { }); let txoutindex_to_txout_addresstype_addressbytes_res_addressindex_opt_handle = scope.spawn(|| -> color_eyre::Result, Option)>> { + (&TxOut, Txindexvout, Addresstype, color_eyre::Result, Option)>> { outputs.into_par_iter().enumerate() .map( |(block_txoutindex, (block_txindex, vout, txout))| { @@ -265,24 +255,18 @@ fn main() -> color_eyre::Result<()> { }); let addressindex_slice_opt = addressbytes_res.as_ref().ok().and_then(|addressbytes| { - let prefix = AddressbytesPrefix::from(addressbytes); - wtx.get( - parts.addressbytes_prefix_to_addressindex.data(), - prefix.clone(), - ) - .ok() - .and_then(|s| s) + databases.addressbytes_prefix_to_addressindex.get( + &AddressbytesPrefix::try_from(addressbytes).unwrap(), + ).cloned() }); let is_new_address = addressindex_slice_opt.is_none(); if check_collisions && is_new_address { if let Ok(addressbytes) = &addressbytes_res { - let prefix = AddressbytesPrefix::from(addressbytes); - if let Some(prev) = wtx.get( - parts.addressbytes_prefix_to_addressindex.data(), - prefix.clone(), - )? { + if let Some(prev) = databases.addressbytes_prefix_to_addressindex.get( + &AddressbytesPrefix::try_from(addressbytes)?, + ) { dbg!(prev); return Err(eyre!("addressbytes_prefix_to_addressindex collision, expect none")); } @@ -327,16 +311,15 @@ fn main() -> color_eyre::Result<()> { txoutindex_to_txout_addresstype_addressbytes_res_addressindex_opt .into_iter() - .try_for_each(|(txoutindex, (txout, txindexvout, addresstype, addressbytes_res, addressindex_slice_opt))| -> color_eyre::Result<()> { + .try_for_each(|(txoutindex, (txout, txindexvout, addresstype, addressbytes_res, addressindex_opt))| -> color_eyre::Result<()> { let amount = Amount::from(txout.value); - if parts.txindexvout_to_txoutindex.needs(height) { - wtx.insert( - parts.txindexvout_to_txoutindex.data(), - Slice::from(txindexvout), - Slice::from(txoutindex), + // if parts.txindexvout_to_txoutindex.needs(height) { + databases.txindexvout_to_txoutindex.insert( + txindexvout, + txoutindex, ); - } + // } vecdisks.txoutindex_to_amount.push_if_needed( txoutindex, @@ -345,8 +328,8 @@ fn main() -> color_eyre::Result<()> { let mut addressindex_local = addressindex; - if let Some(addressindex_slice) = addressindex_slice_opt { - addressindex_local = Addressindex::try_from(addressindex_slice)?; + if let Some(addressindex) = addressindex_opt { + addressindex_local = addressindex; } else { vecdisks.addressindex_to_addresstype.push_if_needed(addressindex_local, addresstype)?; @@ -356,13 +339,12 @@ fn main() -> color_eyre::Result<()> { vecdisks.addressindex_to_addresstypeindex.push_if_needed(addressindex_local, addresstypeindex)?; if let Ok(addressbytes) = addressbytes_res { - if parts.addressbytes_prefix_to_addressindex.needs(height) { - wtx.insert( - parts.addressbytes_prefix_to_addressindex.data(), - AddressbytesPrefix::from(&addressbytes).clone(), - Slice::from(addressindex_local), + // if parts.addressbytes_prefix_to_addressindex.needs(height) { + databases.addressbytes_prefix_to_addressindex.insert( + AddressbytesPrefix::try_from(&addressbytes)?, + addressindex_local, ); - } + // } vecdisks.push_addressbytes_if_needed(addresstypeindex, addressbytes)?; } @@ -377,19 +359,18 @@ fn main() -> color_eyre::Result<()> { addressindex_local, )?; - if parts.addressindextxoutindex_in.needs(height) { + // if parts.addressindextxoutindex_in.needs(height) { let addressindextxoutindex = Addressindextxoutindex::from((addressindex_local, txoutindex)); - wtx.insert( - parts.addressindextxoutindex_in.data(), - Slice::from(addressindextxoutindex), - Slice::from(&[]), + databases.addressindextxoutindex_in.insert( + addressindextxoutindex, + (), ); - } + // } Ok(()) })?; - if parts.addressindextxoutindex_out.needs(height) { + // if parts.addressindextxoutindex_out.needs(height) { txin_or_addressindextxoutindex_vec .into_iter() .map(|txin_or_addressindextxoutindex| -> color_eyre::Result { @@ -400,7 +381,7 @@ fn main() -> color_eyre::Result<()> { let txid = outpoint.txid; let vout = outpoint.vout; let index = txid_prefix_to_txid_and_block_txindex_and_prev_txindex - .get(&TxidPrefix::from(&txid)) + .get(&TxidPrefix::try_from(&txid)?) .context("txid should be in same block")?.1; let txindex_local = txindex + index; @@ -415,14 +396,13 @@ fn main() -> color_eyre::Result<()> { } }) .try_for_each(|addressindextxoutindex| -> color_eyre::Result<()> { - wtx.insert( - parts.addressindextxoutindex_out.data(), - Slice::from(addressindextxoutindex?), - Slice::from(&[]), + databases.addressindextxoutindex_out.insert( + addressindextxoutindex?, + (), ); Ok(()) })?; - } + // } drop(new_txindexvout_to_addressindextxoutindex); @@ -436,13 +416,11 @@ fn main() -> color_eyre::Result<()> { match prev_txindex_opt { None => { - if parts.txid_prefix_to_txindex.needs(height) { - wtx.insert(parts.txid_prefix_to_txindex.data(), txid_prefix.clone(), Slice::from(txindex_local)); - } + // if parts.txid_prefix_to_txindex.needs(height) { + databases.txid_prefix_to_txindex.insert(txid_prefix, txindex_local); + // } } - Some(prev_txindex_res) => { - let prev_txindex = prev_txindex_res?; - + Some(prev_txindex) => { // In case if we start at an already parsed height if txindex_local == prev_txindex { return Ok(()) @@ -487,12 +465,12 @@ fn main() -> color_eyre::Result<()> { vecdisks.height_to_last_txoutindex.push_if_needed(height, txoutindex.decremented())?; vecdisks.height_to_last_addressindex.push_if_needed(height, addressindex.decremented())?; - let should_snapshot = _height % 100 == 0 && !exit.active(); + let should_snapshot = _height % MONTHLY_BLOCK_TARGET == 0 && !exit.active(); if should_snapshot { - export(&keyspace, wtx, &parts, &mut vecdisks, height)?; - wtx_opt.replace(keyspace.write_tx()); + export(databases, &mut vecdisks, height)?; + databases_opt.replace(Databases::open(path_database)?); } else { - wtx_opt.replace(wtx); + databases_opt.replace(databases); } txindex += Txindex::from(tx_len); @@ -505,8 +483,8 @@ fn main() -> color_eyre::Result<()> { pause(); - let wtx = wtx_opt.take().context("option should have wtx")?; - export(&keyspace, wtx, &parts, &mut vecdisks, height)?; + let databases = databases_opt.take().context("option should have wtx")?; + export(databases, &mut vecdisks, height)?; pause(); diff --git a/src/crates/bindex/src/structs/addressindex.rs b/src/crates/bindex/src/structs/addressindex.rs index a5d2c9774..7da1b22c0 100644 --- a/src/crates/bindex/src/structs/addressindex.rs +++ b/src/crates/bindex/src/structs/addressindex.rs @@ -1,10 +1,9 @@ use derive_deref::{Deref, DerefMut}; -use fjall::Slice; - -use super::SliceExtended; +use snkrj::{direct_repr, Storable, UnsizedStorable}; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Deref, DerefMut, Default)] pub struct Addressindex(u32); +direct_repr!(Addressindex); impl Addressindex { pub const BYTES: usize = size_of::(); @@ -49,21 +48,3 @@ impl From for usize { value.0 as usize } } - -impl TryFrom for Addressindex { - type Error = color_eyre::Report; - fn try_from(value: Slice) -> Result { - Self::try_from(&value[..]) - } -} -impl TryFrom<&[u8]> for Addressindex { - type Error = color_eyre::Report; - fn try_from(value: &[u8]) -> Result { - Ok(Self::from(value.read_be_u32()?)) - } -} -impl From for Slice { - fn from(value: Addressindex) -> Self { - value.to_be_bytes().into() - } -} diff --git a/src/crates/bindex/src/structs/addressindextxoutindex.rs b/src/crates/bindex/src/structs/addressindextxoutindex.rs index cc89164b1..aa07e3bec 100644 --- a/src/crates/bindex/src/structs/addressindextxoutindex.rs +++ b/src/crates/bindex/src/structs/addressindextxoutindex.rs @@ -1,12 +1,13 @@ -use fjall::Slice; +use snkrj::{direct_repr, Storable, UnsizedStorable}; use super::{Addressindex, Txoutindex}; -#[derive(Debug)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pub struct Addressindextxoutindex { addressindex: Addressindex, txoutindex: Txoutindex, } +direct_repr!(Addressindextxoutindex); impl From<(Addressindex, Txoutindex)> for Addressindextxoutindex { fn from(value: (Addressindex, Txoutindex)) -> Self { @@ -16,23 +17,3 @@ impl From<(Addressindex, Txoutindex)> for Addressindextxoutindex { } } } - -impl From for Slice { - fn from(value: Addressindextxoutindex) -> Self { - let addressindex_slice = Self::from(value.addressindex); - let txindexvout_slice = Self::from(value.txoutindex); - Self::from([addressindex_slice, txindexvout_slice].concat()) - } -} -impl TryFrom for Addressindextxoutindex { - type Error = color_eyre::Report; - fn try_from(value: Slice) -> Result { - let addressindex = Addressindex::try_from(&value[..Addressindex::BYTES])?; - let txindexvout = Txoutindex::try_from(&value[Addressindex::BYTES..])?; - - Ok(Self { - addressindex, - txoutindex: txindexvout, - }) - } -} diff --git a/src/crates/bindex/src/structs/addresstypeindex.rs b/src/crates/bindex/src/structs/addresstypeindex.rs index 15c2f4ba3..a2ca0e5de 100644 --- a/src/crates/bindex/src/structs/addresstypeindex.rs +++ b/src/crates/bindex/src/structs/addresstypeindex.rs @@ -1,10 +1,9 @@ use derive_deref::{Deref, DerefMut}; -use fjall::Slice; - -use super::SliceExtended; +use snkrj::{direct_repr, Storable, UnsizedStorable}; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Deref, DerefMut, Default)] pub struct Addresstypeindex(u32); +direct_repr!(Addresstypeindex); impl Addresstypeindex { pub fn decremented(self) -> Self { @@ -47,35 +46,3 @@ impl From for usize { value.0 as usize } } - -impl TryFrom for Addresstypeindex { - type Error = color_eyre::Report; - fn try_from(value: Slice) -> Result { - Self::try_from(&value[..]) - } -} -impl TryFrom<&[u8]> for Addresstypeindex { - type Error = color_eyre::Report; - fn try_from(value: &[u8]) -> Result { - Ok(Self::from(value.read_be_u32()?)) - } -} -impl From for Slice { - fn from(value: Addresstypeindex) -> Self { - value.to_be_bytes().into() - } -} - -// impl Bytes for Addresstypeindex { -// const SIZE: usize = size_of::(); - -// type ByteArray = [u8; Self::SIZE]; - -// // fn try_from_bytes(bytes: &[u8]) -> color_eyre::Result { -// // Ok(Self(Self::read_u32(bytes))) -// // } - -// fn to_bytes(&self) -> Self::ByteArray { -// self.to_ne_bytes() -// } -// } diff --git a/src/crates/bindex/src/structs/amount.rs b/src/crates/bindex/src/structs/amount.rs index 515ea29da..9f4320b8a 100644 --- a/src/crates/bindex/src/structs/amount.rs +++ b/src/crates/bindex/src/structs/amount.rs @@ -5,12 +5,13 @@ use std::{ use biter::bitcoin; use derive_deref::{Deref, DerefMut}; -use fjall::Slice; +use snkrj::{direct_repr, Storable, UnsizedStorable}; use super::Height; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Deref, DerefMut, Default)] pub struct Amount(bitcoin::Amount); +direct_repr!(Amount); impl Amount { pub const ZERO: Self = Self(bitcoin::Amount::ZERO); @@ -22,24 +23,6 @@ impl Amount { } } -impl From for Amount { - fn from(value: u64) -> Self { - Self(bitcoin::Amount::from_sat(value)) - } -} - -impl From for Amount { - fn from(value: bitcoin::Amount) -> Self { - Self(value) - } -} - -impl From for Slice { - fn from(value: Amount) -> Self { - value.to_sat().to_be_bytes().into() - } -} - impl Add for Amount { type Output = Amount; fn add(self, rhs: Amount) -> Self::Output { @@ -93,3 +76,15 @@ impl Sum for Amount { Amount::from(sats) } } + +impl From for Amount { + fn from(value: u64) -> Self { + Self(bitcoin::Amount::from_sat(value)) + } +} + +impl From for Amount { + fn from(value: bitcoin::Amount) -> Self { + Self(value) + } +} diff --git a/src/crates/bindex/src/structs/canopy/database.rs b/src/crates/bindex/src/structs/canopy/database.rs new file mode 100644 index 000000000..8cced0770 --- /dev/null +++ b/src/crates/bindex/src/structs/canopy/database.rs @@ -0,0 +1,23 @@ +use std::time::Duration; + +use canopydb::{Database as CanopyDatabase, DbOptions}; +use derive_deref::{Deref, DerefMut}; + +use super::Environment; + +#[derive(Debug, Deref, DerefMut)] +pub struct Database(CanopyDatabase); + +impl Database { + pub fn new(environment: &Environment, name: &str) -> color_eyre::Result { + let mut options = DbOptions::default(); + options.use_wal = false; + options.checkpoint_interval = Duration::from_secs(u64::MAX); + options.checkpoint_target_size = usize::MAX; + options.throttle_memory_limit = usize::MAX; + options.stall_memory_limit = usize::MAX; + options.write_txn_memory_limit = usize::MAX; + + Ok(Self(environment.get_or_create_database_with(name, options)?)) + } +} diff --git a/src/crates/bindex/src/structs/canopy/environment.rs b/src/crates/bindex/src/structs/canopy/environment.rs new file mode 100644 index 000000000..562e159d9 --- /dev/null +++ b/src/crates/bindex/src/structs/canopy/environment.rs @@ -0,0 +1,20 @@ +use std::path::Path; + +use canopydb::{EnvOptions, Environment as CanopyEnvironment}; +use derive_deref::{Deref, DerefMut}; + +#[derive(Debug, Deref, DerefMut)] +pub struct Environment(CanopyEnvironment); + +impl Environment { + pub fn new(path: &Path) -> color_eyre::Result { + let mut options = EnvOptions::new(path); + // options.use_mmap = true; + options.disable_fsync = true; + options.wal_new_file_on_checkpoint = false; + options.wal_background_sync_interval = None; + options.wal_write_batch_memory_limit = usize::MAX; + + Ok(Self(CanopyEnvironment::with_options(options)?)) + } +} diff --git a/src/crates/bindex/src/structs/canopy/mod.rs b/src/crates/bindex/src/structs/canopy/mod.rs new file mode 100644 index 000000000..46cb95a00 --- /dev/null +++ b/src/crates/bindex/src/structs/canopy/mod.rs @@ -0,0 +1,9 @@ +mod database; +mod environment; +// mod transaction; +mod tree; + +pub use database::*; +pub use environment::*; +// pub use transaction::*; +pub use tree::*; diff --git a/src/crates/bindex/src/structs/canopy/transaction.rs b/src/crates/bindex/src/structs/canopy/transaction.rs new file mode 100644 index 000000000..d1a6ca13c --- /dev/null +++ b/src/crates/bindex/src/structs/canopy/transaction.rs @@ -0,0 +1,19 @@ +use canopydb::{Tree as CanopyTree, TreeOptions, WriteTransaction}; + +use super::{Database, Tree}; + +#[derive(Debug)] +pub struct Transaction<'a, K, V> { + tx: WriteTransaction, + tree: Tree<'a, K, V>, +} + +impl<'a, K, V> Transaction<'a, K, V> { + pub fn new(db: &Database) -> color_eyre::Result { + let tx = db.begin_write()?; + + let tree = Tree::new(&tx)?; + + Ok(Self { tx, tree }) + } +} diff --git a/src/crates/bindex/src/structs/canopy/tree.rs b/src/crates/bindex/src/structs/canopy/tree.rs new file mode 100644 index 000000000..7809835ea --- /dev/null +++ b/src/crates/bindex/src/structs/canopy/tree.rs @@ -0,0 +1,84 @@ +use std::{ + fmt::Debug, + marker::PhantomData, + ops::{Deref, DerefMut}, +}; + +use canopydb::{Tree as CanopyTree, TreeOptions, WriteTransaction}; +use color_eyre::eyre::eyre; + +#[derive(Debug)] +pub struct Tree<'a, K, V> { + tree: CanopyTree<'a>, + k: PhantomData, + v: PhantomData, +} +impl<'a, K, V> Deref for Tree<'a, K, V> { + type Target = CanopyTree<'a>; + fn deref(&self) -> &Self::Target { + &self.tree + } +} +impl<'a, K, V> DerefMut for Tree<'a, K, V> { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.tree + } +} + +impl<'a, K, V> Tree<'a, K, V> +where + K: Debug + Sized, + V: Debug + Sized + Clone + Copy, +{ + const SIZE_OF_K: usize = size_of::(); + const SIZE_OF_V: usize = size_of::(); + + pub fn new(tx: &'a WriteTransaction) -> color_eyre::Result { + let mut options = TreeOptions::new(); + options.compress_overflow_values = None; + options.fixed_key_len = size_of::() as i8; + options.fixed_value_len = size_of::() as i8; + + Ok(Self { + tree: tx.get_or_create_tree_with(b"tree", options)?, + k: PhantomData, + v: PhantomData, + }) + } + + pub fn get(&self, key: &K) -> color_eyre::Result> { + let slice = self.tree.get(Self::key_as_slice(key))?; + + if slice.is_none() { + return Ok(None); + } + + let slice = slice.unwrap(); + + let (prefix, shorts, suffix) = unsafe { slice.align_to::() }; + + if !prefix.is_empty() || shorts.len() != 1 || !suffix.is_empty() { + dbg!(&key, &prefix, &shorts, &suffix); + return Err(eyre!("align_to issue")); + } + + Ok(Some(shorts[0])) + } + + pub fn insert(&mut self, key: &K, value: &V) -> Result<(), canopydb::Error> { + self.tree + .insert(Self::key_as_slice(key), Self::value_as_slice(value)) + } + + fn key_as_slice(key: &K) -> &[u8] { + let data: *const K = key; + let data: *const u8 = data as *const u8; + unsafe { std::slice::from_raw_parts(data, Self::SIZE_OF_K) } + } + + fn value_as_slice(value: &V) -> &[u8] { + let data: *const V = value; + let data: *const u8 = data as *const u8; + unsafe { std::slice::from_raw_parts(data, Self::SIZE_OF_V) } + } +} diff --git a/src/crates/bindex/src/structs/databases.rs b/src/crates/bindex/src/structs/databases.rs new file mode 100644 index 000000000..f28a2e7d4 --- /dev/null +++ b/src/crates/bindex/src/structs/databases.rs @@ -0,0 +1,186 @@ +use std::{path::Path, thread}; + +use snkrj::{AnyDatabase, Database}; + +use crate::structs::Height; + +use super::{ + AddressbytesPrefix, Addressindex, Addressindextxoutindex, BlockHashPrefix, TxidPrefix, Txindex, Txindexvout, + Txoutindex, +}; + +pub struct Databases { + pub addressbytes_prefix_to_addressindex: Database, + pub addressindextxoutindex_in: Database, + pub addressindextxoutindex_out: Database, + pub blockhash_prefix_to_height: Database, + pub txid_prefix_to_txindex: Database, + pub txindexvout_to_txoutindex: Database, +} + +const UNSAFE_BLOCKS: usize = 100; + +impl Databases { + pub fn open(path: &Path) -> color_eyre::Result { + Ok(Self { + addressbytes_prefix_to_addressindex: Database::open(path.join("addressbytes_prefix_to_addressindex"))?, + addressindextxoutindex_in: Database::open(path.join("addresstxoutindexes_in"))?, + addressindextxoutindex_out: Database::open(path.join("addresstxoutindexes_out"))?, + blockhash_prefix_to_height: Database::open(path.join("blockhash_prefix_to_height"))?, + txid_prefix_to_txindex: Database::open(path.join("txid_prefix_to_txindex"))?, + txindexvout_to_txoutindex: Database::open(path.join("txindexvout_to_txoutindex"))?, + }) + } + + // pub fn rollback_from( + // &mut self, + // _wtx: &mut WriteTransaction, + // _height: Height, + // _exit: &Exit, + // ) -> color_eyre::Result<()> { + // panic!(); + // let mut txindex = None; + + // wtx.range(self.height_to_blockhash.data(), Slice::from(height)..) + // .try_for_each(|slice| -> color_eyre::Result<()> { + // let (height_slice, slice_blockhash) = slice?; + // let blockhash = BlockHash::from_slice(&slice_blockhash)?; + + // wtx.remove(self.height_to_blockhash.data(), height_slice); + + // wtx.remove(self.blockhash_prefix_to_height.data(), blockhash.prefix()); + + // if txindex.is_none() { + // txindex.replace( + // wtx.get(self.height_to_first_txindex.data(), height_slice)? + // .context("for height to have first txindex")?, + // ); + // } + // wtx.remove(self.height_to_first_txindex.data(), height_slice); + // wtx.remove(self.height_to_last_txindex.data(), height_slice); + + // Ok(()) + // })?; + + // let txindex = txindex.context("txindex to not be none by now")?; + + // wtx.range(self.txindex_to_txid.data(), Slice::from(txindex)..) + // .try_for_each(|slice| -> color_eyre::Result<()> { + // let (slice_txindex, slice_txid) = slice?; + // let txindex = Txindex::from(slice_txindex); + // let txid = Txid::from_slice(&slice_txid)?; + + // wtx.remove(self.txindex_to_txid.data(), Slice::from(txindex)); + // wtx.remove(self.txindex_to_height.data(), Slice::from(txindex)); + // wtx.remove(self.txid_prefix_to_txindex.data(), txid.prefix()); + + // Ok(()) + // })?; + + // let txoutindex = Txoutindex::from(txindex); + + // let mut addressindexes = BTreeSet::new(); + + // wtx.range(self.txoutindex_to_amount.data(), Slice::from(txoutindex)..) + // .try_for_each(|slice| -> color_eyre::Result<()> { + // let (txoutindex_slice, _) = slice?; + + // wtx.remove(self.txoutindex_to_amount.data(), txoutindex_slice); + + // if let Some(addressindex_slice) = + // wtx.get(self.txoutindex_to_addressindex.data(), txoutindex_slice)? + // { + // wtx.remove(self.txoutindex_to_addressindex.data(), txoutindex_slice); + + // let addressindex = Addressindex::from(addressindex_slice); + // addressindexes.insert(addressindex); + + // let txoutindex = Txoutindex::from(txoutindex_slice); + // let addresstxoutindex = Addresstxoutindex::from((addressindex, txoutindex)); + + // wtx.remove( + // self.addressindex_to_txoutindexes.data(), + // Slice::from(addresstxoutindex), + // ); + // } + + // Ok(()) + // })?; + + // addressindexes + // .into_iter() + // .filter(|addressindex| { + // let is_empty = wtx + // .prefix( + // self.addressindex_to_txoutindexes.data(), + // Slice::from(*addressindex), + // ) + // .next() + // .is_none(); + // is_empty + // }) + // .try_for_each(|addressindex| -> color_eyre::Result<()> { + // let addressindex_slice = Slice::from(addressindex); + + // let addressbytes = Addressbytes::from( + // wtx.get( + // self.addressindex_to_addressbytes.data(), + // &addressindex_slice, + // )? + // .context("addressindex_to_address to have value")?, + // ); + // wtx.remove( + // self.addressbytes_prefix_to_addressindex.data(), + // addressbytes.prefix(), + // ); + // wtx.remove( + // self.addressindex_to_addressbytes.data(), + // &addressindex_slice, + // ); + // wtx.remove(self.addressindex_to_addresstype.data(), &addressindex_slice); + + // Ok(()) + // })?; + // + + // todo!("clear addresstxoutindexes_out") + // todo!("clear addresstxoutindexes_in") + // todo!("clear zero_txoutindexes") + // todo!("clear txindexvout_to_txoutindex") + + // Ok(()) + // } + + fn to_ref_vec(&self) -> Vec<&dyn AnyDatabase> { + vec![ + &self.addressbytes_prefix_to_addressindex as &dyn AnyDatabase, + &self.addressindextxoutindex_in, + &self.addressindextxoutindex_out, + &self.blockhash_prefix_to_height, + &self.txid_prefix_to_txindex, + &self.txindexvout_to_txoutindex, + ] + } + + fn to_ref_mut_vec(&mut self) -> Vec<&mut dyn AnyDatabase> { + vec![ + &mut self.addressbytes_prefix_to_addressindex as &mut dyn AnyDatabase, + &mut self.addressindextxoutindex_in, + &mut self.addressindextxoutindex_out, + &mut self.blockhash_prefix_to_height, + &mut self.txid_prefix_to_txindex, + &mut self.txindexvout_to_txoutindex, + ] + } + + pub fn export(self) { + thread::scope(|scope| { + scope.spawn(|| self.addressbytes_prefix_to_addressindex.export(false)); + scope.spawn(|| self.addressindextxoutindex_in.export(false)); + scope.spawn(|| self.addressindextxoutindex_out.export(false)); + scope.spawn(|| self.blockhash_prefix_to_height.export(false)); + scope.spawn(|| self.txid_prefix_to_txindex.export(false)); + scope.spawn(|| self.txindexvout_to_txoutindex.export(false)); + }); + } +} diff --git a/src/crates/bindex/src/structs/height.rs b/src/crates/bindex/src/structs/height.rs index 3f8f0f346..6528b8fab 100644 --- a/src/crates/bindex/src/structs/height.rs +++ b/src/crates/bindex/src/structs/height.rs @@ -5,12 +5,11 @@ use std::{ use biter::bitcoincore_rpc::{self, RpcApi}; use derive_deref::{Deref, DerefMut}; -use fjall::Slice; - -use super::SliceExtended; +use snkrj::{direct_repr, Storable, UnsizedStorable}; #[derive(Debug, Clone, Copy, Deref, DerefMut, PartialEq, Eq, PartialOrd, Ord, Default)] pub struct Height(u32); +direct_repr!(Height); impl PartialEq for Height { fn eq(&self, other: &u64) -> bool { @@ -75,18 +74,6 @@ impl fmt::Display for Height { } } -impl TryFrom for Height { - type Error = color_eyre::Report; - fn try_from(value: Slice) -> Result { - Ok(Self::from((&value[..]).read_be_u32()?)) - } -} -impl From for Slice { - fn from(value: Height) -> Self { - value.to_be_bytes().into() - } -} - impl From for Height { fn from(value: u32) -> Self { Self(value) @@ -110,17 +97,3 @@ impl TryFrom<&bitcoincore_rpc::Client> for Height { Ok((value.get_blockchain_info()?.blocks as usize - 1).into()) } } - -// impl Bytes for Height { -// const SIZE: usize = size_of::(); - -// type ByteArray = [u8; Self::SIZE]; - -// // fn try_from_bytes(bytes: &[u8]) -> color_eyre::Result { -// // Ok(Self(Self::read_u32(bytes))) -// // } - -// fn to_bytes(&self) -> Self::ByteArray { -// self.to_ne_bytes() -// } -// } diff --git a/src/crates/bindex/src/structs/mod.rs b/src/crates/bindex/src/structs/mod.rs index 123921c06..44ca041c4 100644 --- a/src/crates/bindex/src/structs/mod.rs +++ b/src/crates/bindex/src/structs/mod.rs @@ -4,10 +4,10 @@ mod addressindextxoutindex; mod addresstype; mod addresstypeindex; mod amount; +mod canopy; +mod databases; mod exit; mod height; -mod partition; -mod partitions; mod prefix; mod slice; mod txindex; @@ -15,7 +15,6 @@ mod txindexvout; mod txoutindex; mod vecdisk; mod vecdisks; -mod version; pub use addressbytes::*; pub use addressindex::*; @@ -23,10 +22,10 @@ pub use addressindextxoutindex::*; pub use addresstype::*; pub use addresstypeindex::*; pub use amount::*; +pub use canopy::*; +pub use databases::*; pub use exit::*; pub use height::*; -pub use partition::*; -pub use partitions::*; pub use prefix::*; pub use slice::*; pub use txindex::*; @@ -34,4 +33,3 @@ pub use txindexvout::*; pub use txoutindex::*; pub use vecdisk::*; pub use vecdisks::*; -pub use version::*; diff --git a/src/crates/bindex/src/structs/prefix.rs b/src/crates/bindex/src/structs/prefix.rs index 661a3971c..ee90efbda 100644 --- a/src/crates/bindex/src/structs/prefix.rs +++ b/src/crates/bindex/src/structs/prefix.rs @@ -1,32 +1,26 @@ use biter::bitcoin::{BlockHash, Txid}; use derive_deref::Deref; -use fjall::Slice; +use snkrj::{direct_repr, Storable, UnsizedStorable}; -use super::Addressbytes; +use super::{Addressbytes, SliceExtended}; -#[derive(Debug, Deref, PartialEq, Eq, PartialOrd, Ord)] -pub struct Prefix(Slice); -impl From<&[u8]> for Prefix { - fn from(value: &[u8]) -> Self { - Self(Slice::from(&value[..8])) +#[derive(Debug, Deref, Clone, PartialEq, Eq, PartialOrd, Ord)] +pub struct Prefix([u8; 8]); +direct_repr!(Prefix); +impl TryFrom<&[u8]> for Prefix { + type Error = color_eyre::Report; + fn try_from(value: &[u8]) -> Result { + Ok(Self(value.read_8xU8()?)) } } -// pub struct Prefix([u8; 8]); -// impl From<&[u8]> for Prefix { -// fn from(value: &[u8]) -> Self { -// let mut buf: [u8; 8] = [0; 8]; -// value.iter().take(8).enumerate().for_each(|(i, v)| { -// buf[i] = *v; -// }); -// Self(buf) -// } -// } -#[derive(Debug, Deref)] +#[derive(Debug, Deref, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct AddressbytesPrefix(Prefix); -impl From<&Addressbytes> for AddressbytesPrefix { - fn from(value: &Addressbytes) -> Self { - Self(Prefix::from(match value { +direct_repr!(AddressbytesPrefix); +impl TryFrom<&Addressbytes> for AddressbytesPrefix { + type Error = color_eyre::Report; + fn try_from(value: &Addressbytes) -> Result { + Ok(Self(Prefix::try_from(match value { Addressbytes::P2PK65(bytes) => &bytes[..], Addressbytes::P2PK33(bytes) => &bytes[..], Addressbytes::P2PKH(bytes) => &bytes[..], @@ -34,22 +28,26 @@ impl From<&Addressbytes> for AddressbytesPrefix { Addressbytes::P2WPKH(bytes) => &bytes[..], Addressbytes::P2WSH(bytes) => &bytes[..], Addressbytes::P2TR(bytes) => &bytes[..], - })) + })?)) } } -#[derive(Debug, Deref)] +#[derive(Debug, Deref, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct BlockHashPrefix(Prefix); -impl From<&BlockHash> for BlockHashPrefix { - fn from(value: &BlockHash) -> Self { - Self(Prefix::from(&value[..])) +direct_repr!(BlockHashPrefix); +impl TryFrom<&BlockHash> for BlockHashPrefix { + type Error = color_eyre::Report; + fn try_from(value: &BlockHash) -> Result { + Ok(Self(Prefix::try_from(&value[..])?)) } } -#[derive(Debug, Deref, PartialEq, Eq, PartialOrd, Ord)] +#[derive(Debug, Deref, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct TxidPrefix(Prefix); -impl From<&Txid> for TxidPrefix { - fn from(value: &Txid) -> Self { - Self(Prefix::from(&value[..])) +direct_repr!(TxidPrefix); +impl TryFrom<&Txid> for TxidPrefix { + type Error = color_eyre::Report; + fn try_from(value: &Txid) -> Result { + Ok(Self(Prefix::try_from(&value[..])?)) } } diff --git a/src/crates/bindex/src/structs/slice.rs b/src/crates/bindex/src/structs/slice.rs index 4ded832b1..1c598970b 100644 --- a/src/crates/bindex/src/structs/slice.rs +++ b/src/crates/bindex/src/structs/slice.rs @@ -2,6 +2,7 @@ use color_eyre::eyre::eyre; #[allow(unused)] pub trait SliceExtended { + fn read_8xU8(&self) -> color_eyre::Result<[u8; 8]>; fn read_be_u8(&self) -> color_eyre::Result; fn read_be_u16(&self) -> color_eyre::Result; fn read_be_u32(&self) -> color_eyre::Result; @@ -10,6 +11,12 @@ pub trait SliceExtended { } impl SliceExtended for &[u8] { + fn read_8xU8(&self) -> color_eyre::Result<[u8; 8]> { + let mut buf: [u8; 8] = [0; 8]; + (&self[..8]).read_exact(&mut buf)?; + Ok(buf) + } + fn read_be_u8(&self) -> color_eyre::Result { let mut buf: [u8; 1] = [0; 1]; self.read_exact(&mut buf)?; diff --git a/src/crates/bindex/src/structs/txindex.rs b/src/crates/bindex/src/structs/txindex.rs index 47bcdea8f..70a3735e3 100644 --- a/src/crates/bindex/src/structs/txindex.rs +++ b/src/crates/bindex/src/structs/txindex.rs @@ -1,12 +1,11 @@ use std::ops::{Add, AddAssign}; use derive_deref::{Deref, DerefMut}; -use fjall::Slice; - -use super::SliceExtended; +use snkrj::{direct_repr, Storable, UnsizedStorable}; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Deref, DerefMut, Default)] pub struct Txindex(u32); +direct_repr!(Txindex); impl Txindex { pub fn incremented(self) -> Self { @@ -58,21 +57,3 @@ impl From for usize { value.0 as usize } } - -impl TryFrom for Txindex { - type Error = color_eyre::Report; - fn try_from(value: Slice) -> Result { - Self::try_from(&value[..]) - } -} -impl TryFrom<&[u8]> for Txindex { - type Error = color_eyre::Report; - fn try_from(value: &[u8]) -> Result { - Ok(Self::from(value.read_be_u32()?)) - } -} -impl From for Slice { - fn from(value: Txindex) -> Self { - value.to_be_bytes().into() - } -} diff --git a/src/crates/bindex/src/structs/txindexvout.rs b/src/crates/bindex/src/structs/txindexvout.rs index 0a75a529c..6ba23d23c 100644 --- a/src/crates/bindex/src/structs/txindexvout.rs +++ b/src/crates/bindex/src/structs/txindexvout.rs @@ -1,14 +1,13 @@ -use fjall::Slice; +use snkrj::{direct_repr, Storable, UnsizedStorable}; -use super::{SliceExtended, Txindex}; +use super::Txindex; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default)] pub struct Txindexvout { pub txindex: Txindex, pub vout: u32, } - -const BYTES: usize = size_of::(); +direct_repr!(Txindexvout); impl From for Txindexvout { fn from(value: Txindex) -> Self { @@ -27,25 +26,3 @@ impl From<(Txindex, u32)> for Txindexvout { } } } - -impl From for Slice { - fn from(value: Txindexvout) -> Self { - let txindex_slice = Self::from(value.txindex); - let vout_slice = Self::from(value.vout.to_be_bytes()); - Self::from([txindex_slice, vout_slice].concat()) - } -} -impl TryFrom for Txindexvout { - type Error = color_eyre::Report; - fn try_from(value: Slice) -> Result { - Self::try_from(&value[..]) - } -} -impl TryFrom<&[u8]> for Txindexvout { - type Error = color_eyre::Report; - fn try_from(value: &[u8]) -> Result { - let txindex = Txindex::try_from(&value[..BYTES])?; - let vout = (&value[BYTES..]).read_be_u32()?; - Ok(Self { txindex, vout }) - } -} diff --git a/src/crates/bindex/src/structs/txoutindex.rs b/src/crates/bindex/src/structs/txoutindex.rs index 92e1bc88d..6424bf70a 100644 --- a/src/crates/bindex/src/structs/txoutindex.rs +++ b/src/crates/bindex/src/structs/txoutindex.rs @@ -1,12 +1,11 @@ use std::ops::{Add, AddAssign}; use derive_deref::{Deref, DerefMut}; -use fjall::Slice; - -use super::SliceExtended; +use snkrj::{direct_repr, Storable, UnsizedStorable}; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Deref, DerefMut, Default)] pub struct Txoutindex(u64); +direct_repr!(Txoutindex); impl Txoutindex { pub fn incremented(self) -> Self { @@ -52,21 +51,3 @@ impl From for usize { value.0 as usize } } - -impl TryFrom for Txoutindex { - type Error = color_eyre::Report; - fn try_from(value: Slice) -> Result { - Self::try_from(&value[..]) - } -} -impl TryFrom<&[u8]> for Txoutindex { - type Error = color_eyre::Report; - fn try_from(value: &[u8]) -> Result { - Ok(Self::from(value.read_be_u64()?)) - } -} -impl From for Slice { - fn from(value: Txoutindex) -> Self { - value.to_be_bytes().into() - } -} diff --git a/src/crates/bindex/src/structs/version.rs b/src/crates/bindex/src/structs/version.rs index cc94051ed..a4dd4b0ec 100644 --- a/src/crates/bindex/src/structs/version.rs +++ b/src/crates/bindex/src/structs/version.rs @@ -1,5 +1,4 @@ use derive_deref::{Deref, DerefMut}; -use fjall::Slice; use super::SliceExtended; diff --git a/src/crates/biter/Cargo.lock b/src/crates/biter/Cargo.lock index 04c5c6ee7..c3335d7d9 100644 --- a/src/crates/biter/Cargo.lock +++ b/src/crates/biter/Cargo.lock @@ -299,9 +299,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] @@ -414,9 +414,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.134" +version = "1.0.135" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d00f4175c42ee48b15416f6193a959ba3a0d67fc699a0db9ad12df9f83991c7d" +checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9" dependencies = [ "itoa", "memchr", @@ -432,9 +432,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "syn" -version = "2.0.93" +version = "2.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c786062daee0d6db1132800e623df74274a0a87322d8e183338e01b3d98d058" +checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" dependencies = [ "proc-macro2", "quote", diff --git a/src/crates/biter/Cargo.toml b/src/crates/biter/Cargo.toml index 26db5dd47..6bb8bc3f6 100644 --- a/src/crates/biter/Cargo.toml +++ b/src/crates/biter/Cargo.toml @@ -13,7 +13,7 @@ bitcoin = { version = "0.32.5", features = ["serde"] } rayon = "1.10.0" crossbeam = { version = "0.8.4", features = ["crossbeam-channel"] } serde = { version = "1.0.217", features = ["derive"] } -serde_json = "1.0.134" +serde_json = "1.0.135" derived-deref = "2.1.0" bitcoincore-rpc = "0.19.0" # tokio = { version = "1.39.2", features = ["rt-multi-thread"] }