computer: snapshot

This commit is contained in:
nym21
2026-03-09 14:27:35 +01:00
parent e4bd11317a
commit cba3b7dc38
178 changed files with 1089 additions and 1089 deletions

View File

@@ -5,7 +5,7 @@ use vecdb::Database;
use super::Vecs;
use crate::{
indexes,
internal::{ComputedFromHeight, PercentFromHeight},
internal::{ComputedPerBlock, PercentPerBlock},
};
impl Vecs {
@@ -18,98 +18,98 @@ impl Vecs {
let v5 = Version::new(5);
Ok(Self {
hash_rate: ComputedFromHeight::forced_import(db, "hash_rate", version + v5, indexes)?,
hash_rate_sma_1w: ComputedFromHeight::forced_import(
hash_rate: ComputedPerBlock::forced_import(db, "hash_rate", version + v5, indexes)?,
hash_rate_sma_1w: ComputedPerBlock::forced_import(
db,
"hash_rate_sma_1w",
version,
indexes,
)?,
hash_rate_sma_1m: ComputedFromHeight::forced_import(
hash_rate_sma_1m: ComputedPerBlock::forced_import(
db,
"hash_rate_sma_1m",
version,
indexes,
)?,
hash_rate_sma_2m: ComputedFromHeight::forced_import(
hash_rate_sma_2m: ComputedPerBlock::forced_import(
db,
"hash_rate_sma_2m",
version,
indexes,
)?,
hash_rate_sma_1y: ComputedFromHeight::forced_import(
hash_rate_sma_1y: ComputedPerBlock::forced_import(
db,
"hash_rate_sma_1y",
version,
indexes,
)?,
hash_rate_ath: ComputedFromHeight::forced_import(
hash_rate_ath: ComputedPerBlock::forced_import(
db,
"hash_rate_ath",
version,
indexes,
)?,
hash_rate_drawdown: PercentFromHeight::forced_import(
hash_rate_drawdown: PercentPerBlock::forced_import(
db,
"hash_rate_drawdown",
version,
indexes,
)?,
hash_price_ths: ComputedFromHeight::forced_import(
hash_price_ths: ComputedPerBlock::forced_import(
db,
"hash_price_ths",
version + v4,
indexes,
)?,
hash_price_ths_min: ComputedFromHeight::forced_import(
hash_price_ths_min: ComputedPerBlock::forced_import(
db,
"hash_price_ths_min",
version + v4,
indexes,
)?,
hash_price_phs: ComputedFromHeight::forced_import(
hash_price_phs: ComputedPerBlock::forced_import(
db,
"hash_price_phs",
version + v4,
indexes,
)?,
hash_price_phs_min: ComputedFromHeight::forced_import(
hash_price_phs_min: ComputedPerBlock::forced_import(
db,
"hash_price_phs_min",
version + v4,
indexes,
)?,
hash_price_rebound: PercentFromHeight::forced_import(
hash_price_rebound: PercentPerBlock::forced_import(
db,
"hash_price_rebound",
version + v4,
indexes,
)?,
hash_value_ths: ComputedFromHeight::forced_import(
hash_value_ths: ComputedPerBlock::forced_import(
db,
"hash_value_ths",
version + v4,
indexes,
)?,
hash_value_ths_min: ComputedFromHeight::forced_import(
hash_value_ths_min: ComputedPerBlock::forced_import(
db,
"hash_value_ths_min",
version + v4,
indexes,
)?,
hash_value_phs: ComputedFromHeight::forced_import(
hash_value_phs: ComputedPerBlock::forced_import(
db,
"hash_value_phs",
version + v4,
indexes,
)?,
hash_value_phs_min: ComputedFromHeight::forced_import(
hash_value_phs_min: ComputedPerBlock::forced_import(
db,
"hash_value_phs_min",
version + v4,
indexes,
)?,
hash_value_rebound: PercentFromHeight::forced_import(
hash_value_rebound: PercentPerBlock::forced_import(
db,
"hash_value_rebound",
version + v4,

View File

@@ -2,25 +2,25 @@ use brk_traversable::Traversable;
use brk_types::{BasisPointsSigned16, BasisPointsSigned32, StoredF32, StoredF64};
use vecdb::{Rw, StorageMode};
use crate::internal::{ComputedFromHeight, PercentFromHeight};
use crate::internal::{ComputedPerBlock, PercentPerBlock};
#[derive(Traversable)]
pub struct Vecs<M: StorageMode = Rw> {
pub hash_rate: ComputedFromHeight<StoredF64, M>,
pub hash_rate_sma_1w: ComputedFromHeight<StoredF64, M>,
pub hash_rate_sma_1m: ComputedFromHeight<StoredF64, M>,
pub hash_rate_sma_2m: ComputedFromHeight<StoredF64, M>,
pub hash_rate_sma_1y: ComputedFromHeight<StoredF64, M>,
pub hash_rate_ath: ComputedFromHeight<StoredF64, M>,
pub hash_rate_drawdown: PercentFromHeight<BasisPointsSigned16, M>,
pub hash_price_ths: ComputedFromHeight<StoredF32, M>,
pub hash_price_ths_min: ComputedFromHeight<StoredF32, M>,
pub hash_price_phs: ComputedFromHeight<StoredF32, M>,
pub hash_price_phs_min: ComputedFromHeight<StoredF32, M>,
pub hash_price_rebound: PercentFromHeight<BasisPointsSigned32, M>,
pub hash_value_ths: ComputedFromHeight<StoredF32, M>,
pub hash_value_ths_min: ComputedFromHeight<StoredF32, M>,
pub hash_value_phs: ComputedFromHeight<StoredF32, M>,
pub hash_value_phs_min: ComputedFromHeight<StoredF32, M>,
pub hash_value_rebound: PercentFromHeight<BasisPointsSigned32, M>,
pub hash_rate: ComputedPerBlock<StoredF64, M>,
pub hash_rate_sma_1w: ComputedPerBlock<StoredF64, M>,
pub hash_rate_sma_1m: ComputedPerBlock<StoredF64, M>,
pub hash_rate_sma_2m: ComputedPerBlock<StoredF64, M>,
pub hash_rate_sma_1y: ComputedPerBlock<StoredF64, M>,
pub hash_rate_ath: ComputedPerBlock<StoredF64, M>,
pub hash_rate_drawdown: PercentPerBlock<BasisPointsSigned16, M>,
pub hash_price_ths: ComputedPerBlock<StoredF32, M>,
pub hash_price_ths_min: ComputedPerBlock<StoredF32, M>,
pub hash_price_phs: ComputedPerBlock<StoredF32, M>,
pub hash_price_phs_min: ComputedPerBlock<StoredF32, M>,
pub hash_price_rebound: PercentPerBlock<BasisPointsSigned32, M>,
pub hash_value_ths: ComputedPerBlock<StoredF32, M>,
pub hash_value_ths_min: ComputedPerBlock<StoredF32, M>,
pub hash_value_phs: ComputedPerBlock<StoredF32, M>,
pub hash_value_phs_min: ComputedPerBlock<StoredF32, M>,
pub hash_value_rebound: PercentPerBlock<BasisPointsSigned32, M>,
}

View File

@@ -6,8 +6,8 @@ use super::Vecs;
use crate::{
indexes,
internal::{
AmountFromHeightCumulative, AmountFromHeightCumulativeSum, AmountFromHeightFull,
FiatFromHeight, PercentFromHeight, PercentRollingWindows,
AmountPerBlockCumulative, AmountPerBlockCumulativeSum, AmountPerBlockFull,
FiatPerBlock, PercentPerBlock, PercentRollingWindows,
},
};
@@ -18,25 +18,25 @@ impl Vecs {
indexes: &indexes::Vecs,
) -> Result<Self> {
Ok(Self {
coinbase: AmountFromHeightCumulativeSum::forced_import(
coinbase: AmountPerBlockCumulativeSum::forced_import(
db, "coinbase", version, indexes,
)?,
subsidy: AmountFromHeightCumulative::forced_import(db, "subsidy", version, indexes)?,
fees: AmountFromHeightFull::forced_import(db, "fees", version, indexes)?,
unclaimed_rewards: AmountFromHeightCumulativeSum::forced_import(
subsidy: AmountPerBlockCumulative::forced_import(db, "subsidy", version, indexes)?,
fees: AmountPerBlockFull::forced_import(db, "fees", version, indexes)?,
unclaimed_rewards: AmountPerBlockCumulativeSum::forced_import(
db,
"unclaimed_rewards",
version,
indexes,
)?,
fee_dominance: PercentFromHeight::forced_import(db, "fee_dominance", version, indexes)?,
fee_dominance: PercentPerBlock::forced_import(db, "fee_dominance", version, indexes)?,
fee_dominance_rolling: PercentRollingWindows::forced_import(
db,
"fee_dominance",
version,
indexes,
)?,
subsidy_dominance: PercentFromHeight::forced_import(
subsidy_dominance: PercentPerBlock::forced_import(
db,
"subsidy_dominance",
version,
@@ -48,7 +48,7 @@ impl Vecs {
version,
indexes,
)?,
subsidy_sma_1y: FiatFromHeight::forced_import(db, "subsidy_sma_1y", version, indexes)?,
subsidy_sma_1y: FiatPerBlock::forced_import(db, "subsidy_sma_1y", version, indexes)?,
})
}
}

View File

@@ -3,19 +3,19 @@ use brk_types::{BasisPoints16, Cents};
use vecdb::{Rw, StorageMode};
use crate::internal::{
AmountFromHeightCumulative, AmountFromHeightCumulativeSum, AmountFromHeightFull,
FiatFromHeight, PercentFromHeight, PercentRollingWindows,
AmountPerBlockCumulative, AmountPerBlockCumulativeSum, AmountPerBlockFull,
FiatPerBlock, PercentPerBlock, PercentRollingWindows,
};
#[derive(Traversable)]
pub struct Vecs<M: StorageMode = Rw> {
pub coinbase: AmountFromHeightCumulativeSum<M>,
pub subsidy: AmountFromHeightCumulative<M>,
pub fees: AmountFromHeightFull<M>,
pub unclaimed_rewards: AmountFromHeightCumulativeSum<M>,
pub fee_dominance: PercentFromHeight<BasisPoints16, M>,
pub coinbase: AmountPerBlockCumulativeSum<M>,
pub subsidy: AmountPerBlockCumulative<M>,
pub fees: AmountPerBlockFull<M>,
pub unclaimed_rewards: AmountPerBlockCumulativeSum<M>,
pub fee_dominance: PercentPerBlock<BasisPoints16, M>,
pub fee_dominance_rolling: PercentRollingWindows<BasisPoints16, M>,
pub subsidy_dominance: PercentFromHeight<BasisPoints16, M>,
pub subsidy_dominance: PercentPerBlock<BasisPoints16, M>,
pub subsidy_dominance_rolling: PercentRollingWindows<BasisPoints16, M>,
pub subsidy_sma_1y: FiatFromHeight<Cents, M>,
pub subsidy_sma_1y: FiatPerBlock<Cents, M>,
}