brk_computer 0.11.0

A Bitcoin dataset computer built on top of brk_indexer
Documentation
use brk_cohort::AgeRange;
use brk_traversable::Traversable;
use brk_types::StoredF64;
use derive_more::{Deref, DerefMut};
use vecdb::{Rw, StorageMode};

use crate::internal::{LazyPerBlock, PerBlock, PerBlockCumulativeRolling, SpotValuePerBlock};

#[derive(Traversable)]
pub struct ActivityVecs<M: StorageMode = Rw> {
    pub wakefulness: PerBlock<StoredF64, M>,
    pub dormancy: LazyPerBlock<StoredF64>,
    pub wakefulness_to_dormancy: LazyPerBlock<StoredF64>,
}

#[derive(Traversable)]
pub struct SupplyVecs<M: StorageMode = Rw> {
    pub awake: SpotValuePerBlock<M>,
    pub dormant: SpotValuePerBlock<M>,
}

#[derive(Deref, DerefMut, Traversable)]
pub struct CohortVecs<M: StorageMode = Rw> {
    pub coindays_created: PerBlockCumulativeRolling<StoredF64, M>,
    pub coindays_consumed: PerBlockCumulativeRolling<StoredF64, M>,
    pub coindays_stored: PerBlockCumulativeRolling<StoredF64, M>,
    #[deref]
    #[deref_mut]
    #[traversable(flatten)]
    pub activity: ActivityVecs<M>,
    pub supply: SupplyVecs<M>,
}

#[derive(Deref, DerefMut, Traversable)]
#[traversable(transparent)]
pub struct Vecs<M: StorageMode = Rw>(pub AgeRange<CohortVecs<M>>);