computer: indexes + rolling

This commit is contained in:
nym21
2026-02-24 17:07:35 +01:00
parent cefc8cfd42
commit f74115c6e2
160 changed files with 2604 additions and 4739 deletions
@@ -6,7 +6,7 @@ use vecdb::{Database, ReadableCloneableVec};
use super::Vecs;
use crate::{
indexes,
internal::{ComputedFromHeightLast, ComputedFromHeightSum, ComputedHeightDerivedLast},
internal::{ComputedFromHeightLast, ComputedHeightDerivedLast},
};
impl Vecs {
@@ -26,7 +26,7 @@ impl Vecs {
indexes,
),
as_hash: ComputedFromHeightLast::forced_import(db, "difficulty_as_hash", version, indexes)?,
adjustment: ComputedFromHeightSum::forced_import(db, "difficulty_adjustment", version, indexes)?,
adjustment: ComputedFromHeightLast::forced_import(db, "difficulty_adjustment", version, indexes)?,
epoch: ComputedFromHeightLast::forced_import(db, "difficulty_epoch", version, indexes)?,
blocks_before_next_adjustment: ComputedFromHeightLast::forced_import(
db,
@@ -2,7 +2,7 @@ use brk_traversable::Traversable;
use brk_types::{DifficultyEpoch, StoredF32, StoredF64, StoredU32};
use vecdb::{Rw, StorageMode};
use crate::internal::{ComputedFromHeightLast, ComputedFromHeightSum, ComputedHeightDerivedLast};
use crate::internal::{ComputedFromHeightLast, ComputedHeightDerivedLast};
/// Difficulty metrics: raw difficulty, derived stats, adjustment, and countdown
#[derive(Traversable)]
@@ -10,7 +10,7 @@ pub struct Vecs<M: StorageMode = Rw> {
/// Raw difficulty with day1/period stats - merges with indexer's raw
pub raw: ComputedHeightDerivedLast<StoredF64>,
pub as_hash: ComputedFromHeightLast<StoredF32, M>,
pub adjustment: ComputedFromHeightSum<StoredF32, M>,
pub adjustment: ComputedFromHeightLast<StoredF32, M>,
pub epoch: ComputedFromHeightLast<DifficultyEpoch, M>,
pub blocks_before_next_adjustment: ComputedFromHeightLast<StoredU32, M>,
pub days_before_next_adjustment: ComputedFromHeightLast<StoredF32, M>,