mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-29 21:19:28 -07:00
computer: init lazy/eager
This commit is contained in:
@@ -7,19 +7,18 @@ use brk_parser::bitcoin;
|
||||
use brk_vec::{Compressed, Version};
|
||||
|
||||
use super::{
|
||||
Indexes,
|
||||
base::ComputedVec,
|
||||
EagerVec, Indexes,
|
||||
grouped::{ComputedVecsFromHeight, StorableVecGeneatorOptions},
|
||||
indexes,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Vecs {
|
||||
pub height_to_interval: ComputedVec<Height, Timestamp>,
|
||||
pub height_to_interval: EagerVec<Height, Timestamp>,
|
||||
pub indexes_to_block_interval: ComputedVecsFromHeight<Timestamp>,
|
||||
pub indexes_to_block_count: ComputedVecsFromHeight<StoredU32>,
|
||||
pub indexes_to_block_weight: ComputedVecsFromHeight<Weight>,
|
||||
pub height_to_vbytes: ComputedVec<Height, StoredU64>,
|
||||
pub height_to_vbytes: EagerVec<Height, StoredU64>,
|
||||
pub indexes_to_block_vbytes: ComputedVecsFromHeight<StoredU64>,
|
||||
pub indexes_to_block_size: ComputedVecsFromHeight<StoredUsize>,
|
||||
}
|
||||
@@ -29,7 +28,7 @@ impl Vecs {
|
||||
fs::create_dir_all(path)?;
|
||||
|
||||
Ok(Self {
|
||||
height_to_interval: ComputedVec::forced_import(
|
||||
height_to_interval: EagerVec::forced_import(
|
||||
&path.join("height_to_interval"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
@@ -69,7 +68,7 @@ impl Vecs {
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_sum().add_total(),
|
||||
)?,
|
||||
height_to_vbytes: ComputedVec::forced_import(
|
||||
height_to_vbytes: EagerVec::forced_import(
|
||||
&path.join("height_to_vbytes"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
|
||||
@@ -6,9 +6,7 @@ use brk_vec::{
|
||||
};
|
||||
use color_eyre::eyre::ContextCompat;
|
||||
|
||||
use crate::storage::vecs::base::ComputedVec;
|
||||
|
||||
use super::ComputedType;
|
||||
use crate::storage::{ComputedType, EagerVec};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ComputedVecBuilder<I, T>
|
||||
@@ -16,18 +14,18 @@ where
|
||||
I: StoredIndex,
|
||||
T: ComputedType,
|
||||
{
|
||||
first: Option<ComputedVec<I, T>>,
|
||||
average: Option<ComputedVec<I, T>>,
|
||||
sum: Option<ComputedVec<I, T>>,
|
||||
max: Option<ComputedVec<I, T>>,
|
||||
_90p: Option<ComputedVec<I, T>>,
|
||||
_75p: Option<ComputedVec<I, T>>,
|
||||
median: Option<ComputedVec<I, T>>,
|
||||
_25p: Option<ComputedVec<I, T>>,
|
||||
_10p: Option<ComputedVec<I, T>>,
|
||||
min: Option<ComputedVec<I, T>>,
|
||||
last: Option<ComputedVec<I, T>>,
|
||||
total: Option<ComputedVec<I, T>>,
|
||||
first: Option<EagerVec<I, T>>,
|
||||
average: Option<EagerVec<I, T>>,
|
||||
sum: Option<EagerVec<I, T>>,
|
||||
max: Option<EagerVec<I, T>>,
|
||||
_90p: Option<EagerVec<I, T>>,
|
||||
_75p: Option<EagerVec<I, T>>,
|
||||
median: Option<EagerVec<I, T>>,
|
||||
_25p: Option<EagerVec<I, T>>,
|
||||
_10p: Option<EagerVec<I, T>>,
|
||||
min: Option<EagerVec<I, T>>,
|
||||
last: Option<EagerVec<I, T>>,
|
||||
total: Option<EagerVec<I, T>>,
|
||||
}
|
||||
|
||||
const VERSION: Version = Version::ZERO;
|
||||
@@ -74,15 +72,11 @@ where
|
||||
|
||||
let s = Self {
|
||||
first: options.first.then(|| {
|
||||
ComputedVec::forced_import(
|
||||
&maybe_prefix("first"),
|
||||
version + Version::ZERO,
|
||||
compressed,
|
||||
)
|
||||
.unwrap()
|
||||
EagerVec::forced_import(&maybe_prefix("first"), version + Version::ZERO, compressed)
|
||||
.unwrap()
|
||||
}),
|
||||
last: options.last.then(|| {
|
||||
ComputedVec::forced_import(
|
||||
EagerVec::forced_import(
|
||||
&path.join(format!("{key}_to_{name}")),
|
||||
version + Version::ZERO,
|
||||
compressed,
|
||||
@@ -90,23 +84,15 @@ where
|
||||
.unwrap()
|
||||
}),
|
||||
min: options.min.then(|| {
|
||||
ComputedVec::forced_import(
|
||||
&maybe_suffix("min"),
|
||||
version + Version::ZERO,
|
||||
compressed,
|
||||
)
|
||||
.unwrap()
|
||||
EagerVec::forced_import(&maybe_suffix("min"), version + Version::ZERO, compressed)
|
||||
.unwrap()
|
||||
}),
|
||||
max: options.max.then(|| {
|
||||
ComputedVec::forced_import(
|
||||
&maybe_suffix("max"),
|
||||
version + Version::ZERO,
|
||||
compressed,
|
||||
)
|
||||
.unwrap()
|
||||
EagerVec::forced_import(&maybe_suffix("max"), version + Version::ZERO, compressed)
|
||||
.unwrap()
|
||||
}),
|
||||
median: options.median.then(|| {
|
||||
ComputedVec::forced_import(
|
||||
EagerVec::forced_import(
|
||||
&maybe_suffix("median"),
|
||||
version + Version::ZERO,
|
||||
compressed,
|
||||
@@ -114,7 +100,7 @@ where
|
||||
.unwrap()
|
||||
}),
|
||||
average: options.average.then(|| {
|
||||
ComputedVec::forced_import(
|
||||
EagerVec::forced_import(
|
||||
&maybe_suffix("average"),
|
||||
version + Version::ZERO,
|
||||
compressed,
|
||||
@@ -122,48 +108,28 @@ where
|
||||
.unwrap()
|
||||
}),
|
||||
sum: options.sum.then(|| {
|
||||
ComputedVec::forced_import(
|
||||
&maybe_suffix("sum"),
|
||||
version + Version::ZERO,
|
||||
compressed,
|
||||
)
|
||||
.unwrap()
|
||||
EagerVec::forced_import(&maybe_suffix("sum"), version + Version::ZERO, compressed)
|
||||
.unwrap()
|
||||
}),
|
||||
total: options.total.then(|| {
|
||||
ComputedVec::forced_import(&prefix("total"), version + Version::ZERO, compressed)
|
||||
EagerVec::forced_import(&prefix("total"), version + Version::ZERO, compressed)
|
||||
.unwrap()
|
||||
}),
|
||||
_90p: options._90p.then(|| {
|
||||
ComputedVec::forced_import(
|
||||
&maybe_suffix("90p"),
|
||||
version + Version::ZERO,
|
||||
compressed,
|
||||
)
|
||||
.unwrap()
|
||||
EagerVec::forced_import(&maybe_suffix("90p"), version + Version::ZERO, compressed)
|
||||
.unwrap()
|
||||
}),
|
||||
_75p: options._75p.then(|| {
|
||||
ComputedVec::forced_import(
|
||||
&maybe_suffix("75p"),
|
||||
version + Version::ZERO,
|
||||
compressed,
|
||||
)
|
||||
.unwrap()
|
||||
EagerVec::forced_import(&maybe_suffix("75p"), version + Version::ZERO, compressed)
|
||||
.unwrap()
|
||||
}),
|
||||
_25p: options._25p.then(|| {
|
||||
ComputedVec::forced_import(
|
||||
&maybe_suffix("25p"),
|
||||
version + Version::ZERO,
|
||||
compressed,
|
||||
)
|
||||
.unwrap()
|
||||
EagerVec::forced_import(&maybe_suffix("25p"), version + Version::ZERO, compressed)
|
||||
.unwrap()
|
||||
}),
|
||||
_10p: options._10p.then(|| {
|
||||
ComputedVec::forced_import(
|
||||
&maybe_suffix("10p"),
|
||||
version + Version::ZERO,
|
||||
compressed,
|
||||
)
|
||||
.unwrap()
|
||||
EagerVec::forced_import(&maybe_suffix("10p"), version + Version::ZERO, compressed)
|
||||
.unwrap()
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -476,40 +442,40 @@ where
|
||||
))
|
||||
}
|
||||
|
||||
pub fn unwrap_first(&mut self) -> &mut ComputedVec<I, T> {
|
||||
pub fn unwrap_first(&mut self) -> &mut EagerVec<I, T> {
|
||||
self.first.as_mut().unwrap()
|
||||
}
|
||||
pub fn unwrap_average(&mut self) -> &mut ComputedVec<I, T> {
|
||||
pub fn unwrap_average(&mut self) -> &mut EagerVec<I, T> {
|
||||
self.average.as_mut().unwrap()
|
||||
}
|
||||
pub fn unwrap_sum(&mut self) -> &mut ComputedVec<I, T> {
|
||||
pub fn unwrap_sum(&mut self) -> &mut EagerVec<I, T> {
|
||||
self.sum.as_mut().unwrap()
|
||||
}
|
||||
pub fn unwrap_max(&mut self) -> &mut ComputedVec<I, T> {
|
||||
pub fn unwrap_max(&mut self) -> &mut EagerVec<I, T> {
|
||||
self.max.as_mut().unwrap()
|
||||
}
|
||||
pub fn unwrap_90p(&mut self) -> &mut ComputedVec<I, T> {
|
||||
pub fn unwrap_90p(&mut self) -> &mut EagerVec<I, T> {
|
||||
self._90p.as_mut().unwrap()
|
||||
}
|
||||
pub fn unwrap_75p(&mut self) -> &mut ComputedVec<I, T> {
|
||||
pub fn unwrap_75p(&mut self) -> &mut EagerVec<I, T> {
|
||||
self._75p.as_mut().unwrap()
|
||||
}
|
||||
pub fn unwrap_median(&mut self) -> &mut ComputedVec<I, T> {
|
||||
pub fn unwrap_median(&mut self) -> &mut EagerVec<I, T> {
|
||||
self.median.as_mut().unwrap()
|
||||
}
|
||||
pub fn unwrap_25p(&mut self) -> &mut ComputedVec<I, T> {
|
||||
pub fn unwrap_25p(&mut self) -> &mut EagerVec<I, T> {
|
||||
self._25p.as_mut().unwrap()
|
||||
}
|
||||
pub fn unwrap_10p(&mut self) -> &mut ComputedVec<I, T> {
|
||||
pub fn unwrap_10p(&mut self) -> &mut EagerVec<I, T> {
|
||||
self._10p.as_mut().unwrap()
|
||||
}
|
||||
pub fn unwrap_min(&mut self) -> &mut ComputedVec<I, T> {
|
||||
pub fn unwrap_min(&mut self) -> &mut EagerVec<I, T> {
|
||||
self.min.as_mut().unwrap()
|
||||
}
|
||||
pub fn unwrap_last(&mut self) -> &mut ComputedVec<I, T> {
|
||||
pub fn unwrap_last(&mut self) -> &mut EagerVec<I, T> {
|
||||
self.last.as_mut().unwrap()
|
||||
}
|
||||
pub fn unwrap_total(&mut self) -> &mut ComputedVec<I, T> {
|
||||
pub fn unwrap_total(&mut self) -> &mut EagerVec<I, T> {
|
||||
self.total.as_mut().unwrap()
|
||||
}
|
||||
|
||||
|
||||
@@ -5,16 +5,16 @@ use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyStoredVec, Compressed, Result, Version};
|
||||
|
||||
use crate::storage::vecs::{Indexes, base::ComputedVec, indexes};
|
||||
use crate::storage::{ComputedType, EagerVec, Indexes, indexes};
|
||||
|
||||
use super::{ComputedType, ComputedVecBuilder, StorableVecGeneatorOptions};
|
||||
use super::{ComputedVecBuilder, StorableVecGeneatorOptions};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ComputedVecsFromDateindex<T>
|
||||
where
|
||||
T: ComputedType + PartialOrd,
|
||||
{
|
||||
pub dateindex: ComputedVec<Dateindex, T>,
|
||||
pub dateindex: EagerVec<Dateindex, T>,
|
||||
pub dateindex_extra: ComputedVecBuilder<Dateindex, T>,
|
||||
pub weekindex: ComputedVecBuilder<Weekindex, T>,
|
||||
pub monthindex: ComputedVecBuilder<Monthindex, T>,
|
||||
@@ -49,7 +49,7 @@ where
|
||||
let options = options.remove_percentiles();
|
||||
|
||||
Ok(Self {
|
||||
dateindex: ComputedVec::forced_import(
|
||||
dateindex: EagerVec::forced_import(
|
||||
&path.join(format!("dateindex_to_{name}")),
|
||||
version,
|
||||
compressed,
|
||||
@@ -79,7 +79,7 @@ where
|
||||
) -> color_eyre::Result<()>
|
||||
where
|
||||
F: FnMut(
|
||||
&mut ComputedVec<Dateindex, T>,
|
||||
&mut EagerVec<Dateindex, T>,
|
||||
&mut Indexer,
|
||||
&mut indexes::Vecs,
|
||||
&Indexes,
|
||||
|
||||
@@ -7,16 +7,16 @@ use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyStoredVec, Compressed, Result, StoredVec, Version};
|
||||
|
||||
use crate::storage::vecs::{Indexes, base::ComputedVec, indexes};
|
||||
use crate::storage::{ComputedType, EagerVec, Indexes, indexes};
|
||||
|
||||
use super::{ComputedType, ComputedVecBuilder, StorableVecGeneatorOptions};
|
||||
use super::{ComputedVecBuilder, StorableVecGeneatorOptions};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ComputedVecsFromHeight<T>
|
||||
where
|
||||
T: ComputedType + PartialOrd,
|
||||
{
|
||||
pub height: Option<ComputedVec<Height, T>>,
|
||||
pub height: Option<EagerVec<Height, T>>,
|
||||
pub height_extra: ComputedVecBuilder<Height, T>,
|
||||
pub dateindex: ComputedVecBuilder<Dateindex, T>,
|
||||
pub weekindex: ComputedVecBuilder<Weekindex, T>,
|
||||
@@ -46,7 +46,7 @@ where
|
||||
let version = VERSION + version;
|
||||
|
||||
let height = compute_source.then(|| {
|
||||
ComputedVec::forced_import(&path.join(format!("height_to_{name}")), version, compressed)
|
||||
EagerVec::forced_import(&path.join(format!("height_to_{name}")), version, compressed)
|
||||
.unwrap()
|
||||
});
|
||||
|
||||
@@ -95,7 +95,7 @@ where
|
||||
) -> color_eyre::Result<()>
|
||||
where
|
||||
F: FnMut(
|
||||
&mut ComputedVec<Height, T>,
|
||||
&mut EagerVec<Height, T>,
|
||||
&mut Indexer,
|
||||
&mut indexes::Vecs,
|
||||
&Indexes,
|
||||
|
||||
@@ -5,16 +5,16 @@ use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyStoredVec, Compressed, Result, Version};
|
||||
|
||||
use crate::storage::vecs::{Indexes, base::ComputedVec, indexes};
|
||||
use crate::storage::{ComputedType, EagerVec, Indexes, indexes};
|
||||
|
||||
use super::{ComputedType, ComputedVecBuilder, StorableVecGeneatorOptions};
|
||||
use super::{ComputedVecBuilder, StorableVecGeneatorOptions};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ComputedVecsFromHeightStrict<T>
|
||||
where
|
||||
T: ComputedType + PartialOrd,
|
||||
{
|
||||
pub height: ComputedVec<Height, T>,
|
||||
pub height: EagerVec<Height, T>,
|
||||
pub height_extra: ComputedVecBuilder<Height, T>,
|
||||
pub difficultyepoch: ComputedVecBuilder<Difficultyepoch, T>,
|
||||
// TODO: pub halvingepoch: StorableVecGeneator<Halvingepoch, T>,
|
||||
@@ -36,11 +36,8 @@ where
|
||||
) -> color_eyre::Result<Self> {
|
||||
let version = VERSION + version;
|
||||
|
||||
let height = ComputedVec::forced_import(
|
||||
&path.join(format!("height_to_{name}")),
|
||||
version,
|
||||
compressed,
|
||||
)?;
|
||||
let height =
|
||||
EagerVec::forced_import(&path.join(format!("height_to_{name}")), version, compressed)?;
|
||||
|
||||
let height_extra = ComputedVecBuilder::forced_import(
|
||||
path,
|
||||
@@ -72,7 +69,7 @@ where
|
||||
) -> color_eyre::Result<()>
|
||||
where
|
||||
F: FnMut(
|
||||
&mut ComputedVec<Height, T>,
|
||||
&mut EagerVec<Height, T>,
|
||||
&mut Indexer,
|
||||
&mut indexes::Vecs,
|
||||
&Indexes,
|
||||
|
||||
@@ -8,16 +8,16 @@ use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyStoredVec, Compressed, Result, StoredVec, Version};
|
||||
|
||||
use crate::storage::vecs::{Indexes, base::ComputedVec, indexes};
|
||||
use crate::storage::{ComputedType, EagerVec, Indexes, indexes};
|
||||
|
||||
use super::{ComputedType, ComputedVecBuilder, StorableVecGeneatorOptions};
|
||||
use super::{ComputedVecBuilder, StorableVecGeneatorOptions};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ComputedVecsFromTxindex<T>
|
||||
where
|
||||
T: ComputedType + PartialOrd,
|
||||
{
|
||||
pub txindex: Option<ComputedVec<Txindex, T>>,
|
||||
pub txindex: Option<EagerVec<Txindex, T>>,
|
||||
pub height: ComputedVecBuilder<Height, T>,
|
||||
pub dateindex: ComputedVecBuilder<Dateindex, T>,
|
||||
pub weekindex: ComputedVecBuilder<Weekindex, T>,
|
||||
@@ -47,7 +47,7 @@ where
|
||||
let version = VERSION + version;
|
||||
|
||||
let txindex = compute_source.then(|| {
|
||||
ComputedVec::forced_import(
|
||||
EagerVec::forced_import(
|
||||
&path.join(format!("txindex_to_{name}")),
|
||||
version,
|
||||
compressed,
|
||||
@@ -91,7 +91,7 @@ where
|
||||
) -> color_eyre::Result<()>
|
||||
where
|
||||
F: FnMut(
|
||||
&mut ComputedVec<Txindex, T>,
|
||||
&mut EagerVec<Txindex, T>,
|
||||
&mut Indexer,
|
||||
&mut indexes::Vecs,
|
||||
&Indexes,
|
||||
|
||||
@@ -3,7 +3,6 @@ mod from_dateindex;
|
||||
mod from_height;
|
||||
mod from_height_strict;
|
||||
mod from_txindex;
|
||||
mod stored_type;
|
||||
mod value_from_height;
|
||||
mod value_from_txindex;
|
||||
|
||||
@@ -12,6 +11,5 @@ pub use from_dateindex::*;
|
||||
pub use from_height::*;
|
||||
pub use from_height_strict::*;
|
||||
pub use from_txindex::*;
|
||||
pub use stored_type::*;
|
||||
pub use value_from_height::*;
|
||||
pub use value_from_txindex::*;
|
||||
|
||||
@@ -6,8 +6,7 @@ use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyStoredVec, Compressed, Result, StoredVec, Version};
|
||||
|
||||
use crate::storage::{
|
||||
base::ComputedVec,
|
||||
marketprice,
|
||||
EagerVec, marketprice,
|
||||
vecs::{Indexes, indexes},
|
||||
};
|
||||
|
||||
@@ -74,7 +73,7 @@ impl ComputedValueVecsFromHeight {
|
||||
) -> color_eyre::Result<()>
|
||||
where
|
||||
F: FnMut(
|
||||
&mut ComputedVec<Height, Sats>,
|
||||
&mut EagerVec<Height, Sats>,
|
||||
&mut Indexer,
|
||||
&mut indexes::Vecs,
|
||||
&Indexes,
|
||||
|
||||
@@ -6,8 +6,7 @@ use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyStoredVec, Compressed, Result, StoredVec, Version};
|
||||
|
||||
use crate::storage::{
|
||||
base::ComputedVec,
|
||||
marketprice,
|
||||
EagerVec, marketprice,
|
||||
vecs::{Indexes, indexes},
|
||||
};
|
||||
|
||||
@@ -74,7 +73,7 @@ impl ComputedValueVecsFromTxindex {
|
||||
) -> color_eyre::Result<()>
|
||||
where
|
||||
F: FnMut(
|
||||
&mut ComputedVec<Txindex, Sats>,
|
||||
&mut EagerVec<Txindex, Sats>,
|
||||
&mut Indexer,
|
||||
&mut indexes::Vecs,
|
||||
&Indexes,
|
||||
|
||||
@@ -10,74 +10,74 @@ use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_vec::{Compressed, Version};
|
||||
|
||||
use super::ComputedVec;
|
||||
use super::EagerVec;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Vecs {
|
||||
pub addressindex_to_addressindex: ComputedVec<Addressindex, Addressindex>,
|
||||
pub dateindex_to_date: ComputedVec<Dateindex, Date>,
|
||||
pub dateindex_to_dateindex: ComputedVec<Dateindex, Dateindex>,
|
||||
pub dateindex_to_first_height: ComputedVec<Dateindex, Height>,
|
||||
pub dateindex_to_last_height: ComputedVec<Dateindex, Height>,
|
||||
pub dateindex_to_monthindex: ComputedVec<Dateindex, Monthindex>,
|
||||
pub dateindex_to_timestamp: ComputedVec<Dateindex, Timestamp>,
|
||||
pub dateindex_to_weekindex: ComputedVec<Dateindex, Weekindex>,
|
||||
pub decadeindex_to_decadeindex: ComputedVec<Decadeindex, Decadeindex>,
|
||||
pub decadeindex_to_first_yearindex: ComputedVec<Decadeindex, Yearindex>,
|
||||
pub decadeindex_to_last_yearindex: ComputedVec<Decadeindex, Yearindex>,
|
||||
pub decadeindex_to_timestamp: ComputedVec<Decadeindex, Timestamp>,
|
||||
pub difficultyepoch_to_difficultyepoch: ComputedVec<Difficultyepoch, Difficultyepoch>,
|
||||
pub difficultyepoch_to_first_height: ComputedVec<Difficultyepoch, Height>,
|
||||
pub difficultyepoch_to_last_height: ComputedVec<Difficultyepoch, Height>,
|
||||
pub difficultyepoch_to_timestamp: ComputedVec<Difficultyepoch, Timestamp>,
|
||||
pub emptyindex_to_emptyindex: ComputedVec<Emptyindex, Emptyindex>,
|
||||
pub halvingepoch_to_first_height: ComputedVec<Halvingepoch, Height>,
|
||||
pub halvingepoch_to_halvingepoch: ComputedVec<Halvingepoch, Halvingepoch>,
|
||||
pub halvingepoch_to_last_height: ComputedVec<Halvingepoch, Height>,
|
||||
pub halvingepoch_to_timestamp: ComputedVec<Halvingepoch, Timestamp>,
|
||||
pub height_to_dateindex: ComputedVec<Height, Dateindex>,
|
||||
pub height_to_difficultyepoch: ComputedVec<Height, Difficultyepoch>,
|
||||
pub height_to_fixed_date: ComputedVec<Height, Date>,
|
||||
pub height_to_fixed_timestamp: ComputedVec<Height, Timestamp>,
|
||||
pub height_to_halvingepoch: ComputedVec<Height, Halvingepoch>,
|
||||
pub height_to_height: ComputedVec<Height, Height>,
|
||||
pub height_to_last_txindex: ComputedVec<Height, Txindex>,
|
||||
pub height_to_real_date: ComputedVec<Height, Date>,
|
||||
pub monthindex_to_first_dateindex: ComputedVec<Monthindex, Dateindex>,
|
||||
pub monthindex_to_last_dateindex: ComputedVec<Monthindex, Dateindex>,
|
||||
pub monthindex_to_monthindex: ComputedVec<Monthindex, Monthindex>,
|
||||
pub monthindex_to_quarterindex: ComputedVec<Monthindex, Quarterindex>,
|
||||
pub monthindex_to_timestamp: ComputedVec<Monthindex, Timestamp>,
|
||||
pub monthindex_to_yearindex: ComputedVec<Monthindex, Yearindex>,
|
||||
pub multisigindex_to_multisigindex: ComputedVec<Multisigindex, Multisigindex>,
|
||||
pub opreturnindex_to_opreturnindex: ComputedVec<Opreturnindex, Opreturnindex>,
|
||||
pub p2pk33index_to_p2pk33index: ComputedVec<P2PK33index, P2PK33index>,
|
||||
pub p2pk65index_to_p2pk65index: ComputedVec<P2PK65index, P2PK65index>,
|
||||
pub p2pkhindex_to_p2pkhindex: ComputedVec<P2PKHindex, P2PKHindex>,
|
||||
pub p2shindex_to_p2shindex: ComputedVec<P2SHindex, P2SHindex>,
|
||||
pub p2trindex_to_p2trindex: ComputedVec<P2TRindex, P2TRindex>,
|
||||
pub p2wpkhindex_to_p2wpkhindex: ComputedVec<P2WPKHindex, P2WPKHindex>,
|
||||
pub p2wshindex_to_p2wshindex: ComputedVec<P2WSHindex, P2WSHindex>,
|
||||
pub pushonlyindex_to_pushonlyindex: ComputedVec<Pushonlyindex, Pushonlyindex>,
|
||||
pub quarterindex_to_first_monthindex: ComputedVec<Quarterindex, Monthindex>,
|
||||
pub quarterindex_to_last_monthindex: ComputedVec<Quarterindex, Monthindex>,
|
||||
pub quarterindex_to_quarterindex: ComputedVec<Quarterindex, Quarterindex>,
|
||||
pub quarterindex_to_timestamp: ComputedVec<Quarterindex, Timestamp>,
|
||||
pub txindex_to_last_txinindex: ComputedVec<Txindex, Txinindex>,
|
||||
pub txindex_to_last_txoutindex: ComputedVec<Txindex, Txoutindex>,
|
||||
pub txindex_to_txindex: ComputedVec<Txindex, Txindex>,
|
||||
pub txinindex_to_txinindex: ComputedVec<Txinindex, Txinindex>,
|
||||
pub txoutindex_to_txoutindex: ComputedVec<Txoutindex, Txoutindex>,
|
||||
pub unknownindex_to_unknownindex: ComputedVec<Unknownindex, Unknownindex>,
|
||||
pub weekindex_to_first_dateindex: ComputedVec<Weekindex, Dateindex>,
|
||||
pub weekindex_to_last_dateindex: ComputedVec<Weekindex, Dateindex>,
|
||||
pub weekindex_to_timestamp: ComputedVec<Weekindex, Timestamp>,
|
||||
pub weekindex_to_weekindex: ComputedVec<Weekindex, Weekindex>,
|
||||
pub yearindex_to_decadeindex: ComputedVec<Yearindex, Decadeindex>,
|
||||
pub yearindex_to_first_monthindex: ComputedVec<Yearindex, Monthindex>,
|
||||
pub yearindex_to_last_monthindex: ComputedVec<Yearindex, Monthindex>,
|
||||
pub yearindex_to_timestamp: ComputedVec<Yearindex, Timestamp>,
|
||||
pub yearindex_to_yearindex: ComputedVec<Yearindex, Yearindex>,
|
||||
pub addressindex_to_addressindex: EagerVec<Addressindex, Addressindex>,
|
||||
pub dateindex_to_date: EagerVec<Dateindex, Date>,
|
||||
pub dateindex_to_dateindex: EagerVec<Dateindex, Dateindex>,
|
||||
pub dateindex_to_first_height: EagerVec<Dateindex, Height>,
|
||||
pub dateindex_to_last_height: EagerVec<Dateindex, Height>,
|
||||
pub dateindex_to_monthindex: EagerVec<Dateindex, Monthindex>,
|
||||
pub dateindex_to_timestamp: EagerVec<Dateindex, Timestamp>,
|
||||
pub dateindex_to_weekindex: EagerVec<Dateindex, Weekindex>,
|
||||
pub decadeindex_to_decadeindex: EagerVec<Decadeindex, Decadeindex>,
|
||||
pub decadeindex_to_first_yearindex: EagerVec<Decadeindex, Yearindex>,
|
||||
pub decadeindex_to_last_yearindex: EagerVec<Decadeindex, Yearindex>,
|
||||
pub decadeindex_to_timestamp: EagerVec<Decadeindex, Timestamp>,
|
||||
pub difficultyepoch_to_difficultyepoch: EagerVec<Difficultyepoch, Difficultyepoch>,
|
||||
pub difficultyepoch_to_first_height: EagerVec<Difficultyepoch, Height>,
|
||||
pub difficultyepoch_to_last_height: EagerVec<Difficultyepoch, Height>,
|
||||
pub difficultyepoch_to_timestamp: EagerVec<Difficultyepoch, Timestamp>,
|
||||
pub emptyindex_to_emptyindex: EagerVec<Emptyindex, Emptyindex>,
|
||||
pub halvingepoch_to_first_height: EagerVec<Halvingepoch, Height>,
|
||||
pub halvingepoch_to_halvingepoch: EagerVec<Halvingepoch, Halvingepoch>,
|
||||
pub halvingepoch_to_last_height: EagerVec<Halvingepoch, Height>,
|
||||
pub halvingepoch_to_timestamp: EagerVec<Halvingepoch, Timestamp>,
|
||||
pub height_to_dateindex: EagerVec<Height, Dateindex>,
|
||||
pub height_to_difficultyepoch: EagerVec<Height, Difficultyepoch>,
|
||||
pub height_to_fixed_date: EagerVec<Height, Date>,
|
||||
pub height_to_fixed_timestamp: EagerVec<Height, Timestamp>,
|
||||
pub height_to_halvingepoch: EagerVec<Height, Halvingepoch>,
|
||||
pub height_to_height: EagerVec<Height, Height>,
|
||||
pub height_to_last_txindex: EagerVec<Height, Txindex>,
|
||||
pub height_to_real_date: EagerVec<Height, Date>,
|
||||
pub monthindex_to_first_dateindex: EagerVec<Monthindex, Dateindex>,
|
||||
pub monthindex_to_last_dateindex: EagerVec<Monthindex, Dateindex>,
|
||||
pub monthindex_to_monthindex: EagerVec<Monthindex, Monthindex>,
|
||||
pub monthindex_to_quarterindex: EagerVec<Monthindex, Quarterindex>,
|
||||
pub monthindex_to_timestamp: EagerVec<Monthindex, Timestamp>,
|
||||
pub monthindex_to_yearindex: EagerVec<Monthindex, Yearindex>,
|
||||
pub multisigindex_to_multisigindex: EagerVec<Multisigindex, Multisigindex>,
|
||||
pub opreturnindex_to_opreturnindex: EagerVec<Opreturnindex, Opreturnindex>,
|
||||
pub p2pk33index_to_p2pk33index: EagerVec<P2PK33index, P2PK33index>,
|
||||
pub p2pk65index_to_p2pk65index: EagerVec<P2PK65index, P2PK65index>,
|
||||
pub p2pkhindex_to_p2pkhindex: EagerVec<P2PKHindex, P2PKHindex>,
|
||||
pub p2shindex_to_p2shindex: EagerVec<P2SHindex, P2SHindex>,
|
||||
pub p2trindex_to_p2trindex: EagerVec<P2TRindex, P2TRindex>,
|
||||
pub p2wpkhindex_to_p2wpkhindex: EagerVec<P2WPKHindex, P2WPKHindex>,
|
||||
pub p2wshindex_to_p2wshindex: EagerVec<P2WSHindex, P2WSHindex>,
|
||||
pub pushonlyindex_to_pushonlyindex: EagerVec<Pushonlyindex, Pushonlyindex>,
|
||||
pub quarterindex_to_first_monthindex: EagerVec<Quarterindex, Monthindex>,
|
||||
pub quarterindex_to_last_monthindex: EagerVec<Quarterindex, Monthindex>,
|
||||
pub quarterindex_to_quarterindex: EagerVec<Quarterindex, Quarterindex>,
|
||||
pub quarterindex_to_timestamp: EagerVec<Quarterindex, Timestamp>,
|
||||
pub txindex_to_last_txinindex: EagerVec<Txindex, Txinindex>,
|
||||
pub txindex_to_last_txoutindex: EagerVec<Txindex, Txoutindex>,
|
||||
pub txindex_to_txindex: EagerVec<Txindex, Txindex>,
|
||||
pub txinindex_to_txinindex: EagerVec<Txinindex, Txinindex>,
|
||||
pub txoutindex_to_txoutindex: EagerVec<Txoutindex, Txoutindex>,
|
||||
pub unknownindex_to_unknownindex: EagerVec<Unknownindex, Unknownindex>,
|
||||
pub weekindex_to_first_dateindex: EagerVec<Weekindex, Dateindex>,
|
||||
pub weekindex_to_last_dateindex: EagerVec<Weekindex, Dateindex>,
|
||||
pub weekindex_to_timestamp: EagerVec<Weekindex, Timestamp>,
|
||||
pub weekindex_to_weekindex: EagerVec<Weekindex, Weekindex>,
|
||||
pub yearindex_to_decadeindex: EagerVec<Yearindex, Decadeindex>,
|
||||
pub yearindex_to_first_monthindex: EagerVec<Yearindex, Monthindex>,
|
||||
pub yearindex_to_last_monthindex: EagerVec<Yearindex, Monthindex>,
|
||||
pub yearindex_to_timestamp: EagerVec<Yearindex, Timestamp>,
|
||||
pub yearindex_to_yearindex: EagerVec<Yearindex, Yearindex>,
|
||||
}
|
||||
|
||||
impl Vecs {
|
||||
@@ -85,322 +85,322 @@ impl Vecs {
|
||||
fs::create_dir_all(path)?;
|
||||
|
||||
Ok(Self {
|
||||
dateindex_to_date: ComputedVec::forced_import(
|
||||
dateindex_to_date: EagerVec::forced_import(
|
||||
&path.join("dateindex_to_date"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_dateindex: ComputedVec::forced_import(
|
||||
dateindex_to_dateindex: EagerVec::forced_import(
|
||||
&path.join("dateindex_to_dateindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_first_height: ComputedVec::forced_import(
|
||||
dateindex_to_first_height: EagerVec::forced_import(
|
||||
&path.join("dateindex_to_first_height"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_last_height: ComputedVec::forced_import(
|
||||
dateindex_to_last_height: EagerVec::forced_import(
|
||||
&path.join("dateindex_to_last_height"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_real_date: ComputedVec::forced_import(
|
||||
height_to_real_date: EagerVec::forced_import(
|
||||
&path.join("height_to_real_date"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_fixed_date: ComputedVec::forced_import(
|
||||
height_to_fixed_date: EagerVec::forced_import(
|
||||
&path.join("height_to_fixed_date"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_dateindex: ComputedVec::forced_import(
|
||||
height_to_dateindex: EagerVec::forced_import(
|
||||
&path.join("height_to_dateindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_height: ComputedVec::forced_import(
|
||||
height_to_height: EagerVec::forced_import(
|
||||
&path.join("height_to_height"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_last_txindex: ComputedVec::forced_import(
|
||||
height_to_last_txindex: EagerVec::forced_import(
|
||||
&path.join("height_to_last_txindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
txindex_to_last_txinindex: ComputedVec::forced_import(
|
||||
txindex_to_last_txinindex: EagerVec::forced_import(
|
||||
&path.join("txindex_to_last_txinindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
txindex_to_last_txoutindex: ComputedVec::forced_import(
|
||||
txindex_to_last_txoutindex: EagerVec::forced_import(
|
||||
&path.join("txindex_to_last_txoutindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
difficultyepoch_to_first_height: ComputedVec::forced_import(
|
||||
difficultyepoch_to_first_height: EagerVec::forced_import(
|
||||
&path.join("difficultyepoch_to_first_height"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
difficultyepoch_to_last_height: ComputedVec::forced_import(
|
||||
difficultyepoch_to_last_height: EagerVec::forced_import(
|
||||
&path.join("difficultyepoch_to_last_height"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
halvingepoch_to_first_height: ComputedVec::forced_import(
|
||||
halvingepoch_to_first_height: EagerVec::forced_import(
|
||||
&path.join("halvingepoch_to_first_height"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
halvingepoch_to_last_height: ComputedVec::forced_import(
|
||||
halvingepoch_to_last_height: EagerVec::forced_import(
|
||||
&path.join("halvingepoch_to_last_height"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
weekindex_to_first_dateindex: ComputedVec::forced_import(
|
||||
weekindex_to_first_dateindex: EagerVec::forced_import(
|
||||
&path.join("weekindex_to_first_dateindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
weekindex_to_last_dateindex: ComputedVec::forced_import(
|
||||
weekindex_to_last_dateindex: EagerVec::forced_import(
|
||||
&path.join("weekindex_to_last_dateindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
monthindex_to_first_dateindex: ComputedVec::forced_import(
|
||||
monthindex_to_first_dateindex: EagerVec::forced_import(
|
||||
&path.join("monthindex_to_first_dateindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
monthindex_to_last_dateindex: ComputedVec::forced_import(
|
||||
monthindex_to_last_dateindex: EagerVec::forced_import(
|
||||
&path.join("monthindex_to_last_dateindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
yearindex_to_first_monthindex: ComputedVec::forced_import(
|
||||
yearindex_to_first_monthindex: EagerVec::forced_import(
|
||||
&path.join("yearindex_to_first_monthindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
yearindex_to_last_monthindex: ComputedVec::forced_import(
|
||||
yearindex_to_last_monthindex: EagerVec::forced_import(
|
||||
&path.join("yearindex_to_last_monthindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
decadeindex_to_first_yearindex: ComputedVec::forced_import(
|
||||
decadeindex_to_first_yearindex: EagerVec::forced_import(
|
||||
&path.join("decadeindex_to_first_yearindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
decadeindex_to_last_yearindex: ComputedVec::forced_import(
|
||||
decadeindex_to_last_yearindex: EagerVec::forced_import(
|
||||
&path.join("decadeindex_to_last_yearindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_weekindex: ComputedVec::forced_import(
|
||||
dateindex_to_weekindex: EagerVec::forced_import(
|
||||
&path.join("dateindex_to_weekindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_monthindex: ComputedVec::forced_import(
|
||||
dateindex_to_monthindex: EagerVec::forced_import(
|
||||
&path.join("dateindex_to_monthindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
monthindex_to_yearindex: ComputedVec::forced_import(
|
||||
monthindex_to_yearindex: EagerVec::forced_import(
|
||||
&path.join("monthindex_to_yearindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
yearindex_to_decadeindex: ComputedVec::forced_import(
|
||||
yearindex_to_decadeindex: EagerVec::forced_import(
|
||||
&path.join("yearindex_to_decadeindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_difficultyepoch: ComputedVec::forced_import(
|
||||
height_to_difficultyepoch: EagerVec::forced_import(
|
||||
&path.join("height_to_difficultyepoch"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_halvingepoch: ComputedVec::forced_import(
|
||||
height_to_halvingepoch: EagerVec::forced_import(
|
||||
&path.join("height_to_halvingepoch"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
weekindex_to_weekindex: ComputedVec::forced_import(
|
||||
weekindex_to_weekindex: EagerVec::forced_import(
|
||||
&path.join("weekindex_to_weekindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
monthindex_to_monthindex: ComputedVec::forced_import(
|
||||
monthindex_to_monthindex: EagerVec::forced_import(
|
||||
&path.join("monthindex_to_monthindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
yearindex_to_yearindex: ComputedVec::forced_import(
|
||||
yearindex_to_yearindex: EagerVec::forced_import(
|
||||
&path.join("yearindex_to_yearindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
decadeindex_to_decadeindex: ComputedVec::forced_import(
|
||||
decadeindex_to_decadeindex: EagerVec::forced_import(
|
||||
&path.join("decadeindex_to_decadeindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
difficultyepoch_to_difficultyepoch: ComputedVec::forced_import(
|
||||
difficultyepoch_to_difficultyepoch: EagerVec::forced_import(
|
||||
&path.join("difficultyepoch_to_difficultyepoch"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
halvingepoch_to_halvingepoch: ComputedVec::forced_import(
|
||||
halvingepoch_to_halvingepoch: EagerVec::forced_import(
|
||||
&path.join("halvingepoch_to_halvingepoch"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_timestamp: ComputedVec::forced_import(
|
||||
dateindex_to_timestamp: EagerVec::forced_import(
|
||||
&path.join("dateindex_to_timestamp"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
decadeindex_to_timestamp: ComputedVec::forced_import(
|
||||
decadeindex_to_timestamp: EagerVec::forced_import(
|
||||
&path.join("decadeindex_to_timestamp"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
difficultyepoch_to_timestamp: ComputedVec::forced_import(
|
||||
difficultyepoch_to_timestamp: EagerVec::forced_import(
|
||||
&path.join("difficultyepoch_to_timestamp"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
halvingepoch_to_timestamp: ComputedVec::forced_import(
|
||||
halvingepoch_to_timestamp: EagerVec::forced_import(
|
||||
&path.join("halvingepoch_to_timestamp"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
monthindex_to_timestamp: ComputedVec::forced_import(
|
||||
monthindex_to_timestamp: EagerVec::forced_import(
|
||||
&path.join("monthindex_to_timestamp"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
weekindex_to_timestamp: ComputedVec::forced_import(
|
||||
weekindex_to_timestamp: EagerVec::forced_import(
|
||||
&path.join("weekindex_to_timestamp"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
yearindex_to_timestamp: ComputedVec::forced_import(
|
||||
yearindex_to_timestamp: EagerVec::forced_import(
|
||||
&path.join("yearindex_to_timestamp"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_fixed_timestamp: ComputedVec::forced_import(
|
||||
height_to_fixed_timestamp: EagerVec::forced_import(
|
||||
&path.join("height_to_fixed_timestamp"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
monthindex_to_quarterindex: ComputedVec::forced_import(
|
||||
monthindex_to_quarterindex: EagerVec::forced_import(
|
||||
&path.join("monthindex_to_quarterindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
quarterindex_to_first_monthindex: ComputedVec::forced_import(
|
||||
quarterindex_to_first_monthindex: EagerVec::forced_import(
|
||||
&path.join("quarterindex_to_first_monthindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
quarterindex_to_last_monthindex: ComputedVec::forced_import(
|
||||
quarterindex_to_last_monthindex: EagerVec::forced_import(
|
||||
&path.join("quarterindex_to_last_monthindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
quarterindex_to_quarterindex: ComputedVec::forced_import(
|
||||
quarterindex_to_quarterindex: EagerVec::forced_import(
|
||||
&path.join("quarterindex_to_quarterindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
quarterindex_to_timestamp: ComputedVec::forced_import(
|
||||
quarterindex_to_timestamp: EagerVec::forced_import(
|
||||
&path.join("quarterindex_to_timestamp"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
p2pk33index_to_p2pk33index: ComputedVec::forced_import(
|
||||
p2pk33index_to_p2pk33index: EagerVec::forced_import(
|
||||
&path.join("p2pk33index_to_p2pk33index"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
p2pk65index_to_p2pk65index: ComputedVec::forced_import(
|
||||
p2pk65index_to_p2pk65index: EagerVec::forced_import(
|
||||
&path.join("p2pk65index_to_p2pk65index"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
p2pkhindex_to_p2pkhindex: ComputedVec::forced_import(
|
||||
p2pkhindex_to_p2pkhindex: EagerVec::forced_import(
|
||||
&path.join("p2pkhindex_to_p2pkhindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
p2shindex_to_p2shindex: ComputedVec::forced_import(
|
||||
p2shindex_to_p2shindex: EagerVec::forced_import(
|
||||
&path.join("p2shindex_to_p2shindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
p2trindex_to_p2trindex: ComputedVec::forced_import(
|
||||
p2trindex_to_p2trindex: EagerVec::forced_import(
|
||||
&path.join("p2trindex_to_p2trindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
p2wpkhindex_to_p2wpkhindex: ComputedVec::forced_import(
|
||||
p2wpkhindex_to_p2wpkhindex: EagerVec::forced_import(
|
||||
&path.join("p2wpkhindex_to_p2wpkhindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
p2wshindex_to_p2wshindex: ComputedVec::forced_import(
|
||||
p2wshindex_to_p2wshindex: EagerVec::forced_import(
|
||||
&path.join("p2wshindex_to_p2wshindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
txindex_to_txindex: ComputedVec::forced_import(
|
||||
txindex_to_txindex: EagerVec::forced_import(
|
||||
&path.join("txindex_to_txindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
txinindex_to_txinindex: ComputedVec::forced_import(
|
||||
txinindex_to_txinindex: EagerVec::forced_import(
|
||||
&path.join("txinindex_to_txinindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
emptyindex_to_emptyindex: ComputedVec::forced_import(
|
||||
emptyindex_to_emptyindex: EagerVec::forced_import(
|
||||
&path.join("emptyindex_to_emptyindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
multisigindex_to_multisigindex: ComputedVec::forced_import(
|
||||
multisigindex_to_multisigindex: EagerVec::forced_import(
|
||||
&path.join("multisigindex_to_multisigindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
opreturnindex_to_opreturnindex: ComputedVec::forced_import(
|
||||
opreturnindex_to_opreturnindex: EagerVec::forced_import(
|
||||
&path.join("opreturnindex_to_opreturnindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
pushonlyindex_to_pushonlyindex: ComputedVec::forced_import(
|
||||
pushonlyindex_to_pushonlyindex: EagerVec::forced_import(
|
||||
&path.join("pushonlyindex_to_pushonlyindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
unknownindex_to_unknownindex: ComputedVec::forced_import(
|
||||
unknownindex_to_unknownindex: EagerVec::forced_import(
|
||||
&path.join("unknownindex_to_unknownindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
addressindex_to_addressindex: ComputedVec::forced_import(
|
||||
addressindex_to_addressindex: EagerVec::forced_import(
|
||||
&path.join("addressindex_to_addressindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
txoutindex_to_txoutindex: ComputedVec::forced_import(
|
||||
txoutindex_to_txoutindex: EagerVec::forced_import(
|
||||
&path.join("txoutindex_to_txoutindex"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
|
||||
@@ -10,7 +10,7 @@ use brk_indexer::Indexer;
|
||||
use brk_vec::{Compressed, Version};
|
||||
|
||||
use super::{
|
||||
ComputedVec, Indexes,
|
||||
EagerVec, Indexes,
|
||||
grouped::{
|
||||
ComputedVecsFromDateindex, ComputedVecsFromHeightStrict, StorableVecGeneatorOptions,
|
||||
},
|
||||
@@ -19,20 +19,20 @@ use super::{
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Vecs {
|
||||
pub dateindex_to_close_in_cents: ComputedVec<Dateindex, Close<Cents>>,
|
||||
pub dateindex_to_high_in_cents: ComputedVec<Dateindex, High<Cents>>,
|
||||
pub dateindex_to_low_in_cents: ComputedVec<Dateindex, Low<Cents>>,
|
||||
pub dateindex_to_ohlc: ComputedVec<Dateindex, OHLCDollars>,
|
||||
pub dateindex_to_ohlc_in_sats: ComputedVec<Dateindex, OHLCSats>,
|
||||
pub dateindex_to_ohlc_in_cents: ComputedVec<Dateindex, OHLCCents>,
|
||||
pub dateindex_to_open_in_cents: ComputedVec<Dateindex, Open<Cents>>,
|
||||
pub height_to_close_in_cents: ComputedVec<Height, Close<Cents>>,
|
||||
pub height_to_high_in_cents: ComputedVec<Height, High<Cents>>,
|
||||
pub height_to_low_in_cents: ComputedVec<Height, Low<Cents>>,
|
||||
pub height_to_ohlc: ComputedVec<Height, OHLCDollars>,
|
||||
pub height_to_ohlc_in_sats: ComputedVec<Height, OHLCSats>,
|
||||
pub height_to_ohlc_in_cents: ComputedVec<Height, OHLCCents>,
|
||||
pub height_to_open_in_cents: ComputedVec<Height, Open<Cents>>,
|
||||
pub dateindex_to_close_in_cents: EagerVec<Dateindex, Close<Cents>>,
|
||||
pub dateindex_to_high_in_cents: EagerVec<Dateindex, High<Cents>>,
|
||||
pub dateindex_to_low_in_cents: EagerVec<Dateindex, Low<Cents>>,
|
||||
pub dateindex_to_ohlc: EagerVec<Dateindex, OHLCDollars>,
|
||||
pub dateindex_to_ohlc_in_sats: EagerVec<Dateindex, OHLCSats>,
|
||||
pub dateindex_to_ohlc_in_cents: EagerVec<Dateindex, OHLCCents>,
|
||||
pub dateindex_to_open_in_cents: EagerVec<Dateindex, Open<Cents>>,
|
||||
pub height_to_close_in_cents: EagerVec<Height, Close<Cents>>,
|
||||
pub height_to_high_in_cents: EagerVec<Height, High<Cents>>,
|
||||
pub height_to_low_in_cents: EagerVec<Height, Low<Cents>>,
|
||||
pub height_to_ohlc: EagerVec<Height, OHLCDollars>,
|
||||
pub height_to_ohlc_in_sats: EagerVec<Height, OHLCSats>,
|
||||
pub height_to_ohlc_in_cents: EagerVec<Height, OHLCCents>,
|
||||
pub height_to_open_in_cents: EagerVec<Height, Open<Cents>>,
|
||||
pub timeindexes_to_close: ComputedVecsFromDateindex<Close<Dollars>>,
|
||||
pub timeindexes_to_high: ComputedVecsFromDateindex<High<Dollars>>,
|
||||
pub timeindexes_to_low: ComputedVecsFromDateindex<Low<Dollars>>,
|
||||
@@ -49,20 +49,20 @@ pub struct Vecs {
|
||||
pub chainindexes_to_high_in_sats: ComputedVecsFromHeightStrict<High<Sats>>,
|
||||
pub chainindexes_to_low_in_sats: ComputedVecsFromHeightStrict<Low<Sats>>,
|
||||
pub chainindexes_to_close_in_sats: ComputedVecsFromHeightStrict<Close<Sats>>,
|
||||
pub weekindex_to_ohlc: ComputedVec<Weekindex, OHLCDollars>,
|
||||
pub weekindex_to_ohlc_in_sats: ComputedVec<Weekindex, OHLCSats>,
|
||||
pub difficultyepoch_to_ohlc: ComputedVec<Difficultyepoch, OHLCDollars>,
|
||||
pub difficultyepoch_to_ohlc_in_sats: ComputedVec<Difficultyepoch, OHLCSats>,
|
||||
pub monthindex_to_ohlc: ComputedVec<Monthindex, OHLCDollars>,
|
||||
pub monthindex_to_ohlc_in_sats: ComputedVec<Monthindex, OHLCSats>,
|
||||
pub quarterindex_to_ohlc: ComputedVec<Quarterindex, OHLCDollars>,
|
||||
pub quarterindex_to_ohlc_in_sats: ComputedVec<Quarterindex, OHLCSats>,
|
||||
pub yearindex_to_ohlc: ComputedVec<Yearindex, OHLCDollars>,
|
||||
pub yearindex_to_ohlc_in_sats: ComputedVec<Yearindex, OHLCSats>,
|
||||
pub weekindex_to_ohlc: EagerVec<Weekindex, OHLCDollars>,
|
||||
pub weekindex_to_ohlc_in_sats: EagerVec<Weekindex, OHLCSats>,
|
||||
pub difficultyepoch_to_ohlc: EagerVec<Difficultyepoch, OHLCDollars>,
|
||||
pub difficultyepoch_to_ohlc_in_sats: EagerVec<Difficultyepoch, OHLCSats>,
|
||||
pub monthindex_to_ohlc: EagerVec<Monthindex, OHLCDollars>,
|
||||
pub monthindex_to_ohlc_in_sats: EagerVec<Monthindex, OHLCSats>,
|
||||
pub quarterindex_to_ohlc: EagerVec<Quarterindex, OHLCDollars>,
|
||||
pub quarterindex_to_ohlc_in_sats: EagerVec<Quarterindex, OHLCSats>,
|
||||
pub yearindex_to_ohlc: EagerVec<Yearindex, OHLCDollars>,
|
||||
pub yearindex_to_ohlc_in_sats: EagerVec<Yearindex, OHLCSats>,
|
||||
// pub halvingepoch_to_ohlc: StorableVec<Halvingepoch, OHLCDollars>,
|
||||
// pub halvingepoch_to_ohlc_in_sats: StorableVec<Halvingepoch, OHLCSats>,
|
||||
pub decadeindex_to_ohlc: ComputedVec<Decadeindex, OHLCDollars>,
|
||||
pub decadeindex_to_ohlc_in_sats: ComputedVec<Decadeindex, OHLCSats>,
|
||||
pub decadeindex_to_ohlc: EagerVec<Decadeindex, OHLCDollars>,
|
||||
pub decadeindex_to_ohlc_in_sats: EagerVec<Decadeindex, OHLCSats>,
|
||||
}
|
||||
|
||||
const VERSION: Version = Version::ZERO;
|
||||
@@ -78,72 +78,72 @@ impl Vecs {
|
||||
fetched_path = fetched_path.join("fetched/vecs");
|
||||
|
||||
Ok(Self {
|
||||
dateindex_to_ohlc_in_cents: ComputedVec::forced_import(
|
||||
dateindex_to_ohlc_in_cents: EagerVec::forced_import(
|
||||
&fetched_path.join("dateindex_to_ohlc_in_cents"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_ohlc: ComputedVec::forced_import(
|
||||
dateindex_to_ohlc: EagerVec::forced_import(
|
||||
&path.join("dateindex_to_ohlc"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_ohlc_in_sats: ComputedVec::forced_import(
|
||||
dateindex_to_ohlc_in_sats: EagerVec::forced_import(
|
||||
&path.join("dateindex_to_ohlc_in_sats"),
|
||||
VERSION + VERSION_IN_SATS + Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_close_in_cents: ComputedVec::forced_import(
|
||||
dateindex_to_close_in_cents: EagerVec::forced_import(
|
||||
&path.join("dateindex_to_close_in_cents"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_high_in_cents: ComputedVec::forced_import(
|
||||
dateindex_to_high_in_cents: EagerVec::forced_import(
|
||||
&path.join("dateindex_to_high_in_cents"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_low_in_cents: ComputedVec::forced_import(
|
||||
dateindex_to_low_in_cents: EagerVec::forced_import(
|
||||
&path.join("dateindex_to_low_in_cents"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
dateindex_to_open_in_cents: ComputedVec::forced_import(
|
||||
dateindex_to_open_in_cents: EagerVec::forced_import(
|
||||
&path.join("dateindex_to_open_in_cents"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_ohlc_in_cents: ComputedVec::forced_import(
|
||||
height_to_ohlc_in_cents: EagerVec::forced_import(
|
||||
&fetched_path.join("height_to_ohlc_in_cents"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_ohlc: ComputedVec::forced_import(
|
||||
height_to_ohlc: EagerVec::forced_import(
|
||||
&path.join("height_to_ohlc"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_ohlc_in_sats: ComputedVec::forced_import(
|
||||
height_to_ohlc_in_sats: EagerVec::forced_import(
|
||||
&path.join("height_to_ohlc_in_sats"),
|
||||
VERSION + VERSION_IN_SATS + Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_close_in_cents: ComputedVec::forced_import(
|
||||
height_to_close_in_cents: EagerVec::forced_import(
|
||||
&path.join("height_to_close_in_cents"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_high_in_cents: ComputedVec::forced_import(
|
||||
height_to_high_in_cents: EagerVec::forced_import(
|
||||
&path.join("height_to_high_in_cents"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_low_in_cents: ComputedVec::forced_import(
|
||||
height_to_low_in_cents: EagerVec::forced_import(
|
||||
&path.join("height_to_low_in_cents"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
height_to_open_in_cents: ComputedVec::forced_import(
|
||||
height_to_open_in_cents: EagerVec::forced_import(
|
||||
&path.join("height_to_open_in_cents"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
@@ -260,63 +260,63 @@ impl Vecs {
|
||||
compressed,
|
||||
StorableVecGeneatorOptions::default().add_last(),
|
||||
)?,
|
||||
weekindex_to_ohlc: ComputedVec::forced_import(
|
||||
weekindex_to_ohlc: EagerVec::forced_import(
|
||||
&path.join("weekindex_to_ohlc"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
weekindex_to_ohlc_in_sats: ComputedVec::forced_import(
|
||||
weekindex_to_ohlc_in_sats: EagerVec::forced_import(
|
||||
&path.join("weekindex_to_ohlc_in_sats"),
|
||||
VERSION + VERSION_IN_SATS + Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
difficultyepoch_to_ohlc: ComputedVec::forced_import(
|
||||
difficultyepoch_to_ohlc: EagerVec::forced_import(
|
||||
&path.join("difficultyepoch_to_ohlc"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
difficultyepoch_to_ohlc_in_sats: ComputedVec::forced_import(
|
||||
difficultyepoch_to_ohlc_in_sats: EagerVec::forced_import(
|
||||
&path.join("difficultyepoch_to_ohlc_in_sats"),
|
||||
VERSION + VERSION_IN_SATS + Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
monthindex_to_ohlc: ComputedVec::forced_import(
|
||||
monthindex_to_ohlc: EagerVec::forced_import(
|
||||
&path.join("monthindex_to_ohlc"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
monthindex_to_ohlc_in_sats: ComputedVec::forced_import(
|
||||
monthindex_to_ohlc_in_sats: EagerVec::forced_import(
|
||||
&path.join("monthindex_to_ohlc_in_sats"),
|
||||
VERSION + VERSION_IN_SATS + Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
quarterindex_to_ohlc: ComputedVec::forced_import(
|
||||
quarterindex_to_ohlc: EagerVec::forced_import(
|
||||
&path.join("quarterindex_to_ohlc"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
quarterindex_to_ohlc_in_sats: ComputedVec::forced_import(
|
||||
quarterindex_to_ohlc_in_sats: EagerVec::forced_import(
|
||||
&path.join("quarterindex_to_ohlc_in_sats"),
|
||||
VERSION + VERSION_IN_SATS + Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
yearindex_to_ohlc: ComputedVec::forced_import(
|
||||
yearindex_to_ohlc: EagerVec::forced_import(
|
||||
&path.join("yearindex_to_ohlc"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
yearindex_to_ohlc_in_sats: ComputedVec::forced_import(
|
||||
yearindex_to_ohlc_in_sats: EagerVec::forced_import(
|
||||
&path.join("yearindex_to_ohlc_in_sats"),
|
||||
VERSION + VERSION_IN_SATS + Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
// halvingepoch_to_ohlc: StorableVec::forced_import(&path.join("halvingepoch_to_ohlc"), Version::ZERO, compressed)?,
|
||||
decadeindex_to_ohlc: ComputedVec::forced_import(
|
||||
decadeindex_to_ohlc: EagerVec::forced_import(
|
||||
&path.join("decadeindex_to_ohlc"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
decadeindex_to_ohlc_in_sats: ComputedVec::forced_import(
|
||||
decadeindex_to_ohlc_in_sats: EagerVec::forced_import(
|
||||
&path.join("decadeindex_to_ohlc_in_sats"),
|
||||
VERSION + VERSION_IN_SATS + Version::ZERO,
|
||||
compressed,
|
||||
|
||||
@@ -5,15 +5,15 @@ use brk_fetcher::Fetcher;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_vec::{AnyStoredVec, Compressed};
|
||||
|
||||
pub mod base;
|
||||
pub mod blocks;
|
||||
pub mod grouped;
|
||||
pub mod indexes;
|
||||
pub mod marketprice;
|
||||
pub mod transactions;
|
||||
pub mod vec;
|
||||
|
||||
use base::*;
|
||||
use indexes::*;
|
||||
pub use indexes::*;
|
||||
pub use vec::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Vecs {
|
||||
|
||||
@@ -10,7 +10,7 @@ use brk_parser::bitcoin;
|
||||
use brk_vec::{Compressed, DynamicVec, StoredIndex, Version};
|
||||
|
||||
use super::{
|
||||
ComputedVec, Indexes,
|
||||
EagerVec, Indexes,
|
||||
grouped::{
|
||||
ComputedValueVecsFromHeight, ComputedValueVecsFromTxindex, ComputedVecsFromHeight,
|
||||
ComputedVecsFromTxindex, StorableVecGeneatorOptions,
|
||||
@@ -34,12 +34,12 @@ pub struct Vecs {
|
||||
pub indexes_to_tx_vsize: ComputedVecsFromTxindex<StoredUsize>,
|
||||
pub indexes_to_tx_weight: ComputedVecsFromTxindex<Weight>,
|
||||
pub txindex_to_input_count: ComputedVecsFromTxindex<StoredU64>,
|
||||
pub txindex_to_is_coinbase: ComputedVec<Txindex, bool>,
|
||||
pub txindex_to_is_coinbase: EagerVec<Txindex, bool>,
|
||||
pub txindex_to_output_count: ComputedVecsFromTxindex<StoredU64>,
|
||||
pub txindex_to_vsize: ComputedVec<Txindex, StoredUsize>,
|
||||
pub txindex_to_weight: ComputedVec<Txindex, Weight>,
|
||||
pub txindex_to_vsize: EagerVec<Txindex, StoredUsize>,
|
||||
pub txindex_to_weight: EagerVec<Txindex, Weight>,
|
||||
/// Value == 0 when Coinbase
|
||||
pub txinindex_to_value: ComputedVec<Txinindex, Sats>,
|
||||
pub txinindex_to_value: EagerVec<Txinindex, Sats>,
|
||||
pub indexes_to_subsidy: ComputedValueVecsFromHeight,
|
||||
pub indexes_to_coinbase: ComputedValueVecsFromHeight,
|
||||
}
|
||||
@@ -67,7 +67,7 @@ impl Vecs {
|
||||
.add_total(),
|
||||
)?,
|
||||
// height_to_subsidy: StorableVec::forced_import(&path.join("height_to_subsidy"), Version::ZERO)?,
|
||||
txindex_to_is_coinbase: ComputedVec::forced_import(
|
||||
txindex_to_is_coinbase: EagerVec::forced_import(
|
||||
&path.join("txindex_to_is_coinbase"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
@@ -98,7 +98,7 @@ impl Vecs {
|
||||
.add_sum()
|
||||
.add_total(),
|
||||
)?,
|
||||
txinindex_to_value: ComputedVec::forced_import(
|
||||
txinindex_to_value: EagerVec::forced_import(
|
||||
&path.join("txinindex_to_value"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
@@ -174,12 +174,12 @@ impl Vecs {
|
||||
.add_minmax()
|
||||
.add_average(),
|
||||
)?,
|
||||
txindex_to_weight: ComputedVec::forced_import(
|
||||
txindex_to_weight: EagerVec::forced_import(
|
||||
&path.join("txindex_to_weight"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
)?,
|
||||
txindex_to_vsize: ComputedVec::forced_import(
|
||||
txindex_to_vsize: EagerVec::forced_import(
|
||||
&path.join("txindex_to_vsize"),
|
||||
Version::ZERO,
|
||||
compressed,
|
||||
|
||||
@@ -18,7 +18,7 @@ const ONE_MIB: usize = ONE_KIB * ONE_KIB;
|
||||
const MAX_CACHE_SIZE: usize = 210 * ONE_MIB;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ComputedVec<I, T>
|
||||
pub struct EagerVec<I, T>
|
||||
where
|
||||
I: StoredIndex,
|
||||
T: StoredType,
|
||||
@@ -27,7 +27,7 @@ where
|
||||
inner: StoredVec<I, T>,
|
||||
}
|
||||
|
||||
impl<I, T> ComputedVec<I, T>
|
||||
impl<I, T> EagerVec<I, T>
|
||||
where
|
||||
I: StoredIndex,
|
||||
T: StoredType,
|
||||
@@ -443,7 +443,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<I> ComputedVec<I, Bitcoin>
|
||||
impl<I> EagerVec<I, Bitcoin>
|
||||
where
|
||||
I: StoredIndex,
|
||||
{
|
||||
@@ -467,7 +467,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl ComputedVec<Height, Dollars> {
|
||||
impl EagerVec<Height, Dollars> {
|
||||
pub fn compute_from_bitcoin(
|
||||
&mut self,
|
||||
max_from: Height,
|
||||
@@ -490,7 +490,7 @@ impl ComputedVec<Height, Dollars> {
|
||||
}
|
||||
}
|
||||
|
||||
impl ComputedVec<Txindex, Dollars> {
|
||||
impl EagerVec<Txindex, Dollars> {
|
||||
pub fn compute_from_bitcoin(
|
||||
&mut self,
|
||||
max_from: Txindex,
|
||||
@@ -515,7 +515,7 @@ impl ComputedVec<Txindex, Dollars> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<I, T> Clone for ComputedVec<I, T>
|
||||
impl<I, T> Clone for EagerVec<I, T>
|
||||
where
|
||||
I: StoredIndex,
|
||||
T: StoredType,
|
||||
76
crates/brk_computer/src/storage/vecs/vec/lazy.rs
Normal file
76
crates/brk_computer/src/storage/vecs/vec/lazy.rs
Normal file
@@ -0,0 +1,76 @@
|
||||
use core::error;
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
fmt::Debug,
|
||||
ops::Add,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use brk_core::{Bitcoin, CheckedSub, Close, Dollars, Height, Sats, Txindex};
|
||||
use brk_exit::Exit;
|
||||
use brk_vec::{
|
||||
Compressed, DynamicVec, Error, GenericVec, Result, StoredIndex, StoredType, StoredVec, Version,
|
||||
};
|
||||
use log::info;
|
||||
|
||||
const ONE_KIB: usize = 1024;
|
||||
const ONE_MIB: usize = ONE_KIB * ONE_KIB;
|
||||
const MAX_CACHE_SIZE: usize = 210 * ONE_MIB;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
enum Mode {
|
||||
Lazy,
|
||||
Eager,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct LazyVec<I, T>
|
||||
where
|
||||
I: StoredIndex,
|
||||
T: StoredType,
|
||||
{
|
||||
inner: StoredVec<I, T>,
|
||||
}
|
||||
|
||||
impl<I, T> LazyVec<I, T>
|
||||
where
|
||||
I: StoredIndex,
|
||||
T: StoredType,
|
||||
{
|
||||
const SIZE_OF: usize = size_of::<T>();
|
||||
|
||||
fn version(&self) -> Version {
|
||||
self.inner.version()
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
self.inner.len()
|
||||
}
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.inner.is_empty()
|
||||
}
|
||||
|
||||
pub fn unwrap_cached_get(&mut self, index: I) -> Option<T> {
|
||||
self.inner.unwrap_cached_get(index)
|
||||
}
|
||||
#[inline]
|
||||
pub fn double_unwrap_cached_get(&mut self, index: I) -> T {
|
||||
self.inner.double_unwrap_cached_get(index)
|
||||
}
|
||||
|
||||
pub fn collect_inclusive_range(&self, from: I, to: I) -> Result<Vec<T>> {
|
||||
self.inner.collect_inclusive_range(from, to)
|
||||
}
|
||||
}
|
||||
|
||||
impl<I, T> Clone for LazyVec<I, T>
|
||||
where
|
||||
I: StoredIndex,
|
||||
T: StoredType,
|
||||
{
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
inner: self.inner.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
7
crates/brk_computer/src/storage/vecs/vec/mod.rs
Normal file
7
crates/brk_computer/src/storage/vecs/vec/mod.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
mod _type;
|
||||
mod eager;
|
||||
// mod lazy;
|
||||
|
||||
pub use _type::*;
|
||||
pub use eager::*;
|
||||
// pub use lazy::*;
|
||||
Reference in New Issue
Block a user