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:
@@ -6,7 +6,7 @@ use super::Vecs;
|
||||
use crate::{indexes, ComputeIndexes};
|
||||
|
||||
impl Vecs {
|
||||
pub fn compute(
|
||||
pub(crate) fn compute(
|
||||
&mut self,
|
||||
indexer: &Indexer,
|
||||
indexes: &indexes::Vecs,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
use brk_error::Result;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_types::{TxIndex, VSize, Version, Weight};
|
||||
use vecdb::{Database, IterableCloneableVec, LazyVecFrom2, VecIndex};
|
||||
use vecdb::{Database, ReadableCloneableVec, LazyVecFrom2};
|
||||
|
||||
use super::Vecs;
|
||||
use crate::{indexes, internal::LazyFromTxDistribution};
|
||||
|
||||
impl Vecs {
|
||||
pub fn forced_import(
|
||||
pub(crate) fn forced_import(
|
||||
db: &Database,
|
||||
version: Version,
|
||||
indexer: &Indexer,
|
||||
@@ -16,28 +16,20 @@ impl Vecs {
|
||||
let txindex_to_weight = LazyVecFrom2::init(
|
||||
"tx_weight",
|
||||
version,
|
||||
indexer.vecs.transactions.base_size.boxed_clone(),
|
||||
indexer.vecs.transactions.total_size.boxed_clone(),
|
||||
|index: TxIndex, base_size_iter, total_size_iter| {
|
||||
let index = index.to_usize();
|
||||
base_size_iter.get_at(index).map(|base_size| {
|
||||
let total_size = total_size_iter.get_at_unwrap(index);
|
||||
Weight::from_sizes(*base_size, *total_size)
|
||||
})
|
||||
indexer.vecs.transactions.base_size.read_only_boxed_clone(),
|
||||
indexer.vecs.transactions.total_size.read_only_boxed_clone(),
|
||||
|_index: TxIndex, base_size, total_size| {
|
||||
Weight::from_sizes(*base_size, *total_size)
|
||||
},
|
||||
);
|
||||
|
||||
let txindex_to_vsize = LazyVecFrom2::init(
|
||||
"tx_vsize",
|
||||
version,
|
||||
indexer.vecs.transactions.base_size.boxed_clone(),
|
||||
indexer.vecs.transactions.total_size.boxed_clone(),
|
||||
|index: TxIndex, base_size_iter, total_size_iter| {
|
||||
let index = index.to_usize();
|
||||
base_size_iter.get_at(index).map(|base_size| {
|
||||
let total_size = total_size_iter.get_at_unwrap(index);
|
||||
VSize::from(Weight::from_sizes(*base_size, *total_size))
|
||||
})
|
||||
indexer.vecs.transactions.base_size.read_only_boxed_clone(),
|
||||
indexer.vecs.transactions.total_size.read_only_boxed_clone(),
|
||||
|_index: TxIndex, base_size, total_size| {
|
||||
VSize::from(Weight::from_sizes(*base_size, *total_size))
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
use brk_traversable::Traversable;
|
||||
use brk_types::{StoredU32, VSize, Weight};
|
||||
use vecdb::{Rw, StorageMode};
|
||||
|
||||
use crate::internal::LazyFromTxDistribution;
|
||||
|
||||
#[derive(Clone, Traversable)]
|
||||
pub struct Vecs {
|
||||
pub vsize: LazyFromTxDistribution<VSize, StoredU32, StoredU32>,
|
||||
pub weight: LazyFromTxDistribution<Weight, StoredU32, StoredU32>,
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub vsize: LazyFromTxDistribution<VSize, StoredU32, StoredU32, M>,
|
||||
pub weight: LazyFromTxDistribution<Weight, StoredU32, StoredU32, M>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user