global: fixes

This commit is contained in:
nym21
2026-04-27 12:52:02 +02:00
parent b24bfdc15c
commit 76869ed2b6
114 changed files with 6623 additions and 1981 deletions
@@ -81,4 +81,3 @@ pub(crate) fn walk_blocks(
Ok(())
}
@@ -6,7 +6,7 @@ use vecdb::{Database, Exit, Rw, StorageMode};
use crate::{
indexes,
internal::{
FiatType, FiatBlock, FiatPerBlock, LazyRollingSumsFiatFromHeight, WindowStartVec, Windows,
FiatBlock, FiatPerBlock, FiatType, LazyRollingSumsFiatFromHeight, WindowStartVec, Windows,
},
};
@@ -9,7 +9,7 @@ use crate::{
internal::{BpsType, LazyRollingDeltasFiatFromHeight, WindowStartVec, Windows},
};
use super::{FiatType, FiatPerBlockCumulativeWithSums};
use super::{FiatPerBlockCumulativeWithSums, FiatType};
#[derive(Deref, DerefMut, Traversable)]
pub struct FiatPerBlockCumulativeWithSumsAndDeltas<C, CS, B, M: StorageMode = Rw>
@@ -6,7 +6,7 @@ use vecdb::{DeltaSub, LazyDeltaVec, LazyVecFrom1, ReadOnlyClone, ReadableCloneab
use crate::{
indexes,
internal::{
FiatType, DerivedResolutions, LazyPerBlock, LazyRollingSumFromHeight, Resolutions,
DerivedResolutions, FiatType, LazyPerBlock, LazyRollingSumFromHeight, Resolutions,
WindowStartVec, Windows,
},
};
@@ -19,9 +19,7 @@ pub struct LazyRollingSumFiatFromHeight<C: FiatType> {
#[derive(Clone, Deref, DerefMut, Traversable)]
#[traversable(transparent)]
pub struct LazyRollingSumsFiatFromHeight<C: FiatType>(
pub Windows<LazyRollingSumFiatFromHeight<C>>,
);
pub struct LazyRollingSumsFiatFromHeight<C: FiatType>(pub Windows<LazyRollingSumFiatFromHeight<C>>);
impl<C: FiatType> LazyRollingSumsFiatFromHeight<C> {
pub fn new(
@@ -10,7 +10,7 @@ use crate::{
internal::{BpsType, LazyRollingDeltasFiatFromHeight, WindowStartVec, Windows},
};
use super::{FiatType, FiatPerBlock};
use super::{FiatPerBlock, FiatType};
#[derive(Deref, DerefMut, Traversable)]
pub struct FiatPerBlockWithDeltas<C, CS, B, M: StorageMode = Rw>
@@ -44,7 +44,9 @@ where
Self {
height: LazyVecFrom1::transformed::<F>(name, version, height_source),
resolutions: Box::new(DerivedResolutions::from_derived_computed::<F>(
name, version, resolutions,
name,
version,
resolutions,
)),
}
}
@@ -10,7 +10,9 @@ use vecdb::{BinaryTransform, Database, Exit, ReadableVec, Rw, StorageMode, VecVa
use crate::{
indexes,
internal::{BpsType, PerBlockCumulativeRolling, PercentPerBlock, PercentRollingWindows, RatioU64Bp16},
internal::{
BpsType, PerBlockCumulativeRolling, PercentPerBlock, PercentRollingWindows, RatioU64Bp16,
},
};
#[derive(Traversable)]
@@ -27,8 +27,7 @@ impl<B: BpsType> LazyPercentCumulativeRolling<B> {
version: Version,
source: &PercentCumulativeRolling<B>,
) -> Self {
let cumulative =
LazyPercentPerBlock::from_percent::<F>(name, version, &source.cumulative);
let cumulative = LazyPercentPerBlock::from_percent::<F>(name, version, &source.cumulative);
let rolling = LazyPercentRollingWindows::from_rolling::<F>(name, version, &source.rolling);
Self {
cumulative,
@@ -46,12 +46,7 @@ where
starts_version,
move || cached.cached(),
);
let resolutions = Resolutions::forced_import(
&full_name,
avg.clone(),
version,
indexes,
);
let resolutions = Resolutions::forced_import(&full_name, avg.clone(), version, indexes);
LazyRollingAvgFromHeight {
height: avg,
resolutions: Box::new(resolutions),
@@ -369,12 +369,8 @@ where
move || cached.cached()
},
);
let change_resolutions = Resolutions::forced_import(
&cents_name,
change_vec.clone(),
version,
indexes,
);
let change_resolutions =
Resolutions::forced_import(&cents_name, change_vec.clone(), version, indexes);
let cents = LazyDeltaFromHeight {
height: change_vec,
resolutions: Box::new(change_resolutions),
@@ -7,7 +7,7 @@ use vecdb::{Database, EagerVec, Exit, PcoVec, Rw, StorageMode};
use crate::{
indexes,
internal::{
ValuePerBlockCumulative, LazyRollingAvgsAmountFromHeight, LazyRollingSumsAmountFromHeight,
LazyRollingAvgsAmountFromHeight, LazyRollingSumsAmountFromHeight, ValuePerBlockCumulative,
WindowStartVec, Windows,
},
prices,
@@ -7,7 +7,7 @@ use vecdb::{Database, EagerVec, Exit, PcoVec, Rw, StorageMode};
use crate::{
indexes,
internal::{
ValuePerBlockCumulativeRolling, RollingDistributionValuePerBlock, WindowStartVec,
RollingDistributionValuePerBlock, ValuePerBlockCumulativeRolling, WindowStartVec,
WindowStarts, Windows,
},
prices,
@@ -6,7 +6,7 @@ use derive_more::{Deref, DerefMut};
use vecdb::UnaryTransform;
use crate::internal::{
ValuePerBlock, Identity, LazyValue, LazyValueDerivedResolutions, SatsToBitcoin,
Identity, LazyValue, LazyValueDerivedResolutions, SatsToBitcoin, ValuePerBlock,
};
/// Lazy value wrapper with height + all derived last transforms from ValuePerBlock.
@@ -2,7 +2,7 @@ use brk_traversable::Traversable;
use brk_types::{Bitcoin, Cents, Dollars, Sats, Version};
use vecdb::UnaryTransform;
use crate::internal::{ValuePerBlock, DerivedResolutions};
use crate::internal::{DerivedResolutions, ValuePerBlock};
#[derive(Clone, Traversable)]
pub struct LazyValueDerivedResolutions {
@@ -7,7 +7,7 @@ use vecdb::{Database, Exit, ReadableVec, Rw, StorageMode};
use crate::{
indexes,
internal::{
ValuePerBlock, DistributionStats, WindowStarts, Windows,
DistributionStats, ValuePerBlock, WindowStarts, Windows,
algo::compute_rolling_distribution_from_starts,
},
};
@@ -8,7 +8,9 @@ use brk_indexer::Indexer;
use brk_traversable::Traversable;
use brk_types::{Indexes, TxIndex, VSize};
use schemars::JsonSchema;
use vecdb::{Database, EagerVec, Exit, ImportableVec, PcoVec, ReadableVec, Rw, StorageMode, Version};
use vecdb::{
Database, EagerVec, Exit, ImportableVec, PcoVec, ReadableVec, Rw, StorageMode, Version,
};
use crate::{
indexes,
@@ -13,7 +13,7 @@ use vecdb::{AnyStoredVec, AnyVec, Database, EagerVec, Exit, PcoVec, WritableVec}
use crate::{indexes, prices};
use super::{
ValuePerBlock, BpsType, NumericValue, PerBlock, PerBlockCumulativeRolling, PercentPerBlock,
BpsType, NumericValue, PerBlock, PerBlockCumulativeRolling, PercentPerBlock, ValuePerBlock,
WindowStartVec, Windows,
};
@@ -83,11 +83,7 @@ where
}
/// Compute `all.height` as the per-block sum of the per-type vecs.
pub(crate) fn compute_rest(
&mut self,
starting_indexes: &Indexes,
exit: &Exit,
) -> Result<()> {
pub(crate) fn compute_rest(&mut self, starting_indexes: &Indexes, exit: &Exit) -> Result<()> {
let sources: Vec<&EagerVec<PcoVec<Height, T>>> =
self.by_addr_type.values().map(|v| &v.height).collect();
self.all
@@ -109,13 +105,8 @@ where
indexes: &indexes::Vecs,
cached_starts: &Windows<&WindowStartVec>,
) -> Result<Self> {
let all = PerBlockCumulativeRolling::forced_import(
db,
name,
version,
indexes,
cached_starts,
)?;
let all =
PerBlockCumulativeRolling::forced_import(db, name, version, indexes, cached_starts)?;
let by_addr_type = ByAddrType::new_with_name(|type_name| {
PerBlockCumulativeRolling::forced_import(
db,