diff --git a/crates/brk_computer/src/blocks/size/import.rs b/crates/brk_computer/src/blocks/size/import.rs index 6b6d53e7f..b86c6b120 100644 --- a/crates/brk_computer/src/blocks/size/import.rs +++ b/crates/brk_computer/src/blocks/size/import.rs @@ -4,7 +4,7 @@ use brk_types::{Height, StoredU64, Version}; use vecdb::{Database, IterableCloneableVec, VecIndex}; use super::Vecs; -use crate::{indexes, internal::{ComputedDerivedBlockFull, LazyComputedBlockFull}}; +use crate::{indexes, internal::{ComputedDerivedBlockFull, BlockFullLazyHeight}}; impl Vecs { pub fn forced_import( @@ -14,7 +14,7 @@ impl Vecs { indexes: &indexes::Vecs, ) -> Result { Ok(Self { - vbytes: LazyComputedBlockFull::forced_import_with_init( + vbytes: BlockFullLazyHeight::forced_import_with_init( db, "block_vbytes", version, diff --git a/crates/brk_computer/src/blocks/size/vecs.rs b/crates/brk_computer/src/blocks/size/vecs.rs index c4fe97256..95d6d39a4 100644 --- a/crates/brk_computer/src/blocks/size/vecs.rs +++ b/crates/brk_computer/src/blocks/size/vecs.rs @@ -1,10 +1,10 @@ use brk_traversable::Traversable; use brk_types::{StoredU64, Weight}; -use crate::internal::{ComputedDerivedBlockFull, LazyComputedBlockFull}; +use crate::internal::{ComputedDerivedBlockFull, BlockFullLazyHeight}; #[derive(Clone, Traversable)] pub struct Vecs { - pub vbytes: LazyComputedBlockFull, + pub vbytes: BlockFullLazyHeight, pub size: ComputedDerivedBlockFull, } diff --git a/crates/brk_computer/src/internal/computed/block/lazy_sum_cum.rs b/crates/brk_computer/src/internal/computed/block/lazy_height_sum_cum.rs similarity index 88% rename from crates/brk_computer/src/internal/computed/block/lazy_sum_cum.rs rename to crates/brk_computer/src/internal/computed/block/lazy_height_sum_cum.rs index b77c01e84..65cf85208 100644 --- a/crates/brk_computer/src/internal/computed/block/lazy_sum_cum.rs +++ b/crates/brk_computer/src/internal/computed/block/lazy_height_sum_cum.rs @@ -1,4 +1,4 @@ -//! Lazy binary height + stored derived SumCum. +//! BlockSumCumLazyHeight - block sum+cumulative with lazy height transform. //! //! Use this when you need: //! - Lazy height (binary transform from two sources) @@ -16,14 +16,14 @@ use crate::{indexes, ComputeIndexes}; use crate::internal::{ComputedVecValue, ComputedDerivedBlockSumCum, NumericValue}; -/// Lazy binary height + stored derived block SumCum. +/// Block sum+cumulative with lazy binary height transform + computed derived indexes. /// /// Height is a lazy binary transform (e.g., mask × source, or price × sats). /// Cumulative and dateindex are stored (computed from lazy height). /// Coarser periods are lazy lookups. #[derive(Clone, Deref, DerefMut, Traversable)] #[traversable(merge)] -pub struct LazyComputedBlockSumCum +pub struct BlockSumCumLazyHeight where T: ComputedVecValue + PartialOrd + JsonSchema, S1T: ComputedVecValue, @@ -38,7 +38,7 @@ where const VERSION: Version = Version::ZERO; -impl LazyComputedBlockSumCum +impl BlockSumCumLazyHeight where T: NumericValue + JsonSchema, S1T: ComputedVecValue + JsonSchema, diff --git a/crates/brk_computer/src/internal/computed/block/mod.rs b/crates/brk_computer/src/internal/computed/block/mod.rs index 236bcad43..d3508550f 100644 --- a/crates/brk_computer/src/internal/computed/block/mod.rs +++ b/crates/brk_computer/src/internal/computed/block/mod.rs @@ -9,7 +9,7 @@ mod height_date_last; mod height_date_max; mod height_date_min; mod last; -mod lazy_sum_cum; +mod lazy_height_sum_cum; mod sum; mod sum_cum; @@ -20,6 +20,6 @@ pub use height_date_last::*; pub use height_date_max::*; pub use height_date_min::*; pub use last::*; -pub use lazy_sum_cum::*; +pub use lazy_height_sum_cum::*; pub use sum::*; pub use sum_cum::*; diff --git a/crates/brk_computer/src/internal/lazy/block/computed_full.rs b/crates/brk_computer/src/internal/lazy/block/lazy_height_full.rs similarity index 90% rename from crates/brk_computer/src/internal/lazy/block/computed_full.rs rename to crates/brk_computer/src/internal/lazy/block/lazy_height_full.rs index 4e7e57fa4..89897367b 100644 --- a/crates/brk_computer/src/internal/lazy/block/computed_full.rs +++ b/crates/brk_computer/src/internal/lazy/block/lazy_height_full.rs @@ -1,4 +1,4 @@ -//! LazyComputedBlockFull - lazy height + ComputedDerivedBlockFull. +//! BlockFullLazyHeight - block full with lazy height transform. use brk_error::Result; use brk_traversable::Traversable; @@ -14,10 +14,10 @@ use crate::{ const VERSION: Version = Version::ZERO; -/// Lazy height transform + stored/computed derived indexes. +/// Block full aggregation with lazy height transform + computed derived indexes. #[derive(Clone, Deref, DerefMut, Traversable)] #[traversable(merge)] -pub struct LazyComputedBlockFull +pub struct BlockFullLazyHeight where T: ComputedVecValue + PartialOrd + JsonSchema, S: ComputedVecValue, @@ -29,7 +29,7 @@ where pub rest: ComputedDerivedBlockFull, } -impl LazyComputedBlockFull +impl BlockFullLazyHeight where T: NumericValue + JsonSchema, S: ComputedVecValue + JsonSchema, diff --git a/crates/brk_computer/src/internal/lazy/block/mod.rs b/crates/brk_computer/src/internal/lazy/block/mod.rs index a71d694c3..1bb57e7ad 100644 --- a/crates/brk_computer/src/internal/lazy/block/mod.rs +++ b/crates/brk_computer/src/internal/lazy/block/mod.rs @@ -2,10 +2,10 @@ mod binary_full; mod binary_last; mod binary_sum; mod binary_sum_cum; -mod computed_full; mod distribution; mod full; mod last; +mod lazy_height_full; mod sum; mod sum_cum; @@ -13,9 +13,9 @@ pub use binary_full::*; pub use binary_last::*; pub use binary_sum::*; pub use binary_sum_cum::*; -pub use computed_full::*; pub use distribution::*; pub use full::*; pub use last::*; +pub use lazy_height_full::*; pub use sum::*; pub use sum_cum::*; diff --git a/crates/brk_computer/src/internal/specialized/value/block/lazy_computed_sum_cum.rs b/crates/brk_computer/src/internal/specialized/value/block/lazy_computed_sum_cum.rs index 7edfaa7c1..cde6a0a62 100644 --- a/crates/brk_computer/src/internal/specialized/value/block/lazy_computed_sum_cum.rs +++ b/crates/brk_computer/src/internal/specialized/value/block/lazy_computed_sum_cum.rs @@ -14,7 +14,7 @@ use vecdb::{Database, Exit, IterableCloneableVec, LazyVecFrom2}; use crate::{ ComputeIndexes, indexes, internal::{ - ClosePriceTimesSats, ComputedBlockSumCum, LazyBlockSumCum, LazyComputedBlockSumCum, + ClosePriceTimesSats, ComputedBlockSumCum, LazyBlockSumCum, BlockSumCumLazyHeight, SatsToBitcoin, }, price, @@ -29,7 +29,7 @@ use crate::{ pub struct LazyComputedValueBlockSumCum { pub sats: ComputedBlockSumCum, pub bitcoin: LazyBlockSumCum, - pub dollars: Option, Sats>>, + pub dollars: Option, Sats>>, } const VERSION: Version = Version::ZERO; @@ -61,7 +61,7 @@ impl LazyComputedValueBlockSumCum { sats.height.boxed_clone(), ); - Some(LazyComputedBlockSumCum::forced_import( + Some(BlockSumCumLazyHeight::forced_import( db, &format!("{name}_usd"), v, diff --git a/crates/brk_computer/src/internal/specialized/value/block/lazy_sum_cum.rs b/crates/brk_computer/src/internal/specialized/value/block/lazy_sum_cum.rs index d9c00561e..a1df5aa70 100644 --- a/crates/brk_computer/src/internal/specialized/value/block/lazy_sum_cum.rs +++ b/crates/brk_computer/src/internal/specialized/value/block/lazy_sum_cum.rs @@ -13,7 +13,7 @@ use vecdb::{ use crate::{ ComputeIndexes, indexes, internal::{ - ClosePriceTimesSats, ComputedVecValue, LazyBlockSumCum, LazyComputedBlockSumCum, + ClosePriceTimesSats, ComputedVecValue, LazyBlockSumCum, BlockSumCumLazyHeight, SatsToBitcoin, }, price, @@ -30,9 +30,9 @@ where S1T: ComputedVecValue + JsonSchema, S2T: ComputedVecValue + JsonSchema, { - pub sats: LazyComputedBlockSumCum, + pub sats: BlockSumCumLazyHeight, pub bitcoin: LazyBlockSumCum, - pub dollars: Option, Sats>>, + pub dollars: Option, Sats>>, } const VERSION: Version = Version::ZERO; @@ -57,7 +57,7 @@ where let v = version + VERSION; let sats_height = LazyVecFrom2::transformed::(name, v, source1, source2); - let sats = LazyComputedBlockSumCum::forced_import(db, name, v, indexes, sats_height)?; + let sats = BlockSumCumLazyHeight::forced_import(db, name, v, indexes, sats_height)?; let bitcoin = LazyBlockSumCum::from_derived::( &format!("{name}_btc"), @@ -74,7 +74,7 @@ where sats.height.boxed_clone(), ); - Some(LazyComputedBlockSumCum::forced_import( + Some(BlockSumCumLazyHeight::forced_import( db, &format!("{name}_usd"), v, diff --git a/crates/brk_computer/src/internal/specialized/value/derived_block/sum_cum.rs b/crates/brk_computer/src/internal/specialized/value/derived_block/sum_cum.rs index ef09c1932..e8030db10 100644 --- a/crates/brk_computer/src/internal/specialized/value/derived_block/sum_cum.rs +++ b/crates/brk_computer/src/internal/specialized/value/derived_block/sum_cum.rs @@ -8,7 +8,7 @@ use vecdb::{Database, Exit, IterableBoxedVec, IterableCloneableVec, IterableVec, use crate::{ ComputeIndexes, indexes, internal::{ - ClosePriceTimesSats, ComputedDerivedBlockSumCum, LazyBlockSumCum, LazyComputedBlockSumCum, + ClosePriceTimesSats, ComputedDerivedBlockSumCum, LazyBlockSumCum, BlockSumCumLazyHeight, SatsToBitcoin, }, price, @@ -19,7 +19,7 @@ use crate::{ pub struct DerivedValueBlockSumCum { pub sats: ComputedDerivedBlockSumCum, pub bitcoin: LazyBlockSumCum, - pub dollars: Option, Sats>>, + pub dollars: Option, Sats>>, } const VERSION: Version = Version::ZERO; @@ -58,7 +58,7 @@ impl DerivedValueBlockSumCum { sats_source.boxed_clone(), ); - Some(LazyComputedBlockSumCum::forced_import( + Some(BlockSumCumLazyHeight::forced_import( db, &format!("{name}_usd"), v,