computer: init lazy/eager

This commit is contained in:
nym21
2025-04-23 22:36:10 +02:00
parent 0a789fe551
commit 5ab6197356
22 changed files with 405 additions and 382 deletions

88
Cargo.lock generated
View File

@@ -1204,9 +1204,9 @@ dependencies = [
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.15" version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
@@ -1791,9 +1791,9 @@ checksum = "1036865bb9422d3300cf723f657c2851d0e9ab12567854b1f4eba3d77decf564"
[[package]] [[package]]
name = "oxc" name = "oxc"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "339134dd7e4bb36c2d0e97601fe4193b37649f729e94e7c26667feecd439b27e" checksum = "409ba57c4752b7fab9609af78790aadeb541316933d1525484dad877988622f6"
dependencies = [ dependencies = [
"oxc_allocator", "oxc_allocator",
"oxc_ast", "oxc_ast",
@@ -1834,9 +1834,9 @@ dependencies = [
[[package]] [[package]]
name = "oxc_allocator" name = "oxc_allocator"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56c3dd872f5f819775c28163977399a1dd4f2177f3745dcb1bfd4214bae27e43" checksum = "43fe5f8d34c351e3c90b512046dbfff2ff87c8a1927ebe6945f1cdefcc3219d0"
dependencies = [ dependencies = [
"allocator-api2", "allocator-api2",
"bumpalo", "bumpalo",
@@ -1848,9 +1848,9 @@ dependencies = [
[[package]] [[package]]
name = "oxc_ast" name = "oxc_ast"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1bebb401e36d73f35400ee9609ab6372b457543ce7bb1ef17c922235f24ba7b" checksum = "5ad2e9c3fb4b409b14fd791fbbf6ced9a81363364beedd48059bbb8f42bf4987"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cow-utils", "cow-utils",
@@ -1865,9 +1865,9 @@ dependencies = [
[[package]] [[package]]
name = "oxc_ast_macros" name = "oxc_ast_macros"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b997c2a787321814d6e92f212486b4d590af4dbfff5c2265d3b0386e016eafe" checksum = "578b69ed39d814cb8396674e17a0f94f1c02bc25d226b265c2913bd6e84afffb"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1876,9 +1876,9 @@ dependencies = [
[[package]] [[package]]
name = "oxc_ast_visit" name = "oxc_ast_visit"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1ee363bd1ff2000ae2a1052bb4d68e827e62f76e0139449ad1301ad9adc6ac4" checksum = "f437ca959bf931d5facbc6df77c7491a4aec32df5b9f647ffa19c52055a7dc56"
dependencies = [ dependencies = [
"oxc_allocator", "oxc_allocator",
"oxc_ast", "oxc_ast",
@@ -1888,9 +1888,9 @@ dependencies = [
[[package]] [[package]]
name = "oxc_cfg" name = "oxc_cfg"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77cb606168f768c747885ae48272287a028de5374db865c29d6d307d3b601a97" checksum = "ccecf0bce4034ebf17e7edb6f214fa0e6f8d134d1a3fb98408d6bcbef024a3a1"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"itertools", "itertools",
@@ -1903,9 +1903,9 @@ dependencies = [
[[package]] [[package]]
name = "oxc_codegen" name = "oxc_codegen"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4afef88d94fe9eee073332e3f908bd429baa989300d83152dab10dad99bd2a66" checksum = "e3361ed40dd6b4b6a7a4b44c175aa6beea68eefed68bc32a28684a0d1a00bc39"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cow-utils", "cow-utils",
@@ -1924,15 +1924,15 @@ dependencies = [
[[package]] [[package]]
name = "oxc_data_structures" name = "oxc_data_structures"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "235fe6251a3f06813e77b45f3cd9c7ec5d0a23741c33f6c308b5af393d5d2409" checksum = "0d2d64d2e627796f73e37ccb51f1f87cd9de612245ef3f790051855587d3734e"
[[package]] [[package]]
name = "oxc_diagnostics" name = "oxc_diagnostics"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cd0f62519773d942baf1a17474e53b535182182f2cb41319ad1c2782e34310d" checksum = "96ece1486240cfeec516eaaa7332c96decb3a756d72e504bb63393507996c39d"
dependencies = [ dependencies = [
"cow-utils", "cow-utils",
"oxc-miette", "oxc-miette",
@@ -1940,9 +1940,9 @@ dependencies = [
[[package]] [[package]]
name = "oxc_ecmascript" name = "oxc_ecmascript"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d073fdd2a3e1adb63731faab3c3861d0f9244cc15e88453d78460a4b2a604ca" checksum = "0d7d5ddf1cd783ed1a930ac6eedd4f73c6a5359beaabad7ee8333e366816291c"
dependencies = [ dependencies = [
"cow-utils", "cow-utils",
"num-bigint", "num-bigint",
@@ -1954,9 +1954,9 @@ dependencies = [
[[package]] [[package]]
name = "oxc_estree" name = "oxc_estree"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59df015cfd58d084b27d049281835094556a4469db3e2ac45b0676336e0aeed8" checksum = "62de94b10df7ab86a379f01b75076f6a762fc91a001678108318203fc0805ad9"
[[package]] [[package]]
name = "oxc_index" name = "oxc_index"
@@ -1966,9 +1966,9 @@ checksum = "2fa07b0cfa997730afed43705766ef27792873fdf5215b1391949fec678d2392"
[[package]] [[package]]
name = "oxc_mangler" name = "oxc_mangler"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dfc3363726f4ade77ba4d9e56cc38cc306436feee7b72e1c69436fb30c02b9b" checksum = "8d691c6609bca852ae1e0571de564de3b4d110a46c9877aa029e9dba56b76d1c"
dependencies = [ dependencies = [
"fixedbitset", "fixedbitset",
"itertools", "itertools",
@@ -1983,9 +1983,9 @@ dependencies = [
[[package]] [[package]]
name = "oxc_minifier" name = "oxc_minifier"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f095580f12a6277d4cb532310ba95cc6d1f719b6c59341fb392b71e37d1207e6" checksum = "294aa5790cc0beae7018d99dc5b389d373725ef7ea7ecef5d0ed18794b3414b3"
dependencies = [ dependencies = [
"cow-utils", "cow-utils",
"oxc_allocator", "oxc_allocator",
@@ -2005,9 +2005,9 @@ dependencies = [
[[package]] [[package]]
name = "oxc_parser" name = "oxc_parser"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d54fd003e5347dcb5ccdcc96cb283bf32a648ff291912b5a6e5e718b3359935" checksum = "5b7defa49cc20f9e3c346674b06752cacaacce053cde69a04f0f85f31e00820f"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cow-utils", "cow-utils",
@@ -2028,9 +2028,9 @@ dependencies = [
[[package]] [[package]]
name = "oxc_regular_expression" name = "oxc_regular_expression"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e6e8058355e43a2388112eddf73031d8749b40255ad6f3a824e35fe0c6addec" checksum = "14d37e8585630a167c4a2b121dcdab52bf13b71a6bd64260efe797956bd4f6d0"
dependencies = [ dependencies = [
"oxc_allocator", "oxc_allocator",
"oxc_ast_macros", "oxc_ast_macros",
@@ -2044,9 +2044,9 @@ dependencies = [
[[package]] [[package]]
name = "oxc_semantic" name = "oxc_semantic"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9f297db174c99b43e1b268b0960dcc588767093575cc39bb5517196a7a21d3" checksum = "895130e4f197b77d9b54deffccc2ce8a9d977435c022a49ddecb1f467b946854"
dependencies = [ dependencies = [
"itertools", "itertools",
"oxc_allocator", "oxc_allocator",
@@ -2080,9 +2080,9 @@ dependencies = [
[[package]] [[package]]
name = "oxc_span" name = "oxc_span"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69575b94d8fdac097784abf48a5e43ee38375aa377f8e9bb8bc80f2ef3d2269c" checksum = "8350c982e6284f41668ebd3c714de22280a19f617c3cb6117bbc4e16afc6b13a"
dependencies = [ dependencies = [
"compact_str", "compact_str",
"oxc-miette", "oxc-miette",
@@ -2093,9 +2093,9 @@ dependencies = [
[[package]] [[package]]
name = "oxc_syntax" name = "oxc_syntax"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32c4940ed3e38ce51fb6bc3e880edb815182bdcdc19c6dc110857625aac9c9a7" checksum = "7e85d9197e08e176d6f58a3885d125738c46a69145410e82b3a32f676ddd5546"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cow-utils", "cow-utils",
@@ -2114,9 +2114,9 @@ dependencies = [
[[package]] [[package]]
name = "oxc_traverse" name = "oxc_traverse"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f8868dcb4ac2cd1e08dadbf34cd4fd9bbf36b70ef64dfa3376e1042a9f705a3" checksum = "ac43e668dcd3a0b17cf4f889feac5321e56430a0550205df2e85b3e9314f6caa"
dependencies = [ dependencies = [
"compact_str", "compact_str",
"itoa", "itoa",
@@ -2384,7 +2384,7 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [ dependencies = [
"getrandom 0.2.15", "getrandom 0.2.16",
] ]
[[package]] [[package]]
@@ -2459,7 +2459,7 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
dependencies = [ dependencies = [
"cc", "cc",
"cfg-if", "cfg-if",
"getrandom 0.2.15", "getrandom 0.2.16",
"libc", "libc",
"untrusted", "untrusted",
"windows-sys 0.52.0", "windows-sys 0.52.0",
@@ -2956,9 +2956,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio-util" name = "tokio-util"
version = "0.7.14" version = "0.7.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034" checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-core", "futures-core",

View File

@@ -7,19 +7,18 @@ use brk_parser::bitcoin;
use brk_vec::{Compressed, Version}; use brk_vec::{Compressed, Version};
use super::{ use super::{
Indexes, EagerVec, Indexes,
base::ComputedVec,
grouped::{ComputedVecsFromHeight, StorableVecGeneatorOptions}, grouped::{ComputedVecsFromHeight, StorableVecGeneatorOptions},
indexes, indexes,
}; };
#[derive(Clone)] #[derive(Clone)]
pub struct Vecs { pub struct Vecs {
pub height_to_interval: ComputedVec<Height, Timestamp>, pub height_to_interval: EagerVec<Height, Timestamp>,
pub indexes_to_block_interval: ComputedVecsFromHeight<Timestamp>, pub indexes_to_block_interval: ComputedVecsFromHeight<Timestamp>,
pub indexes_to_block_count: ComputedVecsFromHeight<StoredU32>, pub indexes_to_block_count: ComputedVecsFromHeight<StoredU32>,
pub indexes_to_block_weight: ComputedVecsFromHeight<Weight>, pub indexes_to_block_weight: ComputedVecsFromHeight<Weight>,
pub height_to_vbytes: ComputedVec<Height, StoredU64>, pub height_to_vbytes: EagerVec<Height, StoredU64>,
pub indexes_to_block_vbytes: ComputedVecsFromHeight<StoredU64>, pub indexes_to_block_vbytes: ComputedVecsFromHeight<StoredU64>,
pub indexes_to_block_size: ComputedVecsFromHeight<StoredUsize>, pub indexes_to_block_size: ComputedVecsFromHeight<StoredUsize>,
} }
@@ -29,7 +28,7 @@ impl Vecs {
fs::create_dir_all(path)?; fs::create_dir_all(path)?;
Ok(Self { Ok(Self {
height_to_interval: ComputedVec::forced_import( height_to_interval: EagerVec::forced_import(
&path.join("height_to_interval"), &path.join("height_to_interval"),
Version::ZERO, Version::ZERO,
compressed, compressed,
@@ -69,7 +68,7 @@ impl Vecs {
compressed, compressed,
StorableVecGeneatorOptions::default().add_sum().add_total(), StorableVecGeneatorOptions::default().add_sum().add_total(),
)?, )?,
height_to_vbytes: ComputedVec::forced_import( height_to_vbytes: EagerVec::forced_import(
&path.join("height_to_vbytes"), &path.join("height_to_vbytes"),
Version::ZERO, Version::ZERO,
compressed, compressed,

View File

@@ -6,9 +6,7 @@ use brk_vec::{
}; };
use color_eyre::eyre::ContextCompat; use color_eyre::eyre::ContextCompat;
use crate::storage::vecs::base::ComputedVec; use crate::storage::{ComputedType, EagerVec};
use super::ComputedType;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct ComputedVecBuilder<I, T> pub struct ComputedVecBuilder<I, T>
@@ -16,18 +14,18 @@ where
I: StoredIndex, I: StoredIndex,
T: ComputedType, T: ComputedType,
{ {
first: Option<ComputedVec<I, T>>, first: Option<EagerVec<I, T>>,
average: Option<ComputedVec<I, T>>, average: Option<EagerVec<I, T>>,
sum: Option<ComputedVec<I, T>>, sum: Option<EagerVec<I, T>>,
max: Option<ComputedVec<I, T>>, max: Option<EagerVec<I, T>>,
_90p: Option<ComputedVec<I, T>>, _90p: Option<EagerVec<I, T>>,
_75p: Option<ComputedVec<I, T>>, _75p: Option<EagerVec<I, T>>,
median: Option<ComputedVec<I, T>>, median: Option<EagerVec<I, T>>,
_25p: Option<ComputedVec<I, T>>, _25p: Option<EagerVec<I, T>>,
_10p: Option<ComputedVec<I, T>>, _10p: Option<EagerVec<I, T>>,
min: Option<ComputedVec<I, T>>, min: Option<EagerVec<I, T>>,
last: Option<ComputedVec<I, T>>, last: Option<EagerVec<I, T>>,
total: Option<ComputedVec<I, T>>, total: Option<EagerVec<I, T>>,
} }
const VERSION: Version = Version::ZERO; const VERSION: Version = Version::ZERO;
@@ -74,15 +72,11 @@ where
let s = Self { let s = Self {
first: options.first.then(|| { first: options.first.then(|| {
ComputedVec::forced_import( EagerVec::forced_import(&maybe_prefix("first"), version + Version::ZERO, compressed)
&maybe_prefix("first"), .unwrap()
version + Version::ZERO,
compressed,
)
.unwrap()
}), }),
last: options.last.then(|| { last: options.last.then(|| {
ComputedVec::forced_import( EagerVec::forced_import(
&path.join(format!("{key}_to_{name}")), &path.join(format!("{key}_to_{name}")),
version + Version::ZERO, version + Version::ZERO,
compressed, compressed,
@@ -90,23 +84,15 @@ where
.unwrap() .unwrap()
}), }),
min: options.min.then(|| { min: options.min.then(|| {
ComputedVec::forced_import( EagerVec::forced_import(&maybe_suffix("min"), version + Version::ZERO, compressed)
&maybe_suffix("min"), .unwrap()
version + Version::ZERO,
compressed,
)
.unwrap()
}), }),
max: options.max.then(|| { max: options.max.then(|| {
ComputedVec::forced_import( EagerVec::forced_import(&maybe_suffix("max"), version + Version::ZERO, compressed)
&maybe_suffix("max"), .unwrap()
version + Version::ZERO,
compressed,
)
.unwrap()
}), }),
median: options.median.then(|| { median: options.median.then(|| {
ComputedVec::forced_import( EagerVec::forced_import(
&maybe_suffix("median"), &maybe_suffix("median"),
version + Version::ZERO, version + Version::ZERO,
compressed, compressed,
@@ -114,7 +100,7 @@ where
.unwrap() .unwrap()
}), }),
average: options.average.then(|| { average: options.average.then(|| {
ComputedVec::forced_import( EagerVec::forced_import(
&maybe_suffix("average"), &maybe_suffix("average"),
version + Version::ZERO, version + Version::ZERO,
compressed, compressed,
@@ -122,48 +108,28 @@ where
.unwrap() .unwrap()
}), }),
sum: options.sum.then(|| { sum: options.sum.then(|| {
ComputedVec::forced_import( EagerVec::forced_import(&maybe_suffix("sum"), version + Version::ZERO, compressed)
&maybe_suffix("sum"), .unwrap()
version + Version::ZERO,
compressed,
)
.unwrap()
}), }),
total: options.total.then(|| { total: options.total.then(|| {
ComputedVec::forced_import(&prefix("total"), version + Version::ZERO, compressed) EagerVec::forced_import(&prefix("total"), version + Version::ZERO, compressed)
.unwrap() .unwrap()
}), }),
_90p: options._90p.then(|| { _90p: options._90p.then(|| {
ComputedVec::forced_import( EagerVec::forced_import(&maybe_suffix("90p"), version + Version::ZERO, compressed)
&maybe_suffix("90p"), .unwrap()
version + Version::ZERO,
compressed,
)
.unwrap()
}), }),
_75p: options._75p.then(|| { _75p: options._75p.then(|| {
ComputedVec::forced_import( EagerVec::forced_import(&maybe_suffix("75p"), version + Version::ZERO, compressed)
&maybe_suffix("75p"), .unwrap()
version + Version::ZERO,
compressed,
)
.unwrap()
}), }),
_25p: options._25p.then(|| { _25p: options._25p.then(|| {
ComputedVec::forced_import( EagerVec::forced_import(&maybe_suffix("25p"), version + Version::ZERO, compressed)
&maybe_suffix("25p"), .unwrap()
version + Version::ZERO,
compressed,
)
.unwrap()
}), }),
_10p: options._10p.then(|| { _10p: options._10p.then(|| {
ComputedVec::forced_import( EagerVec::forced_import(&maybe_suffix("10p"), version + Version::ZERO, compressed)
&maybe_suffix("10p"), .unwrap()
version + Version::ZERO,
compressed,
)
.unwrap()
}), }),
}; };
@@ -476,40 +442,40 @@ where
)) ))
} }
pub fn unwrap_first(&mut self) -> &mut ComputedVec<I, T> { pub fn unwrap_first(&mut self) -> &mut EagerVec<I, T> {
self.first.as_mut().unwrap() self.first.as_mut().unwrap()
} }
pub fn unwrap_average(&mut self) -> &mut ComputedVec<I, T> { pub fn unwrap_average(&mut self) -> &mut EagerVec<I, T> {
self.average.as_mut().unwrap() self.average.as_mut().unwrap()
} }
pub fn unwrap_sum(&mut self) -> &mut ComputedVec<I, T> { pub fn unwrap_sum(&mut self) -> &mut EagerVec<I, T> {
self.sum.as_mut().unwrap() self.sum.as_mut().unwrap()
} }
pub fn unwrap_max(&mut self) -> &mut ComputedVec<I, T> { pub fn unwrap_max(&mut self) -> &mut EagerVec<I, T> {
self.max.as_mut().unwrap() self.max.as_mut().unwrap()
} }
pub fn unwrap_90p(&mut self) -> &mut ComputedVec<I, T> { pub fn unwrap_90p(&mut self) -> &mut EagerVec<I, T> {
self._90p.as_mut().unwrap() self._90p.as_mut().unwrap()
} }
pub fn unwrap_75p(&mut self) -> &mut ComputedVec<I, T> { pub fn unwrap_75p(&mut self) -> &mut EagerVec<I, T> {
self._75p.as_mut().unwrap() self._75p.as_mut().unwrap()
} }
pub fn unwrap_median(&mut self) -> &mut ComputedVec<I, T> { pub fn unwrap_median(&mut self) -> &mut EagerVec<I, T> {
self.median.as_mut().unwrap() self.median.as_mut().unwrap()
} }
pub fn unwrap_25p(&mut self) -> &mut ComputedVec<I, T> { pub fn unwrap_25p(&mut self) -> &mut EagerVec<I, T> {
self._25p.as_mut().unwrap() self._25p.as_mut().unwrap()
} }
pub fn unwrap_10p(&mut self) -> &mut ComputedVec<I, T> { pub fn unwrap_10p(&mut self) -> &mut EagerVec<I, T> {
self._10p.as_mut().unwrap() self._10p.as_mut().unwrap()
} }
pub fn unwrap_min(&mut self) -> &mut ComputedVec<I, T> { pub fn unwrap_min(&mut self) -> &mut EagerVec<I, T> {
self.min.as_mut().unwrap() self.min.as_mut().unwrap()
} }
pub fn unwrap_last(&mut self) -> &mut ComputedVec<I, T> { pub fn unwrap_last(&mut self) -> &mut EagerVec<I, T> {
self.last.as_mut().unwrap() self.last.as_mut().unwrap()
} }
pub fn unwrap_total(&mut self) -> &mut ComputedVec<I, T> { pub fn unwrap_total(&mut self) -> &mut EagerVec<I, T> {
self.total.as_mut().unwrap() self.total.as_mut().unwrap()
} }

View File

@@ -5,16 +5,16 @@ use brk_exit::Exit;
use brk_indexer::Indexer; use brk_indexer::Indexer;
use brk_vec::{AnyStoredVec, Compressed, Result, Version}; use brk_vec::{AnyStoredVec, Compressed, Result, Version};
use crate::storage::vecs::{Indexes, base::ComputedVec, indexes}; use crate::storage::{ComputedType, EagerVec, Indexes, indexes};
use super::{ComputedType, ComputedVecBuilder, StorableVecGeneatorOptions}; use super::{ComputedVecBuilder, StorableVecGeneatorOptions};
#[derive(Clone)] #[derive(Clone)]
pub struct ComputedVecsFromDateindex<T> pub struct ComputedVecsFromDateindex<T>
where where
T: ComputedType + PartialOrd, T: ComputedType + PartialOrd,
{ {
pub dateindex: ComputedVec<Dateindex, T>, pub dateindex: EagerVec<Dateindex, T>,
pub dateindex_extra: ComputedVecBuilder<Dateindex, T>, pub dateindex_extra: ComputedVecBuilder<Dateindex, T>,
pub weekindex: ComputedVecBuilder<Weekindex, T>, pub weekindex: ComputedVecBuilder<Weekindex, T>,
pub monthindex: ComputedVecBuilder<Monthindex, T>, pub monthindex: ComputedVecBuilder<Monthindex, T>,
@@ -49,7 +49,7 @@ where
let options = options.remove_percentiles(); let options = options.remove_percentiles();
Ok(Self { Ok(Self {
dateindex: ComputedVec::forced_import( dateindex: EagerVec::forced_import(
&path.join(format!("dateindex_to_{name}")), &path.join(format!("dateindex_to_{name}")),
version, version,
compressed, compressed,
@@ -79,7 +79,7 @@ where
) -> color_eyre::Result<()> ) -> color_eyre::Result<()>
where where
F: FnMut( F: FnMut(
&mut ComputedVec<Dateindex, T>, &mut EagerVec<Dateindex, T>,
&mut Indexer, &mut Indexer,
&mut indexes::Vecs, &mut indexes::Vecs,
&Indexes, &Indexes,

View File

@@ -7,16 +7,16 @@ use brk_exit::Exit;
use brk_indexer::Indexer; use brk_indexer::Indexer;
use brk_vec::{AnyStoredVec, Compressed, Result, StoredVec, Version}; use brk_vec::{AnyStoredVec, Compressed, Result, StoredVec, Version};
use crate::storage::vecs::{Indexes, base::ComputedVec, indexes}; use crate::storage::{ComputedType, EagerVec, Indexes, indexes};
use super::{ComputedType, ComputedVecBuilder, StorableVecGeneatorOptions}; use super::{ComputedVecBuilder, StorableVecGeneatorOptions};
#[derive(Clone)] #[derive(Clone)]
pub struct ComputedVecsFromHeight<T> pub struct ComputedVecsFromHeight<T>
where where
T: ComputedType + PartialOrd, T: ComputedType + PartialOrd,
{ {
pub height: Option<ComputedVec<Height, T>>, pub height: Option<EagerVec<Height, T>>,
pub height_extra: ComputedVecBuilder<Height, T>, pub height_extra: ComputedVecBuilder<Height, T>,
pub dateindex: ComputedVecBuilder<Dateindex, T>, pub dateindex: ComputedVecBuilder<Dateindex, T>,
pub weekindex: ComputedVecBuilder<Weekindex, T>, pub weekindex: ComputedVecBuilder<Weekindex, T>,
@@ -46,7 +46,7 @@ where
let version = VERSION + version; let version = VERSION + version;
let height = compute_source.then(|| { let height = compute_source.then(|| {
ComputedVec::forced_import(&path.join(format!("height_to_{name}")), version, compressed) EagerVec::forced_import(&path.join(format!("height_to_{name}")), version, compressed)
.unwrap() .unwrap()
}); });
@@ -95,7 +95,7 @@ where
) -> color_eyre::Result<()> ) -> color_eyre::Result<()>
where where
F: FnMut( F: FnMut(
&mut ComputedVec<Height, T>, &mut EagerVec<Height, T>,
&mut Indexer, &mut Indexer,
&mut indexes::Vecs, &mut indexes::Vecs,
&Indexes, &Indexes,

View File

@@ -5,16 +5,16 @@ use brk_exit::Exit;
use brk_indexer::Indexer; use brk_indexer::Indexer;
use brk_vec::{AnyStoredVec, Compressed, Result, Version}; use brk_vec::{AnyStoredVec, Compressed, Result, Version};
use crate::storage::vecs::{Indexes, base::ComputedVec, indexes}; use crate::storage::{ComputedType, EagerVec, Indexes, indexes};
use super::{ComputedType, ComputedVecBuilder, StorableVecGeneatorOptions}; use super::{ComputedVecBuilder, StorableVecGeneatorOptions};
#[derive(Clone)] #[derive(Clone)]
pub struct ComputedVecsFromHeightStrict<T> pub struct ComputedVecsFromHeightStrict<T>
where where
T: ComputedType + PartialOrd, T: ComputedType + PartialOrd,
{ {
pub height: ComputedVec<Height, T>, pub height: EagerVec<Height, T>,
pub height_extra: ComputedVecBuilder<Height, T>, pub height_extra: ComputedVecBuilder<Height, T>,
pub difficultyepoch: ComputedVecBuilder<Difficultyepoch, T>, pub difficultyepoch: ComputedVecBuilder<Difficultyepoch, T>,
// TODO: pub halvingepoch: StorableVecGeneator<Halvingepoch, T>, // TODO: pub halvingepoch: StorableVecGeneator<Halvingepoch, T>,
@@ -36,11 +36,8 @@ where
) -> color_eyre::Result<Self> { ) -> color_eyre::Result<Self> {
let version = VERSION + version; let version = VERSION + version;
let height = ComputedVec::forced_import( let height =
&path.join(format!("height_to_{name}")), EagerVec::forced_import(&path.join(format!("height_to_{name}")), version, compressed)?;
version,
compressed,
)?;
let height_extra = ComputedVecBuilder::forced_import( let height_extra = ComputedVecBuilder::forced_import(
path, path,
@@ -72,7 +69,7 @@ where
) -> color_eyre::Result<()> ) -> color_eyre::Result<()>
where where
F: FnMut( F: FnMut(
&mut ComputedVec<Height, T>, &mut EagerVec<Height, T>,
&mut Indexer, &mut Indexer,
&mut indexes::Vecs, &mut indexes::Vecs,
&Indexes, &Indexes,

View File

@@ -8,16 +8,16 @@ use brk_exit::Exit;
use brk_indexer::Indexer; use brk_indexer::Indexer;
use brk_vec::{AnyStoredVec, Compressed, Result, StoredVec, Version}; use brk_vec::{AnyStoredVec, Compressed, Result, StoredVec, Version};
use crate::storage::vecs::{Indexes, base::ComputedVec, indexes}; use crate::storage::{ComputedType, EagerVec, Indexes, indexes};
use super::{ComputedType, ComputedVecBuilder, StorableVecGeneatorOptions}; use super::{ComputedVecBuilder, StorableVecGeneatorOptions};
#[derive(Clone)] #[derive(Clone)]
pub struct ComputedVecsFromTxindex<T> pub struct ComputedVecsFromTxindex<T>
where where
T: ComputedType + PartialOrd, T: ComputedType + PartialOrd,
{ {
pub txindex: Option<ComputedVec<Txindex, T>>, pub txindex: Option<EagerVec<Txindex, T>>,
pub height: ComputedVecBuilder<Height, T>, pub height: ComputedVecBuilder<Height, T>,
pub dateindex: ComputedVecBuilder<Dateindex, T>, pub dateindex: ComputedVecBuilder<Dateindex, T>,
pub weekindex: ComputedVecBuilder<Weekindex, T>, pub weekindex: ComputedVecBuilder<Weekindex, T>,
@@ -47,7 +47,7 @@ where
let version = VERSION + version; let version = VERSION + version;
let txindex = compute_source.then(|| { let txindex = compute_source.then(|| {
ComputedVec::forced_import( EagerVec::forced_import(
&path.join(format!("txindex_to_{name}")), &path.join(format!("txindex_to_{name}")),
version, version,
compressed, compressed,
@@ -91,7 +91,7 @@ where
) -> color_eyre::Result<()> ) -> color_eyre::Result<()>
where where
F: FnMut( F: FnMut(
&mut ComputedVec<Txindex, T>, &mut EagerVec<Txindex, T>,
&mut Indexer, &mut Indexer,
&mut indexes::Vecs, &mut indexes::Vecs,
&Indexes, &Indexes,

View File

@@ -3,7 +3,6 @@ mod from_dateindex;
mod from_height; mod from_height;
mod from_height_strict; mod from_height_strict;
mod from_txindex; mod from_txindex;
mod stored_type;
mod value_from_height; mod value_from_height;
mod value_from_txindex; mod value_from_txindex;
@@ -12,6 +11,5 @@ pub use from_dateindex::*;
pub use from_height::*; pub use from_height::*;
pub use from_height_strict::*; pub use from_height_strict::*;
pub use from_txindex::*; pub use from_txindex::*;
pub use stored_type::*;
pub use value_from_height::*; pub use value_from_height::*;
pub use value_from_txindex::*; pub use value_from_txindex::*;

View File

@@ -6,8 +6,7 @@ use brk_indexer::Indexer;
use brk_vec::{AnyStoredVec, Compressed, Result, StoredVec, Version}; use brk_vec::{AnyStoredVec, Compressed, Result, StoredVec, Version};
use crate::storage::{ use crate::storage::{
base::ComputedVec, EagerVec, marketprice,
marketprice,
vecs::{Indexes, indexes}, vecs::{Indexes, indexes},
}; };
@@ -74,7 +73,7 @@ impl ComputedValueVecsFromHeight {
) -> color_eyre::Result<()> ) -> color_eyre::Result<()>
where where
F: FnMut( F: FnMut(
&mut ComputedVec<Height, Sats>, &mut EagerVec<Height, Sats>,
&mut Indexer, &mut Indexer,
&mut indexes::Vecs, &mut indexes::Vecs,
&Indexes, &Indexes,

View File

@@ -6,8 +6,7 @@ use brk_indexer::Indexer;
use brk_vec::{AnyStoredVec, Compressed, Result, StoredVec, Version}; use brk_vec::{AnyStoredVec, Compressed, Result, StoredVec, Version};
use crate::storage::{ use crate::storage::{
base::ComputedVec, EagerVec, marketprice,
marketprice,
vecs::{Indexes, indexes}, vecs::{Indexes, indexes},
}; };
@@ -74,7 +73,7 @@ impl ComputedValueVecsFromTxindex {
) -> color_eyre::Result<()> ) -> color_eyre::Result<()>
where where
F: FnMut( F: FnMut(
&mut ComputedVec<Txindex, Sats>, &mut EagerVec<Txindex, Sats>,
&mut Indexer, &mut Indexer,
&mut indexes::Vecs, &mut indexes::Vecs,
&Indexes, &Indexes,

View File

@@ -10,74 +10,74 @@ use brk_exit::Exit;
use brk_indexer::Indexer; use brk_indexer::Indexer;
use brk_vec::{Compressed, Version}; use brk_vec::{Compressed, Version};
use super::ComputedVec; use super::EagerVec;
#[derive(Clone)] #[derive(Clone)]
pub struct Vecs { pub struct Vecs {
pub addressindex_to_addressindex: ComputedVec<Addressindex, Addressindex>, pub addressindex_to_addressindex: EagerVec<Addressindex, Addressindex>,
pub dateindex_to_date: ComputedVec<Dateindex, Date>, pub dateindex_to_date: EagerVec<Dateindex, Date>,
pub dateindex_to_dateindex: ComputedVec<Dateindex, Dateindex>, pub dateindex_to_dateindex: EagerVec<Dateindex, Dateindex>,
pub dateindex_to_first_height: ComputedVec<Dateindex, Height>, pub dateindex_to_first_height: EagerVec<Dateindex, Height>,
pub dateindex_to_last_height: ComputedVec<Dateindex, Height>, pub dateindex_to_last_height: EagerVec<Dateindex, Height>,
pub dateindex_to_monthindex: ComputedVec<Dateindex, Monthindex>, pub dateindex_to_monthindex: EagerVec<Dateindex, Monthindex>,
pub dateindex_to_timestamp: ComputedVec<Dateindex, Timestamp>, pub dateindex_to_timestamp: EagerVec<Dateindex, Timestamp>,
pub dateindex_to_weekindex: ComputedVec<Dateindex, Weekindex>, pub dateindex_to_weekindex: EagerVec<Dateindex, Weekindex>,
pub decadeindex_to_decadeindex: ComputedVec<Decadeindex, Decadeindex>, pub decadeindex_to_decadeindex: EagerVec<Decadeindex, Decadeindex>,
pub decadeindex_to_first_yearindex: ComputedVec<Decadeindex, Yearindex>, pub decadeindex_to_first_yearindex: EagerVec<Decadeindex, Yearindex>,
pub decadeindex_to_last_yearindex: ComputedVec<Decadeindex, Yearindex>, pub decadeindex_to_last_yearindex: EagerVec<Decadeindex, Yearindex>,
pub decadeindex_to_timestamp: ComputedVec<Decadeindex, Timestamp>, pub decadeindex_to_timestamp: EagerVec<Decadeindex, Timestamp>,
pub difficultyepoch_to_difficultyepoch: ComputedVec<Difficultyepoch, Difficultyepoch>, pub difficultyepoch_to_difficultyepoch: EagerVec<Difficultyepoch, Difficultyepoch>,
pub difficultyepoch_to_first_height: ComputedVec<Difficultyepoch, Height>, pub difficultyepoch_to_first_height: EagerVec<Difficultyepoch, Height>,
pub difficultyepoch_to_last_height: ComputedVec<Difficultyepoch, Height>, pub difficultyepoch_to_last_height: EagerVec<Difficultyepoch, Height>,
pub difficultyepoch_to_timestamp: ComputedVec<Difficultyepoch, Timestamp>, pub difficultyepoch_to_timestamp: EagerVec<Difficultyepoch, Timestamp>,
pub emptyindex_to_emptyindex: ComputedVec<Emptyindex, Emptyindex>, pub emptyindex_to_emptyindex: EagerVec<Emptyindex, Emptyindex>,
pub halvingepoch_to_first_height: ComputedVec<Halvingepoch, Height>, pub halvingepoch_to_first_height: EagerVec<Halvingepoch, Height>,
pub halvingepoch_to_halvingepoch: ComputedVec<Halvingepoch, Halvingepoch>, pub halvingepoch_to_halvingepoch: EagerVec<Halvingepoch, Halvingepoch>,
pub halvingepoch_to_last_height: ComputedVec<Halvingepoch, Height>, pub halvingepoch_to_last_height: EagerVec<Halvingepoch, Height>,
pub halvingepoch_to_timestamp: ComputedVec<Halvingepoch, Timestamp>, pub halvingepoch_to_timestamp: EagerVec<Halvingepoch, Timestamp>,
pub height_to_dateindex: ComputedVec<Height, Dateindex>, pub height_to_dateindex: EagerVec<Height, Dateindex>,
pub height_to_difficultyepoch: ComputedVec<Height, Difficultyepoch>, pub height_to_difficultyepoch: EagerVec<Height, Difficultyepoch>,
pub height_to_fixed_date: ComputedVec<Height, Date>, pub height_to_fixed_date: EagerVec<Height, Date>,
pub height_to_fixed_timestamp: ComputedVec<Height, Timestamp>, pub height_to_fixed_timestamp: EagerVec<Height, Timestamp>,
pub height_to_halvingepoch: ComputedVec<Height, Halvingepoch>, pub height_to_halvingepoch: EagerVec<Height, Halvingepoch>,
pub height_to_height: ComputedVec<Height, Height>, pub height_to_height: EagerVec<Height, Height>,
pub height_to_last_txindex: ComputedVec<Height, Txindex>, pub height_to_last_txindex: EagerVec<Height, Txindex>,
pub height_to_real_date: ComputedVec<Height, Date>, pub height_to_real_date: EagerVec<Height, Date>,
pub monthindex_to_first_dateindex: ComputedVec<Monthindex, Dateindex>, pub monthindex_to_first_dateindex: EagerVec<Monthindex, Dateindex>,
pub monthindex_to_last_dateindex: ComputedVec<Monthindex, Dateindex>, pub monthindex_to_last_dateindex: EagerVec<Monthindex, Dateindex>,
pub monthindex_to_monthindex: ComputedVec<Monthindex, Monthindex>, pub monthindex_to_monthindex: EagerVec<Monthindex, Monthindex>,
pub monthindex_to_quarterindex: ComputedVec<Monthindex, Quarterindex>, pub monthindex_to_quarterindex: EagerVec<Monthindex, Quarterindex>,
pub monthindex_to_timestamp: ComputedVec<Monthindex, Timestamp>, pub monthindex_to_timestamp: EagerVec<Monthindex, Timestamp>,
pub monthindex_to_yearindex: ComputedVec<Monthindex, Yearindex>, pub monthindex_to_yearindex: EagerVec<Monthindex, Yearindex>,
pub multisigindex_to_multisigindex: ComputedVec<Multisigindex, Multisigindex>, pub multisigindex_to_multisigindex: EagerVec<Multisigindex, Multisigindex>,
pub opreturnindex_to_opreturnindex: ComputedVec<Opreturnindex, Opreturnindex>, pub opreturnindex_to_opreturnindex: EagerVec<Opreturnindex, Opreturnindex>,
pub p2pk33index_to_p2pk33index: ComputedVec<P2PK33index, P2PK33index>, pub p2pk33index_to_p2pk33index: EagerVec<P2PK33index, P2PK33index>,
pub p2pk65index_to_p2pk65index: ComputedVec<P2PK65index, P2PK65index>, pub p2pk65index_to_p2pk65index: EagerVec<P2PK65index, P2PK65index>,
pub p2pkhindex_to_p2pkhindex: ComputedVec<P2PKHindex, P2PKHindex>, pub p2pkhindex_to_p2pkhindex: EagerVec<P2PKHindex, P2PKHindex>,
pub p2shindex_to_p2shindex: ComputedVec<P2SHindex, P2SHindex>, pub p2shindex_to_p2shindex: EagerVec<P2SHindex, P2SHindex>,
pub p2trindex_to_p2trindex: ComputedVec<P2TRindex, P2TRindex>, pub p2trindex_to_p2trindex: EagerVec<P2TRindex, P2TRindex>,
pub p2wpkhindex_to_p2wpkhindex: ComputedVec<P2WPKHindex, P2WPKHindex>, pub p2wpkhindex_to_p2wpkhindex: EagerVec<P2WPKHindex, P2WPKHindex>,
pub p2wshindex_to_p2wshindex: ComputedVec<P2WSHindex, P2WSHindex>, pub p2wshindex_to_p2wshindex: EagerVec<P2WSHindex, P2WSHindex>,
pub pushonlyindex_to_pushonlyindex: ComputedVec<Pushonlyindex, Pushonlyindex>, pub pushonlyindex_to_pushonlyindex: EagerVec<Pushonlyindex, Pushonlyindex>,
pub quarterindex_to_first_monthindex: ComputedVec<Quarterindex, Monthindex>, pub quarterindex_to_first_monthindex: EagerVec<Quarterindex, Monthindex>,
pub quarterindex_to_last_monthindex: ComputedVec<Quarterindex, Monthindex>, pub quarterindex_to_last_monthindex: EagerVec<Quarterindex, Monthindex>,
pub quarterindex_to_quarterindex: ComputedVec<Quarterindex, Quarterindex>, pub quarterindex_to_quarterindex: EagerVec<Quarterindex, Quarterindex>,
pub quarterindex_to_timestamp: ComputedVec<Quarterindex, Timestamp>, pub quarterindex_to_timestamp: EagerVec<Quarterindex, Timestamp>,
pub txindex_to_last_txinindex: ComputedVec<Txindex, Txinindex>, pub txindex_to_last_txinindex: EagerVec<Txindex, Txinindex>,
pub txindex_to_last_txoutindex: ComputedVec<Txindex, Txoutindex>, pub txindex_to_last_txoutindex: EagerVec<Txindex, Txoutindex>,
pub txindex_to_txindex: ComputedVec<Txindex, Txindex>, pub txindex_to_txindex: EagerVec<Txindex, Txindex>,
pub txinindex_to_txinindex: ComputedVec<Txinindex, Txinindex>, pub txinindex_to_txinindex: EagerVec<Txinindex, Txinindex>,
pub txoutindex_to_txoutindex: ComputedVec<Txoutindex, Txoutindex>, pub txoutindex_to_txoutindex: EagerVec<Txoutindex, Txoutindex>,
pub unknownindex_to_unknownindex: ComputedVec<Unknownindex, Unknownindex>, pub unknownindex_to_unknownindex: EagerVec<Unknownindex, Unknownindex>,
pub weekindex_to_first_dateindex: ComputedVec<Weekindex, Dateindex>, pub weekindex_to_first_dateindex: EagerVec<Weekindex, Dateindex>,
pub weekindex_to_last_dateindex: ComputedVec<Weekindex, Dateindex>, pub weekindex_to_last_dateindex: EagerVec<Weekindex, Dateindex>,
pub weekindex_to_timestamp: ComputedVec<Weekindex, Timestamp>, pub weekindex_to_timestamp: EagerVec<Weekindex, Timestamp>,
pub weekindex_to_weekindex: ComputedVec<Weekindex, Weekindex>, pub weekindex_to_weekindex: EagerVec<Weekindex, Weekindex>,
pub yearindex_to_decadeindex: ComputedVec<Yearindex, Decadeindex>, pub yearindex_to_decadeindex: EagerVec<Yearindex, Decadeindex>,
pub yearindex_to_first_monthindex: ComputedVec<Yearindex, Monthindex>, pub yearindex_to_first_monthindex: EagerVec<Yearindex, Monthindex>,
pub yearindex_to_last_monthindex: ComputedVec<Yearindex, Monthindex>, pub yearindex_to_last_monthindex: EagerVec<Yearindex, Monthindex>,
pub yearindex_to_timestamp: ComputedVec<Yearindex, Timestamp>, pub yearindex_to_timestamp: EagerVec<Yearindex, Timestamp>,
pub yearindex_to_yearindex: ComputedVec<Yearindex, Yearindex>, pub yearindex_to_yearindex: EagerVec<Yearindex, Yearindex>,
} }
impl Vecs { impl Vecs {
@@ -85,322 +85,322 @@ impl Vecs {
fs::create_dir_all(path)?; fs::create_dir_all(path)?;
Ok(Self { Ok(Self {
dateindex_to_date: ComputedVec::forced_import( dateindex_to_date: EagerVec::forced_import(
&path.join("dateindex_to_date"), &path.join("dateindex_to_date"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
dateindex_to_dateindex: ComputedVec::forced_import( dateindex_to_dateindex: EagerVec::forced_import(
&path.join("dateindex_to_dateindex"), &path.join("dateindex_to_dateindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
dateindex_to_first_height: ComputedVec::forced_import( dateindex_to_first_height: EagerVec::forced_import(
&path.join("dateindex_to_first_height"), &path.join("dateindex_to_first_height"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
dateindex_to_last_height: ComputedVec::forced_import( dateindex_to_last_height: EagerVec::forced_import(
&path.join("dateindex_to_last_height"), &path.join("dateindex_to_last_height"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
height_to_real_date: ComputedVec::forced_import( height_to_real_date: EagerVec::forced_import(
&path.join("height_to_real_date"), &path.join("height_to_real_date"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
height_to_fixed_date: ComputedVec::forced_import( height_to_fixed_date: EagerVec::forced_import(
&path.join("height_to_fixed_date"), &path.join("height_to_fixed_date"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
height_to_dateindex: ComputedVec::forced_import( height_to_dateindex: EagerVec::forced_import(
&path.join("height_to_dateindex"), &path.join("height_to_dateindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
height_to_height: ComputedVec::forced_import( height_to_height: EagerVec::forced_import(
&path.join("height_to_height"), &path.join("height_to_height"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
height_to_last_txindex: ComputedVec::forced_import( height_to_last_txindex: EagerVec::forced_import(
&path.join("height_to_last_txindex"), &path.join("height_to_last_txindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
txindex_to_last_txinindex: ComputedVec::forced_import( txindex_to_last_txinindex: EagerVec::forced_import(
&path.join("txindex_to_last_txinindex"), &path.join("txindex_to_last_txinindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
txindex_to_last_txoutindex: ComputedVec::forced_import( txindex_to_last_txoutindex: EagerVec::forced_import(
&path.join("txindex_to_last_txoutindex"), &path.join("txindex_to_last_txoutindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
difficultyepoch_to_first_height: ComputedVec::forced_import( difficultyepoch_to_first_height: EagerVec::forced_import(
&path.join("difficultyepoch_to_first_height"), &path.join("difficultyepoch_to_first_height"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
difficultyepoch_to_last_height: ComputedVec::forced_import( difficultyepoch_to_last_height: EagerVec::forced_import(
&path.join("difficultyepoch_to_last_height"), &path.join("difficultyepoch_to_last_height"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
halvingepoch_to_first_height: ComputedVec::forced_import( halvingepoch_to_first_height: EagerVec::forced_import(
&path.join("halvingepoch_to_first_height"), &path.join("halvingepoch_to_first_height"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
halvingepoch_to_last_height: ComputedVec::forced_import( halvingepoch_to_last_height: EagerVec::forced_import(
&path.join("halvingepoch_to_last_height"), &path.join("halvingepoch_to_last_height"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
weekindex_to_first_dateindex: ComputedVec::forced_import( weekindex_to_first_dateindex: EagerVec::forced_import(
&path.join("weekindex_to_first_dateindex"), &path.join("weekindex_to_first_dateindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
weekindex_to_last_dateindex: ComputedVec::forced_import( weekindex_to_last_dateindex: EagerVec::forced_import(
&path.join("weekindex_to_last_dateindex"), &path.join("weekindex_to_last_dateindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
monthindex_to_first_dateindex: ComputedVec::forced_import( monthindex_to_first_dateindex: EagerVec::forced_import(
&path.join("monthindex_to_first_dateindex"), &path.join("monthindex_to_first_dateindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
monthindex_to_last_dateindex: ComputedVec::forced_import( monthindex_to_last_dateindex: EagerVec::forced_import(
&path.join("monthindex_to_last_dateindex"), &path.join("monthindex_to_last_dateindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
yearindex_to_first_monthindex: ComputedVec::forced_import( yearindex_to_first_monthindex: EagerVec::forced_import(
&path.join("yearindex_to_first_monthindex"), &path.join("yearindex_to_first_monthindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
yearindex_to_last_monthindex: ComputedVec::forced_import( yearindex_to_last_monthindex: EagerVec::forced_import(
&path.join("yearindex_to_last_monthindex"), &path.join("yearindex_to_last_monthindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
decadeindex_to_first_yearindex: ComputedVec::forced_import( decadeindex_to_first_yearindex: EagerVec::forced_import(
&path.join("decadeindex_to_first_yearindex"), &path.join("decadeindex_to_first_yearindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
decadeindex_to_last_yearindex: ComputedVec::forced_import( decadeindex_to_last_yearindex: EagerVec::forced_import(
&path.join("decadeindex_to_last_yearindex"), &path.join("decadeindex_to_last_yearindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
dateindex_to_weekindex: ComputedVec::forced_import( dateindex_to_weekindex: EagerVec::forced_import(
&path.join("dateindex_to_weekindex"), &path.join("dateindex_to_weekindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
dateindex_to_monthindex: ComputedVec::forced_import( dateindex_to_monthindex: EagerVec::forced_import(
&path.join("dateindex_to_monthindex"), &path.join("dateindex_to_monthindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
monthindex_to_yearindex: ComputedVec::forced_import( monthindex_to_yearindex: EagerVec::forced_import(
&path.join("monthindex_to_yearindex"), &path.join("monthindex_to_yearindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
yearindex_to_decadeindex: ComputedVec::forced_import( yearindex_to_decadeindex: EagerVec::forced_import(
&path.join("yearindex_to_decadeindex"), &path.join("yearindex_to_decadeindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
height_to_difficultyepoch: ComputedVec::forced_import( height_to_difficultyepoch: EagerVec::forced_import(
&path.join("height_to_difficultyepoch"), &path.join("height_to_difficultyepoch"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
height_to_halvingepoch: ComputedVec::forced_import( height_to_halvingepoch: EagerVec::forced_import(
&path.join("height_to_halvingepoch"), &path.join("height_to_halvingepoch"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
weekindex_to_weekindex: ComputedVec::forced_import( weekindex_to_weekindex: EagerVec::forced_import(
&path.join("weekindex_to_weekindex"), &path.join("weekindex_to_weekindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
monthindex_to_monthindex: ComputedVec::forced_import( monthindex_to_monthindex: EagerVec::forced_import(
&path.join("monthindex_to_monthindex"), &path.join("monthindex_to_monthindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
yearindex_to_yearindex: ComputedVec::forced_import( yearindex_to_yearindex: EagerVec::forced_import(
&path.join("yearindex_to_yearindex"), &path.join("yearindex_to_yearindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
decadeindex_to_decadeindex: ComputedVec::forced_import( decadeindex_to_decadeindex: EagerVec::forced_import(
&path.join("decadeindex_to_decadeindex"), &path.join("decadeindex_to_decadeindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
difficultyepoch_to_difficultyepoch: ComputedVec::forced_import( difficultyepoch_to_difficultyepoch: EagerVec::forced_import(
&path.join("difficultyepoch_to_difficultyepoch"), &path.join("difficultyepoch_to_difficultyepoch"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
halvingepoch_to_halvingepoch: ComputedVec::forced_import( halvingepoch_to_halvingepoch: EagerVec::forced_import(
&path.join("halvingepoch_to_halvingepoch"), &path.join("halvingepoch_to_halvingepoch"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
dateindex_to_timestamp: ComputedVec::forced_import( dateindex_to_timestamp: EagerVec::forced_import(
&path.join("dateindex_to_timestamp"), &path.join("dateindex_to_timestamp"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
decadeindex_to_timestamp: ComputedVec::forced_import( decadeindex_to_timestamp: EagerVec::forced_import(
&path.join("decadeindex_to_timestamp"), &path.join("decadeindex_to_timestamp"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
difficultyepoch_to_timestamp: ComputedVec::forced_import( difficultyepoch_to_timestamp: EagerVec::forced_import(
&path.join("difficultyepoch_to_timestamp"), &path.join("difficultyepoch_to_timestamp"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
halvingepoch_to_timestamp: ComputedVec::forced_import( halvingepoch_to_timestamp: EagerVec::forced_import(
&path.join("halvingepoch_to_timestamp"), &path.join("halvingepoch_to_timestamp"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
monthindex_to_timestamp: ComputedVec::forced_import( monthindex_to_timestamp: EagerVec::forced_import(
&path.join("monthindex_to_timestamp"), &path.join("monthindex_to_timestamp"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
weekindex_to_timestamp: ComputedVec::forced_import( weekindex_to_timestamp: EagerVec::forced_import(
&path.join("weekindex_to_timestamp"), &path.join("weekindex_to_timestamp"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
yearindex_to_timestamp: ComputedVec::forced_import( yearindex_to_timestamp: EagerVec::forced_import(
&path.join("yearindex_to_timestamp"), &path.join("yearindex_to_timestamp"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
height_to_fixed_timestamp: ComputedVec::forced_import( height_to_fixed_timestamp: EagerVec::forced_import(
&path.join("height_to_fixed_timestamp"), &path.join("height_to_fixed_timestamp"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
monthindex_to_quarterindex: ComputedVec::forced_import( monthindex_to_quarterindex: EagerVec::forced_import(
&path.join("monthindex_to_quarterindex"), &path.join("monthindex_to_quarterindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
quarterindex_to_first_monthindex: ComputedVec::forced_import( quarterindex_to_first_monthindex: EagerVec::forced_import(
&path.join("quarterindex_to_first_monthindex"), &path.join("quarterindex_to_first_monthindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
quarterindex_to_last_monthindex: ComputedVec::forced_import( quarterindex_to_last_monthindex: EagerVec::forced_import(
&path.join("quarterindex_to_last_monthindex"), &path.join("quarterindex_to_last_monthindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
quarterindex_to_quarterindex: ComputedVec::forced_import( quarterindex_to_quarterindex: EagerVec::forced_import(
&path.join("quarterindex_to_quarterindex"), &path.join("quarterindex_to_quarterindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
quarterindex_to_timestamp: ComputedVec::forced_import( quarterindex_to_timestamp: EagerVec::forced_import(
&path.join("quarterindex_to_timestamp"), &path.join("quarterindex_to_timestamp"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
p2pk33index_to_p2pk33index: ComputedVec::forced_import( p2pk33index_to_p2pk33index: EagerVec::forced_import(
&path.join("p2pk33index_to_p2pk33index"), &path.join("p2pk33index_to_p2pk33index"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
p2pk65index_to_p2pk65index: ComputedVec::forced_import( p2pk65index_to_p2pk65index: EagerVec::forced_import(
&path.join("p2pk65index_to_p2pk65index"), &path.join("p2pk65index_to_p2pk65index"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
p2pkhindex_to_p2pkhindex: ComputedVec::forced_import( p2pkhindex_to_p2pkhindex: EagerVec::forced_import(
&path.join("p2pkhindex_to_p2pkhindex"), &path.join("p2pkhindex_to_p2pkhindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
p2shindex_to_p2shindex: ComputedVec::forced_import( p2shindex_to_p2shindex: EagerVec::forced_import(
&path.join("p2shindex_to_p2shindex"), &path.join("p2shindex_to_p2shindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
p2trindex_to_p2trindex: ComputedVec::forced_import( p2trindex_to_p2trindex: EagerVec::forced_import(
&path.join("p2trindex_to_p2trindex"), &path.join("p2trindex_to_p2trindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
p2wpkhindex_to_p2wpkhindex: ComputedVec::forced_import( p2wpkhindex_to_p2wpkhindex: EagerVec::forced_import(
&path.join("p2wpkhindex_to_p2wpkhindex"), &path.join("p2wpkhindex_to_p2wpkhindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
p2wshindex_to_p2wshindex: ComputedVec::forced_import( p2wshindex_to_p2wshindex: EagerVec::forced_import(
&path.join("p2wshindex_to_p2wshindex"), &path.join("p2wshindex_to_p2wshindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
txindex_to_txindex: ComputedVec::forced_import( txindex_to_txindex: EagerVec::forced_import(
&path.join("txindex_to_txindex"), &path.join("txindex_to_txindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
txinindex_to_txinindex: ComputedVec::forced_import( txinindex_to_txinindex: EagerVec::forced_import(
&path.join("txinindex_to_txinindex"), &path.join("txinindex_to_txinindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
emptyindex_to_emptyindex: ComputedVec::forced_import( emptyindex_to_emptyindex: EagerVec::forced_import(
&path.join("emptyindex_to_emptyindex"), &path.join("emptyindex_to_emptyindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
multisigindex_to_multisigindex: ComputedVec::forced_import( multisigindex_to_multisigindex: EagerVec::forced_import(
&path.join("multisigindex_to_multisigindex"), &path.join("multisigindex_to_multisigindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
opreturnindex_to_opreturnindex: ComputedVec::forced_import( opreturnindex_to_opreturnindex: EagerVec::forced_import(
&path.join("opreturnindex_to_opreturnindex"), &path.join("opreturnindex_to_opreturnindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
pushonlyindex_to_pushonlyindex: ComputedVec::forced_import( pushonlyindex_to_pushonlyindex: EagerVec::forced_import(
&path.join("pushonlyindex_to_pushonlyindex"), &path.join("pushonlyindex_to_pushonlyindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
unknownindex_to_unknownindex: ComputedVec::forced_import( unknownindex_to_unknownindex: EagerVec::forced_import(
&path.join("unknownindex_to_unknownindex"), &path.join("unknownindex_to_unknownindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
addressindex_to_addressindex: ComputedVec::forced_import( addressindex_to_addressindex: EagerVec::forced_import(
&path.join("addressindex_to_addressindex"), &path.join("addressindex_to_addressindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
txoutindex_to_txoutindex: ComputedVec::forced_import( txoutindex_to_txoutindex: EagerVec::forced_import(
&path.join("txoutindex_to_txoutindex"), &path.join("txoutindex_to_txoutindex"),
Version::ZERO, Version::ZERO,
compressed, compressed,

View File

@@ -10,7 +10,7 @@ use brk_indexer::Indexer;
use brk_vec::{Compressed, Version}; use brk_vec::{Compressed, Version};
use super::{ use super::{
ComputedVec, Indexes, EagerVec, Indexes,
grouped::{ grouped::{
ComputedVecsFromDateindex, ComputedVecsFromHeightStrict, StorableVecGeneatorOptions, ComputedVecsFromDateindex, ComputedVecsFromHeightStrict, StorableVecGeneatorOptions,
}, },
@@ -19,20 +19,20 @@ use super::{
#[derive(Clone)] #[derive(Clone)]
pub struct Vecs { pub struct Vecs {
pub dateindex_to_close_in_cents: ComputedVec<Dateindex, Close<Cents>>, pub dateindex_to_close_in_cents: EagerVec<Dateindex, Close<Cents>>,
pub dateindex_to_high_in_cents: ComputedVec<Dateindex, High<Cents>>, pub dateindex_to_high_in_cents: EagerVec<Dateindex, High<Cents>>,
pub dateindex_to_low_in_cents: ComputedVec<Dateindex, Low<Cents>>, pub dateindex_to_low_in_cents: EagerVec<Dateindex, Low<Cents>>,
pub dateindex_to_ohlc: ComputedVec<Dateindex, OHLCDollars>, pub dateindex_to_ohlc: EagerVec<Dateindex, OHLCDollars>,
pub dateindex_to_ohlc_in_sats: ComputedVec<Dateindex, OHLCSats>, pub dateindex_to_ohlc_in_sats: EagerVec<Dateindex, OHLCSats>,
pub dateindex_to_ohlc_in_cents: ComputedVec<Dateindex, OHLCCents>, pub dateindex_to_ohlc_in_cents: EagerVec<Dateindex, OHLCCents>,
pub dateindex_to_open_in_cents: ComputedVec<Dateindex, Open<Cents>>, pub dateindex_to_open_in_cents: EagerVec<Dateindex, Open<Cents>>,
pub height_to_close_in_cents: ComputedVec<Height, Close<Cents>>, pub height_to_close_in_cents: EagerVec<Height, Close<Cents>>,
pub height_to_high_in_cents: ComputedVec<Height, High<Cents>>, pub height_to_high_in_cents: EagerVec<Height, High<Cents>>,
pub height_to_low_in_cents: ComputedVec<Height, Low<Cents>>, pub height_to_low_in_cents: EagerVec<Height, Low<Cents>>,
pub height_to_ohlc: ComputedVec<Height, OHLCDollars>, pub height_to_ohlc: EagerVec<Height, OHLCDollars>,
pub height_to_ohlc_in_sats: ComputedVec<Height, OHLCSats>, pub height_to_ohlc_in_sats: EagerVec<Height, OHLCSats>,
pub height_to_ohlc_in_cents: ComputedVec<Height, OHLCCents>, pub height_to_ohlc_in_cents: EagerVec<Height, OHLCCents>,
pub height_to_open_in_cents: ComputedVec<Height, Open<Cents>>, pub height_to_open_in_cents: EagerVec<Height, Open<Cents>>,
pub timeindexes_to_close: ComputedVecsFromDateindex<Close<Dollars>>, pub timeindexes_to_close: ComputedVecsFromDateindex<Close<Dollars>>,
pub timeindexes_to_high: ComputedVecsFromDateindex<High<Dollars>>, pub timeindexes_to_high: ComputedVecsFromDateindex<High<Dollars>>,
pub timeindexes_to_low: ComputedVecsFromDateindex<Low<Dollars>>, pub timeindexes_to_low: ComputedVecsFromDateindex<Low<Dollars>>,
@@ -49,20 +49,20 @@ pub struct Vecs {
pub chainindexes_to_high_in_sats: ComputedVecsFromHeightStrict<High<Sats>>, pub chainindexes_to_high_in_sats: ComputedVecsFromHeightStrict<High<Sats>>,
pub chainindexes_to_low_in_sats: ComputedVecsFromHeightStrict<Low<Sats>>, pub chainindexes_to_low_in_sats: ComputedVecsFromHeightStrict<Low<Sats>>,
pub chainindexes_to_close_in_sats: ComputedVecsFromHeightStrict<Close<Sats>>, pub chainindexes_to_close_in_sats: ComputedVecsFromHeightStrict<Close<Sats>>,
pub weekindex_to_ohlc: ComputedVec<Weekindex, OHLCDollars>, pub weekindex_to_ohlc: EagerVec<Weekindex, OHLCDollars>,
pub weekindex_to_ohlc_in_sats: ComputedVec<Weekindex, OHLCSats>, pub weekindex_to_ohlc_in_sats: EagerVec<Weekindex, OHLCSats>,
pub difficultyepoch_to_ohlc: ComputedVec<Difficultyepoch, OHLCDollars>, pub difficultyepoch_to_ohlc: EagerVec<Difficultyepoch, OHLCDollars>,
pub difficultyepoch_to_ohlc_in_sats: ComputedVec<Difficultyepoch, OHLCSats>, pub difficultyepoch_to_ohlc_in_sats: EagerVec<Difficultyepoch, OHLCSats>,
pub monthindex_to_ohlc: ComputedVec<Monthindex, OHLCDollars>, pub monthindex_to_ohlc: EagerVec<Monthindex, OHLCDollars>,
pub monthindex_to_ohlc_in_sats: ComputedVec<Monthindex, OHLCSats>, pub monthindex_to_ohlc_in_sats: EagerVec<Monthindex, OHLCSats>,
pub quarterindex_to_ohlc: ComputedVec<Quarterindex, OHLCDollars>, pub quarterindex_to_ohlc: EagerVec<Quarterindex, OHLCDollars>,
pub quarterindex_to_ohlc_in_sats: ComputedVec<Quarterindex, OHLCSats>, pub quarterindex_to_ohlc_in_sats: EagerVec<Quarterindex, OHLCSats>,
pub yearindex_to_ohlc: ComputedVec<Yearindex, OHLCDollars>, pub yearindex_to_ohlc: EagerVec<Yearindex, OHLCDollars>,
pub yearindex_to_ohlc_in_sats: ComputedVec<Yearindex, OHLCSats>, pub yearindex_to_ohlc_in_sats: EagerVec<Yearindex, OHLCSats>,
// pub halvingepoch_to_ohlc: StorableVec<Halvingepoch, OHLCDollars>, // pub halvingepoch_to_ohlc: StorableVec<Halvingepoch, OHLCDollars>,
// pub halvingepoch_to_ohlc_in_sats: StorableVec<Halvingepoch, OHLCSats>, // pub halvingepoch_to_ohlc_in_sats: StorableVec<Halvingepoch, OHLCSats>,
pub decadeindex_to_ohlc: ComputedVec<Decadeindex, OHLCDollars>, pub decadeindex_to_ohlc: EagerVec<Decadeindex, OHLCDollars>,
pub decadeindex_to_ohlc_in_sats: ComputedVec<Decadeindex, OHLCSats>, pub decadeindex_to_ohlc_in_sats: EagerVec<Decadeindex, OHLCSats>,
} }
const VERSION: Version = Version::ZERO; const VERSION: Version = Version::ZERO;
@@ -78,72 +78,72 @@ impl Vecs {
fetched_path = fetched_path.join("fetched/vecs"); fetched_path = fetched_path.join("fetched/vecs");
Ok(Self { Ok(Self {
dateindex_to_ohlc_in_cents: ComputedVec::forced_import( dateindex_to_ohlc_in_cents: EagerVec::forced_import(
&fetched_path.join("dateindex_to_ohlc_in_cents"), &fetched_path.join("dateindex_to_ohlc_in_cents"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
dateindex_to_ohlc: ComputedVec::forced_import( dateindex_to_ohlc: EagerVec::forced_import(
&path.join("dateindex_to_ohlc"), &path.join("dateindex_to_ohlc"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
dateindex_to_ohlc_in_sats: ComputedVec::forced_import( dateindex_to_ohlc_in_sats: EagerVec::forced_import(
&path.join("dateindex_to_ohlc_in_sats"), &path.join("dateindex_to_ohlc_in_sats"),
VERSION + VERSION_IN_SATS + Version::ZERO, VERSION + VERSION_IN_SATS + Version::ZERO,
compressed, compressed,
)?, )?,
dateindex_to_close_in_cents: ComputedVec::forced_import( dateindex_to_close_in_cents: EagerVec::forced_import(
&path.join("dateindex_to_close_in_cents"), &path.join("dateindex_to_close_in_cents"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
dateindex_to_high_in_cents: ComputedVec::forced_import( dateindex_to_high_in_cents: EagerVec::forced_import(
&path.join("dateindex_to_high_in_cents"), &path.join("dateindex_to_high_in_cents"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
dateindex_to_low_in_cents: ComputedVec::forced_import( dateindex_to_low_in_cents: EagerVec::forced_import(
&path.join("dateindex_to_low_in_cents"), &path.join("dateindex_to_low_in_cents"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
dateindex_to_open_in_cents: ComputedVec::forced_import( dateindex_to_open_in_cents: EagerVec::forced_import(
&path.join("dateindex_to_open_in_cents"), &path.join("dateindex_to_open_in_cents"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
height_to_ohlc_in_cents: ComputedVec::forced_import( height_to_ohlc_in_cents: EagerVec::forced_import(
&fetched_path.join("height_to_ohlc_in_cents"), &fetched_path.join("height_to_ohlc_in_cents"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
height_to_ohlc: ComputedVec::forced_import( height_to_ohlc: EagerVec::forced_import(
&path.join("height_to_ohlc"), &path.join("height_to_ohlc"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
height_to_ohlc_in_sats: ComputedVec::forced_import( height_to_ohlc_in_sats: EagerVec::forced_import(
&path.join("height_to_ohlc_in_sats"), &path.join("height_to_ohlc_in_sats"),
VERSION + VERSION_IN_SATS + Version::ZERO, VERSION + VERSION_IN_SATS + Version::ZERO,
compressed, compressed,
)?, )?,
height_to_close_in_cents: ComputedVec::forced_import( height_to_close_in_cents: EagerVec::forced_import(
&path.join("height_to_close_in_cents"), &path.join("height_to_close_in_cents"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
height_to_high_in_cents: ComputedVec::forced_import( height_to_high_in_cents: EagerVec::forced_import(
&path.join("height_to_high_in_cents"), &path.join("height_to_high_in_cents"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
height_to_low_in_cents: ComputedVec::forced_import( height_to_low_in_cents: EagerVec::forced_import(
&path.join("height_to_low_in_cents"), &path.join("height_to_low_in_cents"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
height_to_open_in_cents: ComputedVec::forced_import( height_to_open_in_cents: EagerVec::forced_import(
&path.join("height_to_open_in_cents"), &path.join("height_to_open_in_cents"),
Version::ZERO, Version::ZERO,
compressed, compressed,
@@ -260,63 +260,63 @@ impl Vecs {
compressed, compressed,
StorableVecGeneatorOptions::default().add_last(), StorableVecGeneatorOptions::default().add_last(),
)?, )?,
weekindex_to_ohlc: ComputedVec::forced_import( weekindex_to_ohlc: EagerVec::forced_import(
&path.join("weekindex_to_ohlc"), &path.join("weekindex_to_ohlc"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
weekindex_to_ohlc_in_sats: ComputedVec::forced_import( weekindex_to_ohlc_in_sats: EagerVec::forced_import(
&path.join("weekindex_to_ohlc_in_sats"), &path.join("weekindex_to_ohlc_in_sats"),
VERSION + VERSION_IN_SATS + Version::ZERO, VERSION + VERSION_IN_SATS + Version::ZERO,
compressed, compressed,
)?, )?,
difficultyepoch_to_ohlc: ComputedVec::forced_import( difficultyepoch_to_ohlc: EagerVec::forced_import(
&path.join("difficultyepoch_to_ohlc"), &path.join("difficultyepoch_to_ohlc"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
difficultyepoch_to_ohlc_in_sats: ComputedVec::forced_import( difficultyepoch_to_ohlc_in_sats: EagerVec::forced_import(
&path.join("difficultyepoch_to_ohlc_in_sats"), &path.join("difficultyepoch_to_ohlc_in_sats"),
VERSION + VERSION_IN_SATS + Version::ZERO, VERSION + VERSION_IN_SATS + Version::ZERO,
compressed, compressed,
)?, )?,
monthindex_to_ohlc: ComputedVec::forced_import( monthindex_to_ohlc: EagerVec::forced_import(
&path.join("monthindex_to_ohlc"), &path.join("monthindex_to_ohlc"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
monthindex_to_ohlc_in_sats: ComputedVec::forced_import( monthindex_to_ohlc_in_sats: EagerVec::forced_import(
&path.join("monthindex_to_ohlc_in_sats"), &path.join("monthindex_to_ohlc_in_sats"),
VERSION + VERSION_IN_SATS + Version::ZERO, VERSION + VERSION_IN_SATS + Version::ZERO,
compressed, compressed,
)?, )?,
quarterindex_to_ohlc: ComputedVec::forced_import( quarterindex_to_ohlc: EagerVec::forced_import(
&path.join("quarterindex_to_ohlc"), &path.join("quarterindex_to_ohlc"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
quarterindex_to_ohlc_in_sats: ComputedVec::forced_import( quarterindex_to_ohlc_in_sats: EagerVec::forced_import(
&path.join("quarterindex_to_ohlc_in_sats"), &path.join("quarterindex_to_ohlc_in_sats"),
VERSION + VERSION_IN_SATS + Version::ZERO, VERSION + VERSION_IN_SATS + Version::ZERO,
compressed, compressed,
)?, )?,
yearindex_to_ohlc: ComputedVec::forced_import( yearindex_to_ohlc: EagerVec::forced_import(
&path.join("yearindex_to_ohlc"), &path.join("yearindex_to_ohlc"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
yearindex_to_ohlc_in_sats: ComputedVec::forced_import( yearindex_to_ohlc_in_sats: EagerVec::forced_import(
&path.join("yearindex_to_ohlc_in_sats"), &path.join("yearindex_to_ohlc_in_sats"),
VERSION + VERSION_IN_SATS + Version::ZERO, VERSION + VERSION_IN_SATS + Version::ZERO,
compressed, compressed,
)?, )?,
// halvingepoch_to_ohlc: StorableVec::forced_import(&path.join("halvingepoch_to_ohlc"), Version::ZERO, compressed)?, // halvingepoch_to_ohlc: StorableVec::forced_import(&path.join("halvingepoch_to_ohlc"), Version::ZERO, compressed)?,
decadeindex_to_ohlc: ComputedVec::forced_import( decadeindex_to_ohlc: EagerVec::forced_import(
&path.join("decadeindex_to_ohlc"), &path.join("decadeindex_to_ohlc"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
decadeindex_to_ohlc_in_sats: ComputedVec::forced_import( decadeindex_to_ohlc_in_sats: EagerVec::forced_import(
&path.join("decadeindex_to_ohlc_in_sats"), &path.join("decadeindex_to_ohlc_in_sats"),
VERSION + VERSION_IN_SATS + Version::ZERO, VERSION + VERSION_IN_SATS + Version::ZERO,
compressed, compressed,

View File

@@ -5,15 +5,15 @@ use brk_fetcher::Fetcher;
use brk_indexer::Indexer; use brk_indexer::Indexer;
use brk_vec::{AnyStoredVec, Compressed}; use brk_vec::{AnyStoredVec, Compressed};
pub mod base;
pub mod blocks; pub mod blocks;
pub mod grouped; pub mod grouped;
pub mod indexes; pub mod indexes;
pub mod marketprice; pub mod marketprice;
pub mod transactions; pub mod transactions;
pub mod vec;
use base::*; pub use indexes::*;
use indexes::*; pub use vec::*;
#[derive(Clone)] #[derive(Clone)]
pub struct Vecs { pub struct Vecs {

View File

@@ -10,7 +10,7 @@ use brk_parser::bitcoin;
use brk_vec::{Compressed, DynamicVec, StoredIndex, Version}; use brk_vec::{Compressed, DynamicVec, StoredIndex, Version};
use super::{ use super::{
ComputedVec, Indexes, EagerVec, Indexes,
grouped::{ grouped::{
ComputedValueVecsFromHeight, ComputedValueVecsFromTxindex, ComputedVecsFromHeight, ComputedValueVecsFromHeight, ComputedValueVecsFromTxindex, ComputedVecsFromHeight,
ComputedVecsFromTxindex, StorableVecGeneatorOptions, ComputedVecsFromTxindex, StorableVecGeneatorOptions,
@@ -34,12 +34,12 @@ pub struct Vecs {
pub indexes_to_tx_vsize: ComputedVecsFromTxindex<StoredUsize>, pub indexes_to_tx_vsize: ComputedVecsFromTxindex<StoredUsize>,
pub indexes_to_tx_weight: ComputedVecsFromTxindex<Weight>, pub indexes_to_tx_weight: ComputedVecsFromTxindex<Weight>,
pub txindex_to_input_count: ComputedVecsFromTxindex<StoredU64>, pub txindex_to_input_count: ComputedVecsFromTxindex<StoredU64>,
pub txindex_to_is_coinbase: ComputedVec<Txindex, bool>, pub txindex_to_is_coinbase: EagerVec<Txindex, bool>,
pub txindex_to_output_count: ComputedVecsFromTxindex<StoredU64>, pub txindex_to_output_count: ComputedVecsFromTxindex<StoredU64>,
pub txindex_to_vsize: ComputedVec<Txindex, StoredUsize>, pub txindex_to_vsize: EagerVec<Txindex, StoredUsize>,
pub txindex_to_weight: ComputedVec<Txindex, Weight>, pub txindex_to_weight: EagerVec<Txindex, Weight>,
/// Value == 0 when Coinbase /// Value == 0 when Coinbase
pub txinindex_to_value: ComputedVec<Txinindex, Sats>, pub txinindex_to_value: EagerVec<Txinindex, Sats>,
pub indexes_to_subsidy: ComputedValueVecsFromHeight, pub indexes_to_subsidy: ComputedValueVecsFromHeight,
pub indexes_to_coinbase: ComputedValueVecsFromHeight, pub indexes_to_coinbase: ComputedValueVecsFromHeight,
} }
@@ -67,7 +67,7 @@ impl Vecs {
.add_total(), .add_total(),
)?, )?,
// height_to_subsidy: StorableVec::forced_import(&path.join("height_to_subsidy"), Version::ZERO)?, // height_to_subsidy: StorableVec::forced_import(&path.join("height_to_subsidy"), Version::ZERO)?,
txindex_to_is_coinbase: ComputedVec::forced_import( txindex_to_is_coinbase: EagerVec::forced_import(
&path.join("txindex_to_is_coinbase"), &path.join("txindex_to_is_coinbase"),
Version::ZERO, Version::ZERO,
compressed, compressed,
@@ -98,7 +98,7 @@ impl Vecs {
.add_sum() .add_sum()
.add_total(), .add_total(),
)?, )?,
txinindex_to_value: ComputedVec::forced_import( txinindex_to_value: EagerVec::forced_import(
&path.join("txinindex_to_value"), &path.join("txinindex_to_value"),
Version::ZERO, Version::ZERO,
compressed, compressed,
@@ -174,12 +174,12 @@ impl Vecs {
.add_minmax() .add_minmax()
.add_average(), .add_average(),
)?, )?,
txindex_to_weight: ComputedVec::forced_import( txindex_to_weight: EagerVec::forced_import(
&path.join("txindex_to_weight"), &path.join("txindex_to_weight"),
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
txindex_to_vsize: ComputedVec::forced_import( txindex_to_vsize: EagerVec::forced_import(
&path.join("txindex_to_vsize"), &path.join("txindex_to_vsize"),
Version::ZERO, Version::ZERO,
compressed, compressed,

View File

@@ -18,7 +18,7 @@ const ONE_MIB: usize = ONE_KIB * ONE_KIB;
const MAX_CACHE_SIZE: usize = 210 * ONE_MIB; const MAX_CACHE_SIZE: usize = 210 * ONE_MIB;
#[derive(Debug)] #[derive(Debug)]
pub struct ComputedVec<I, T> pub struct EagerVec<I, T>
where where
I: StoredIndex, I: StoredIndex,
T: StoredType, T: StoredType,
@@ -27,7 +27,7 @@ where
inner: StoredVec<I, T>, inner: StoredVec<I, T>,
} }
impl<I, T> ComputedVec<I, T> impl<I, T> EagerVec<I, T>
where where
I: StoredIndex, I: StoredIndex,
T: StoredType, T: StoredType,
@@ -443,7 +443,7 @@ where
} }
} }
impl<I> ComputedVec<I, Bitcoin> impl<I> EagerVec<I, Bitcoin>
where where
I: StoredIndex, I: StoredIndex,
{ {
@@ -467,7 +467,7 @@ where
} }
} }
impl ComputedVec<Height, Dollars> { impl EagerVec<Height, Dollars> {
pub fn compute_from_bitcoin( pub fn compute_from_bitcoin(
&mut self, &mut self,
max_from: Height, max_from: Height,
@@ -490,7 +490,7 @@ impl ComputedVec<Height, Dollars> {
} }
} }
impl ComputedVec<Txindex, Dollars> { impl EagerVec<Txindex, Dollars> {
pub fn compute_from_bitcoin( pub fn compute_from_bitcoin(
&mut self, &mut self,
max_from: Txindex, max_from: Txindex,
@@ -515,7 +515,7 @@ impl ComputedVec<Txindex, Dollars> {
} }
} }
impl<I, T> Clone for ComputedVec<I, T> impl<I, T> Clone for EagerVec<I, T>
where where
I: StoredIndex, I: StoredIndex,
T: StoredType, T: StoredType,

View File

@@ -0,0 +1,76 @@
use core::error;
use std::{
cmp::Ordering,
fmt::Debug,
ops::Add,
path::{Path, PathBuf},
};
use brk_core::{Bitcoin, CheckedSub, Close, Dollars, Height, Sats, Txindex};
use brk_exit::Exit;
use brk_vec::{
Compressed, DynamicVec, Error, GenericVec, Result, StoredIndex, StoredType, StoredVec, Version,
};
use log::info;
const ONE_KIB: usize = 1024;
const ONE_MIB: usize = ONE_KIB * ONE_KIB;
const MAX_CACHE_SIZE: usize = 210 * ONE_MIB;
#[derive(Debug, Clone, Copy)]
enum Mode {
Lazy,
Eager,
}
#[derive(Debug)]
pub struct LazyVec<I, T>
where
I: StoredIndex,
T: StoredType,
{
inner: StoredVec<I, T>,
}
impl<I, T> LazyVec<I, T>
where
I: StoredIndex,
T: StoredType,
{
const SIZE_OF: usize = size_of::<T>();
fn version(&self) -> Version {
self.inner.version()
}
pub fn len(&self) -> usize {
self.inner.len()
}
pub fn is_empty(&self) -> bool {
self.inner.is_empty()
}
pub fn unwrap_cached_get(&mut self, index: I) -> Option<T> {
self.inner.unwrap_cached_get(index)
}
#[inline]
pub fn double_unwrap_cached_get(&mut self, index: I) -> T {
self.inner.double_unwrap_cached_get(index)
}
pub fn collect_inclusive_range(&self, from: I, to: I) -> Result<Vec<T>> {
self.inner.collect_inclusive_range(from, to)
}
}
impl<I, T> Clone for LazyVec<I, T>
where
I: StoredIndex,
T: StoredType,
{
fn clone(&self) -> Self {
Self {
inner: self.inner.clone(),
}
}
}

View File

@@ -0,0 +1,7 @@
mod _type;
mod eager;
// mod lazy;
pub use _type::*;
pub use eager::*;
// pub use lazy::*;

View File

@@ -24,7 +24,7 @@ fn main() -> color_eyre::Result<()> {
let outputs = Path::new("../../_outputs"); let outputs = Path::new("../../_outputs");
let mut indexer = Indexer::new(outputs.join("indexed").to_owned(), true, true)?; let mut indexer = Indexer::new(outputs.join("indexed").to_owned(), false, false)?;
indexer.import_stores()?; indexer.import_stores()?;
indexer.import_vecs()?; indexer.import_vecs()?;

View File

@@ -31,7 +31,7 @@ pub use stores::*;
pub use vecs::*; pub use vecs::*;
const SNAPSHOT_BLOCK_RANGE: usize = 1000; const SNAPSHOT_BLOCK_RANGE: usize = 1000;
const COLLISIONS_CHECKED_UP_TO: u32 = 890_000; const COLLISIONS_CHECKED_UP_TO: u32 = 893_000;
#[derive(Clone)] #[derive(Clone)]
pub struct Indexer { pub struct Indexer {

View File

@@ -21,7 +21,7 @@ color-eyre = { workspace = true }
jiff = { workspace = true } jiff = { workspace = true }
log = { workspace = true } log = { workspace = true }
minreq = { workspace = true } minreq = { workspace = true }
oxc = { version = "0.65.0", features = ["codegen", "minifier"] } oxc = { version = "0.66.0", features = ["codegen", "minifier"] }
serde = { workspace = true } serde = { workspace = true }
tokio = { version = "1.44.2", features = ["full"] } tokio = { version = "1.44.2", features = ["full"] }
tower-http = { version = "0.6.2", features = ["compression-full", "trace"] } tower-http = { version = "0.6.2", features = ["compression-full", "trace"] }

View File

@@ -443,39 +443,21 @@ function createPartialOptions(colors) {
name: "Versions", name: "Versions",
title: "Transaction Versions", title: "Transaction Versions",
bottom: [ bottom: [
// {
// name: "1",
// title: "Transaction V1 Count",
// bottom: [
createBaseSeries({ createBaseSeries({
key: "tx-v1", key: "tx-v1",
name: "v1 Count", name: "v1 Count",
}), }),
...createSumTotalSeries({ concat: "tx-v1", name: "v1" }), ...createSumTotalSeries({ concat: "tx-v1", name: "v1" }),
// ],
// },
// {
// name: "2",
// title: "Transaction V2 Count",
// bottom: [
createBaseSeries({ createBaseSeries({
key: "tx-v2", key: "tx-v2",
name: "v2 Count", name: "v2 Count",
}), }),
...createSumTotalSeries({ concat: "tx-v2", name: "v2" }), ...createSumTotalSeries({ concat: "tx-v2", name: "v2" }),
// ],
// },
// {
// name: "3",
// title: "Transaction V3 Count",
// bottom: [
createBaseSeries({ createBaseSeries({
key: "tx-v3", key: "tx-v3",
name: "v3 Count", name: "v3 Count",
}), }),
...createSumTotalSeries({ concat: "tx-v3", name: "v3" }), ...createSumTotalSeries({ concat: "tx-v3", name: "v3" }),
// ],
// },
], ],
}, },
], ],