mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-06-13 16:33:30 -07:00
server: api doc part 4
This commit is contained in:
Generated
+30
-102
@@ -524,8 +524,8 @@ dependencies = [
|
||||
"bytes",
|
||||
"cfg-if",
|
||||
"http",
|
||||
"indexmap 2.11.4",
|
||||
"schemars 1.0.4",
|
||||
"indexmap",
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_qs",
|
||||
@@ -635,6 +635,7 @@ dependencies = [
|
||||
"bitcoincore-rpc",
|
||||
"brk_error",
|
||||
"brk_fetcher",
|
||||
"brk_grouper",
|
||||
"brk_indexer",
|
||||
"brk_logger",
|
||||
"brk_parser",
|
||||
@@ -677,6 +678,15 @@ dependencies = [
|
||||
"sonic-rs 0.5.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "brk_grouper"
|
||||
version = "0.0.111"
|
||||
dependencies = [
|
||||
"brk_structs",
|
||||
"brk_traversable",
|
||||
"vecdb",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "brk_indexer"
|
||||
version = "0.0.111"
|
||||
@@ -684,6 +694,7 @@ dependencies = [
|
||||
"bitcoin",
|
||||
"bitcoincore-rpc",
|
||||
"brk_error",
|
||||
"brk_grouper",
|
||||
"brk_logger",
|
||||
"brk_parser",
|
||||
"brk_store",
|
||||
@@ -709,11 +720,9 @@ dependencies = [
|
||||
"derive_deref",
|
||||
"nucleo-matcher",
|
||||
"quick_cache",
|
||||
"schemars 1.0.4",
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"sonic-rs 0.5.5",
|
||||
"vecdb",
|
||||
]
|
||||
|
||||
@@ -735,7 +744,7 @@ dependencies = [
|
||||
"brk_interface",
|
||||
"brk_rmcp",
|
||||
"log",
|
||||
"schemars 1.0.4",
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
@@ -771,7 +780,7 @@ dependencies = [
|
||||
"paste",
|
||||
"pin-project-lite",
|
||||
"rand 0.9.2",
|
||||
"schemars 1.0.4",
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sse-stream",
|
||||
@@ -831,7 +840,7 @@ dependencies = [
|
||||
"derive_more",
|
||||
"dunce",
|
||||
"futures",
|
||||
"indexmap 2.11.4",
|
||||
"indexmap",
|
||||
"itertools",
|
||||
"itoa",
|
||||
"memchr",
|
||||
@@ -1114,7 +1123,7 @@ dependencies = [
|
||||
"fast-glob",
|
||||
"form_urlencoded",
|
||||
"futures",
|
||||
"indexmap 2.11.4",
|
||||
"indexmap",
|
||||
"infer",
|
||||
"itoa",
|
||||
"memchr",
|
||||
@@ -1167,7 +1176,7 @@ dependencies = [
|
||||
"jiff",
|
||||
"log",
|
||||
"quick_cache",
|
||||
"schemars 1.0.4",
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sonic-rs 0.5.5",
|
||||
@@ -1210,7 +1219,6 @@ dependencies = [
|
||||
"bitcoin",
|
||||
"bitcoincore-rpc",
|
||||
"brk_error",
|
||||
"brk_traversable",
|
||||
"byteview",
|
||||
"derive_deref",
|
||||
"itoa",
|
||||
@@ -1218,7 +1226,7 @@ dependencies = [
|
||||
"num_enum",
|
||||
"rapidhash",
|
||||
"ryu",
|
||||
"schemars 1.0.4",
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
"strum",
|
||||
@@ -1231,9 +1239,8 @@ dependencies = [
|
||||
name = "brk_traversable"
|
||||
version = "0.0.111"
|
||||
dependencies = [
|
||||
"brk_structs",
|
||||
"brk_traversable_derive",
|
||||
"schemars 1.0.4",
|
||||
"serde",
|
||||
"vecdb",
|
||||
]
|
||||
|
||||
@@ -1688,7 +1695,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a41953f86f8a05768a6cda24def994fd2f424b04ec5c719cf89989779f199071"
|
||||
dependencies = [
|
||||
"powerfmt",
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2149,12 +2155,6 @@ dependencies = [
|
||||
"crunchy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.5"
|
||||
@@ -2187,12 +2187,6 @@ version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "hex"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "hex-conservative"
|
||||
version = "0.2.1"
|
||||
@@ -2434,17 +2428,6 @@ version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown 0.12.3",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.11.4"
|
||||
@@ -3323,7 +3306,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9bc696688fc6cbab56971f02badc233541f964f4705240c986abc02535a3728e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"indexmap 2.11.4",
|
||||
"indexmap",
|
||||
"json-strip-comments",
|
||||
"libc",
|
||||
"once_cell",
|
||||
@@ -3418,7 +3401,7 @@ checksum = "7c10b7504559c08191c3881ef53fb671619c62c9cc26bd5e66274c68057e6ad3"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"compact_str",
|
||||
"indexmap 2.11.4",
|
||||
"indexmap",
|
||||
"itoa",
|
||||
"memchr",
|
||||
"oxc_allocator",
|
||||
@@ -3594,7 +3577,7 @@ checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455"
|
||||
dependencies = [
|
||||
"fixedbitset",
|
||||
"hashbrown 0.15.5",
|
||||
"indexmap 2.11.4",
|
||||
"indexmap",
|
||||
"serde",
|
||||
]
|
||||
|
||||
@@ -4034,7 +4017,7 @@ checksum = "35a640b26f007713818e9a9b65d34da1cf58538207b052916a83d80e43f3ffa4"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"hashbrown 0.15.5",
|
||||
"indexmap 2.11.4",
|
||||
"indexmap",
|
||||
"munge",
|
||||
"ptr_meta",
|
||||
"rancor",
|
||||
@@ -4143,18 +4126,6 @@ dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "schemars"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f"
|
||||
dependencies = [
|
||||
"dyn-clone",
|
||||
"ref-cast",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "schemars"
|
||||
version = "1.0.4"
|
||||
@@ -4163,7 +4134,7 @@ checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"dyn-clone",
|
||||
"indexmap 2.11.4",
|
||||
"indexmap",
|
||||
"ref-cast",
|
||||
"schemars_derive",
|
||||
"serde",
|
||||
@@ -4314,7 +4285,7 @@ version = "1.0.145"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c"
|
||||
dependencies = [
|
||||
"indexmap 2.11.4",
|
||||
"indexmap",
|
||||
"itoa",
|
||||
"memchr",
|
||||
"ryu",
|
||||
@@ -4367,37 +4338,6 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_with"
|
||||
version = "3.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6093cd8c01b25262b84927e0f7151692158fab02d961e04c979d3903eba7ecc5"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"chrono",
|
||||
"hex",
|
||||
"indexmap 1.9.3",
|
||||
"indexmap 2.11.4",
|
||||
"schemars 0.9.0",
|
||||
"schemars 1.0.4",
|
||||
"serde_core",
|
||||
"serde_json",
|
||||
"serde_with_macros",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_with_macros"
|
||||
version = "3.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7e6c180db0816026a61afa1cff5344fb7ebded7e4d3062772179f2501481c27"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.106",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha1"
|
||||
version = "0.10.6"
|
||||
@@ -4727,12 +4667,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d"
|
||||
dependencies = [
|
||||
"deranged",
|
||||
"itoa",
|
||||
"num-conv",
|
||||
"powerfmt",
|
||||
"serde",
|
||||
"time-core",
|
||||
"time-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4741,16 +4679,6 @@ version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b"
|
||||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.2.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3"
|
||||
dependencies = [
|
||||
"num-conv",
|
||||
"time-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinystr"
|
||||
version = "0.8.1"
|
||||
@@ -4835,7 +4763,7 @@ version = "0.9.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00e5e5d9bf2475ac9d4f0d9edab68cc573dc2fd644b0dba36b0c30a92dd9eaa0"
|
||||
dependencies = [
|
||||
"indexmap 2.11.4",
|
||||
"indexmap",
|
||||
"serde_core",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
@@ -4859,7 +4787,7 @@ version = "0.23.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3effe7c0e86fdff4f69cdd2ccc1b96f933e24811c5441d44904e8683e27184b"
|
||||
dependencies = [
|
||||
"indexmap 2.11.4",
|
||||
"indexmap",
|
||||
"toml_datetime",
|
||||
"toml_parser",
|
||||
"winnow",
|
||||
@@ -5778,7 +5706,7 @@ dependencies = [
|
||||
"arbitrary",
|
||||
"crc32fast",
|
||||
"flate2",
|
||||
"indexmap 2.11.4",
|
||||
"indexmap",
|
||||
"memchr",
|
||||
"zopfli",
|
||||
]
|
||||
|
||||
@@ -52,6 +52,7 @@ brk_cli = { version = "0.0.111", path = "crates/brk_cli" }
|
||||
brk_computer = { version = "0.0.111", path = "crates/brk_computer" }
|
||||
brk_error = { version = "0.0.111", path = "crates/brk_error" }
|
||||
brk_fetcher = { version = "0.0.111", path = "crates/brk_fetcher" }
|
||||
brk_grouper = { version = "0.0.111", path = "crates/brk_grouper" }
|
||||
brk_indexer = { version = "0.0.111", path = "crates/brk_indexer" }
|
||||
brk_interface = { version = "0.0.111", path = "crates/brk_interface" }
|
||||
brk_logger = { version = "0.0.111", path = "crates/brk_logger" }
|
||||
|
||||
@@ -13,19 +13,20 @@ build = "build.rs"
|
||||
allocative = { workspace = true }
|
||||
bitcoin = { workspace = true }
|
||||
bitcoincore-rpc = { workspace = true }
|
||||
brk_structs = { workspace = true }
|
||||
brk_error = { workspace = true }
|
||||
brk_fetcher = { workspace = true }
|
||||
brk_grouper = { workspace = true }
|
||||
brk_indexer = { workspace = true }
|
||||
brk_logger = { workspace = true }
|
||||
brk_store = { workspace = true }
|
||||
brk_parser = { workspace = true }
|
||||
brk_store = { workspace = true }
|
||||
brk_structs = { workspace = true }
|
||||
brk_traversable = { workspace = true }
|
||||
vecdb = { workspace = true }
|
||||
derive_deref = { workspace = true }
|
||||
log = { workspace = true }
|
||||
pco = "0.4.6"
|
||||
rayon = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
vecdb = { workspace = true }
|
||||
zerocopy = { workspace = true }
|
||||
zerocopy-derive = { workspace = true }
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
use std::path::Path;
|
||||
|
||||
use brk_error::Result;
|
||||
use brk_structs::{
|
||||
AddressGroups, Bitcoin, ByAmountRange, ByGreatEqualAmount, ByLowerThanAmount, DateIndex,
|
||||
Dollars, Filtered, Height, Version,
|
||||
};
|
||||
use brk_grouper::{AddressGroups, ByAmountRange, ByGreatEqualAmount, ByLowerThanAmount, Filtered};
|
||||
use brk_structs::{Bitcoin, DateIndex, Dollars, Height, Version};
|
||||
use brk_traversable::Traversable;
|
||||
use derive_deref::{Deref, DerefMut};
|
||||
use vecdb::{AnyIterableVec, Database, Exit, Format};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use brk_structs::{ByAddressType, Height};
|
||||
use brk_grouper::ByAddressType;
|
||||
use brk_structs::Height;
|
||||
use derive_deref::{Deref, DerefMut};
|
||||
use vecdb::VecIterator;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use brk_error::Result;
|
||||
use brk_structs::{ByAddressType, Height, StoredU64};
|
||||
use brk_grouper::ByAddressType;
|
||||
use brk_structs::{Height, StoredU64};
|
||||
use brk_traversable::Traversable;
|
||||
use derive_deref::{Deref, DerefMut};
|
||||
use vecdb::{EagerVec, Exit, GenericStoredVec};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use brk_error::Result;
|
||||
use brk_structs::{ByAddressType, StoredU64};
|
||||
use brk_grouper::ByAddressType;
|
||||
use brk_structs::StoredU64;
|
||||
use brk_traversable::Traversable;
|
||||
use derive_deref::{Deref, DerefMut};
|
||||
use vecdb::Exit;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::{collections::BTreeMap, mem};
|
||||
|
||||
use brk_structs::{ByAddressType, TypeIndex};
|
||||
use brk_grouper::ByAddressType;
|
||||
use brk_structs::TypeIndex;
|
||||
use derive_deref::{Deref, DerefMut};
|
||||
|
||||
#[derive(Debug, Deref, DerefMut)]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::mem;
|
||||
|
||||
use brk_structs::ByAddressType;
|
||||
use brk_grouper::ByAddressType;
|
||||
use derive_deref::{Deref, DerefMut};
|
||||
|
||||
#[derive(Debug, Deref, DerefMut)]
|
||||
|
||||
@@ -7,13 +7,14 @@ use std::{
|
||||
};
|
||||
|
||||
use brk_error::Result;
|
||||
use brk_grouper::{ByAddressType, ByAnyAddress, Filtered};
|
||||
use brk_indexer::Indexer;
|
||||
use brk_structs::{
|
||||
AnyAddressDataIndexEnum, AnyAddressIndex, ByAddressType, ByAnyAddress, CheckedSub, DateIndex,
|
||||
Dollars, EmptyAddressData, EmptyAddressIndex, Filtered, Height, InputIndex, LoadedAddressData,
|
||||
LoadedAddressIndex, OutputIndex, OutputType, P2AAddressIndex, P2PK33AddressIndex,
|
||||
P2PK65AddressIndex, P2PKHAddressIndex, P2SHAddressIndex, P2TRAddressIndex, P2WPKHAddressIndex,
|
||||
P2WSHAddressIndex, Sats, StoredU64, Timestamp, TypeIndex, Version,
|
||||
AnyAddressDataIndexEnum, AnyAddressIndex, CheckedSub, DateIndex, Dollars, EmptyAddressData,
|
||||
EmptyAddressIndex, Height, InputIndex, LoadedAddressData, LoadedAddressIndex, OutputIndex,
|
||||
OutputType, P2AAddressIndex, P2PK33AddressIndex, P2PK65AddressIndex, P2PKHAddressIndex,
|
||||
P2SHAddressIndex, P2TRAddressIndex, P2WPKHAddressIndex, P2WSHAddressIndex, Sats, StoredU64,
|
||||
Timestamp, TypeIndex, Version,
|
||||
};
|
||||
use brk_traversable::Traversable;
|
||||
use log::info;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
use std::{collections::BTreeMap, ops::ControlFlow, path::Path};
|
||||
|
||||
use brk_error::Result;
|
||||
use brk_grouper::{
|
||||
ByAgeRange, ByAmountRange, ByEpoch, ByGreatEqualAmount, ByLowerThanAmount, ByMaxAge, ByMinAge,
|
||||
BySpendableType, ByTerm, Filter, Filtered, UTXOGroups,
|
||||
};
|
||||
use brk_structs::{
|
||||
Bitcoin, ByAgeRange, ByAmountRange, ByEpoch, ByGreatEqualAmount, ByLowerThanAmount, ByMaxAge,
|
||||
ByMinAge, BySpendableType, ByTerm, CheckedSub, DateIndex, Dollars, Filter, Filtered,
|
||||
HalvingEpoch, Height, Timestamp, UTXOGroups, Version,
|
||||
Bitcoin, CheckedSub, DateIndex, Dollars, HalvingEpoch, Height, Timestamp, Version,
|
||||
};
|
||||
use brk_traversable::Traversable;
|
||||
use derive_deref::{Deref, DerefMut};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::ops::{Add, AddAssign};
|
||||
|
||||
use brk_structs::{ByAmountRange, GroupedByType, OutputType, Sats};
|
||||
use brk_grouper::{ByAmountRange, GroupedByType};
|
||||
use brk_structs::{OutputType, Sats};
|
||||
|
||||
use super::SupplyState;
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "brk_grouper"
|
||||
description = "Groups used throughout BRK"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
brk_structs = { workspace = true }
|
||||
brk_traversable = { workspace = true }
|
||||
vecdb = { workspace = true }
|
||||
@@ -0,0 +1 @@
|
||||
# brk_grouper
|
||||
@@ -0,0 +1,8 @@
|
||||
fn main() {
|
||||
let profile = std::env::var("PROFILE").unwrap_or_default();
|
||||
|
||||
if profile == "release" {
|
||||
println!("cargo:rustc-flag=-C");
|
||||
println!("cargo:rustc-flag=target-cpu=native");
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
use std::ops::{Add, AddAssign};
|
||||
|
||||
use brk_structs::OutputType;
|
||||
use brk_traversable::{Traversable, TreeNode};
|
||||
use vecdb::AnyCollectableVec;
|
||||
|
||||
use super::Filter;
|
||||
use crate::{Filtered, OutputType};
|
||||
use super::{Filter, Filtered};
|
||||
|
||||
#[derive(Default, Clone, Debug)]
|
||||
pub struct ByAddressType<T> {
|
||||
+2
-3
@@ -1,10 +1,9 @@
|
||||
use std::ops::{Add, AddAssign};
|
||||
|
||||
use brk_structs::Sats;
|
||||
use brk_traversable::Traversable;
|
||||
|
||||
use crate::{Filtered, Sats};
|
||||
|
||||
use super::Filter;
|
||||
use super::{Filter, Filtered};
|
||||
|
||||
#[derive(Debug, Default, Clone, Traversable)]
|
||||
pub struct ByAmountRange<T> {
|
||||
@@ -1,8 +1,7 @@
|
||||
use brk_structs::{HalvingEpoch, Height};
|
||||
use brk_traversable::Traversable;
|
||||
|
||||
use crate::{Filtered, HalvingEpoch, Height};
|
||||
|
||||
use super::Filter;
|
||||
use super::{Filter, Filtered};
|
||||
|
||||
#[derive(Default, Clone, Traversable)]
|
||||
pub struct ByEpoch<T> {
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
use brk_structs::Sats;
|
||||
use brk_traversable::Traversable;
|
||||
|
||||
use crate::{Filtered, Sats};
|
||||
|
||||
use super::Filter;
|
||||
use super::{Filter, Filtered};
|
||||
|
||||
#[derive(Default, Clone, Traversable)]
|
||||
pub struct ByGreatEqualAmount<T> {
|
||||
+2
-3
@@ -1,8 +1,7 @@
|
||||
use brk_structs::Sats;
|
||||
use brk_traversable::Traversable;
|
||||
|
||||
use crate::{Filtered, Sats};
|
||||
|
||||
use super::Filter;
|
||||
use super::{Filter, Filtered};
|
||||
|
||||
#[derive(Default, Clone, Traversable)]
|
||||
pub struct ByLowerThanAmount<T> {
|
||||
+2
-3
@@ -1,10 +1,9 @@
|
||||
use std::ops::{Add, AddAssign};
|
||||
|
||||
use brk_structs::OutputType;
|
||||
use brk_traversable::Traversable;
|
||||
|
||||
use crate::{Filtered, OutputType};
|
||||
|
||||
use super::Filter;
|
||||
use super::{Filter, Filtered};
|
||||
|
||||
#[derive(Default, Clone, Debug, Traversable)]
|
||||
pub struct BySpendableType<T> {
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::ops::{Add, AddAssign};
|
||||
|
||||
use crate::OutputType;
|
||||
use brk_structs::OutputType;
|
||||
|
||||
use super::{BySpendableType, ByUnspendableType};
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
use std::ops::Range;
|
||||
|
||||
use brk_structs::{HalvingEpoch, OutputType};
|
||||
use brk_traversable::{Traversable, TreeNode};
|
||||
use vecdb::AnyCollectableVec;
|
||||
|
||||
use crate::{HalvingEpoch, OutputType};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum Filter {
|
||||
All,
|
||||
@@ -1,3 +1,5 @@
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
||||
mod address;
|
||||
mod by_address_type;
|
||||
mod by_age_range;
|
||||
@@ -12,13 +12,14 @@ build = "build.rs"
|
||||
[dependencies]
|
||||
bitcoin = { workspace = true }
|
||||
bitcoincore-rpc = { workspace = true }
|
||||
brk_structs = { workspace = true }
|
||||
brk_error = { workspace = true }
|
||||
brk_grouper = { workspace = true }
|
||||
brk_logger = { workspace = true }
|
||||
brk_parser = { workspace = true }
|
||||
brk_store = { workspace = true }
|
||||
brk_structs = { workspace = true }
|
||||
brk_traversable = { workspace = true }
|
||||
vecdb = { workspace = true }
|
||||
fjall = { workspace = true }
|
||||
log = { workspace = true }
|
||||
rayon = { workspace = true }
|
||||
vecdb = { workspace = true }
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use std::{borrow::Cow, fs, path::Path, thread};
|
||||
|
||||
use brk_error::Result;
|
||||
use brk_grouper::ByAddressType;
|
||||
use brk_store::{AnyStore, Store};
|
||||
use brk_structs::{
|
||||
AddressBytes, AddressBytesHash, BlockHashPrefix, ByAddressType, Height, OutputIndex,
|
||||
OutputType, StoredString, TxIndex, TxidPrefix, TypeIndex, TypeIndexWithOutputindex, Unit,
|
||||
Version,
|
||||
AddressBytes, AddressBytesHash, BlockHashPrefix, Height, OutputIndex, OutputType, StoredString,
|
||||
TxIndex, TxidPrefix, TypeIndex, TypeIndexWithOutputindex, Unit, Version,
|
||||
};
|
||||
use fjall::{PersistMode, TransactionalKeyspace};
|
||||
use rayon::prelude::*;
|
||||
|
||||
@@ -23,6 +23,4 @@ quick_cache = { workspace = true }
|
||||
schemars = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
sonic-rs = { workspace = true }
|
||||
serde_with = "3.15.0"
|
||||
nucleo-matcher = "0.3.1"
|
||||
|
||||
@@ -83,14 +83,18 @@ impl<'a> Vecs<'a> {
|
||||
this.index_to_metrics
|
||||
.values_mut()
|
||||
.for_each(|ids| sort_ids(ids));
|
||||
this.catalog.replace(TreeNode::Branch(
|
||||
[
|
||||
("indexer".to_string(), indexer.vecs.to_tree_node()),
|
||||
("computer".to_string(), computer.to_tree_node()),
|
||||
]
|
||||
.into_iter()
|
||||
.collect(),
|
||||
));
|
||||
this.catalog.replace(
|
||||
TreeNode::Branch(
|
||||
[
|
||||
("indexer".to_string(), indexer.vecs.to_tree_node()),
|
||||
("computer".to_string(), computer.to_tree_node()),
|
||||
]
|
||||
.into_iter()
|
||||
.collect(),
|
||||
)
|
||||
.simplify()
|
||||
.unwrap(),
|
||||
);
|
||||
|
||||
this
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ allocative = { workspace = true }
|
||||
bitcoin = { workspace = true }
|
||||
bitcoincore-rpc = { workspace = true }
|
||||
brk_error = { workspace = true }
|
||||
brk_traversable = { workspace = true }
|
||||
byteview = { workspace = true }
|
||||
derive_deref = { workspace = true }
|
||||
itoa = "1.0.15"
|
||||
|
||||
+1
-4
@@ -1,10 +1,7 @@
|
||||
use serde::Serialize;
|
||||
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
|
||||
|
||||
use crate::{
|
||||
TypeIndex,
|
||||
structs::{EmptyAddressIndex, LoadedAddressIndex},
|
||||
};
|
||||
use crate::{EmptyAddressIndex, LoadedAddressIndex, TypeIndex};
|
||||
|
||||
const MIN_EMPTY_INDEX: u32 = u32::MAX - 4_000_000_000;
|
||||
|
||||
@@ -1,9 +1,175 @@
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
||||
mod groups;
|
||||
mod structs;
|
||||
|
||||
pub use groups::*;
|
||||
pub use structs::*;
|
||||
|
||||
pub use vecdb::{CheckedSub, Exit, PrintableIndex, Version};
|
||||
|
||||
use brk_error::{Error, Result};
|
||||
|
||||
mod addressbytes;
|
||||
mod addressbyteshash;
|
||||
mod anyaddressindex;
|
||||
mod bitcoin;
|
||||
mod blkmetadata;
|
||||
mod blkposition;
|
||||
mod block;
|
||||
mod blockhash;
|
||||
mod blockhashprefix;
|
||||
mod cents;
|
||||
mod date;
|
||||
mod dateindex;
|
||||
mod decadeindex;
|
||||
mod difficultyepoch;
|
||||
mod dollars;
|
||||
mod emptyaddressdata;
|
||||
mod emptyaddressindex;
|
||||
mod emptyoutputindex;
|
||||
mod feerate;
|
||||
mod halvingepoch;
|
||||
mod height;
|
||||
mod index;
|
||||
mod indexinfo;
|
||||
mod inputindex;
|
||||
mod loadedaddressdata;
|
||||
mod loadedaddressindex;
|
||||
mod monthindex;
|
||||
mod ohlc;
|
||||
mod opreturnindex;
|
||||
mod outputindex;
|
||||
mod outputtype;
|
||||
mod p2aaddressindex;
|
||||
mod p2msoutputindex;
|
||||
mod p2pk33addressindex;
|
||||
mod p2pk65addressindex;
|
||||
mod p2pkhaddressindex;
|
||||
mod p2shaddressindex;
|
||||
mod p2traddressindex;
|
||||
mod p2wpkhaddressindex;
|
||||
mod p2wshaddressindex;
|
||||
mod pool;
|
||||
mod poolid;
|
||||
mod pools;
|
||||
mod quarterindex;
|
||||
mod rawlocktime;
|
||||
mod sats;
|
||||
mod semesterindex;
|
||||
mod stored_bool;
|
||||
mod stored_f32;
|
||||
mod stored_f64;
|
||||
mod stored_i16;
|
||||
mod stored_string;
|
||||
mod stored_u16;
|
||||
mod stored_u32;
|
||||
mod stored_u64;
|
||||
mod stored_u8;
|
||||
mod timestamp;
|
||||
mod treenode;
|
||||
mod txid;
|
||||
mod txidprefix;
|
||||
mod txindex;
|
||||
mod txversion;
|
||||
mod typeindex;
|
||||
mod typeindex_with_outputindex;
|
||||
mod unit;
|
||||
mod unknownoutputindex;
|
||||
mod vin;
|
||||
mod vout;
|
||||
mod weekindex;
|
||||
mod weight;
|
||||
mod yearindex;
|
||||
|
||||
pub use addressbytes::*;
|
||||
pub use addressbyteshash::*;
|
||||
pub use anyaddressindex::*;
|
||||
pub use bitcoin::*;
|
||||
pub use blkmetadata::*;
|
||||
pub use blkposition::*;
|
||||
pub use block::*;
|
||||
pub use blockhash::*;
|
||||
pub use blockhashprefix::*;
|
||||
pub use cents::*;
|
||||
pub use date::*;
|
||||
pub use dateindex::*;
|
||||
pub use decadeindex::*;
|
||||
pub use difficultyepoch::*;
|
||||
pub use dollars::*;
|
||||
pub use emptyaddressdata::*;
|
||||
pub use emptyaddressindex::*;
|
||||
pub use emptyoutputindex::*;
|
||||
pub use feerate::*;
|
||||
pub use halvingepoch::*;
|
||||
pub use height::*;
|
||||
pub use index::*;
|
||||
pub use indexinfo::*;
|
||||
pub use inputindex::*;
|
||||
pub use loadedaddressdata::*;
|
||||
pub use loadedaddressindex::*;
|
||||
pub use monthindex::*;
|
||||
pub use ohlc::*;
|
||||
pub use opreturnindex::*;
|
||||
pub use outputindex::*;
|
||||
pub use outputtype::*;
|
||||
pub use p2aaddressindex::*;
|
||||
pub use p2msoutputindex::*;
|
||||
pub use p2pk33addressindex::*;
|
||||
pub use p2pk65addressindex::*;
|
||||
pub use p2pkhaddressindex::*;
|
||||
pub use p2shaddressindex::*;
|
||||
pub use p2traddressindex::*;
|
||||
pub use p2wpkhaddressindex::*;
|
||||
pub use p2wshaddressindex::*;
|
||||
pub use pool::*;
|
||||
pub use poolid::*;
|
||||
pub use pools::*;
|
||||
pub use quarterindex::*;
|
||||
pub use rawlocktime::*;
|
||||
pub use sats::*;
|
||||
pub use semesterindex::*;
|
||||
pub use stored_bool::*;
|
||||
pub use stored_f32::*;
|
||||
pub use stored_f64::*;
|
||||
pub use stored_i16::*;
|
||||
pub use stored_string::*;
|
||||
pub use stored_u8::*;
|
||||
pub use stored_u16::*;
|
||||
pub use stored_u32::*;
|
||||
pub use stored_u64::*;
|
||||
pub use timestamp::*;
|
||||
pub use treenode::*;
|
||||
pub use txid::*;
|
||||
pub use txidprefix::*;
|
||||
pub use txindex::*;
|
||||
pub use txversion::*;
|
||||
pub use typeindex::*;
|
||||
pub use typeindex_with_outputindex::*;
|
||||
pub use unit::*;
|
||||
pub use unknownoutputindex::*;
|
||||
pub use vin::*;
|
||||
pub use vout::*;
|
||||
pub use weekindex::*;
|
||||
pub use weight::*;
|
||||
pub use yearindex::*;
|
||||
|
||||
#[allow(clippy::result_unit_err)]
|
||||
pub fn copy_first_4bytes(slice: &[u8]) -> Result<[u8; 4]> {
|
||||
let mut buf: [u8; 4] = [0; 4];
|
||||
let buf_len = buf.len();
|
||||
if slice.len() < buf_len {
|
||||
return Err(Error::Str("Buffer is too small to convert to 8 bytes"));
|
||||
}
|
||||
slice.iter().take(buf_len).enumerate().for_each(|(i, r)| {
|
||||
buf[i] = *r;
|
||||
});
|
||||
Ok(buf)
|
||||
}
|
||||
|
||||
#[allow(clippy::result_unit_err)]
|
||||
pub fn copy_first_8bytes(slice: &[u8]) -> Result<[u8; 8]> {
|
||||
let mut buf: [u8; 8] = [0; 8];
|
||||
let buf_len = buf.len();
|
||||
if slice.len() < buf_len {
|
||||
return Err(Error::Str("Buffer is too small to convert to 8 bytes"));
|
||||
}
|
||||
slice.iter().take(buf_len).enumerate().for_each(|(i, r)| {
|
||||
buf[i] = *r;
|
||||
});
|
||||
Ok(buf)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ use allocative::Allocative;
|
||||
|
||||
use crate::{JSONPool, PoolId};
|
||||
|
||||
use super::super::Pool;
|
||||
use super::Pool;
|
||||
|
||||
const POOL_COUNT: usize = 158;
|
||||
|
||||
@@ -1,171 +0,0 @@
|
||||
use brk_error::{Error, Result};
|
||||
|
||||
mod addressbytes;
|
||||
mod addressbyteshash;
|
||||
mod anyaddressindex;
|
||||
mod bitcoin;
|
||||
mod blkmetadata;
|
||||
mod blkposition;
|
||||
mod block;
|
||||
mod blockhash;
|
||||
mod blockhashprefix;
|
||||
mod cents;
|
||||
mod date;
|
||||
mod dateindex;
|
||||
mod decadeindex;
|
||||
mod difficultyepoch;
|
||||
mod dollars;
|
||||
mod emptyaddressdata;
|
||||
mod emptyaddressindex;
|
||||
mod emptyoutputindex;
|
||||
mod feerate;
|
||||
mod halvingepoch;
|
||||
mod height;
|
||||
mod index;
|
||||
mod indexinfo;
|
||||
mod inputindex;
|
||||
mod loadedaddressdata;
|
||||
mod loadedaddressindex;
|
||||
mod monthindex;
|
||||
mod ohlc;
|
||||
mod opreturnindex;
|
||||
mod outputindex;
|
||||
mod outputtype;
|
||||
mod p2aaddressindex;
|
||||
mod p2msoutputindex;
|
||||
mod p2pk33addressindex;
|
||||
mod p2pk65addressindex;
|
||||
mod p2pkhaddressindex;
|
||||
mod p2shaddressindex;
|
||||
mod p2traddressindex;
|
||||
mod p2wpkhaddressindex;
|
||||
mod p2wshaddressindex;
|
||||
mod pool;
|
||||
mod poolid;
|
||||
mod pools;
|
||||
mod quarterindex;
|
||||
mod rawlocktime;
|
||||
mod sats;
|
||||
mod semesterindex;
|
||||
mod stored_bool;
|
||||
mod stored_f32;
|
||||
mod stored_f64;
|
||||
mod stored_i16;
|
||||
mod stored_string;
|
||||
mod stored_u16;
|
||||
mod stored_u32;
|
||||
mod stored_u64;
|
||||
mod stored_u8;
|
||||
mod timestamp;
|
||||
mod treenode;
|
||||
mod txid;
|
||||
mod txidprefix;
|
||||
mod txindex;
|
||||
mod txversion;
|
||||
mod typeindex;
|
||||
mod typeindex_with_outputindex;
|
||||
mod unit;
|
||||
mod unknownoutputindex;
|
||||
mod vin;
|
||||
mod vout;
|
||||
mod weekindex;
|
||||
mod weight;
|
||||
mod yearindex;
|
||||
|
||||
pub use addressbytes::*;
|
||||
pub use addressbyteshash::*;
|
||||
pub use anyaddressindex::*;
|
||||
pub use bitcoin::*;
|
||||
pub use blkmetadata::*;
|
||||
pub use blkposition::*;
|
||||
pub use block::*;
|
||||
pub use blockhash::*;
|
||||
pub use blockhashprefix::*;
|
||||
pub use cents::*;
|
||||
pub use date::*;
|
||||
pub use dateindex::*;
|
||||
pub use decadeindex::*;
|
||||
pub use difficultyepoch::*;
|
||||
pub use dollars::*;
|
||||
pub use emptyaddressdata::*;
|
||||
pub use emptyaddressindex::*;
|
||||
pub use emptyoutputindex::*;
|
||||
pub use feerate::*;
|
||||
pub use halvingepoch::*;
|
||||
pub use height::*;
|
||||
pub use index::*;
|
||||
pub use indexinfo::*;
|
||||
pub use inputindex::*;
|
||||
pub use loadedaddressdata::*;
|
||||
pub use loadedaddressindex::*;
|
||||
pub use monthindex::*;
|
||||
pub use ohlc::*;
|
||||
pub use opreturnindex::*;
|
||||
pub use outputindex::*;
|
||||
pub use outputtype::*;
|
||||
pub use p2aaddressindex::*;
|
||||
pub use p2msoutputindex::*;
|
||||
pub use p2pk33addressindex::*;
|
||||
pub use p2pk65addressindex::*;
|
||||
pub use p2pkhaddressindex::*;
|
||||
pub use p2shaddressindex::*;
|
||||
pub use p2traddressindex::*;
|
||||
pub use p2wpkhaddressindex::*;
|
||||
pub use p2wshaddressindex::*;
|
||||
pub use pool::*;
|
||||
pub use poolid::*;
|
||||
pub use pools::*;
|
||||
pub use quarterindex::*;
|
||||
pub use rawlocktime::*;
|
||||
pub use sats::*;
|
||||
pub use semesterindex::*;
|
||||
pub use stored_bool::*;
|
||||
pub use stored_f32::*;
|
||||
pub use stored_f64::*;
|
||||
pub use stored_i16::*;
|
||||
pub use stored_string::*;
|
||||
pub use stored_u8::*;
|
||||
pub use stored_u16::*;
|
||||
pub use stored_u32::*;
|
||||
pub use stored_u64::*;
|
||||
pub use timestamp::*;
|
||||
pub use treenode::*;
|
||||
pub use txid::*;
|
||||
pub use txidprefix::*;
|
||||
pub use txindex::*;
|
||||
pub use txversion::*;
|
||||
pub use typeindex::*;
|
||||
pub use typeindex_with_outputindex::*;
|
||||
pub use unit::*;
|
||||
pub use unknownoutputindex::*;
|
||||
pub use vin::*;
|
||||
pub use vout::*;
|
||||
pub use weekindex::*;
|
||||
pub use weight::*;
|
||||
pub use yearindex::*;
|
||||
|
||||
#[allow(clippy::result_unit_err)]
|
||||
pub fn copy_first_4bytes(slice: &[u8]) -> Result<[u8; 4]> {
|
||||
let mut buf: [u8; 4] = [0; 4];
|
||||
let buf_len = buf.len();
|
||||
if slice.len() < buf_len {
|
||||
return Err(Error::Str("Buffer is too small to convert to 8 bytes"));
|
||||
}
|
||||
slice.iter().take(buf_len).enumerate().for_each(|(i, r)| {
|
||||
buf[i] = *r;
|
||||
});
|
||||
Ok(buf)
|
||||
}
|
||||
|
||||
#[allow(clippy::result_unit_err)]
|
||||
pub fn copy_first_8bytes(slice: &[u8]) -> Result<[u8; 8]> {
|
||||
let mut buf: [u8; 8] = [0; 8];
|
||||
let buf_len = buf.len();
|
||||
if slice.len() < buf_len {
|
||||
return Err(Error::Str("Buffer is too small to convert to 8 bytes"));
|
||||
}
|
||||
slice.iter().take(buf_len).enumerate().for_each(|(i, r)| {
|
||||
buf[i] = *r;
|
||||
});
|
||||
Ok(buf)
|
||||
}
|
||||
@@ -1,3 +1,10 @@
|
||||
use std::{collections::BTreeMap, sync::LazyLock};
|
||||
|
||||
use schemars::JsonSchema;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::Index;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, PartialEq, Eq, JsonSchema)]
|
||||
#[serde(untagged)]
|
||||
/// Hierarchical tree node for organizing metrics into categories
|
||||
@@ -9,6 +16,17 @@ pub enum TreeNode {
|
||||
Leaf(String),
|
||||
}
|
||||
|
||||
const BASE: &str = "base";
|
||||
|
||||
/// List of prefixes to remove during simplification
|
||||
static PREFIXES: LazyLock<Vec<String>> = LazyLock::new(|| {
|
||||
["indexes", "timeindexes", "chainindexes"]
|
||||
.into_iter()
|
||||
.chain(Index::all().iter().map(|i| i.serialize_long()))
|
||||
.map(|s| format!("{s}_to_"))
|
||||
.collect()
|
||||
});
|
||||
|
||||
impl TreeNode {
|
||||
pub fn is_empty(&self) -> bool {
|
||||
if let Self::Branch(tree) = self {
|
||||
@@ -18,8 +36,15 @@ impl TreeNode {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_mut_branch(&mut self) -> &mut BTreeMap<String, TreeNode> {
|
||||
match self {
|
||||
Self::Branch(b) => b,
|
||||
_ => panic!(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Merges all first-level branches into a single flattened structure.
|
||||
/// Root-level leaves are placed under "default" key.
|
||||
/// Root-level leaves are placed under BASE key.
|
||||
/// Returns None if conflicts are found (same key with incompatible values).
|
||||
pub fn merge_branches(&self) -> Option<Self> {
|
||||
let Self::Branch(tree) = self else {
|
||||
@@ -31,7 +56,7 @@ impl TreeNode {
|
||||
for node in tree.values() {
|
||||
match node {
|
||||
Self::Leaf(value) => {
|
||||
Self::merge_node(&mut merged, "base", &Self::Leaf(value.clone()))?;
|
||||
Self::merge_node(&mut merged, BASE, &Self::Leaf(value.clone()))?;
|
||||
}
|
||||
Self::Branch(inner) => {
|
||||
for (key, inner_node) in inner {
|
||||
@@ -86,20 +111,35 @@ impl TreeNode {
|
||||
target.insert(key.to_string(), node.clone());
|
||||
Some(())
|
||||
}
|
||||
Some(existing) => match (existing, node) {
|
||||
Some(existing) => match (&existing, node) {
|
||||
// Same leaf values: ok
|
||||
(Self::Leaf(a), Self::Leaf(b)) if a == b => Some(()),
|
||||
// Different leaf values: conflict
|
||||
(Self::Leaf(_), Self::Leaf(_)) => None,
|
||||
// Leaf vs branch: conflict
|
||||
(Self::Leaf(_), Self::Branch(_)) | (Self::Branch(_), Self::Leaf(_)) => {
|
||||
// dbg!((&existing, &node));
|
||||
(Self::Leaf(a), Self::Leaf(b)) => {
|
||||
eprintln!("Conflict: Different leaf values for key '{key}'");
|
||||
eprintln!(" Existing: {a:?}");
|
||||
eprintln!(" New: {b:?}");
|
||||
None
|
||||
}
|
||||
(Self::Leaf(leaf), Self::Branch(branch)) => {
|
||||
let mut new_branch = BTreeMap::new();
|
||||
new_branch.insert(BASE.to_string(), Self::Leaf(leaf.clone()));
|
||||
|
||||
for (k, v) in branch {
|
||||
Self::merge_node(&mut new_branch, k, v)?;
|
||||
}
|
||||
|
||||
*existing = Self::Branch(new_branch);
|
||||
Some(())
|
||||
}
|
||||
(Self::Branch(_), Self::Leaf(leaf)) => {
|
||||
Self::merge_node(existing.as_mut_branch(), BASE, &Self::Leaf(leaf.clone()))?;
|
||||
Some(())
|
||||
}
|
||||
// Both branches: merge recursively
|
||||
(Self::Branch(existing_inner), Self::Branch(new_inner)) => {
|
||||
(Self::Branch(_), Self::Branch(new_inner)) => {
|
||||
for (k, v) in new_inner {
|
||||
Self::merge_node(existing_inner, k, v)?;
|
||||
Self::merge_node(existing.as_mut_branch(), k, v)?;
|
||||
}
|
||||
Some(())
|
||||
}
|
||||
@@ -107,20 +147,6 @@ impl TreeNode {
|
||||
}
|
||||
}
|
||||
|
||||
/// List of prefixes to remove during simplification
|
||||
const PREFIXES: &'static [&'static str] = &[
|
||||
"indexes_to_",
|
||||
"chainindexes_to_",
|
||||
"timeindexes_to_",
|
||||
"txindex_to_",
|
||||
"height_to_",
|
||||
"dateindex_to_",
|
||||
"weekindex_to_",
|
||||
"difficultyepoch_to_",
|
||||
"halvingepoch_to_",
|
||||
// Add more prefixes here
|
||||
];
|
||||
|
||||
/// Recursively simplifies the tree by removing known prefixes from keys.
|
||||
/// If multiple keys map to the same simplified name, checks for conflicts.
|
||||
/// Returns None if there are conflicts (same simplified key, different values).
|
||||
@@ -135,7 +161,7 @@ impl TreeNode {
|
||||
let simplified_node = node.simplify()?;
|
||||
|
||||
// Remove prefixes from the key
|
||||
let simplified_key = Self::PREFIXES
|
||||
let simplified_key = PREFIXES
|
||||
.iter()
|
||||
.find_map(|prefix| key.strip_prefix(prefix))
|
||||
.map(String::from)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user