global: snapshot

This commit is contained in:
nym21
2026-03-07 13:00:10 +01:00
parent bf07570848
commit 1011825949
87 changed files with 1304 additions and 1201 deletions

View File

@@ -1,5 +1,52 @@
mod base;
mod core;
mod full;
pub use base::UnrealizedBase;
pub use self::core::UnrealizedCore;
pub use full::UnrealizedFull;
use brk_error::Result;
use brk_types::{Height, Indexes};
use vecdb::Exit;
use crate::{distribution::state::UnrealizedState, prices};
pub trait UnrealizedLike: Send + Sync {
fn as_base(&self) -> &UnrealizedBase;
fn as_base_mut(&mut self) -> &mut UnrealizedBase;
fn min_stateful_height_len(&self) -> usize;
fn truncate_push(&mut self, height: Height, state: &UnrealizedState) -> Result<()>;
fn compute_rest(&mut self, prices: &prices::Vecs, starting_indexes: &Indexes, exit: &Exit) -> Result<()>;
fn compute_net_sentiment_height(&mut self, starting_indexes: &Indexes, exit: &Exit) -> Result<()>;
}
impl UnrealizedLike for UnrealizedBase {
fn as_base(&self) -> &UnrealizedBase { self }
fn as_base_mut(&mut self) -> &mut UnrealizedBase { self }
fn min_stateful_height_len(&self) -> usize { self.min_stateful_height_len() }
fn truncate_push(&mut self, height: Height, state: &UnrealizedState) -> Result<()> {
self.truncate_push(height, state)
}
fn compute_rest(&mut self, prices: &prices::Vecs, starting_indexes: &Indexes, exit: &Exit) -> Result<()> {
self.compute_rest(prices, starting_indexes, exit)
}
fn compute_net_sentiment_height(&mut self, _starting_indexes: &Indexes, _exit: &Exit) -> Result<()> {
Ok(())
}
}
impl UnrealizedLike for UnrealizedFull {
fn as_base(&self) -> &UnrealizedBase { &self.inner }
fn as_base_mut(&mut self) -> &mut UnrealizedBase { &mut self.inner }
fn min_stateful_height_len(&self) -> usize { self.inner.min_stateful_height_len() }
fn truncate_push(&mut self, height: Height, state: &UnrealizedState) -> Result<()> {
self.inner.truncate_push(height, state)
}
fn compute_rest(&mut self, prices: &prices::Vecs, starting_indexes: &Indexes, exit: &Exit) -> Result<()> {
self.compute_rest(prices, starting_indexes, exit)
}
fn compute_net_sentiment_height(&mut self, starting_indexes: &Indexes, exit: &Exit) -> Result<()> {
self.compute_net_sentiment_height(starting_indexes, exit)
}
}