comp + lazy: part 6

This commit is contained in:
nym21
2025-05-06 12:23:37 +02:00
parent aa30feb875
commit 3f62da879c
20 changed files with 891 additions and 422 deletions

View File

@@ -7,7 +7,7 @@ use brk_core::{
use brk_exit::Exit; use brk_exit::Exit;
use brk_indexer::Indexer; use brk_indexer::Indexer;
use brk_parser::bitcoin; use brk_parser::bitcoin;
use brk_vec::{AnyIterableVec, Compressed, Computation, EagerVec, VecIterator, Version}; use brk_vec::{AnyCollectableVec, AnyIterableVec, Compressed, Computation, EagerVec, Version};
use super::{ use super::{
Indexes, Indexes,
@@ -32,7 +32,7 @@ pub struct Vecs {
impl Vecs { impl Vecs {
pub fn forced_import( pub fn forced_import(
path: &Path, path: &Path,
computation: Computation, _computation: Computation,
compressed: Compressed, compressed: Compressed,
) -> color_eyre::Result<Self> { ) -> color_eyre::Result<Self> {
fs::create_dir_all(path)?; fs::create_dir_all(path)?;
@@ -126,7 +126,7 @@ impl Vecs {
|vec, _, indexes, starting_indexes, exit| { |vec, _, indexes, starting_indexes, exit| {
vec.compute_transform( vec.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
indexes.dateindex_to_date.vec(), &indexes.dateindex_to_date,
|(di, d, ..)| (di, Timestamp::from(d)), |(di, d, ..)| (di, Timestamp::from(d)),
exit, exit,
) )
@@ -143,7 +143,7 @@ impl Vecs {
v.compute_range( v.compute_range(
starting_indexes.height, starting_indexes.height,
indexer_vecs.height_to_weight.vec(), &indexer_vecs.height_to_weight,
|h| (h, StoredU32::from(1_u32)), |h| (h, StoredU32::from(1_u32)),
exit, exit,
) )
@@ -155,7 +155,7 @@ impl Vecs {
let mut height_to_timestamp_iter = indexer_vecs.height_to_timestamp.iter(); let mut height_to_timestamp_iter = indexer_vecs.height_to_timestamp.iter();
self.height_to_interval.compute_transform( self.height_to_interval.compute_transform(
starting_indexes.height, starting_indexes.height,
indexer_vecs.height_to_timestamp.vec(), &indexer_vecs.height_to_timestamp,
|(height, timestamp, ..)| { |(height, timestamp, ..)| {
let interval = height.decremented().map_or(Timestamp::ZERO, |prev_h| { let interval = height.decremented().map_or(Timestamp::ZERO, |prev_h| {
let prev_timestamp = height_to_timestamp_iter.unwrap_get_inner(prev_h); let prev_timestamp = height_to_timestamp_iter.unwrap_get_inner(prev_h);
@@ -172,26 +172,26 @@ impl Vecs {
indexes, indexes,
starting_indexes, starting_indexes,
exit, exit,
Some(self.height_to_interval.vec()), Some(&self.height_to_interval),
)?; )?;
self.indexes_to_block_weight.compute_rest( self.indexes_to_block_weight.compute_rest(
indexes, indexes,
starting_indexes, starting_indexes,
exit, exit,
Some(indexer_vecs.height_to_weight.vec()), Some(&indexer_vecs.height_to_weight),
)?; )?;
self.indexes_to_block_size.compute_rest( self.indexes_to_block_size.compute_rest(
indexes, indexes,
starting_indexes, starting_indexes,
exit, exit,
Some(indexer_vecs.height_to_total_size.vec()), Some(&indexer_vecs.height_to_total_size),
)?; )?;
self.height_to_vbytes.compute_transform( self.height_to_vbytes.compute_transform(
starting_indexes.height, starting_indexes.height,
indexer_vecs.height_to_weight.vec(), &indexer_vecs.height_to_weight,
|(h, w, ..)| { |(h, w, ..)| {
( (
h, h,
@@ -205,21 +205,21 @@ impl Vecs {
indexes, indexes,
starting_indexes, starting_indexes,
exit, exit,
Some(self.height_to_vbytes.vec()), Some(&self.height_to_vbytes),
)?; )?;
let mut height_to_timestamp_iter = indexer_vecs.height_to_timestamp.iter(); let mut height_to_timestamp_iter = indexer_vecs.height_to_timestamp.iter();
self.difficultyepoch_to_timestamp.compute_transform( self.difficultyepoch_to_timestamp.compute_transform(
starting_indexes.difficultyepoch, starting_indexes.difficultyepoch,
indexes.difficultyepoch_to_first_height.vec(), &indexes.difficultyepoch_to_first_height,
|(i, h, ..)| (i, height_to_timestamp_iter.unwrap_get_inner(h)), |(i, h, ..)| (i, height_to_timestamp_iter.unwrap_get_inner(h)),
exit, exit,
)?; )?;
self.halvingepoch_to_timestamp.compute_transform( self.halvingepoch_to_timestamp.compute_transform(
starting_indexes.halvingepoch, starting_indexes.halvingepoch,
indexes.halvingepoch_to_first_height.vec(), &indexes.halvingepoch_to_first_height,
|(i, h, ..)| (i, height_to_timestamp_iter.unwrap_get_inner(h)), |(i, h, ..)| (i, height_to_timestamp_iter.unwrap_get_inner(h)),
exit, exit,
)?; )?;
@@ -227,13 +227,13 @@ impl Vecs {
Ok(()) Ok(())
} }
pub fn vecs(&self) -> Vec<&dyn brk_vec::AnyVec> { pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
[ [
vec![ vec![
self.height_to_interval.any_vec(), &self.height_to_interval as &dyn AnyCollectableVec,
self.height_to_vbytes.any_vec(), &self.height_to_vbytes,
self.difficultyepoch_to_timestamp.any_vec(), &self.difficultyepoch_to_timestamp,
self.halvingepoch_to_timestamp.any_vec(), &self.halvingepoch_to_timestamp,
], ],
self.timeindexes_to_timestamp.vecs(), self.timeindexes_to_timestamp.vecs(),
self.indexes_to_block_count.vecs(), self.indexes_to_block_count.vecs(),

View File

@@ -3,7 +3,7 @@ use std::path::Path;
use brk_core::{CheckedSub, StoredUsize}; use brk_core::{CheckedSub, StoredUsize};
use brk_exit::Exit; use brk_exit::Exit;
use brk_vec::{ use brk_vec::{
AnyIterableVec, AnyVec, Compressed, EagerVec, Result, StoredIndex, StoredType, VecIterator, AnyCollectableVec, AnyIterableVec, Compressed, EagerVec, Result, StoredIndex, StoredType,
Version, Version,
}; };
use color_eyre::eyre::ContextCompat; use color_eyre::eyre::ContextCompat;
@@ -178,6 +178,10 @@ where
{ {
let index = self.starting_index(max_from); let index = self.starting_index(max_from);
self.validate_computed_version_or_reset_file(
source.version() + first_indexes.version() + count_indexes.version(),
)?;
let mut count_indexes_iter = count_indexes.iter(); let mut count_indexes_iter = count_indexes.iter();
let mut source_iter = source.iter(); let mut source_iter = source.iter();
@@ -341,6 +345,10 @@ where
panic!("unsupported"); panic!("unsupported");
} }
self.validate_computed_version_or_reset_file(
VERSION + first_indexes.version() + count_indexes.version(),
)?;
let index = self.starting_index(max_from); let index = self.starting_index(max_from);
let mut count_indexes_iter = count_indexes.iter(); let mut count_indexes_iter = count_indexes.iter();
@@ -495,6 +503,7 @@ where
pub fn unwrap_first(&mut self) -> &mut EagerVec<I, T> { pub fn unwrap_first(&mut self) -> &mut EagerVec<I, T> {
self.first.as_mut().unwrap() self.first.as_mut().unwrap()
} }
#[allow(unused)]
pub fn unwrap_average(&mut self) -> &mut EagerVec<I, T> { pub fn unwrap_average(&mut self) -> &mut EagerVec<I, T> {
self.average.as_mut().unwrap() self.average.as_mut().unwrap()
} }
@@ -504,18 +513,23 @@ where
pub fn unwrap_max(&mut self) -> &mut EagerVec<I, T> { pub fn unwrap_max(&mut self) -> &mut EagerVec<I, T> {
self.max.as_mut().unwrap() self.max.as_mut().unwrap()
} }
#[allow(unused)]
pub fn unwrap_90p(&mut self) -> &mut EagerVec<I, T> { pub fn unwrap_90p(&mut self) -> &mut EagerVec<I, T> {
self._90p.as_mut().unwrap() self._90p.as_mut().unwrap()
} }
#[allow(unused)]
pub fn unwrap_75p(&mut self) -> &mut EagerVec<I, T> { pub fn unwrap_75p(&mut self) -> &mut EagerVec<I, T> {
self._75p.as_mut().unwrap() self._75p.as_mut().unwrap()
} }
#[allow(unused)]
pub fn unwrap_median(&mut self) -> &mut EagerVec<I, T> { pub fn unwrap_median(&mut self) -> &mut EagerVec<I, T> {
self.median.as_mut().unwrap() self.median.as_mut().unwrap()
} }
#[allow(unused)]
pub fn unwrap_25p(&mut self) -> &mut EagerVec<I, T> { pub fn unwrap_25p(&mut self) -> &mut EagerVec<I, T> {
self._25p.as_mut().unwrap() self._25p.as_mut().unwrap()
} }
#[allow(unused)]
pub fn unwrap_10p(&mut self) -> &mut EagerVec<I, T> { pub fn unwrap_10p(&mut self) -> &mut EagerVec<I, T> {
self._10p.as_mut().unwrap() self._10p.as_mut().unwrap()
} }
@@ -525,48 +539,49 @@ where
pub fn unwrap_last(&mut self) -> &mut EagerVec<I, T> { pub fn unwrap_last(&mut self) -> &mut EagerVec<I, T> {
self.last.as_mut().unwrap() self.last.as_mut().unwrap()
} }
#[allow(unused)]
pub fn unwrap_total(&mut self) -> &mut EagerVec<I, T> { pub fn unwrap_total(&mut self) -> &mut EagerVec<I, T> {
self.total.as_mut().unwrap() self.total.as_mut().unwrap()
} }
pub fn vecs(&self) -> Vec<&dyn brk_vec::AnyVec> { pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
let mut v: Vec<&dyn brk_vec::AnyVec> = vec![]; let mut v: Vec<&dyn AnyCollectableVec> = vec![];
if let Some(first) = self.first.as_ref() { if let Some(first) = self.first.as_ref() {
v.push(first.any_vec()); v.push(first);
} }
if let Some(last) = self.last.as_ref() { if let Some(last) = self.last.as_ref() {
v.push(last.any_vec()); v.push(last);
} }
if let Some(min) = self.min.as_ref() { if let Some(min) = self.min.as_ref() {
v.push(min.any_vec()); v.push(min);
} }
if let Some(max) = self.max.as_ref() { if let Some(max) = self.max.as_ref() {
v.push(max.any_vec()); v.push(max);
} }
if let Some(median) = self.median.as_ref() { if let Some(median) = self.median.as_ref() {
v.push(median.any_vec()); v.push(median);
} }
if let Some(average) = self.average.as_ref() { if let Some(average) = self.average.as_ref() {
v.push(average.any_vec()); v.push(average);
} }
if let Some(sum) = self.sum.as_ref() { if let Some(sum) = self.sum.as_ref() {
v.push(sum.any_vec()); v.push(sum);
} }
if let Some(total) = self.total.as_ref() { if let Some(total) = self.total.as_ref() {
v.push(total.any_vec()); v.push(total);
} }
if let Some(_90p) = self._90p.as_ref() { if let Some(_90p) = self._90p.as_ref() {
v.push(_90p.any_vec()); v.push(_90p);
} }
if let Some(_75p) = self._75p.as_ref() { if let Some(_75p) = self._75p.as_ref() {
v.push(_75p.any_vec()); v.push(_75p);
} }
if let Some(_25p) = self._25p.as_ref() { if let Some(_25p) = self._25p.as_ref() {
v.push(_25p.any_vec()); v.push(_25p);
} }
if let Some(_10p) = self._10p.as_ref() { if let Some(_10p) = self._10p.as_ref() {
v.push(_10p.any_vec()); v.push(_10p);
} }
v v
@@ -612,6 +627,47 @@ where
Ok(()) Ok(())
} }
fn validate_computed_version_or_reset_file(&mut self, version: Version) -> Result<()> {
if let Some(first) = self.first.as_mut() {
first.validate_computed_version_or_reset_file(Version::ZERO + version)?;
}
if let Some(last) = self.last.as_mut() {
last.validate_computed_version_or_reset_file(Version::ZERO + version)?;
}
if let Some(min) = self.min.as_mut() {
min.validate_computed_version_or_reset_file(Version::ZERO + version)?;
}
if let Some(max) = self.max.as_mut() {
max.validate_computed_version_or_reset_file(Version::ZERO + version)?;
}
if let Some(median) = self.median.as_mut() {
median.validate_computed_version_or_reset_file(Version::ZERO + version)?;
}
if let Some(average) = self.average.as_mut() {
average.validate_computed_version_or_reset_file(Version::ZERO + version)?;
}
if let Some(sum) = self.sum.as_mut() {
sum.validate_computed_version_or_reset_file(Version::ZERO + version)?;
}
if let Some(total) = self.total.as_mut() {
total.validate_computed_version_or_reset_file(Version::ZERO + version)?;
}
if let Some(_90p) = self._90p.as_mut() {
_90p.validate_computed_version_or_reset_file(Version::ZERO + version)?;
}
if let Some(_75p) = self._75p.as_mut() {
_75p.validate_computed_version_or_reset_file(Version::ZERO + version)?;
}
if let Some(_25p) = self._25p.as_mut() {
_25p.validate_computed_version_or_reset_file(Version::ZERO + version)?;
}
if let Some(_10p) = self._10p.as_mut() {
_10p.validate_computed_version_or_reset_file(Version::ZERO + version)?;
}
Ok(())
}
} }
#[derive(Default, Clone, Copy)] #[derive(Default, Clone, Copy)]
@@ -651,6 +707,7 @@ impl StorableVecGeneatorOptions {
self self
} }
#[allow(unused)]
pub fn add_median(mut self) -> Self { pub fn add_median(mut self) -> Self {
self.median = true; self.median = true;
self self
@@ -666,21 +723,25 @@ impl StorableVecGeneatorOptions {
self self
} }
#[allow(unused)]
pub fn add_90p(mut self) -> Self { pub fn add_90p(mut self) -> Self {
self._90p = true; self._90p = true;
self self
} }
#[allow(unused)]
pub fn add_75p(mut self) -> Self { pub fn add_75p(mut self) -> Self {
self._75p = true; self._75p = true;
self self
} }
#[allow(unused)]
pub fn add_25p(mut self) -> Self { pub fn add_25p(mut self) -> Self {
self._25p = true; self._25p = true;
self self
} }
#[allow(unused)]
pub fn add_10p(mut self) -> Self { pub fn add_10p(mut self) -> Self {
self._10p = true; self._10p = true;
self self
@@ -691,51 +752,61 @@ impl StorableVecGeneatorOptions {
self self
} }
#[allow(unused)]
pub fn rm_min(mut self) -> Self { pub fn rm_min(mut self) -> Self {
self.min = false; self.min = false;
self self
} }
#[allow(unused)]
pub fn rm_max(mut self) -> Self { pub fn rm_max(mut self) -> Self {
self.max = false; self.max = false;
self self
} }
#[allow(unused)]
pub fn rm_median(mut self) -> Self { pub fn rm_median(mut self) -> Self {
self.median = false; self.median = false;
self self
} }
#[allow(unused)]
pub fn rm_average(mut self) -> Self { pub fn rm_average(mut self) -> Self {
self.average = false; self.average = false;
self self
} }
#[allow(unused)]
pub fn rm_sum(mut self) -> Self { pub fn rm_sum(mut self) -> Self {
self.sum = false; self.sum = false;
self self
} }
#[allow(unused)]
pub fn rm_90p(mut self) -> Self { pub fn rm_90p(mut self) -> Self {
self._90p = false; self._90p = false;
self self
} }
#[allow(unused)]
pub fn rm_75p(mut self) -> Self { pub fn rm_75p(mut self) -> Self {
self._75p = false; self._75p = false;
self self
} }
#[allow(unused)]
pub fn rm_25p(mut self) -> Self { pub fn rm_25p(mut self) -> Self {
self._25p = false; self._25p = false;
self self
} }
#[allow(unused)]
pub fn rm_10p(mut self) -> Self { pub fn rm_10p(mut self) -> Self {
self._10p = false; self._10p = false;
self self
} }
#[allow(unused)]
pub fn rm_total(mut self) -> Self { pub fn rm_total(mut self) -> Self {
self.total = false; self.total = false;
self self

View File

@@ -3,7 +3,7 @@ use std::path::Path;
use brk_core::{DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex}; use brk_core::{DateIndex, DecadeIndex, MonthIndex, QuarterIndex, WeekIndex, YearIndex};
use brk_exit::Exit; use brk_exit::Exit;
use brk_indexer::Indexer; use brk_indexer::Indexer;
use brk_vec::{AnyIterableVec, AnyVec, Compressed, EagerVec, Result, Version}; use brk_vec::{AnyCollectableVec, Compressed, EagerVec, Result, Version};
use crate::storage::{Indexes, indexes}; use crate::storage::{Indexes, indexes};
@@ -95,54 +95,54 @@ where
)?; )?;
self.dateindex_extra self.dateindex_extra
.extend(starting_indexes.dateindex, self.dateindex.iter_vec(), exit)?; .extend(starting_indexes.dateindex, &self.dateindex, exit)?;
self.weekindex.compute( self.weekindex.compute(
starting_indexes.weekindex, starting_indexes.weekindex,
self.dateindex.iter_vec(), &self.dateindex,
indexes.weekindex_to_first_dateindex.iter_vec(), &indexes.weekindex_to_first_dateindex,
indexes.weekindex_to_dateindex_count.iter_vec(), &indexes.weekindex_to_dateindex_count,
exit, exit,
)?; )?;
self.monthindex.compute( self.monthindex.compute(
starting_indexes.monthindex, starting_indexes.monthindex,
self.dateindex.iter_vec(), &self.dateindex,
indexes.monthindex_to_first_dateindex.iter_vec(), &indexes.monthindex_to_first_dateindex,
indexes.monthindex_to_dateindex_count.iter_vec(), &indexes.monthindex_to_dateindex_count,
exit, exit,
)?; )?;
self.quarterindex.from_aligned( self.quarterindex.from_aligned(
starting_indexes.quarterindex, starting_indexes.quarterindex,
&self.monthindex, &self.monthindex,
indexes.quarterindex_to_first_monthindex.iter_vec(), &indexes.quarterindex_to_first_monthindex,
indexes.quarterindex_to_monthindex_count.iter_vec(), &indexes.quarterindex_to_monthindex_count,
exit, exit,
)?; )?;
self.yearindex.from_aligned( self.yearindex.from_aligned(
starting_indexes.yearindex, starting_indexes.yearindex,
&self.monthindex, &self.monthindex,
indexes.yearindex_to_first_monthindex.iter_vec(), &indexes.yearindex_to_first_monthindex,
indexes.yearindex_to_monthindex_count.iter_vec(), &indexes.yearindex_to_monthindex_count,
exit, exit,
)?; )?;
self.decadeindex.from_aligned( self.decadeindex.from_aligned(
starting_indexes.decadeindex, starting_indexes.decadeindex,
&self.yearindex, &self.yearindex,
indexes.decadeindex_to_first_yearindex.iter_vec(), &indexes.decadeindex_to_first_yearindex,
indexes.decadeindex_to_yearindex_count.iter_vec(), &indexes.decadeindex_to_yearindex_count,
exit, exit,
)?; )?;
Ok(()) Ok(())
} }
pub fn vecs(&self) -> Vec<&dyn AnyVec> { pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
[ [
vec![self.dateindex.any_vec()], vec![&self.dateindex as &dyn AnyCollectableVec],
self.dateindex_extra.vecs(), self.dateindex_extra.vecs(),
self.weekindex.vecs(), self.weekindex.vecs(),
self.monthindex.vecs(), self.monthindex.vecs(),

View File

@@ -5,7 +5,7 @@ use brk_core::{
}; };
use brk_exit::Exit; use brk_exit::Exit;
use brk_indexer::Indexer; use brk_indexer::Indexer;
use brk_vec::{AnyIterableVec, AnyVec, Compressed, EagerVec, Result, StoredVec, Version}; use brk_vec::{AnyCollectableVec, AnyIterableVec, Compressed, EagerVec, Result, Version};
use crate::storage::{Indexes, indexes}; use crate::storage::{Indexes, indexes};
@@ -104,7 +104,8 @@ where
exit, exit,
)?; )?;
self.compute_rest(indexes, starting_indexes, exit, None)?; let height: Option<&EagerVec<Height, T>> = None;
self.compute_rest(indexes, starting_indexes, exit, height)?;
Ok(()) Ok(())
} }
@@ -116,73 +117,96 @@ where
exit: &Exit, exit: &Exit,
height: Option<&impl AnyIterableVec<Height, T>>, height: Option<&impl AnyIterableVec<Height, T>>,
) -> color_eyre::Result<()> { ) -> color_eyre::Result<()> {
let height = height.unwrap_or_else(|| self.height.as_ref().unwrap().iter_vec()); if let Some(height) = height {
self.height_extra
.extend(starting_indexes.height, height, exit)?;
self.height_extra self.dateindex.compute(
.extend(starting_indexes.height, height, exit)?; starting_indexes.dateindex,
height,
&indexes.dateindex_to_first_height,
&indexes.dateindex_to_height_count,
exit,
)?;
self.dateindex.compute( self.difficultyepoch.compute(
starting_indexes.dateindex, starting_indexes.difficultyepoch,
height, height,
indexes.dateindex_to_first_height.iter_vec(), &indexes.difficultyepoch_to_first_height,
indexes.dateindex_to_height_count.iter_vec(), &indexes.difficultyepoch_to_height_count,
exit, exit,
)?; )?;
} else {
let height = self.height.as_ref().unwrap();
self.height_extra
.extend(starting_indexes.height, height, exit)?;
self.dateindex.compute(
starting_indexes.dateindex,
height,
&indexes.dateindex_to_first_height,
&indexes.dateindex_to_height_count,
exit,
)?;
self.difficultyepoch.compute(
starting_indexes.difficultyepoch,
height,
&indexes.difficultyepoch_to_first_height,
&indexes.difficultyepoch_to_height_count,
exit,
)?;
}
self.weekindex.from_aligned( self.weekindex.from_aligned(
starting_indexes.weekindex, starting_indexes.weekindex,
&self.dateindex, &self.dateindex,
indexes.weekindex_to_first_dateindex.iter_vec(), &indexes.weekindex_to_first_dateindex,
indexes.weekindex_to_dateindex_count.iter_vec(), &indexes.weekindex_to_dateindex_count,
exit, exit,
)?; )?;
self.monthindex.from_aligned( self.monthindex.from_aligned(
starting_indexes.monthindex, starting_indexes.monthindex,
&self.dateindex, &self.dateindex,
indexes.monthindex_to_first_dateindex.iter_vec(), &indexes.monthindex_to_first_dateindex,
indexes.monthindex_to_dateindex_count.iter_vec(), &indexes.monthindex_to_dateindex_count,
exit, exit,
)?; )?;
self.quarterindex.from_aligned( self.quarterindex.from_aligned(
starting_indexes.quarterindex, starting_indexes.quarterindex,
&self.monthindex, &self.monthindex,
indexes.quarterindex_to_first_monthindex.iter_vec(), &indexes.quarterindex_to_first_monthindex,
indexes.quarterindex_to_monthindex_count.iter_vec(), &indexes.quarterindex_to_monthindex_count,
exit, exit,
)?; )?;
self.yearindex.from_aligned( self.yearindex.from_aligned(
starting_indexes.yearindex, starting_indexes.yearindex,
&self.monthindex, &self.monthindex,
indexes.yearindex_to_first_monthindex.iter_vec(), &indexes.yearindex_to_first_monthindex,
indexes.yearindex_to_monthindex_count.iter_vec(), &indexes.yearindex_to_monthindex_count,
exit, exit,
)?; )?;
self.decadeindex.from_aligned( self.decadeindex.from_aligned(
starting_indexes.decadeindex, starting_indexes.decadeindex,
&self.yearindex, &self.yearindex,
indexes.decadeindex_to_first_yearindex.iter_vec(), &indexes.decadeindex_to_first_yearindex,
indexes.decadeindex_to_yearindex_count.iter_vec(), &indexes.decadeindex_to_yearindex_count,
exit,
)?;
self.difficultyepoch.compute(
starting_indexes.difficultyepoch,
height,
indexes.difficultyepoch_to_first_height.iter_vec(),
indexes.difficultyepoch_to_height_count.iter_vec(),
exit, exit,
)?; )?;
Ok(()) Ok(())
} }
pub fn vecs(&self) -> Vec<&dyn AnyVec> { pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
[ [
self.height.as_ref().map_or(vec![], |v| vec![v.any_vec()]), self.height
.as_ref()
.map_or(vec![], |v| vec![v as &dyn AnyCollectableVec]),
self.height_extra.vecs(), self.height_extra.vecs(),
self.dateindex.vecs(), self.dateindex.vecs(),
self.weekindex.vecs(), self.weekindex.vecs(),

View File

@@ -3,7 +3,7 @@ use std::path::Path;
use brk_core::{DifficultyEpoch, Height}; use brk_core::{DifficultyEpoch, Height};
use brk_exit::Exit; use brk_exit::Exit;
use brk_indexer::Indexer; use brk_indexer::Indexer;
use brk_vec::{AnyIterableVec, AnyVec, Compressed, EagerVec, Result, Version}; use brk_vec::{AnyCollectableVec, Compressed, EagerVec, Result, Version};
use crate::storage::{Indexes, indexes}; use crate::storage::{Indexes, indexes};
@@ -73,22 +73,22 @@ where
compute(&mut self.height, indexer, indexes, starting_indexes, exit)?; compute(&mut self.height, indexer, indexes, starting_indexes, exit)?;
self.height_extra self.height_extra
.extend(starting_indexes.height, self.height.iter_vec(), exit)?; .extend(starting_indexes.height, &self.height, exit)?;
self.difficultyepoch.compute( self.difficultyepoch.compute(
starting_indexes.difficultyepoch, starting_indexes.difficultyepoch,
self.height.iter_vec(), &self.height,
indexes.difficultyepoch_to_first_height.iter_vec(), &indexes.difficultyepoch_to_first_height,
indexes.difficultyepoch_to_height_count.iter_vec(), &indexes.difficultyepoch_to_height_count,
exit, exit,
)?; )?;
Ok(()) Ok(())
} }
pub fn vecs(&self) -> Vec<&dyn AnyVec> { pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
[ [
vec![self.height.any_vec()], vec![&self.height as &dyn AnyCollectableVec],
self.height_extra.vecs(), self.height_extra.vecs(),
self.difficultyepoch.vecs(), self.difficultyepoch.vecs(),
// self.halvingepoch.vecs(), // self.halvingepoch.vecs(),

View File

@@ -6,7 +6,9 @@ use brk_core::{
}; };
use brk_exit::Exit; use brk_exit::Exit;
use brk_indexer::Indexer; use brk_indexer::Indexer;
use brk_vec::{AnyIterableVec, AnyVec, Compressed, EagerVec, Result, StoredVec, Version}; use brk_vec::{
AnyCollectableVec, CollectableVec, Compressed, EagerVec, Result, StoredVec, Version,
};
use crate::storage::{Indexes, indexes}; use crate::storage::{Indexes, indexes};
@@ -106,7 +108,8 @@ where
exit, exit,
)?; )?;
self.compute_rest(indexer, indexes, starting_indexes, exit, None)?; let txindex: Option<&StoredVec<TxIndex, T>> = None;
self.compute_rest(indexer, indexes, starting_indexes, exit, txindex)?;
Ok(()) Ok(())
} }
@@ -117,80 +120,92 @@ where
indexes: &indexes::Vecs, indexes: &indexes::Vecs,
starting_indexes: &Indexes, starting_indexes: &Indexes,
exit: &Exit, exit: &Exit,
txindex: Option<&StoredVec<TxIndex, T>>, txindex: Option<&impl CollectableVec<TxIndex, T>>,
) -> color_eyre::Result<()> { ) -> color_eyre::Result<()> {
let txindex = txindex.unwrap_or_else(|| self.txindex.as_ref().unwrap().iter_vec()); if let Some(txindex) = txindex {
self.height.compute(
starting_indexes.height,
txindex,
&indexer.vecs().height_to_first_txindex,
&indexes.height_to_txindex_count,
exit,
)?;
} else {
let txindex = self.txindex.as_ref().unwrap();
self.height.compute( self.height.compute(
starting_indexes.height, starting_indexes.height,
txindex, txindex,
indexer.vecs().height_to_first_txindex.vec(), &indexer.vecs().height_to_first_txindex,
indexes.height_to_txindex_count.vec(), &indexes.height_to_txindex_count,
exit, exit,
)?; )?;
}
self.dateindex.from_aligned( self.dateindex.from_aligned(
starting_indexes.dateindex, starting_indexes.dateindex,
&self.height, &self.height,
indexes.dateindex_to_first_height.vec(), &indexes.dateindex_to_first_height,
indexes.dateindex_to_height_count.vec(), &indexes.dateindex_to_height_count,
exit, exit,
)?; )?;
self.weekindex.from_aligned( self.weekindex.from_aligned(
starting_indexes.weekindex, starting_indexes.weekindex,
&self.dateindex, &self.dateindex,
indexes.weekindex_to_first_dateindex.vec(), &indexes.weekindex_to_first_dateindex,
indexes.weekindex_to_dateindex_count.vec(), &indexes.weekindex_to_dateindex_count,
exit, exit,
)?; )?;
self.monthindex.from_aligned( self.monthindex.from_aligned(
starting_indexes.monthindex, starting_indexes.monthindex,
&self.dateindex, &self.dateindex,
indexes.monthindex_to_first_dateindex.vec(), &indexes.monthindex_to_first_dateindex,
indexes.monthindex_to_dateindex_count.vec(), &indexes.monthindex_to_dateindex_count,
exit, exit,
)?; )?;
self.quarterindex.from_aligned( self.quarterindex.from_aligned(
starting_indexes.quarterindex, starting_indexes.quarterindex,
&self.monthindex, &self.monthindex,
indexes.quarterindex_to_first_monthindex.vec(), &indexes.quarterindex_to_first_monthindex,
indexes.quarterindex_to_monthindex_count.vec(), &indexes.quarterindex_to_monthindex_count,
exit, exit,
)?; )?;
self.yearindex.from_aligned( self.yearindex.from_aligned(
starting_indexes.yearindex, starting_indexes.yearindex,
&self.monthindex, &self.monthindex,
indexes.yearindex_to_first_monthindex.vec(), &indexes.yearindex_to_first_monthindex,
indexes.yearindex_to_monthindex_count.vec(), &indexes.yearindex_to_monthindex_count,
exit, exit,
)?; )?;
self.decadeindex.from_aligned( self.decadeindex.from_aligned(
starting_indexes.decadeindex, starting_indexes.decadeindex,
&self.yearindex, &self.yearindex,
indexes.decadeindex_to_first_yearindex.vec(), &indexes.decadeindex_to_first_yearindex,
indexes.decadeindex_to_yearindex_count.vec(), &indexes.decadeindex_to_yearindex_count,
exit, exit,
)?; )?;
self.difficultyepoch.from_aligned( self.difficultyepoch.from_aligned(
starting_indexes.difficultyepoch, starting_indexes.difficultyepoch,
&self.height, &self.height,
indexes.difficultyepoch_to_first_height.vec(), &indexes.difficultyepoch_to_first_height,
indexes.difficultyepoch_to_height_count.vec(), &indexes.difficultyepoch_to_height_count,
exit, exit,
)?; )?;
Ok(()) Ok(())
} }
pub fn vecs(&self) -> Vec<&dyn AnyVec> { pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
[ [
self.txindex.as_ref().map_or(vec![], |v| vec![v.any_vec()]), self.txindex
.as_ref()
.map_or(vec![], |v| vec![v as &dyn AnyCollectableVec]),
self.height.vecs(), self.height.vecs(),
self.dateindex.vecs(), self.dateindex.vecs(),
self.weekindex.vecs(), self.weekindex.vecs(),

View File

@@ -3,7 +3,9 @@ use std::path::Path;
use brk_core::{Bitcoin, Dollars, Height, Sats}; use brk_core::{Bitcoin, Dollars, Height, Sats};
use brk_exit::Exit; use brk_exit::Exit;
use brk_indexer::Indexer; use brk_indexer::Indexer;
use brk_vec::{AnyIterableVec, AnyVec, Compressed, EagerVec, Result, StoredVec, Version}; use brk_vec::{
AnyCollectableVec, CollectableVec, Compressed, EagerVec, Result, StoredVec, Version,
};
use crate::storage::{ use crate::storage::{
marketprice, marketprice,
@@ -88,7 +90,15 @@ impl ComputedValueVecsFromHeight {
exit, exit,
)?; )?;
self.compute_rest(indexer, indexes, marketprices, starting_indexes, exit, None)?; let height: Option<&StoredVec<Height, Sats>> = None;
self.compute_rest(
indexer,
indexes,
marketprices,
starting_indexes,
exit,
height,
)?;
Ok(()) Ok(())
} }
@@ -100,35 +110,44 @@ impl ComputedValueVecsFromHeight {
marketprices: Option<&marketprice::Vecs>, marketprices: Option<&marketprice::Vecs>,
starting_indexes: &Indexes, starting_indexes: &Indexes,
exit: &Exit, exit: &Exit,
height: Option<&StoredVec<Height, Sats>>, height: Option<&impl CollectableVec<Height, Sats>>,
) -> color_eyre::Result<()> { ) -> color_eyre::Result<()> {
if let Some(height) = height.as_ref() { if let Some(height) = height {
self.sats self.sats
.compute_rest(indexes, starting_indexes, exit, Some(height))?; .compute_rest(indexes, starting_indexes, exit, Some(height))?;
self.bitcoin.compute_all(
indexer,
indexes,
starting_indexes,
exit,
|v, _, _, starting_indexes, exit| {
v.compute_from_sats(starting_indexes.height, height, exit)
},
)?;
} else { } else {
let height: Option<&StoredVec<Height, Sats>> = None;
self.sats self.sats
.compute_rest(indexes, starting_indexes, exit, None)?; .compute_rest(indexes, starting_indexes, exit, height)?;
self.bitcoin.compute_all(
indexer,
indexes,
starting_indexes,
exit,
|v, _, _, starting_indexes, exit| {
v.compute_from_sats(
starting_indexes.height,
self.sats.height.as_ref().unwrap(),
exit,
)
},
)?;
} }
let height = height.unwrap_or_else(|| self.sats.height.as_ref().unwrap().iter_vec()); let txindex = self.bitcoin.height.as_ref().unwrap();
let price = &marketprices.as_ref().unwrap().chainindexes_to_close.height;
self.bitcoin.compute_all(
indexer,
indexes,
starting_indexes,
exit,
|v, _, _, starting_indexes, exit| {
v.compute_from_sats(starting_indexes.height, height, exit)
},
)?;
let txindex = self.bitcoin.height.as_ref().unwrap().iter_vec();
let price = marketprices
.as_ref()
.unwrap()
.chainindexes_to_close
.height
.iter_vec();
if let Some(dollars) = self.dollars.as_mut() { if let Some(dollars) = self.dollars.as_mut() {
dollars.compute_all( dollars.compute_all(
@@ -145,7 +164,7 @@ impl ComputedValueVecsFromHeight {
Ok(()) Ok(())
} }
pub fn vecs(&self) -> Vec<&dyn AnyVec> { pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
[ [
self.sats.vecs(), self.sats.vecs(),
self.bitcoin.vecs(), self.bitcoin.vecs(),

View File

@@ -3,7 +3,9 @@ use std::path::Path;
use brk_core::{Bitcoin, Dollars, Sats, TxIndex}; use brk_core::{Bitcoin, Dollars, Sats, TxIndex};
use brk_exit::Exit; use brk_exit::Exit;
use brk_indexer::Indexer; use brk_indexer::Indexer;
use brk_vec::{AnyVec, Compressed, EagerVec, Result, StoredVec, Version}; use brk_vec::{
AnyCollectableVec, CollectableVec, Compressed, EagerVec, Result, StoredVec, Version,
};
use crate::storage::{ use crate::storage::{
marketprice, marketprice,
@@ -88,7 +90,15 @@ impl ComputedValueVecsFromTxindex {
exit, exit,
)?; )?;
self.compute_rest(indexer, indexes, marketprices, starting_indexes, exit, None)?; let txindex: Option<&StoredVec<TxIndex, Sats>> = None;
self.compute_rest(
indexer,
indexes,
marketprices,
starting_indexes,
exit,
txindex,
)?;
Ok(()) Ok(())
} }
@@ -100,32 +110,45 @@ impl ComputedValueVecsFromTxindex {
marketprices: Option<&marketprice::Vecs>, marketprices: Option<&marketprice::Vecs>,
starting_indexes: &Indexes, starting_indexes: &Indexes,
exit: &Exit, exit: &Exit,
txindex: Option<&StoredVec<TxIndex, Sats>>, txindex: Option<&impl CollectableVec<TxIndex, Sats>>,
) -> color_eyre::Result<()> { ) -> color_eyre::Result<()> {
if let Some(txindex) = txindex.as_ref() { if let Some(txindex) = txindex {
self.sats self.sats
.compute_rest(indexer, indexes, starting_indexes, exit, Some(txindex))?; .compute_rest(indexer, indexes, starting_indexes, exit, Some(txindex))?;
self.bitcoin.compute_all(
indexer,
indexes,
starting_indexes,
exit,
|v, _, _, starting_indexes, exit| {
v.compute_from_sats(starting_indexes.txindex, txindex, exit)
},
)?;
} else { } else {
let txindex: Option<&StoredVec<TxIndex, Sats>> = None;
self.sats self.sats
.compute_rest(indexer, indexes, starting_indexes, exit, None)?; .compute_rest(indexer, indexes, starting_indexes, exit, txindex)?;
self.bitcoin.compute_all(
indexer,
indexes,
starting_indexes,
exit,
|v, _, _, starting_indexes, exit| {
v.compute_from_sats(
starting_indexes.txindex,
self.sats.txindex.as_ref().unwrap(),
exit,
)
},
)?;
} }
let txindex = txindex.unwrap_or_else(|| self.sats.txindex.as_ref().unwrap().vec()); let txindex = self.bitcoin.txindex.as_mut().unwrap();
self.bitcoin.compute_all(
indexer,
indexes,
starting_indexes,
exit,
|v, _, _, starting_indexes, exit| {
v.compute_from_sats(starting_indexes.txindex, txindex, exit)
},
)?;
let txindex = self.bitcoin.txindex.as_mut().unwrap().mut_vec();
if let Some(dollars) = self.dollars.as_mut() { if let Some(dollars) = self.dollars.as_mut() {
let price = marketprices.unwrap().chainindexes_to_close.height.vec(); let price = &marketprices.unwrap().chainindexes_to_close.height;
dollars.compute_all( dollars.compute_all(
indexer, indexer,
@@ -136,7 +159,7 @@ impl ComputedValueVecsFromTxindex {
v.compute_from_bitcoin( v.compute_from_bitcoin(
starting_indexes.txindex, starting_indexes.txindex,
txindex, txindex,
indexes.txindex_to_height.vec(), &indexes.txindex_to_height,
price, price,
exit, exit,
) )
@@ -147,7 +170,7 @@ impl ComputedValueVecsFromTxindex {
Ok(()) Ok(())
} }
pub fn vecs(&self) -> Vec<&dyn AnyVec> { pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
[ [
self.sats.vecs(), self.sats.vecs(),
self.bitcoin.vecs(), self.bitcoin.vecs(),

View File

@@ -459,6 +459,7 @@ impl Vecs {
height_to_date, height_to_date,
height_to_difficultyepoch, height_to_difficultyepoch,
height_to_halvingepoch, height_to_halvingepoch,
height_to_height,
inputindex_to_inputindex, inputindex_to_inputindex,
monthindex_to_first_dateindex, monthindex_to_first_dateindex,
monthindex_to_monthindex, monthindex_to_monthindex,
@@ -484,7 +485,6 @@ impl Vecs {
yearindex_to_decadeindex, yearindex_to_decadeindex,
yearindex_to_first_monthindex, yearindex_to_first_monthindex,
yearindex_to_yearindex, yearindex_to_yearindex,
height_to_date_fixed: EagerVec::forced_import( height_to_date_fixed: EagerVec::forced_import(
&path.join("height_to_date_fixed"), &path.join("height_to_date_fixed"),
Version::ZERO, Version::ZERO,
@@ -495,7 +495,6 @@ impl Vecs {
Version::ZERO, Version::ZERO,
compressed, compressed,
)?, )?,
height_to_height,
txindex_to_height: EagerVec::forced_import( txindex_to_height: EagerVec::forced_import(
&path.join("txindex_to_height"), &path.join("txindex_to_height"),
Version::ZERO, Version::ZERO,

View File

@@ -7,7 +7,7 @@ use brk_core::{
use brk_exit::Exit; use brk_exit::Exit;
use brk_fetcher::Fetcher; use brk_fetcher::Fetcher;
use brk_indexer::Indexer; use brk_indexer::Indexer;
use brk_vec::{AnyIterableVec, Compressed, Computation, EagerVec, VecIterator, Version}; use brk_vec::{AnyCollectableVec, AnyIterableVec, Compressed, Computation, EagerVec, Version};
use super::{ use super::{
Indexes, Indexes,
@@ -71,7 +71,7 @@ const VERSION_IN_SATS: Version = Version::ONE;
impl Vecs { impl Vecs {
pub fn forced_import( pub fn forced_import(
path: &Path, path: &Path,
computation: Computation, _computation: Computation,
compressed: Compressed, compressed: Compressed,
) -> color_eyre::Result<Self> { ) -> color_eyre::Result<Self> {
fs::create_dir_all(path)?; fs::create_dir_all(path)?;
@@ -340,7 +340,7 @@ impl Vecs {
let mut height_to_timestamp_iter = indexer_vecs.height_to_timestamp.iter(); let mut height_to_timestamp_iter = indexer_vecs.height_to_timestamp.iter();
self.height_to_ohlc_in_cents.compute_transform( self.height_to_ohlc_in_cents.compute_transform(
starting_indexes.height, starting_indexes.height,
indexer_vecs.height_to_timestamp.iter_vec(), &indexer_vecs.height_to_timestamp,
|(h, t, ..)| { |(h, t, ..)| {
let ohlc = fetcher let ohlc = fetcher
.get_height( .get_height(
@@ -357,42 +357,42 @@ impl Vecs {
self.height_to_open_in_cents.compute_transform( self.height_to_open_in_cents.compute_transform(
starting_indexes.height, starting_indexes.height,
self.height_to_ohlc_in_cents.iter_vec(), &self.height_to_ohlc_in_cents,
|(di, ohlc, ..)| (di, ohlc.open), |(di, ohlc, ..)| (di, ohlc.open),
exit, exit,
)?; )?;
self.height_to_high_in_cents.compute_transform( self.height_to_high_in_cents.compute_transform(
starting_indexes.height, starting_indexes.height,
self.height_to_ohlc_in_cents.iter_vec(), &self.height_to_ohlc_in_cents,
|(di, ohlc, ..)| (di, ohlc.high), |(di, ohlc, ..)| (di, ohlc.high),
exit, exit,
)?; )?;
self.height_to_low_in_cents.compute_transform( self.height_to_low_in_cents.compute_transform(
starting_indexes.height, starting_indexes.height,
self.height_to_ohlc_in_cents.iter_vec(), &self.height_to_ohlc_in_cents,
|(di, ohlc, ..)| (di, ohlc.low), |(di, ohlc, ..)| (di, ohlc.low),
exit, exit,
)?; )?;
self.height_to_close_in_cents.compute_transform( self.height_to_close_in_cents.compute_transform(
starting_indexes.height, starting_indexes.height,
self.height_to_ohlc_in_cents.iter_vec(), &self.height_to_ohlc_in_cents,
|(di, ohlc, ..)| (di, ohlc.close), |(di, ohlc, ..)| (di, ohlc.close),
exit, exit,
)?; )?;
self.height_to_ohlc.compute_transform( self.height_to_ohlc.compute_transform(
starting_indexes.height, starting_indexes.height,
self.height_to_ohlc_in_cents.iter_vec(), &self.height_to_ohlc_in_cents,
|(di, ohlc, ..)| (di, OHLCDollars::from(ohlc)), |(di, ohlc, ..)| (di, OHLCDollars::from(ohlc)),
exit, exit,
)?; )?;
self.dateindex_to_ohlc_in_cents.compute_transform( self.dateindex_to_ohlc_in_cents.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
indexes.dateindex_to_date.iter_vec(), &indexes.dateindex_to_date,
|(di, d, ..)| { |(di, d, ..)| {
let ohlc = fetcher.get_date(d).unwrap(); let ohlc = fetcher.get_date(d).unwrap();
(di, ohlc) (di, ohlc)
@@ -402,35 +402,35 @@ impl Vecs {
self.dateindex_to_open_in_cents.compute_transform( self.dateindex_to_open_in_cents.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
self.dateindex_to_ohlc_in_cents.iter_vec(), &self.dateindex_to_ohlc_in_cents,
|(di, ohlc, ..)| (di, ohlc.open), |(di, ohlc, ..)| (di, ohlc.open),
exit, exit,
)?; )?;
self.dateindex_to_high_in_cents.compute_transform( self.dateindex_to_high_in_cents.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
self.dateindex_to_ohlc_in_cents.iter_vec(), &self.dateindex_to_ohlc_in_cents,
|(di, ohlc, ..)| (di, ohlc.high), |(di, ohlc, ..)| (di, ohlc.high),
exit, exit,
)?; )?;
self.dateindex_to_low_in_cents.compute_transform( self.dateindex_to_low_in_cents.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
self.dateindex_to_ohlc_in_cents.iter_vec(), &self.dateindex_to_ohlc_in_cents,
|(di, ohlc, ..)| (di, ohlc.low), |(di, ohlc, ..)| (di, ohlc.low),
exit, exit,
)?; )?;
self.dateindex_to_close_in_cents.compute_transform( self.dateindex_to_close_in_cents.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
self.dateindex_to_ohlc_in_cents.iter_vec(), &self.dateindex_to_ohlc_in_cents,
|(di, ohlc, ..)| (di, ohlc.close), |(di, ohlc, ..)| (di, ohlc.close),
exit, exit,
)?; )?;
self.dateindex_to_ohlc.compute_transform( self.dateindex_to_ohlc.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
self.dateindex_to_ohlc_in_cents.iter_vec(), &self.dateindex_to_ohlc_in_cents,
|(di, ohlc, ..)| (di, OHLCDollars::from(ohlc)), |(di, ohlc, ..)| (di, OHLCDollars::from(ohlc)),
exit, exit,
)?; )?;
@@ -443,7 +443,7 @@ impl Vecs {
|v, _, _, starting_indexes, exit| { |v, _, _, starting_indexes, exit| {
v.compute_transform( v.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
self.dateindex_to_ohlc.iter_vec(), &self.dateindex_to_ohlc,
|(di, ohlc, ..)| (di, ohlc.close), |(di, ohlc, ..)| (di, ohlc.close),
exit, exit,
) )
@@ -458,7 +458,7 @@ impl Vecs {
|v, _, _, starting_indexes, exit| { |v, _, _, starting_indexes, exit| {
v.compute_transform( v.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
self.dateindex_to_ohlc.iter_vec(), &self.dateindex_to_ohlc,
|(di, ohlc, ..)| (di, ohlc.high), |(di, ohlc, ..)| (di, ohlc.high),
exit, exit,
) )
@@ -473,7 +473,7 @@ impl Vecs {
|v, _, _, starting_indexes, exit| { |v, _, _, starting_indexes, exit| {
v.compute_transform( v.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
self.dateindex_to_ohlc.iter_vec(), &self.dateindex_to_ohlc,
|(di, ohlc, ..)| (di, ohlc.low), |(di, ohlc, ..)| (di, ohlc.low),
exit, exit,
) )
@@ -488,7 +488,7 @@ impl Vecs {
|v, _, _, starting_indexes, exit| { |v, _, _, starting_indexes, exit| {
v.compute_transform( v.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
self.dateindex_to_ohlc.iter_vec(), &self.dateindex_to_ohlc,
|(di, ohlc, ..)| (di, ohlc.open), |(di, ohlc, ..)| (di, ohlc.open),
exit, exit,
) )
@@ -503,7 +503,7 @@ impl Vecs {
|v, _, _, starting_indexes, exit| { |v, _, _, starting_indexes, exit| {
v.compute_transform( v.compute_transform(
starting_indexes.height, starting_indexes.height,
self.height_to_ohlc.iter_vec(), &self.height_to_ohlc,
|(di, ohlc, ..)| (di, ohlc.close), |(di, ohlc, ..)| (di, ohlc.close),
exit, exit,
) )
@@ -518,7 +518,7 @@ impl Vecs {
|v, _, _, starting_indexes, exit| { |v, _, _, starting_indexes, exit| {
v.compute_transform( v.compute_transform(
starting_indexes.height, starting_indexes.height,
self.height_to_ohlc.iter_vec(), &self.height_to_ohlc,
|(di, ohlc, ..)| (di, ohlc.high), |(di, ohlc, ..)| (di, ohlc.high),
exit, exit,
) )
@@ -533,7 +533,7 @@ impl Vecs {
|v, _, _, starting_indexes, exit| { |v, _, _, starting_indexes, exit| {
v.compute_transform( v.compute_transform(
starting_indexes.height, starting_indexes.height,
self.height_to_ohlc.iter_vec(), &self.height_to_ohlc,
|(di, ohlc, ..)| (di, ohlc.low), |(di, ohlc, ..)| (di, ohlc.low),
exit, exit,
) )
@@ -548,7 +548,7 @@ impl Vecs {
|v, _, _, starting_indexes, exit| { |v, _, _, starting_indexes, exit| {
v.compute_transform( v.compute_transform(
starting_indexes.height, starting_indexes.height,
self.height_to_ohlc.iter_vec(), &self.height_to_ohlc,
|(di, ohlc, ..)| (di, ohlc.open), |(di, ohlc, ..)| (di, ohlc.open),
exit, exit,
) )
@@ -560,7 +560,7 @@ impl Vecs {
let mut weekindex_min_iter = self.timeindexes_to_low.weekindex.unwrap_min().iter(); let mut weekindex_min_iter = self.timeindexes_to_low.weekindex.unwrap_min().iter();
self.weekindex_to_ohlc.compute_transform( self.weekindex_to_ohlc.compute_transform(
starting_indexes.weekindex, starting_indexes.weekindex,
self.timeindexes_to_close.weekindex.unwrap_last().iter_vec(), self.timeindexes_to_close.weekindex.unwrap_last(),
|(i, close, ..)| { |(i, close, ..)| {
( (
i, i,
@@ -589,10 +589,7 @@ impl Vecs {
self.chainindexes_to_low.difficultyepoch.unwrap_min().iter(); self.chainindexes_to_low.difficultyepoch.unwrap_min().iter();
self.difficultyepoch_to_ohlc.compute_transform( self.difficultyepoch_to_ohlc.compute_transform(
starting_indexes.difficultyepoch, starting_indexes.difficultyepoch,
self.chainindexes_to_close self.chainindexes_to_close.difficultyepoch.unwrap_last(),
.difficultyepoch
.unwrap_last()
.iter_vec(),
|(i, close, ..)| { |(i, close, ..)| {
( (
i, i,
@@ -612,10 +609,7 @@ impl Vecs {
let mut monthindex_min_iter = self.timeindexes_to_low.monthindex.unwrap_min().iter(); let mut monthindex_min_iter = self.timeindexes_to_low.monthindex.unwrap_min().iter();
self.monthindex_to_ohlc.compute_transform( self.monthindex_to_ohlc.compute_transform(
starting_indexes.monthindex, starting_indexes.monthindex,
self.timeindexes_to_close self.timeindexes_to_close.monthindex.unwrap_last(),
.monthindex
.unwrap_last()
.iter_vec(),
|(i, close, ..)| { |(i, close, ..)| {
( (
i, i,
@@ -636,10 +630,7 @@ impl Vecs {
let mut quarterindex_min_iter = self.timeindexes_to_low.quarterindex.unwrap_min().iter(); let mut quarterindex_min_iter = self.timeindexes_to_low.quarterindex.unwrap_min().iter();
self.quarterindex_to_ohlc.compute_transform( self.quarterindex_to_ohlc.compute_transform(
starting_indexes.quarterindex, starting_indexes.quarterindex,
self.timeindexes_to_close self.timeindexes_to_close.quarterindex.unwrap_last(),
.quarterindex
.unwrap_last()
.iter_vec(),
|(i, close, ..)| { |(i, close, ..)| {
( (
i, i,
@@ -659,7 +650,7 @@ impl Vecs {
let mut yearindex_min_iter = self.timeindexes_to_low.yearindex.unwrap_min().iter(); let mut yearindex_min_iter = self.timeindexes_to_low.yearindex.unwrap_min().iter();
self.yearindex_to_ohlc.compute_transform( self.yearindex_to_ohlc.compute_transform(
starting_indexes.yearindex, starting_indexes.yearindex,
self.timeindexes_to_close.yearindex.unwrap_last().iter_vec(), self.timeindexes_to_close.yearindex.unwrap_last(),
|(i, close, ..)| { |(i, close, ..)| {
( (
i, i,
@@ -682,10 +673,7 @@ impl Vecs {
let mut decadeindex_min_iter = self.timeindexes_to_low.decadeindex.unwrap_min().iter(); let mut decadeindex_min_iter = self.timeindexes_to_low.decadeindex.unwrap_min().iter();
self.decadeindex_to_ohlc.compute_transform( self.decadeindex_to_ohlc.compute_transform(
starting_indexes.decadeindex, starting_indexes.decadeindex,
self.timeindexes_to_close self.timeindexes_to_close.decadeindex.unwrap_last(),
.decadeindex
.unwrap_last()
.iter_vec(),
|(i, close, ..)| { |(i, close, ..)| {
( (
i, i,
@@ -708,7 +696,7 @@ impl Vecs {
|v, _, _, starting_indexes, exit| { |v, _, _, starting_indexes, exit| {
v.compute_transform( v.compute_transform(
starting_indexes.height, starting_indexes.height,
self.chainindexes_to_open.height.iter_vec(), &self.chainindexes_to_open.height,
|(i, open, ..)| (i, Open::new(Sats::ONE_BTC / *open)), |(i, open, ..)| (i, Open::new(Sats::ONE_BTC / *open)),
exit, exit,
) )
@@ -723,7 +711,7 @@ impl Vecs {
|v, _, _, starting_indexes, exit| { |v, _, _, starting_indexes, exit| {
v.compute_transform( v.compute_transform(
starting_indexes.height, starting_indexes.height,
self.chainindexes_to_low.height.iter_vec(), &self.chainindexes_to_low.height,
|(i, low, ..)| (i, High::new(Sats::ONE_BTC / *low)), |(i, low, ..)| (i, High::new(Sats::ONE_BTC / *low)),
exit, exit,
) )
@@ -738,7 +726,7 @@ impl Vecs {
|v, _, _, starting_indexes, exit| { |v, _, _, starting_indexes, exit| {
v.compute_transform( v.compute_transform(
starting_indexes.height, starting_indexes.height,
self.chainindexes_to_high.height.iter_vec(), &self.chainindexes_to_high.height,
|(i, high, ..)| (i, Low::new(Sats::ONE_BTC / *high)), |(i, high, ..)| (i, Low::new(Sats::ONE_BTC / *high)),
exit, exit,
) )
@@ -753,7 +741,7 @@ impl Vecs {
|v, _, _, starting_indexes, exit| { |v, _, _, starting_indexes, exit| {
v.compute_transform( v.compute_transform(
starting_indexes.height, starting_indexes.height,
self.chainindexes_to_close.height.iter_vec(), &self.chainindexes_to_close.height,
|(i, close, ..)| (i, Close::new(Sats::ONE_BTC / *close)), |(i, close, ..)| (i, Close::new(Sats::ONE_BTC / *close)),
exit, exit,
) )
@@ -768,7 +756,7 @@ impl Vecs {
|v, _, _, starting_indexes, exit| { |v, _, _, starting_indexes, exit| {
v.compute_transform( v.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
self.timeindexes_to_open.dateindex.iter_vec(), &self.timeindexes_to_open.dateindex,
|(i, open, ..)| (i, Open::new(Sats::ONE_BTC / *open)), |(i, open, ..)| (i, Open::new(Sats::ONE_BTC / *open)),
exit, exit,
) )
@@ -783,7 +771,7 @@ impl Vecs {
|v, _, _, starting_indexes, exit| { |v, _, _, starting_indexes, exit| {
v.compute_transform( v.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
self.timeindexes_to_low.dateindex.iter_vec(), &self.timeindexes_to_low.dateindex,
|(i, low, ..)| (i, High::new(Sats::ONE_BTC / *low)), |(i, low, ..)| (i, High::new(Sats::ONE_BTC / *low)),
exit, exit,
) )
@@ -798,7 +786,7 @@ impl Vecs {
|v, _, _, starting_indexes, exit| { |v, _, _, starting_indexes, exit| {
v.compute_transform( v.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
self.timeindexes_to_high.dateindex.iter_vec(), &self.timeindexes_to_high.dateindex,
|(i, high, ..)| (i, Low::new(Sats::ONE_BTC / *high)), |(i, high, ..)| (i, Low::new(Sats::ONE_BTC / *high)),
exit, exit,
) )
@@ -813,7 +801,7 @@ impl Vecs {
|v, _, _, starting_indexes, exit| { |v, _, _, starting_indexes, exit| {
v.compute_transform( v.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
self.timeindexes_to_close.dateindex.iter_vec(), &self.timeindexes_to_close.dateindex,
|(i, close, ..)| (i, Close::new(Sats::ONE_BTC / *close)), |(i, close, ..)| (i, Close::new(Sats::ONE_BTC / *close)),
exit, exit,
) )
@@ -825,7 +813,7 @@ impl Vecs {
let mut height_min_iter = self.chainindexes_to_low_in_sats.height.iter(); let mut height_min_iter = self.chainindexes_to_low_in_sats.height.iter();
self.height_to_ohlc_in_sats.compute_transform( self.height_to_ohlc_in_sats.compute_transform(
starting_indexes.height, starting_indexes.height,
self.chainindexes_to_close_in_sats.height.iter_vec(), &self.chainindexes_to_close_in_sats.height,
|(i, close, ..)| { |(i, close, ..)| {
( (
i, i,
@@ -845,7 +833,7 @@ impl Vecs {
let mut dateindex_min_iter = self.timeindexes_to_low_in_sats.dateindex.iter(); let mut dateindex_min_iter = self.timeindexes_to_low_in_sats.dateindex.iter();
self.dateindex_to_ohlc_in_sats.compute_transform( self.dateindex_to_ohlc_in_sats.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
self.timeindexes_to_close_in_sats.dateindex.iter_vec(), &self.timeindexes_to_close_in_sats.dateindex,
|(i, close, ..)| { |(i, close, ..)| {
( (
i, i,
@@ -877,10 +865,7 @@ impl Vecs {
.iter(); .iter();
self.weekindex_to_ohlc_in_sats.compute_transform( self.weekindex_to_ohlc_in_sats.compute_transform(
starting_indexes.weekindex, starting_indexes.weekindex,
self.timeindexes_to_close_in_sats self.timeindexes_to_close_in_sats.weekindex.unwrap_last(),
.weekindex
.unwrap_last()
.iter_vec(),
|(i, close, ..)| { |(i, close, ..)| {
( (
i, i,
@@ -914,8 +899,7 @@ impl Vecs {
starting_indexes.difficultyepoch, starting_indexes.difficultyepoch,
self.chainindexes_to_close_in_sats self.chainindexes_to_close_in_sats
.difficultyepoch .difficultyepoch
.unwrap_last() .unwrap_last(),
.iter_vec(),
|(i, close, ..)| { |(i, close, ..)| {
( (
i, i,
@@ -947,10 +931,7 @@ impl Vecs {
.iter(); .iter();
self.monthindex_to_ohlc_in_sats.compute_transform( self.monthindex_to_ohlc_in_sats.compute_transform(
starting_indexes.monthindex, starting_indexes.monthindex,
self.timeindexes_to_close_in_sats self.timeindexes_to_close_in_sats.monthindex.unwrap_last(),
.monthindex
.unwrap_last()
.iter_vec(),
|(i, close, ..)| { |(i, close, ..)| {
( (
i, i,
@@ -982,10 +963,7 @@ impl Vecs {
.iter(); .iter();
self.quarterindex_to_ohlc_in_sats.compute_transform( self.quarterindex_to_ohlc_in_sats.compute_transform(
starting_indexes.quarterindex, starting_indexes.quarterindex,
self.timeindexes_to_close_in_sats self.timeindexes_to_close_in_sats.quarterindex.unwrap_last(),
.quarterindex
.unwrap_last()
.iter_vec(),
|(i, close, ..)| { |(i, close, ..)| {
( (
i, i,
@@ -1017,10 +995,7 @@ impl Vecs {
.iter(); .iter();
self.yearindex_to_ohlc_in_sats.compute_transform( self.yearindex_to_ohlc_in_sats.compute_transform(
starting_indexes.yearindex, starting_indexes.yearindex,
self.timeindexes_to_close_in_sats self.timeindexes_to_close_in_sats.yearindex.unwrap_last(),
.yearindex
.unwrap_last()
.iter_vec(),
|(i, close, ..)| { |(i, close, ..)| {
( (
i, i,
@@ -1055,10 +1030,7 @@ impl Vecs {
.iter(); .iter();
self.decadeindex_to_ohlc_in_sats.compute_transform( self.decadeindex_to_ohlc_in_sats.compute_transform(
starting_indexes.decadeindex, starting_indexes.decadeindex,
self.timeindexes_to_close_in_sats self.timeindexes_to_close_in_sats.decadeindex.unwrap_last(),
.decadeindex
.unwrap_last()
.iter_vec(),
|(i, close, ..)| { |(i, close, ..)| {
( (
i, i,
@@ -1076,37 +1048,37 @@ impl Vecs {
Ok(()) Ok(())
} }
pub fn vecs(&self) -> Vec<&dyn brk_vec::AnyVec> { pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
vec![ vec![
vec![ vec![
self.dateindex_to_close_in_cents.any_vec(), &self.dateindex_to_close_in_cents as &dyn AnyCollectableVec,
self.dateindex_to_high_in_cents.any_vec(), &self.dateindex_to_high_in_cents,
self.dateindex_to_low_in_cents.any_vec(), &self.dateindex_to_low_in_cents,
self.dateindex_to_ohlc.any_vec(), &self.dateindex_to_ohlc,
self.dateindex_to_ohlc_in_cents.any_vec(), &self.dateindex_to_ohlc_in_cents,
self.dateindex_to_open_in_cents.any_vec(), &self.dateindex_to_open_in_cents,
self.height_to_close_in_cents.any_vec(), &self.height_to_close_in_cents,
self.height_to_high_in_cents.any_vec(), &self.height_to_high_in_cents,
self.height_to_low_in_cents.any_vec(), &self.height_to_low_in_cents,
self.height_to_ohlc.any_vec(), &self.height_to_ohlc,
self.height_to_ohlc_in_cents.any_vec(), &self.height_to_ohlc_in_cents,
self.height_to_open_in_cents.any_vec(), &self.height_to_open_in_cents,
self.weekindex_to_ohlc.any_vec(), &self.weekindex_to_ohlc,
self.difficultyepoch_to_ohlc.any_vec(), &self.difficultyepoch_to_ohlc,
self.monthindex_to_ohlc.any_vec(), &self.monthindex_to_ohlc,
self.quarterindex_to_ohlc.any_vec(), &self.quarterindex_to_ohlc,
self.yearindex_to_ohlc.any_vec(), &self.yearindex_to_ohlc,
// self.halvingepoch_to_ohlc.any_vec(), // &self.halvingepoch_to_ohlc,
self.decadeindex_to_ohlc.any_vec(), &self.decadeindex_to_ohlc,
self.height_to_ohlc_in_sats.any_vec(), &self.height_to_ohlc_in_sats,
self.dateindex_to_ohlc_in_sats.any_vec(), &self.dateindex_to_ohlc_in_sats,
self.weekindex_to_ohlc_in_sats.any_vec(), &self.weekindex_to_ohlc_in_sats,
self.difficultyepoch_to_ohlc_in_sats.any_vec(), &self.difficultyepoch_to_ohlc_in_sats,
self.monthindex_to_ohlc_in_sats.any_vec(), &self.monthindex_to_ohlc_in_sats,
self.quarterindex_to_ohlc_in_sats.any_vec(), &self.quarterindex_to_ohlc_in_sats,
self.yearindex_to_ohlc_in_sats.any_vec(), &self.yearindex_to_ohlc_in_sats,
// self.halvingepoch_to_ohlc_in_sats.any_vec(), // &self.halvingepoch_to_ohlc_in_sats,
self.decadeindex_to_ohlc_in_sats.any_vec(), &self.decadeindex_to_ohlc_in_sats,
], ],
self.timeindexes_to_close.vecs(), self.timeindexes_to_close.vecs(),
self.timeindexes_to_high.vecs(), self.timeindexes_to_high.vecs(),

View File

@@ -3,7 +3,7 @@ use std::{fs, path::Path};
use brk_core::{DifficultyEpoch, HalvingEpoch, StoredF64}; use brk_core::{DifficultyEpoch, HalvingEpoch, StoredF64};
use brk_exit::Exit; use brk_exit::Exit;
use brk_indexer::Indexer; use brk_indexer::Indexer;
use brk_vec::{Compressed, Computation, VecIterator, Version}; use brk_vec::{AnyCollectableVec, Compressed, Computation, VecIterator, Version};
use super::{ use super::{
Indexes, Indexes,
@@ -21,7 +21,7 @@ pub struct Vecs {
impl Vecs { impl Vecs {
pub fn forced_import( pub fn forced_import(
path: &Path, path: &Path,
computation: Computation, _computation: Computation,
compressed: Compressed, compressed: Compressed,
) -> color_eyre::Result<Self> { ) -> color_eyre::Result<Self> {
fs::create_dir_all(path)?; fs::create_dir_all(path)?;
@@ -59,17 +59,17 @@ impl Vecs {
starting_indexes: &Indexes, starting_indexes: &Indexes,
exit: &Exit, exit: &Exit,
) -> color_eyre::Result<()> { ) -> color_eyre::Result<()> {
let mut height_to_difficultyepoch_iter = indexes.height_to_difficultyepoch.iter(); let mut height_to_difficultyepoch_iter = indexes.height_to_difficultyepoch.into_iter();
self.indexes_to_difficultyepoch.compute( self.indexes_to_difficultyepoch.compute(
indexer, indexer,
indexes, indexes,
starting_indexes, starting_indexes,
exit, exit,
|vec, _, indexes, starting_indexes, exit| { |vec, _, indexes, starting_indexes, exit| {
let mut height_count_iter = indexes.dateindex_to_height_count.iter(); let mut height_count_iter = indexes.dateindex_to_height_count.into_iter();
vec.compute_transform( vec.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
indexes.dateindex_to_first_height.vec(), &indexes.dateindex_to_first_height,
|(di, height, ..)| { |(di, height, ..)| {
( (
di, di,
@@ -83,17 +83,17 @@ impl Vecs {
}, },
)?; )?;
let mut height_to_halvingepoch_iter = indexes.height_to_halvingepoch.iter(); let mut height_to_halvingepoch_iter = indexes.height_to_halvingepoch.into_iter();
self.indexes_to_halvingepoch.compute( self.indexes_to_halvingepoch.compute(
indexer, indexer,
indexes, indexes,
starting_indexes, starting_indexes,
exit, exit,
|vec, _, indexes, starting_indexes, exit| { |vec, _, indexes, starting_indexes, exit| {
let mut height_count_iter = indexes.dateindex_to_height_count.iter(); let mut height_count_iter = indexes.dateindex_to_height_count.into_iter();
vec.compute_transform( vec.compute_transform(
starting_indexes.dateindex, starting_indexes.dateindex,
indexes.dateindex_to_first_height.vec(), &indexes.dateindex_to_first_height,
|(di, height, ..)| { |(di, height, ..)| {
( (
di, di,
@@ -111,13 +111,13 @@ impl Vecs {
indexes, indexes,
starting_indexes, starting_indexes,
exit, exit,
Some(indexer.vecs().height_to_difficulty.vec()), Some(&indexer.vecs().height_to_difficulty),
)?; )?;
Ok(()) Ok(())
} }
pub fn vecs(&self) -> Vec<&dyn brk_vec::AnyVec> { pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
[ [
self.indexes_to_difficulty.vecs(), self.indexes_to_difficulty.vecs(),
self.indexes_to_difficultyepoch.vecs(), self.indexes_to_difficultyepoch.vecs(),

View File

@@ -3,24 +3,24 @@ use std::{fs, path::Path};
use brk_exit::Exit; use brk_exit::Exit;
use brk_fetcher::Fetcher; use brk_fetcher::Fetcher;
use brk_indexer::Indexer; use brk_indexer::Indexer;
use brk_vec::{AnyCollectableVec, AnyVec, CollectableVec, Compressed, Computation}; use brk_vec::{AnyCollectableVec, Compressed, Computation};
// 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 mining; pub mod mining;
// pub mod transactions; pub mod transactions;
pub use indexes::Indexes; pub use indexes::Indexes;
#[derive(Clone)] #[derive(Clone)]
pub struct Vecs { pub struct Vecs {
pub indexes: indexes::Vecs, pub indexes: indexes::Vecs,
// pub blocks: blocks::Vecs, pub blocks: blocks::Vecs,
// pub mining: mining::Vecs, pub mining: mining::Vecs,
// pub transactions: transactions::Vecs, pub transactions: transactions::Vecs,
// pub marketprice: Option<marketprice::Vecs>, pub marketprice: Option<marketprice::Vecs>,
} }
impl Vecs { impl Vecs {
@@ -34,18 +34,18 @@ impl Vecs {
fs::create_dir_all(path)?; fs::create_dir_all(path)?;
Ok(Self { Ok(Self {
// blocks: blocks::Vecs::forced_import(path, computation, compressed)?, blocks: blocks::Vecs::forced_import(path, computation, compressed)?,
indexes: indexes::Vecs::forced_import(path, indexer, computation, compressed)?, indexes: indexes::Vecs::forced_import(path, indexer, computation, compressed)?,
// mining: mining::Vecs::forced_import(path, computation, compressed)?, mining: mining::Vecs::forced_import(path, computation, compressed)?,
// transactions: transactions::Vecs::forced_import( transactions: transactions::Vecs::forced_import(
// path, path,
// indexer, indexer,
// computation, computation,
// compressed, compressed,
// fetch, fetch,
// )?, )?,
// marketprice: fetch marketprice: fetch
// .then(|| marketprice::Vecs::forced_import(path, computation, compressed).unwrap()), .then(|| marketprice::Vecs::forced_import(path, computation, compressed).unwrap()),
}) })
} }
@@ -58,29 +58,29 @@ impl Vecs {
) -> color_eyre::Result<()> { ) -> color_eyre::Result<()> {
let starting_indexes = self.indexes.compute(indexer, starting_indexes, exit)?; let starting_indexes = self.indexes.compute(indexer, starting_indexes, exit)?;
// self.blocks self.blocks
// .compute(indexer, &self.indexes, &starting_indexes, exit)?; .compute(indexer, &self.indexes, &starting_indexes, exit)?;
// self.mining self.mining
// .compute(indexer, &self.indexes, &starting_indexes, exit)?; .compute(indexer, &self.indexes, &starting_indexes, exit)?;
// if let Some(marketprice) = self.marketprice.as_mut() { if let Some(marketprice) = self.marketprice.as_mut() {
// marketprice.compute( marketprice.compute(
// indexer, indexer,
// &self.indexes, &self.indexes,
// &starting_indexes, &starting_indexes,
// fetcher.unwrap(), fetcher.unwrap(),
// exit, exit,
// )?; )?;
// } }
// self.transactions.compute( self.transactions.compute(
// indexer, indexer,
// &self.indexes, &self.indexes,
// &starting_indexes, &starting_indexes,
// self.marketprice.as_ref(), self.marketprice.as_ref(),
// exit, exit,
// )?; )?;
Ok(()) Ok(())
} }
@@ -88,10 +88,10 @@ impl Vecs {
pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> { pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
[ [
self.indexes.vecs(), self.indexes.vecs(),
// self.blocks.vecs(), self.blocks.vecs(),
// self.mining.vecs(), self.mining.vecs(),
// self.transactions.vecs(), self.transactions.vecs(),
// self.marketprice.as_ref().map_or(vec![], |v| v.vecs()), self.marketprice.as_ref().map_or(vec![], |v| v.vecs()),
] ]
.concat() .concat()
} }

View File

@@ -7,8 +7,8 @@ use brk_exit::Exit;
use brk_indexer::Indexer; use brk_indexer::Indexer;
use brk_parser::bitcoin; use brk_parser::bitcoin;
use brk_vec::{ use brk_vec::{
AnyIterableVec, AnyVec, Compressed, Computation, ComputedVec, ComputedVecFrom2, EagerVec, AnyCollectableVec, AnyIterableVec, CloneableAnyIterableVec, Compressed, Computation,
StoredIndex, VecIterator, Version, ComputedVec, ComputedVecFrom2, EagerVec, StoredIndex, Version,
}; };
use super::{ use super::{
@@ -84,7 +84,6 @@ impl Vecs {
.add_sum() .add_sum()
.add_total(), .add_total(),
)?, )?,
// height_to_subsidy: StorableVec::forced_import(&path.join("height_to_subsidy"), Version::ZERO)?,
txindex_to_is_coinbase: EagerVec::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,
@@ -117,16 +116,17 @@ impl Vecs {
.add_total(), .add_total(),
)?, )?,
inputindex_to_value: ComputedVec::forced_import_or_init_from_2( inputindex_to_value: ComputedVec::forced_import_or_init_from_2(
computation,
path, path,
"inputindex_to_value", "inputindex_to_value",
computation,
Version::ZERO, Version::ZERO,
compressed, compressed,
indexer.vecs().outputindex_to_value.vec().clone(), indexer.vecs().outputindex_to_value.boxed_clone(),
indexer.vecs().inputindex_to_outputindex.vec().clone(), indexer.vecs().inputindex_to_outputindex.boxed_clone(),
|index, outputindex_to_value_iter, inputindex_to_outputindex_iter| { |index: InputIndex, outputindex_to_value_iter, inputindex_to_outputindex_iter| {
inputindex_to_outputindex_iter.next_at(index).map( inputindex_to_outputindex_iter
|(inputindex, outputindex)| { .next_at(index.unwrap_to_usize())
.map(|(inputindex, outputindex)| {
let outputindex = outputindex.into_inner(); let outputindex = outputindex.into_inner();
if outputindex == OutputIndex::COINBASE { if outputindex == OutputIndex::COINBASE {
Sats::ZERO Sats::ZERO
@@ -138,8 +138,7 @@ impl Vecs {
dbg!(inputindex, outputindex); dbg!(inputindex, outputindex);
panic!() panic!()
} }
}, })
)
}, },
)?, )?,
indexes_to_tx_v1: ComputedVecsFromHeight::forced_import( indexes_to_tx_v1: ComputedVecsFromHeight::forced_import(
@@ -448,8 +447,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| { |v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes( v.compute_count_from_indexes(
starting_indexes.height, starting_indexes.height,
indexer.vecs().height_to_first_txindex.vec(), &indexer.vecs().height_to_first_txindex,
indexer.vecs().txindex_to_txid.vec(), &indexer.vecs().txindex_to_txid,
exit, exit,
) )
}, },
@@ -463,8 +462,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| { |v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes( v.compute_count_from_indexes(
starting_indexes.txindex, starting_indexes.txindex,
indexer.vecs().txindex_to_first_inputindex.vec(), &indexer.vecs().txindex_to_first_inputindex,
indexer.vecs().inputindex_to_outputindex.vec(), &indexer.vecs().inputindex_to_outputindex,
exit, exit,
) )
}, },
@@ -478,8 +477,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| { |v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes( v.compute_count_from_indexes(
starting_indexes.txindex, starting_indexes.txindex,
indexer.vecs().txindex_to_first_outputindex.vec(), &indexer.vecs().txindex_to_first_outputindex,
indexer.vecs().outputindex_to_value.vec(), &indexer.vecs().outputindex_to_value,
exit, exit,
) )
}, },
@@ -496,8 +495,8 @@ impl Vecs {
|vec, indexer, _, starting_indexes, exit| { |vec, indexer, _, starting_indexes, exit| {
vec.compute_filtered_count_from_indexes( vec.compute_filtered_count_from_indexes(
starting_indexes.height, starting_indexes.height,
indexer.vecs().height_to_first_txindex.vec(), &indexer.vecs().height_to_first_txindex,
indexer.vecs().txindex_to_txid.vec(), &indexer.vecs().txindex_to_txid,
|txindex| { |txindex| {
let v = txindex_to_txversion_iter.unwrap_get_inner(txindex); let v = txindex_to_txversion_iter.unwrap_get_inner(txindex);
v == txversion v == txversion
@@ -513,15 +512,15 @@ impl Vecs {
self.txindex_to_is_coinbase.compute_is_first_ordered( self.txindex_to_is_coinbase.compute_is_first_ordered(
starting_indexes.txindex, starting_indexes.txindex,
indexes.txindex_to_height.vec(), &indexes.txindex_to_height,
indexer.vecs().height_to_first_txindex.vec(), &indexer.vecs().height_to_first_txindex,
exit, exit,
)?; )?;
let mut txindex_to_total_size_iter = indexer.vecs().txindex_to_total_size.iter(); let mut txindex_to_total_size_iter = indexer.vecs().txindex_to_total_size.iter();
self.txindex_to_weight.compute_transform( self.txindex_to_weight.compute_transform(
starting_indexes.txindex, starting_indexes.txindex,
indexer.vecs().txindex_to_base_size.vec(), &indexer.vecs().txindex_to_base_size,
|(txindex, base_size, ..)| { |(txindex, base_size, ..)| {
let total_size = txindex_to_total_size_iter.unwrap_get_inner(txindex); let total_size = txindex_to_total_size_iter.unwrap_get_inner(txindex);
@@ -536,7 +535,7 @@ impl Vecs {
self.txindex_to_vsize.compute_transform( self.txindex_to_vsize.compute_transform(
starting_indexes.txindex, starting_indexes.txindex,
self.txindex_to_weight.vec(), &self.txindex_to_weight,
|(txindex, weight, ..)| { |(txindex, weight, ..)| {
let vbytes = let vbytes =
StoredUsize::from(bitcoin::Weight::from(weight).to_vbytes_ceil() as usize); StoredUsize::from(bitcoin::Weight::from(weight).to_vbytes_ceil() as usize);
@@ -556,29 +555,29 @@ impl Vecs {
|vec, indexer, _, starting_indexes, exit| { |vec, indexer, _, starting_indexes, exit| {
vec.compute_sum_from_indexes( vec.compute_sum_from_indexes(
starting_indexes.txindex, starting_indexes.txindex,
indexer.vecs().txindex_to_first_outputindex.vec(), &indexer.vecs().txindex_to_first_outputindex,
self.indexes_to_output_count.txindex.as_ref().unwrap().vec(), self.indexes_to_output_count.txindex.as_ref().unwrap(),
indexer.vecs().outputindex_to_value.vec(), &indexer.vecs().outputindex_to_value,
exit, exit,
) )
}, },
)?; )?;
// self.indexes_to_input_value.compute_all( self.indexes_to_input_value.compute_all(
// indexer, indexer,
// indexes, indexes,
// starting_indexes, starting_indexes,
// exit, exit,
// |vec, indexer, _, starting_indexes, exit| { |vec, indexer, _, starting_indexes, exit| {
// vec.compute_sum_from_indexes( vec.compute_sum_from_indexes(
// starting_indexes.txindex, starting_indexes.txindex,
// indexer.vecs().txindex_to_first_inputindex.vec(), &indexer.vecs().txindex_to_first_inputindex,
// self.indexes_to_input_count.txindex.as_ref().unwrap().vec(), self.indexes_to_input_count.txindex.as_ref().unwrap(),
// self.inputindex_to_value.vec(), &self.inputindex_to_value,
// exit, exit,
// ) )
// }, },
// )?; )?;
self.indexes_to_fee.compute_all( self.indexes_to_fee.compute_all(
indexer, indexer,
@@ -595,7 +594,7 @@ impl Vecs {
.iter(); .iter();
vec.compute_transform( vec.compute_transform(
starting_indexes.txindex, starting_indexes.txindex,
self.indexes_to_input_value.txindex.as_ref().unwrap().vec(), self.indexes_to_input_value.txindex.as_ref().unwrap(),
|(txindex, input_value, ..)| { |(txindex, input_value, ..)| {
if input_value.is_zero() { if input_value.is_zero() {
(txindex, input_value) (txindex, input_value)
@@ -619,7 +618,7 @@ impl Vecs {
let mut txindex_to_vsize_iter = self.txindex_to_vsize.iter(); let mut txindex_to_vsize_iter = self.txindex_to_vsize.iter();
vec.compute_transform( vec.compute_transform(
starting_indexes.txindex, starting_indexes.txindex,
self.indexes_to_fee.sats.txindex.as_ref().unwrap().vec(), self.indexes_to_fee.sats.txindex.as_ref().unwrap(),
|(txindex, fee, ..)| { |(txindex, fee, ..)| {
let vsize = txindex_to_vsize_iter.unwrap_get_inner(txindex); let vsize = txindex_to_vsize_iter.unwrap_get_inner(txindex);
(txindex, Feerate::from((fee, vsize))) (txindex, Feerate::from((fee, vsize)))
@@ -634,7 +633,7 @@ impl Vecs {
indexes, indexes,
starting_indexes, starting_indexes,
exit, exit,
Some(self.txindex_to_weight.vec()), Some(&self.txindex_to_weight),
)?; )?;
self.indexes_to_tx_vsize.compute_rest( self.indexes_to_tx_vsize.compute_rest(
@@ -642,10 +641,10 @@ impl Vecs {
indexes, indexes,
starting_indexes, starting_indexes,
exit, exit,
Some(self.txindex_to_vsize.vec()), Some(&self.txindex_to_vsize),
)?; )?;
self.indexes_to_subsidy.compute_all( self.indexes_to_coinbase.compute_all(
indexer, indexer,
indexes, indexes,
marketprices, marketprices,
@@ -663,7 +662,7 @@ impl Vecs {
let mut outputindex_to_value_iter = indexer.vecs().outputindex_to_value.iter(); let mut outputindex_to_value_iter = indexer.vecs().outputindex_to_value.iter();
vec.compute_transform( vec.compute_transform(
starting_indexes.height, starting_indexes.height,
indexer.vecs().height_to_first_txindex.vec(), &indexer.vecs().height_to_first_txindex,
|(height, txindex, ..)| { |(height, txindex, ..)| {
let first_outputindex = txindex_to_first_outputindex_iter let first_outputindex = txindex_to_first_outputindex_iter
.unwrap_get_inner(txindex) .unwrap_get_inner(txindex)
@@ -683,7 +682,7 @@ impl Vecs {
}, },
)?; )?;
self.indexes_to_coinbase.compute_all( self.indexes_to_subsidy.compute_all(
indexer, indexer,
indexes, indexes,
marketprices, marketprices,
@@ -694,7 +693,7 @@ impl Vecs {
self.indexes_to_fee.sats.height.unwrap_sum().iter(); self.indexes_to_fee.sats.height.unwrap_sum().iter();
vec.compute_transform( vec.compute_transform(
starting_indexes.height, starting_indexes.height,
self.indexes_to_subsidy.sats.height.as_ref().unwrap().vec(), self.indexes_to_coinbase.sats.height.as_ref().unwrap(),
|(height, subsidy, ..)| { |(height, subsidy, ..)| {
let fees = indexes_to_fee_sum_iter.unwrap_get_inner(height); let fees = indexes_to_fee_sum_iter.unwrap_get_inner(height);
(height, subsidy.checked_sub(fees).unwrap()) (height, subsidy.checked_sub(fees).unwrap())
@@ -712,8 +711,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| { |v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes( v.compute_count_from_indexes(
starting_indexes.height, starting_indexes.height,
indexer.vecs().height_to_first_p2aindex.vec(), &indexer.vecs().height_to_first_p2aindex,
indexer.vecs().p2aindex_to_p2abytes.vec(), &indexer.vecs().p2aindex_to_p2abytes,
exit, exit,
) )
}, },
@@ -727,8 +726,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| { |v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes( v.compute_count_from_indexes(
starting_indexes.height, starting_indexes.height,
indexer.vecs().height_to_first_p2msindex.vec(), &indexer.vecs().height_to_first_p2msindex,
indexer.vecs().p2msindex_to_txindex.vec(), &indexer.vecs().p2msindex_to_txindex,
exit, exit,
) )
}, },
@@ -742,8 +741,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| { |v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes( v.compute_count_from_indexes(
starting_indexes.height, starting_indexes.height,
indexer.vecs().height_to_first_p2pk33index.vec(), &indexer.vecs().height_to_first_p2pk33index,
indexer.vecs().p2pk33index_to_p2pk33bytes.vec(), &indexer.vecs().p2pk33index_to_p2pk33bytes,
exit, exit,
) )
}, },
@@ -757,8 +756,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| { |v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes( v.compute_count_from_indexes(
starting_indexes.height, starting_indexes.height,
indexer.vecs().height_to_first_p2pk65index.vec(), &indexer.vecs().height_to_first_p2pk65index,
indexer.vecs().p2pk65index_to_p2pk65bytes.vec(), &indexer.vecs().p2pk65index_to_p2pk65bytes,
exit, exit,
) )
}, },
@@ -772,8 +771,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| { |v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes( v.compute_count_from_indexes(
starting_indexes.height, starting_indexes.height,
indexer.vecs().height_to_first_p2pkhindex.vec(), &indexer.vecs().height_to_first_p2pkhindex,
indexer.vecs().p2pkhindex_to_p2pkhbytes.vec(), &indexer.vecs().p2pkhindex_to_p2pkhbytes,
exit, exit,
) )
}, },
@@ -787,8 +786,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| { |v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes( v.compute_count_from_indexes(
starting_indexes.height, starting_indexes.height,
indexer.vecs().height_to_first_p2shindex.vec(), &indexer.vecs().height_to_first_p2shindex,
indexer.vecs().p2shindex_to_p2shbytes.vec(), &indexer.vecs().p2shindex_to_p2shbytes,
exit, exit,
) )
}, },
@@ -802,8 +801,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| { |v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes( v.compute_count_from_indexes(
starting_indexes.height, starting_indexes.height,
indexer.vecs().height_to_first_p2trindex.vec(), &indexer.vecs().height_to_first_p2trindex,
indexer.vecs().p2trindex_to_p2trbytes.vec(), &indexer.vecs().p2trindex_to_p2trbytes,
exit, exit,
) )
}, },
@@ -817,8 +816,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| { |v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes( v.compute_count_from_indexes(
starting_indexes.height, starting_indexes.height,
indexer.vecs().height_to_first_p2wpkhindex.vec(), &indexer.vecs().height_to_first_p2wpkhindex,
indexer.vecs().p2wpkhindex_to_p2wpkhbytes.vec(), &indexer.vecs().p2wpkhindex_to_p2wpkhbytes,
exit, exit,
) )
}, },
@@ -832,8 +831,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| { |v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes( v.compute_count_from_indexes(
starting_indexes.height, starting_indexes.height,
indexer.vecs().height_to_first_p2wshindex.vec(), &indexer.vecs().height_to_first_p2wshindex,
indexer.vecs().p2wshindex_to_p2wshbytes.vec(), &indexer.vecs().p2wshindex_to_p2wshbytes,
exit, exit,
) )
}, },
@@ -847,8 +846,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| { |v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes( v.compute_count_from_indexes(
starting_indexes.height, starting_indexes.height,
indexer.vecs().height_to_first_opreturnindex.vec(), &indexer.vecs().height_to_first_opreturnindex,
indexer.vecs().opreturnindex_to_txindex.vec(), &indexer.vecs().opreturnindex_to_txindex,
exit, exit,
) )
}, },
@@ -862,8 +861,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| { |v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes( v.compute_count_from_indexes(
starting_indexes.height, starting_indexes.height,
indexer.vecs().height_to_first_unknownoutputindex.vec(), &indexer.vecs().height_to_first_unknownoutputindex,
indexer.vecs().unknownoutputindex_to_txindex.vec(), &indexer.vecs().unknownoutputindex_to_txindex,
exit, exit,
) )
}, },
@@ -877,8 +876,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| { |v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes( v.compute_count_from_indexes(
starting_indexes.height, starting_indexes.height,
indexer.vecs().height_to_first_emptyoutputindex.vec(), &indexer.vecs().height_to_first_emptyoutputindex,
indexer.vecs().emptyoutputindex_to_txindex.vec(), &indexer.vecs().emptyoutputindex_to_txindex,
exit, exit,
) )
}, },
@@ -887,13 +886,13 @@ impl Vecs {
Ok(()) Ok(())
} }
pub fn vecs(&self) -> Vec<&dyn brk_vec::AnyVec> { pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
[ [
vec![ vec![
self.inputindex_to_value.any_vec(), &self.inputindex_to_value as &dyn AnyCollectableVec,
self.txindex_to_is_coinbase.any_vec(), &self.txindex_to_is_coinbase,
self.txindex_to_vsize.any_vec(), &self.txindex_to_vsize,
self.txindex_to_weight.any_vec(), &self.txindex_to_weight,
], ],
self.indexes_to_tx_count.vecs(), self.indexes_to_tx_count.vecs(),
self.indexes_to_coinbase.vecs(), self.indexes_to_coinbase.vecs(),

View File

@@ -18,7 +18,7 @@ pub use brk_parser::*;
use bitcoin::{Transaction, TxIn, TxOut}; use bitcoin::{Transaction, TxIn, TxOut};
use brk_exit::Exit; use brk_exit::Exit;
use brk_vec::{AnyVec, Compressed, GenericStoredVec, VecIterator}; use brk_vec::{AnyVec, Compressed, VecIterator};
use color_eyre::eyre::{ContextCompat, eyre}; use color_eyre::eyre::{ContextCompat, eyre};
use fjall::TransactionalKeyspace; use fjall::TransactionalKeyspace;
use log::{error, info}; use log::{error, info};
@@ -245,7 +245,7 @@ impl Indexer {
let input_source_vec_handle = scope.spawn(|| { let input_source_vec_handle = scope.spawn(|| {
let txindex_to_first_outputindex_mmap = vecs let txindex_to_first_outputindex_mmap = vecs
.txindex_to_first_outputindex.vec().mmap().load(); .txindex_to_first_outputindex.mmap().load();
inputs inputs
.into_par_iter() .into_par_iter()
@@ -308,14 +308,14 @@ impl Indexer {
let outputindex_to_txout_outputtype_addressbytes_res_addressindex_opt_handle = scope.spawn(|| { let outputindex_to_txout_outputtype_addressbytes_res_addressindex_opt_handle = scope.spawn(|| {
let p2pk65index_to_p2pk65bytes_mmap = vecs let p2pk65index_to_p2pk65bytes_mmap = vecs
.p2pk65index_to_p2pk65bytes.vec().mmap().load(); .p2pk65index_to_p2pk65bytes.mmap().load();
let p2pk33index_to_p2pk33bytes_mmap = vecs.p2pk33index_to_p2pk33bytes.vec().mmap().load(); let p2pk33index_to_p2pk33bytes_mmap = vecs.p2pk33index_to_p2pk33bytes.mmap().load();
let p2pkhindex_to_p2pkhbytes_mmap = vecs.p2pkhindex_to_p2pkhbytes.vec().mmap().load(); let p2pkhindex_to_p2pkhbytes_mmap = vecs.p2pkhindex_to_p2pkhbytes.mmap().load();
let p2shindex_to_p2shbytes_mmap = vecs.p2shindex_to_p2shbytes.vec().mmap().load(); let p2shindex_to_p2shbytes_mmap = vecs.p2shindex_to_p2shbytes.mmap().load();
let p2wpkhindex_to_p2wpkhbytes_mmap = vecs.p2wpkhindex_to_p2wpkhbytes.vec().mmap().load(); let p2wpkhindex_to_p2wpkhbytes_mmap = vecs.p2wpkhindex_to_p2wpkhbytes.mmap().load();
let p2wshindex_to_p2wshbytes_mmap = vecs.p2wshindex_to_p2wshbytes.vec().mmap().load(); let p2wshindex_to_p2wshbytes_mmap = vecs.p2wshindex_to_p2wshbytes.mmap().load();
let p2trindex_to_p2trbytes_mmap = vecs.p2trindex_to_p2trbytes.vec().mmap().load(); let p2trindex_to_p2trbytes_mmap = vecs.p2trindex_to_p2trbytes.mmap().load();
let p2aindex_to_p2abytes_mmap = vecs.p2aindex_to_p2abytes.vec().mmap().load(); let p2aindex_to_p2abytes_mmap = vecs.p2aindex_to_p2abytes.mmap().load();
outputs outputs
.into_par_iter() .into_par_iter()

View File

@@ -103,9 +103,9 @@ where
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
pub fn forced_import_or_init_from_2( pub fn forced_import_or_init_from_2(
mode: Computation,
path: &Path, path: &Path,
name: &str, name: &str,
mode: Computation,
version: Version, version: Version,
compressed: Compressed, compressed: Compressed,
source1: BoxedAnyIterableVec<S1I, S1T>, source1: BoxedAnyIterableVec<S1I, S1T>,

View File

@@ -93,7 +93,7 @@ where
self.inner.path().join("computed_version") self.inner.path().join("computed_version")
} }
fn validate_computed_version_or_reset_file(&mut self, version: Version) -> Result<()> { pub fn validate_computed_version_or_reset_file(&mut self, version: Version) -> Result<()> {
let path = self.path_computed_version(); let path = self.path_computed_version();
if version.validate(path.as_ref()).is_err() { if version.validate(path.as_ref()).is_err() {
self.inner.reset()?; self.inner.reset()?;
@@ -503,7 +503,12 @@ where
{ {
#[inline] #[inline]
fn version(&self) -> Version { fn version(&self) -> Version {
self.computed_version.unwrap() self.computed_version
.or_else(|| {
dbg!(self.path());
None
})
.unwrap()
} }
#[inline] #[inline]

View File

@@ -5,6 +5,7 @@ use std::{
time::Duration, time::Duration,
}; };
use arc_swap::ArcSwap;
use brk_core::Height; use brk_core::Height;
use crate::{ use crate::{
@@ -70,12 +71,8 @@ where
self.inner.flush() self.inner.flush()
} }
pub fn vec(&self) -> &StoredVec<I, T> { pub fn mmap(&self) -> &ArcSwap<Mmap> {
&self.inner self.inner.mmap()
}
pub fn mut_vec(&mut self) -> &mut StoredVec<I, T> {
&mut self.inner
} }
#[inline] #[inline]

View File

@@ -60,6 +60,9 @@ where
type Item = (I, Value<'a, T>); type Item = (I, Value<'a, T>);
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {
if self.index >= self.len() {
return None;
}
let index = I::from(self.index); let index = I::from(self.index);
let opt = (self.lazy.compute)(index, &mut *self.source).map(|v| (index, Value::Owned(v))); let opt = (self.lazy.compute)(index, &mut *self.source).map(|v| (index, Value::Owned(v)));
if opt.is_some() { if opt.is_some() {

View File

@@ -1,6 +1,6 @@
// Generated by dts-bundle-generator v9.5.1 // Generated by dts-bundle-generator v9.5.1
import { CanvasRenderingTarget2D } from 'fancy-canvas'; type CanvasRenderingTarget2D = any;
declare const baselineSeries: SeriesDefinition<"Baseline">; declare const baselineSeries: SeriesDefinition<"Baseline">;
declare const candlestickSeries: SeriesDefinition<"Candlestick">; declare const candlestickSeries: SeriesDefinition<"Candlestick">;

View File

@@ -57,15 +57,110 @@ export function createVecIdToIndexes() {
return /** @type {const} */ ({ return /** @type {const} */ ({
"base-size": [TxIndex], "base-size": [TxIndex],
"block-count": [Height],
"block-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"block-interval-10p": [DateIndex],
"block-interval-25p": [DateIndex],
"block-interval-75p": [DateIndex],
"block-interval-90p": [DateIndex],
"block-interval-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"block-interval-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"block-interval-median": [DateIndex],
"block-interval-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"block-size-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"block-vbytes-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"block-weight-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
blockhash: [Height], blockhash: [Height],
close: [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"close-in-cents": [DateIndex, Height],
"close-in-sats": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
coinbase: [Height],
"coinbase-10p": [DateIndex],
"coinbase-25p": [DateIndex],
"coinbase-75p": [DateIndex],
"coinbase-90p": [DateIndex],
"coinbase-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"coinbase-in-btc": [Height],
"coinbase-in-btc-10p": [DateIndex],
"coinbase-in-btc-25p": [DateIndex],
"coinbase-in-btc-75p": [DateIndex],
"coinbase-in-btc-90p": [DateIndex],
"coinbase-in-btc-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"coinbase-in-btc-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"coinbase-in-btc-median": [DateIndex],
"coinbase-in-btc-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"coinbase-in-btc-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"coinbase-in-usd": [Height],
"coinbase-in-usd-10p": [DateIndex],
"coinbase-in-usd-25p": [DateIndex],
"coinbase-in-usd-75p": [DateIndex],
"coinbase-in-usd-90p": [DateIndex],
"coinbase-in-usd-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"coinbase-in-usd-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"coinbase-in-usd-median": [DateIndex],
"coinbase-in-usd-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"coinbase-in-usd-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"coinbase-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"coinbase-median": [DateIndex],
"coinbase-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"coinbase-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
date: [DateIndex, Height], date: [DateIndex, Height],
"date-fixed": [Height], "date-fixed": [Height],
dateindex: [DateIndex, Height], dateindex: [DateIndex, Height],
"dateindex-count": [MonthIndex, WeekIndex], "dateindex-count": [MonthIndex, WeekIndex],
decadeindex: [DecadeIndex, YearIndex], decadeindex: [DecadeIndex, YearIndex],
difficulty: [Height], difficulty: [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
difficultyepoch: [DifficultyEpoch, Height], difficultyepoch: [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"emptyoutput-count": [Height],
"emptyoutput-count-10p": [DateIndex],
"emptyoutput-count-25p": [DateIndex],
"emptyoutput-count-75p": [DateIndex],
"emptyoutput-count-90p": [DateIndex],
"emptyoutput-count-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"emptyoutput-count-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"emptyoutput-count-median": [DateIndex],
"emptyoutput-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"emptyoutput-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
emptyoutputindex: [EmptyOutputIndex], emptyoutputindex: [EmptyOutputIndex],
fee: [TxIndex],
"fee-10p": [Height],
"fee-25p": [Height],
"fee-75p": [Height],
"fee-90p": [Height],
"fee-average": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"fee-in-btc": [TxIndex],
"fee-in-btc-10p": [Height],
"fee-in-btc-25p": [Height],
"fee-in-btc-75p": [Height],
"fee-in-btc-90p": [Height],
"fee-in-btc-average": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"fee-in-btc-max": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"fee-in-btc-median": [Height],
"fee-in-btc-min": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"fee-in-btc-sum": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"fee-in-usd": [TxIndex],
"fee-in-usd-10p": [Height],
"fee-in-usd-25p": [Height],
"fee-in-usd-75p": [Height],
"fee-in-usd-90p": [Height],
"fee-in-usd-average": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"fee-in-usd-max": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"fee-in-usd-median": [Height],
"fee-in-usd-min": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"fee-in-usd-sum": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"fee-max": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"fee-median": [Height],
"fee-min": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"fee-sum": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
feerate: [TxIndex],
"feerate-10p": [Height],
"feerate-25p": [Height],
"feerate-75p": [Height],
"feerate-90p": [Height],
"feerate-average": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"feerate-max": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"feerate-median": [Height],
"feerate-min": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"first-dateindex": [MonthIndex, WeekIndex], "first-dateindex": [MonthIndex, WeekIndex],
"first-emptyoutputindex": [Height], "first-emptyoutputindex": [Height],
"first-height": [DateIndex, DifficultyEpoch, HalvingEpoch], "first-height": [DateIndex, DifficultyEpoch, HalvingEpoch],
@@ -85,47 +180,294 @@ export function createVecIdToIndexes() {
"first-txindex": [Height], "first-txindex": [Height],
"first-unknownoutputindex": [Height], "first-unknownoutputindex": [Height],
"first-yearindex": [DecadeIndex], "first-yearindex": [DecadeIndex],
halvingepoch: [HalvingEpoch, Height], halvingepoch: [DateIndex, DecadeIndex, HalvingEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
height: [Height, TxIndex], height: [Height, TxIndex],
"height-count": [DateIndex, DifficultyEpoch], "height-count": [DateIndex, DifficultyEpoch],
high: [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"high-in-cents": [DateIndex, Height],
"high-in-sats": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"input-count": [TxIndex],
"input-count-10p": [Height],
"input-count-25p": [Height],
"input-count-75p": [Height],
"input-count-90p": [Height],
"input-count-average": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"input-count-max": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"input-count-median": [Height],
"input-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"input-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"input-value": [TxIndex],
"input-value-average": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"input-value-sum": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
inputindex: [InputIndex], inputindex: [InputIndex],
interval: [Height],
"is-coinbase": [TxIndex],
"is-explicitly-rbf": [TxIndex], "is-explicitly-rbf": [TxIndex],
low: [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"low-in-cents": [DateIndex, Height],
"low-in-sats": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
monthindex: [DateIndex, MonthIndex], monthindex: [DateIndex, MonthIndex],
"monthindex-count": [QuarterIndex, YearIndex], "monthindex-count": [QuarterIndex, YearIndex],
ohlc: [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"ohlc-in-cents": [DateIndex, Height],
"ohlc-in-sats": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
open: [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"open-in-cents": [DateIndex, Height],
"open-in-sats": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"opreturn-count": [Height],
"opreturn-count-10p": [DateIndex],
"opreturn-count-25p": [DateIndex],
"opreturn-count-75p": [DateIndex],
"opreturn-count-90p": [DateIndex],
"opreturn-count-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"opreturn-count-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"opreturn-count-median": [DateIndex],
"opreturn-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"opreturn-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
opreturnindex: [OpReturnIndex], opreturnindex: [OpReturnIndex],
"output-count": [TxIndex],
"output-count-10p": [Height],
"output-count-25p": [Height],
"output-count-75p": [Height],
"output-count-90p": [Height],
"output-count-average": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"output-count-max": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"output-count-median": [Height],
"output-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"output-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"output-value": [TxIndex],
"output-value-average": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"output-value-sum": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
outputindex: [InputIndex, OutputIndex], outputindex: [InputIndex, OutputIndex],
outputtype: [OutputIndex], outputtype: [OutputIndex],
outputtypeindex: [OutputIndex], outputtypeindex: [OutputIndex],
"p2a-count": [Height],
"p2a-count-10p": [DateIndex],
"p2a-count-25p": [DateIndex],
"p2a-count-75p": [DateIndex],
"p2a-count-90p": [DateIndex],
"p2a-count-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2a-count-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2a-count-median": [DateIndex],
"p2a-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2a-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
p2abytes: [P2AIndex], p2abytes: [P2AIndex],
p2aindex: [P2AIndex], p2aindex: [P2AIndex],
"p2ms-count": [Height],
"p2ms-count-10p": [DateIndex],
"p2ms-count-25p": [DateIndex],
"p2ms-count-75p": [DateIndex],
"p2ms-count-90p": [DateIndex],
"p2ms-count-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2ms-count-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2ms-count-median": [DateIndex],
"p2ms-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2ms-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
p2msindex: [P2MSIndex], p2msindex: [P2MSIndex],
"p2pk33-count": [Height],
"p2pk33-count-10p": [DateIndex],
"p2pk33-count-25p": [DateIndex],
"p2pk33-count-75p": [DateIndex],
"p2pk33-count-90p": [DateIndex],
"p2pk33-count-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2pk33-count-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2pk33-count-median": [DateIndex],
"p2pk33-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2pk33-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
p2pk33bytes: [P2PK33Index], p2pk33bytes: [P2PK33Index],
p2pk33index: [P2PK33Index], p2pk33index: [P2PK33Index],
"p2pk65-count": [Height],
"p2pk65-count-10p": [DateIndex],
"p2pk65-count-25p": [DateIndex],
"p2pk65-count-75p": [DateIndex],
"p2pk65-count-90p": [DateIndex],
"p2pk65-count-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2pk65-count-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2pk65-count-median": [DateIndex],
"p2pk65-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2pk65-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
p2pk65bytes: [P2PK65Index], p2pk65bytes: [P2PK65Index],
p2pk65index: [P2PK65Index], p2pk65index: [P2PK65Index],
"p2pkh-count": [Height],
"p2pkh-count-10p": [DateIndex],
"p2pkh-count-25p": [DateIndex],
"p2pkh-count-75p": [DateIndex],
"p2pkh-count-90p": [DateIndex],
"p2pkh-count-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2pkh-count-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2pkh-count-median": [DateIndex],
"p2pkh-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2pkh-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
p2pkhbytes: [P2PKHIndex], p2pkhbytes: [P2PKHIndex],
p2pkhindex: [P2PKHIndex], p2pkhindex: [P2PKHIndex],
"p2sh-count": [Height],
"p2sh-count-10p": [DateIndex],
"p2sh-count-25p": [DateIndex],
"p2sh-count-75p": [DateIndex],
"p2sh-count-90p": [DateIndex],
"p2sh-count-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2sh-count-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2sh-count-median": [DateIndex],
"p2sh-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2sh-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
p2shbytes: [P2SHIndex], p2shbytes: [P2SHIndex],
p2shindex: [P2SHIndex], p2shindex: [P2SHIndex],
"p2tr-count": [Height],
"p2tr-count-10p": [DateIndex],
"p2tr-count-25p": [DateIndex],
"p2tr-count-75p": [DateIndex],
"p2tr-count-90p": [DateIndex],
"p2tr-count-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2tr-count-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2tr-count-median": [DateIndex],
"p2tr-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2tr-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
p2trbytes: [P2TRIndex], p2trbytes: [P2TRIndex],
p2trindex: [P2TRIndex], p2trindex: [P2TRIndex],
"p2wpkh-count": [Height],
"p2wpkh-count-10p": [DateIndex],
"p2wpkh-count-25p": [DateIndex],
"p2wpkh-count-75p": [DateIndex],
"p2wpkh-count-90p": [DateIndex],
"p2wpkh-count-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2wpkh-count-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2wpkh-count-median": [DateIndex],
"p2wpkh-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2wpkh-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
p2wpkhbytes: [P2WPKHIndex], p2wpkhbytes: [P2WPKHIndex],
p2wpkhindex: [P2WPKHIndex], p2wpkhindex: [P2WPKHIndex],
"p2wsh-count": [Height],
"p2wsh-count-10p": [DateIndex],
"p2wsh-count-25p": [DateIndex],
"p2wsh-count-75p": [DateIndex],
"p2wsh-count-90p": [DateIndex],
"p2wsh-count-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2wsh-count-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2wsh-count-median": [DateIndex],
"p2wsh-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"p2wsh-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
p2wshbytes: [P2WSHIndex], p2wshbytes: [P2WSHIndex],
p2wshindex: [P2WSHIndex], p2wshindex: [P2WSHIndex],
quarterindex: [MonthIndex, QuarterIndex], quarterindex: [MonthIndex, QuarterIndex],
rawlocktime: [TxIndex], rawlocktime: [TxIndex],
timestamp: [Height], subsidy: [Height],
"subsidy-10p": [DateIndex],
"subsidy-25p": [DateIndex],
"subsidy-75p": [DateIndex],
"subsidy-90p": [DateIndex],
"subsidy-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"subsidy-in-btc": [Height],
"subsidy-in-btc-10p": [DateIndex],
"subsidy-in-btc-25p": [DateIndex],
"subsidy-in-btc-75p": [DateIndex],
"subsidy-in-btc-90p": [DateIndex],
"subsidy-in-btc-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"subsidy-in-btc-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"subsidy-in-btc-median": [DateIndex],
"subsidy-in-btc-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"subsidy-in-btc-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"subsidy-in-usd": [Height],
"subsidy-in-usd-10p": [DateIndex],
"subsidy-in-usd-25p": [DateIndex],
"subsidy-in-usd-75p": [DateIndex],
"subsidy-in-usd-90p": [DateIndex],
"subsidy-in-usd-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"subsidy-in-usd-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"subsidy-in-usd-median": [DateIndex],
"subsidy-in-usd-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"subsidy-in-usd-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"subsidy-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"subsidy-median": [DateIndex],
"subsidy-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"subsidy-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
timestamp: [DateIndex, DecadeIndex, DifficultyEpoch, HalvingEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"timestamp-fixed": [Height], "timestamp-fixed": [Height],
"total-block-count": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-block-size": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-block-vbytes": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-block-weight": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-coinbase": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-coinbase-in-btc": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-coinbase-in-usd": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-emptyoutput-count": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-fee": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-fee-in-btc": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-fee-in-usd": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-input-count": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-input-value": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-opreturn-count": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-output-count": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-output-value": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-p2a-count": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-p2ms-count": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-p2pk33-count": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-p2pk65-count": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-p2pkh-count": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-p2sh-count": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-p2tr-count": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-p2wpkh-count": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-p2wsh-count": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-size": [Height, TxIndex], "total-size": [Height, TxIndex],
"total-subsidy": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-subsidy-in-btc": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-subsidy-in-usd": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-tx-count": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-tx-v1": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-tx-v2": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-tx-v3": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"total-unknownoutput-count": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"tx-count": [Height],
"tx-count-10p": [DateIndex],
"tx-count-25p": [DateIndex],
"tx-count-75p": [DateIndex],
"tx-count-90p": [DateIndex],
"tx-count-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"tx-count-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"tx-count-median": [DateIndex],
"tx-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"tx-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"tx-v1": [Height],
"tx-v1-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"tx-v2": [Height],
"tx-v2-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"tx-v3": [Height],
"tx-v3-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"tx-vsize-10p": [Height],
"tx-vsize-25p": [Height],
"tx-vsize-75p": [Height],
"tx-vsize-90p": [Height],
"tx-vsize-average": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"tx-vsize-max": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"tx-vsize-median": [Height],
"tx-vsize-min": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"tx-weight-10p": [Height],
"tx-weight-25p": [Height],
"tx-weight-75p": [Height],
"tx-weight-90p": [Height],
"tx-weight-average": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"tx-weight-max": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"tx-weight-median": [Height],
"tx-weight-min": [DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
txid: [TxIndex], txid: [TxIndex],
txindex: [EmptyOutputIndex, OpReturnIndex, P2MSIndex, TxIndex, UnknownOutputIndex], txindex: [EmptyOutputIndex, OpReturnIndex, P2MSIndex, TxIndex, UnknownOutputIndex],
"txindex-count": [Height], "txindex-count": [Height],
txversion: [TxIndex], txversion: [TxIndex],
"unknownoutput-count": [Height],
"unknownoutput-count-10p": [DateIndex],
"unknownoutput-count-25p": [DateIndex],
"unknownoutput-count-75p": [DateIndex],
"unknownoutput-count-90p": [DateIndex],
"unknownoutput-count-average": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"unknownoutput-count-max": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"unknownoutput-count-median": [DateIndex],
"unknownoutput-count-min": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
"unknownoutput-count-sum": [DateIndex, DecadeIndex, DifficultyEpoch, MonthIndex, QuarterIndex, WeekIndex, YearIndex],
unknownoutputindex: [UnknownOutputIndex], unknownoutputindex: [UnknownOutputIndex],
value: [OutputIndex], value: [InputIndex, OutputIndex],
vbytes: [Height],
vsize: [TxIndex],
weekindex: [DateIndex, WeekIndex], weekindex: [DateIndex, WeekIndex],
weight: [Height], weight: [Height, TxIndex],
yearindex: [MonthIndex, YearIndex], yearindex: [MonthIndex, YearIndex],
"yearindex-count": [DecadeIndex], "yearindex-count": [DecadeIndex],
}); });