computer: snapshot

This commit is contained in:
nym21
2026-02-27 10:54:36 +01:00
parent 72c17096ea
commit c75421f46e
44 changed files with 1079 additions and 722 deletions

View File

@@ -24,7 +24,7 @@ where
{
pub height: M::Stored<EagerVec<PcoVec<Height, T>>>,
pub cumulative: ComputedFromHeightLast<T, M>,
pub rolling: RollingWindows<T, M>,
pub sum: RollingWindows<T, M>,
}
const VERSION: Version = Version::ZERO;
@@ -49,7 +49,7 @@ where
Ok(Self {
height,
cumulative,
rolling,
sum: rolling,
})
}
@@ -68,7 +68,7 @@ where
self.cumulative
.height
.compute_cumulative(max_from, &self.height, exit)?;
self.rolling
self.sum
.compute_rolling_sum(max_from, windows, &self.height, exit)?;
Ok(())
}

View File

@@ -6,8 +6,8 @@ use vecdb::{AnyStoredVec, AnyVec, Database, EagerVec, Exit, PcoVec, ReadableVec,
use crate::{
ComputeIndexes, blocks, indexes,
internal::{ComputedFromHeightStdDevExtended, Price},
utils::get_percentile,
};
use brk_types::get_percentile;
use super::super::ComputedFromHeightLast;

View File

@@ -7,7 +7,7 @@ use brk_types::{
};
use derive_more::{Deref, DerefMut};
use schemars::JsonSchema;
use vecdb::{LazyAggVec, ReadableBoxedVec, ReadableCloneableVec};
use vecdb::{LazyAggVec, ReadOnlyClone, ReadableBoxedVec, ReadableCloneableVec};
use crate::{
indexes, indexes_from,
@@ -41,6 +41,17 @@ pub struct ComputedHeightDerivedLast<T>(
where
T: ComputedVecValue + PartialOrd + JsonSchema;
/// Already read-only (no StorageMode); cloning is sufficient.
impl<T> ReadOnlyClone for ComputedHeightDerivedLast<T>
where
T: ComputedVecValue + PartialOrd + JsonSchema,
{
type ReadOnly = Self;
fn read_only_clone(&self) -> Self {
self.clone()
}
}
const VERSION: Version = Version::ZERO;
impl<T> ComputedHeightDerivedLast<T>

View File

@@ -9,7 +9,9 @@ use brk_types::{
};
use derive_more::{Deref, DerefMut};
use schemars::JsonSchema;
use vecdb::{LazyVecFrom1, ReadableBoxedVec, ReadableCloneableVec, UnaryTransform, VecIndex, VecValue};
use vecdb::{
LazyVecFrom1, ReadableBoxedVec, ReadableCloneableVec, UnaryTransform, VecIndex, VecValue,
};
use crate::{
indexes, indexes_from,
@@ -108,7 +110,8 @@ where
where
S1T: NumericValue,
{
let derived = ComputedHeightDerivedLast::forced_import(name, height_source, version, indexes);
let derived =
ComputedHeightDerivedLast::forced_import(name, height_source, version, indexes);
Self::from_derived_computed::<F>(name, version, &derived)
}