mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-29 00:59:58 -07:00
global: MASSIVE snapshot
This commit is contained in:
@@ -13,20 +13,20 @@ impl Vecs {
|
||||
starting_indexes: &ComputeIndexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.indexes_to_tx_weight.compute_rest(
|
||||
self.indexes_to_tx_weight.derive_from(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
&self.txindex_to_weight,
|
||||
exit,
|
||||
Some(&self.txindex_to_weight),
|
||||
)?;
|
||||
|
||||
self.indexes_to_tx_vsize.compute_rest(
|
||||
self.indexes_to_tx_vsize.derive_from(
|
||||
indexer,
|
||||
indexes,
|
||||
starting_indexes,
|
||||
&self.txindex_to_vsize,
|
||||
exit,
|
||||
Some(&self.txindex_to_vsize),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -4,10 +4,7 @@ use brk_types::{TxIndex, VSize, Version, Weight};
|
||||
use vecdb::{Database, IterableCloneableVec, LazyVecFrom2, VecIndex};
|
||||
|
||||
use super::Vecs;
|
||||
use crate::{
|
||||
indexes,
|
||||
internal::{ComputedVecsFromTxindex, Source, VecBuilderOptions},
|
||||
};
|
||||
use crate::{indexes, internal::ComputedTxDistribution};
|
||||
|
||||
impl Vecs {
|
||||
pub fn forced_import(
|
||||
@@ -16,13 +13,6 @@ impl Vecs {
|
||||
indexer: &Indexer,
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
let stats = || {
|
||||
VecBuilderOptions::default()
|
||||
.add_average()
|
||||
.add_minmax()
|
||||
.add_percentiles()
|
||||
};
|
||||
|
||||
let txindex_to_weight = LazyVecFrom2::init(
|
||||
"weight",
|
||||
version,
|
||||
@@ -52,23 +42,15 @@ impl Vecs {
|
||||
},
|
||||
);
|
||||
|
||||
let indexes_to_tx_vsize =
|
||||
ComputedTxDistribution::forced_import(db, "tx_vsize", version, indexes)?;
|
||||
|
||||
let indexes_to_tx_weight =
|
||||
ComputedTxDistribution::forced_import(db, "tx_weight", version, indexes)?;
|
||||
|
||||
Ok(Self {
|
||||
indexes_to_tx_vsize: ComputedVecsFromTxindex::forced_import(
|
||||
db,
|
||||
"tx_vsize",
|
||||
Source::Vec(txindex_to_vsize.boxed_clone()),
|
||||
version,
|
||||
indexes,
|
||||
stats(),
|
||||
)?,
|
||||
indexes_to_tx_weight: ComputedVecsFromTxindex::forced_import(
|
||||
db,
|
||||
"tx_weight",
|
||||
Source::Vec(txindex_to_weight.boxed_clone()),
|
||||
version,
|
||||
indexes,
|
||||
stats(),
|
||||
)?,
|
||||
indexes_to_tx_vsize,
|
||||
indexes_to_tx_weight,
|
||||
txindex_to_vsize,
|
||||
txindex_to_weight,
|
||||
})
|
||||
|
||||
@@ -2,12 +2,12 @@ use brk_traversable::Traversable;
|
||||
use brk_types::{StoredU32, TxIndex, VSize, Weight};
|
||||
use vecdb::LazyVecFrom2;
|
||||
|
||||
use crate::internal::ComputedVecsFromTxindex;
|
||||
use crate::internal::ComputedTxDistribution;
|
||||
|
||||
#[derive(Clone, Traversable)]
|
||||
pub struct Vecs {
|
||||
pub indexes_to_tx_vsize: ComputedVecsFromTxindex<VSize>,
|
||||
pub indexes_to_tx_weight: ComputedVecsFromTxindex<Weight>,
|
||||
pub indexes_to_tx_vsize: ComputedTxDistribution<VSize>,
|
||||
pub indexes_to_tx_weight: ComputedTxDistribution<Weight>,
|
||||
// Both derive directly from eager sources (base_size, total_size) to avoid Lazy <- Lazy
|
||||
pub txindex_to_vsize: LazyVecFrom2<TxIndex, VSize, TxIndex, StoredU32, TxIndex, StoredU32>,
|
||||
pub txindex_to_weight: LazyVecFrom2<TxIndex, Weight, TxIndex, StoredU32, TxIndex, StoredU32>,
|
||||
|
||||
Reference in New Issue
Block a user