global: snapshot

This commit is contained in:
nym21
2026-03-13 16:27:10 +01:00
parent b2a1251774
commit 3709ceff8e
168 changed files with 2007 additions and 2008 deletions

View File

@@ -1,11 +1,13 @@
use brk_error::Result;
use brk_types::Version;
use vecdb::Database;
use vecdb::{Database, ReadableCloneableVec};
use super::Vecs;
use crate::{
indexes,
internal::{CachedWindowStarts, ComputedPerBlock, ComputedPerBlockCumulativeWithSums},
internal::{
CachedWindowStarts, LazyPerBlock, OneMinusF64, PerBlock, PerBlockCumulativeWithSums,
},
};
impl Vecs {
@@ -15,29 +17,25 @@ impl Vecs {
indexes: &indexes::Vecs,
cached_starts: &CachedWindowStarts,
) -> Result<Self> {
let liveliness = PerBlock::forced_import(db, "liveliness", version, indexes)?;
let vaultedness = LazyPerBlock::from_computed::<OneMinusF64>(
"vaultedness",
version,
liveliness.height.read_only_boxed_clone(),
&liveliness,
);
Ok(Self {
coinblocks_created: ComputedPerBlockCumulativeWithSums::forced_import(
db,
"coinblocks_created",
version,
indexes,
cached_starts,
coinblocks_created: PerBlockCumulativeWithSums::forced_import(
db, "coinblocks_created", version, indexes, cached_starts,
)?,
coinblocks_stored: ComputedPerBlockCumulativeWithSums::forced_import(
db,
"coinblocks_stored",
version,
indexes,
cached_starts,
)?,
liveliness: ComputedPerBlock::forced_import(db, "liveliness", version, indexes)?,
vaultedness: ComputedPerBlock::forced_import(db, "vaultedness", version, indexes)?,
ratio: ComputedPerBlock::forced_import(
db,
"activity_to_vaultedness_ratio",
version,
indexes,
coinblocks_stored: PerBlockCumulativeWithSums::forced_import(
db, "coinblocks_stored", version, indexes, cached_starts,
)?,
liveliness,
vaultedness,
ratio: PerBlock::forced_import(db, "activity_to_vaultedness_ratio", version, indexes)?,
})
}
}