mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-09 10:08:13 -07:00
global: BIG snapshot
This commit is contained in:
@@ -14,68 +14,59 @@ use crate::{
|
||||
};
|
||||
|
||||
impl Vecs {
|
||||
pub fn forced_import(
|
||||
db: &Database,
|
||||
version: Version,
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
let v0 = Version::ZERO;
|
||||
pub fn forced_import(db: &Database, version: Version, indexes: &indexes::Vecs) -> Result<Self> {
|
||||
let last = || VecBuilderOptions::default().add_last();
|
||||
let sum_cum = || VecBuilderOptions::default().add_sum().add_cumulative();
|
||||
|
||||
Ok(Self {
|
||||
dateindex_to_block_count_target: LazyVecFrom1::init(
|
||||
"block_count_target",
|
||||
version + v0,
|
||||
version,
|
||||
indexes.time.dateindex_to_dateindex.boxed_clone(),
|
||||
|_, _| Some(StoredU64::from(TARGET_BLOCKS_PER_DAY)),
|
||||
),
|
||||
weekindex_to_block_count_target: LazyVecFrom1::init(
|
||||
"block_count_target",
|
||||
version + v0,
|
||||
version,
|
||||
indexes.time.weekindex_to_weekindex.boxed_clone(),
|
||||
|_, _| Some(StoredU64::from(TARGET_BLOCKS_PER_WEEK)),
|
||||
),
|
||||
monthindex_to_block_count_target: LazyVecFrom1::init(
|
||||
"block_count_target",
|
||||
version + v0,
|
||||
version,
|
||||
indexes.time.monthindex_to_monthindex.boxed_clone(),
|
||||
|_, _| Some(StoredU64::from(TARGET_BLOCKS_PER_MONTH)),
|
||||
),
|
||||
quarterindex_to_block_count_target: LazyVecFrom1::init(
|
||||
"block_count_target",
|
||||
version + v0,
|
||||
version,
|
||||
indexes.time.quarterindex_to_quarterindex.boxed_clone(),
|
||||
|_, _| Some(StoredU64::from(TARGET_BLOCKS_PER_QUARTER)),
|
||||
),
|
||||
semesterindex_to_block_count_target: LazyVecFrom1::init(
|
||||
"block_count_target",
|
||||
version + v0,
|
||||
version,
|
||||
indexes.time.semesterindex_to_semesterindex.boxed_clone(),
|
||||
|_, _| Some(StoredU64::from(TARGET_BLOCKS_PER_SEMESTER)),
|
||||
),
|
||||
yearindex_to_block_count_target: LazyVecFrom1::init(
|
||||
"block_count_target",
|
||||
version + v0,
|
||||
version,
|
||||
indexes.time.yearindex_to_yearindex.boxed_clone(),
|
||||
|_, _| Some(StoredU64::from(TARGET_BLOCKS_PER_YEAR)),
|
||||
),
|
||||
decadeindex_to_block_count_target: LazyVecFrom1::init(
|
||||
"block_count_target",
|
||||
version + v0,
|
||||
version,
|
||||
indexes.time.decadeindex_to_decadeindex.boxed_clone(),
|
||||
|_, _| Some(StoredU64::from(TARGET_BLOCKS_PER_DECADE)),
|
||||
),
|
||||
height_to_24h_block_count: EagerVec::forced_import(
|
||||
db,
|
||||
"24h_block_count",
|
||||
version + v0,
|
||||
)?,
|
||||
height_to_24h_block_count: EagerVec::forced_import(db, "24h_block_count", version)?,
|
||||
indexes_to_block_count: ComputedVecsFromHeight::forced_import(
|
||||
db,
|
||||
"block_count",
|
||||
Source::Compute,
|
||||
version + v0,
|
||||
version,
|
||||
indexes,
|
||||
sum_cum(),
|
||||
)?,
|
||||
@@ -83,7 +74,7 @@ impl Vecs {
|
||||
db,
|
||||
"1w_block_count",
|
||||
Source::Compute,
|
||||
version + v0,
|
||||
version,
|
||||
indexes,
|
||||
last(),
|
||||
)?,
|
||||
@@ -91,7 +82,7 @@ impl Vecs {
|
||||
db,
|
||||
"1m_block_count",
|
||||
Source::Compute,
|
||||
version + v0,
|
||||
version,
|
||||
indexes,
|
||||
last(),
|
||||
)?,
|
||||
@@ -99,7 +90,7 @@ impl Vecs {
|
||||
db,
|
||||
"1y_block_count",
|
||||
Source::Compute,
|
||||
version + v0,
|
||||
version,
|
||||
indexes,
|
||||
last(),
|
||||
)?,
|
||||
|
||||
Reference in New Issue
Block a user