mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-29 03:38:10 -07:00
global: snapshot
This commit is contained in:
@@ -5,7 +5,10 @@ use vecdb::Database;
|
||||
use super::Vecs;
|
||||
use crate::{
|
||||
indexes,
|
||||
internal::{BlockCountTarget, CachedWindowStarts, PerBlockCumulativeWithSums, ConstantVecs},
|
||||
internal::{
|
||||
BlockCountTarget24h, BlockCountTarget1w, BlockCountTarget1m, BlockCountTarget1y,
|
||||
CachedWindowStarts, PerBlockCumulativeWithSums, ConstantVecs, Windows,
|
||||
},
|
||||
};
|
||||
|
||||
impl Vecs {
|
||||
@@ -16,11 +19,12 @@ impl Vecs {
|
||||
cached_starts: &CachedWindowStarts,
|
||||
) -> Result<Self> {
|
||||
Ok(Self {
|
||||
target: ConstantVecs::new::<BlockCountTarget>(
|
||||
"block_count_target",
|
||||
version,
|
||||
indexes,
|
||||
),
|
||||
target: Windows {
|
||||
_24h: ConstantVecs::new::<BlockCountTarget24h>("block_count_target_24h", version, indexes),
|
||||
_1w: ConstantVecs::new::<BlockCountTarget1w>("block_count_target_1w", version, indexes),
|
||||
_1m: ConstantVecs::new::<BlockCountTarget1m>("block_count_target_1m", version, indexes),
|
||||
_1y: ConstantVecs::new::<BlockCountTarget1y>("block_count_target_1y", version, indexes),
|
||||
},
|
||||
total: PerBlockCumulativeWithSums::forced_import(
|
||||
db,
|
||||
"block_count",
|
||||
|
||||
@@ -2,10 +2,10 @@ use brk_traversable::Traversable;
|
||||
use brk_types::{StoredU32, StoredU64};
|
||||
use vecdb::{Rw, StorageMode};
|
||||
|
||||
use crate::internal::{PerBlockCumulativeWithSums, ConstantVecs};
|
||||
use crate::internal::{PerBlockCumulativeWithSums, ConstantVecs, Windows};
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub target: ConstantVecs<StoredU64>,
|
||||
pub target: Windows<ConstantVecs<StoredU64>>,
|
||||
pub total: PerBlockCumulativeWithSums<StoredU32, StoredU64, M>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user