global: snapshot

This commit is contained in:
nym21
2025-11-09 22:57:06 +01:00
parent dc2e847f58
commit f6a2a0540b
58 changed files with 504 additions and 714 deletions

View File

@@ -7,7 +7,7 @@ use brk_traversable::Traversable;
use brk_types::{BlkPosition, Height, TxIndex, Version};
use vecdb::{
AnyStoredVec, AnyVec, CompressedVec, Database, Exit, GenericStoredVec, PAGE_SIZE,
VecIteratorExtended,
TypedVecIterator,
};
use super::Indexes;

View File

@@ -10,8 +10,8 @@ use brk_types::{
TxVersion, Version, WeekIndex, Weight, YearIndex,
};
use vecdb::{
AnyCloneableIterableVec, AnyIterableVec, Database, EagerVec, Exit, LazyVecFrom1, LazyVecFrom2,
LazyVecFrom3, PAGE_SIZE, StoredIndex, VecIteratorExtended,
Database, EagerVec, Exit, IterableCloneableVec, IterableVec, LazyVecFrom1, LazyVecFrom2,
LazyVecFrom3, PAGE_SIZE, StoredIndex, TypedVecIterator,
};
use crate::grouped::{

View File

@@ -3,7 +3,7 @@ use std::path::Path;
use brk_error::Result;
use brk_traversable::Traversable;
use brk_types::{Bitcoin, CheckedSub, Dollars, StoredF32, StoredF64, Version};
use vecdb::{Database, Exit, PAGE_SIZE, VecIteratorExtended};
use vecdb::{Database, Exit, PAGE_SIZE, TypedVecIterator};
use crate::grouped::ComputedVecsFromDateIndex;

View File

@@ -6,7 +6,7 @@ use brk_indexer::Indexer;
use brk_traversable::Traversable;
use brk_types::{DateIndex, Height, OHLCCents, Version};
use vecdb::{
AnyIterableVec, AnyStoredVec, AnyVec, Database, Exit, GenericStoredVec, PAGE_SIZE, RawVec,
AnyStoredVec, AnyVec, Database, Exit, GenericStoredVec, IterableVec, PAGE_SIZE, RawVec,
StoredIndex, VecIterator,
};

View File

@@ -2,7 +2,7 @@ use brk_error::{Error, Result};
use brk_traversable::Traversable;
use brk_types::{CheckedSub, StoredU64, Version};
use vecdb::{
AnyIterableVec, AnyStoredVec, AnyVec, Database, EagerVec, Exit, Format, GenericStoredVec,
AnyStoredVec, AnyVec, Database, EagerVec, Exit, Format, GenericStoredVec, IterableVec,
StoredIndex, StoredRaw,
};
@@ -204,7 +204,7 @@ where
pub fn extend(
&mut self,
max_from: I,
source: &impl AnyIterableVec<I, T>,
source: &impl IterableVec<I, T>,
exit: &Exit,
) -> Result<()> {
if self.cumulative.is_none() {
@@ -238,9 +238,9 @@ where
pub fn compute<I2>(
&mut self,
max_from: I,
source: &impl AnyIterableVec<I2, T>,
first_indexes: &impl AnyIterableVec<I, I2>,
count_indexes: &impl AnyIterableVec<I, StoredU64>,
source: &impl IterableVec<I2, T>,
first_indexes: &impl IterableVec<I, I2>,
count_indexes: &impl IterableVec<I, StoredU64>,
exit: &Exit,
) -> Result<()>
where
@@ -398,8 +398,8 @@ where
&mut self,
max_from: I,
source: &EagerVecsBuilder<I2, T>,
first_indexes: &impl AnyIterableVec<I, I2>,
count_indexes: &impl AnyIterableVec<I, StoredU64>,
first_indexes: &impl IterableVec<I, I2>,
count_indexes: &impl IterableVec<I, StoredU64>,
exit: &Exit,
) -> Result<()>
where

View File

@@ -1,8 +1,6 @@
use brk_traversable::Traversable;
use brk_types::Version;
use vecdb::{
AnyBoxedIterableVec, AnyCloneableIterableVec, FromCoarserIndex, LazyVecFrom2, StoredIndex,
};
use vecdb::{FromCoarserIndex, IterableBoxedVec, IterableCloneableVec, LazyVecFrom2, StoredIndex};
use crate::grouped::{EagerVecsBuilder, VecBuilderOptions};
@@ -39,9 +37,9 @@ where
pub fn forced_import(
name: &str,
version: Version,
source: Option<AnyBoxedIterableVec<S1I, T>>,
source: Option<IterableBoxedVec<S1I, T>>,
source_extra: &EagerVecsBuilder<S1I, T>,
len_source: AnyBoxedIterableVec<I, S2T>,
len_source: IterableBoxedVec<I, S2T>,
options: LazyVecBuilderOptions,
) -> Self {
let only_one_active = options.is_only_one_active();

View File

@@ -4,7 +4,7 @@ use brk_traversable::Traversable;
use brk_types::{
DateIndex, DecadeIndex, MonthIndex, QuarterIndex, SemesterIndex, Version, WeekIndex, YearIndex,
};
use vecdb::{AnyCloneableIterableVec, AnyIterableVec, Database, EagerVec, Exit};
use vecdb::{AnyCollectableVec, Database, EagerVec, Exit, IterableCloneableVec, IterableVec};
use crate::{Indexes, grouped::LazyVecsBuilder, indexes};
@@ -128,7 +128,7 @@ where
&mut self,
starting_indexes: &Indexes,
exit: &Exit,
dateindex: Option<&impl AnyIterableVec<DateIndex, T>>,
dateindex: Option<&impl IterableVec<DateIndex, T>>,
) -> Result<()> {
if let Some(dateindex) = dateindex {
self.dateindex_extra
@@ -178,8 +178,8 @@ where
.unwrap()
}
fn iter_any_collectable(&self) -> impl Iterator<Item = &dyn vecdb::AnyCollectableVec> {
let mut regular_iter: Box<dyn Iterator<Item = &dyn vecdb::AnyCollectableVec>> =
fn iter_any_collectable(&self) -> impl Iterator<Item = &dyn AnyCollectableVec> {
let mut regular_iter: Box<dyn Iterator<Item = &dyn AnyCollectableVec>> =
Box::new(self.dateindex_extra.iter_any_collectable());
regular_iter = Box::new(regular_iter.chain(self.weekindex.iter_any_collectable()));
regular_iter = Box::new(regular_iter.chain(self.monthindex.iter_any_collectable()));

View File

@@ -5,7 +5,7 @@ use brk_types::{
DateIndex, DecadeIndex, DifficultyEpoch, Height, MonthIndex, QuarterIndex, SemesterIndex,
Version, WeekIndex, YearIndex,
};
use vecdb::{AnyCloneableIterableVec, AnyIterableVec, Database, EagerVec, Exit};
use vecdb::{AnyCollectableVec, Database, EagerVec, Exit, IterableCloneableVec, IterableVec};
use crate::{
Indexes,
@@ -152,7 +152,7 @@ where
indexes: &indexes::Vecs,
starting_indexes: &Indexes,
exit: &Exit,
height_vec: Option<&impl AnyIterableVec<Height, T>>,
height_vec: Option<&impl IterableVec<Height, T>>,
) -> Result<()> {
if let Some(height) = height_vec {
self.height_extra
@@ -239,8 +239,8 @@ where
.unwrap()
}
fn iter_any_collectable(&self) -> impl Iterator<Item = &dyn vecdb::AnyCollectableVec> {
let mut regular_iter: Box<dyn Iterator<Item = &dyn vecdb::AnyCollectableVec>> =
fn iter_any_collectable(&self) -> impl Iterator<Item = &dyn AnyCollectableVec> {
let mut regular_iter: Box<dyn Iterator<Item = &dyn AnyCollectableVec>> =
Box::new(self.height_extra.iter_any_collectable());
regular_iter = Box::new(regular_iter.chain(self.dateindex.iter_any_collectable()));
regular_iter = Box::new(regular_iter.chain(self.weekindex.iter_any_collectable()));

View File

@@ -2,7 +2,7 @@ use brk_error::Result;
use brk_traversable::Traversable;
use brk_types::{DifficultyEpoch, Height, Version};
use vecdb::{Database, EagerVec, Exit};
use vecdb::{AnyCollectableVec, Database, EagerVec, Exit};
use crate::{Indexes, indexes};
@@ -110,8 +110,8 @@ where
.merge_branches()
.unwrap()
}
fn iter_any_collectable(&self) -> impl Iterator<Item = &dyn vecdb::AnyCollectableVec> {
let mut regular_iter: Box<dyn Iterator<Item = &dyn vecdb::AnyCollectableVec>> =
fn iter_any_collectable(&self) -> impl Iterator<Item = &dyn AnyCollectableVec> {
let mut regular_iter: Box<dyn Iterator<Item = &dyn AnyCollectableVec>> =
Box::new(self.height.iter_any_collectable());
regular_iter = Box::new(regular_iter.chain(self.height_extra.iter_any_collectable()));
regular_iter = Box::new(regular_iter.chain(self.difficultyepoch.iter_any_collectable()));

View File

@@ -6,8 +6,8 @@ use brk_types::{
Sats, SemesterIndex, TxIndex, Version, WeekIndex, YearIndex,
};
use vecdb::{
AnyCloneableIterableVec, AnyVec, CollectableVec, Database, EagerVec, Exit, GenericStoredVec,
StoredIndex, VecIteratorExtended,
AnyCollectableVec, AnyVec, CollectableVec, Database, EagerVec, Exit, GenericStoredVec,
IterableCloneableVec, StoredIndex, TypedVecIterator,
};
use crate::{
@@ -521,8 +521,8 @@ where
.unwrap()
}
fn iter_any_collectable(&self) -> impl Iterator<Item = &dyn vecdb::AnyCollectableVec> {
let mut regular_iter: Box<dyn Iterator<Item = &dyn vecdb::AnyCollectableVec>> =
fn iter_any_collectable(&self) -> impl Iterator<Item = &dyn AnyCollectableVec> {
let mut regular_iter: Box<dyn Iterator<Item = &dyn AnyCollectableVec>> =
Box::new(self.height.iter_any_collectable());
regular_iter = Box::new(regular_iter.chain(self.dateindex.iter_any_collectable()));
regular_iter = Box::new(regular_iter.chain(self.weekindex.iter_any_collectable()));

View File

@@ -2,8 +2,8 @@ use brk_error::Result;
use brk_traversable::Traversable;
use brk_types::{Date, DateIndex, Dollars, StoredF32, Version};
use vecdb::{
AnyIterableVec, AnyStoredVec, AnyVec, CollectableVec, Database, EagerVec, Exit,
GenericStoredVec, StoredIndex, VecIteratorExtended,
AnyStoredVec, AnyVec, CollectableVec, Database, EagerVec, Exit, GenericStoredVec, IterableVec,
StoredIndex, TypedVecIterator,
};
use crate::{
@@ -306,7 +306,7 @@ impl ComputedRatioVecsFromDateIndex {
price: &price::Vecs,
starting_indexes: &Indexes,
exit: &Exit,
price_opt: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
price_opt: Option<&impl IterableVec<DateIndex, Dollars>>,
) -> Result<()> {
let closes = price.timeindexes_to_price_close.dateindex.as_ref().unwrap();

View File

@@ -2,8 +2,8 @@ use brk_error::Result;
use brk_traversable::Traversable;
use brk_types::{Date, DateIndex, Dollars, StoredF32, Version};
use vecdb::{
AnyIterableVec, AnyStoredVec, AnyVec, BoxedVecIterator, CollectableVec, Database, EagerVec,
Exit, GenericStoredVec, StoredIndex,
AnyStoredVec, AnyVec, BoxedVecIterator, CollectableVec, Database, EagerVec, Exit,
GenericStoredVec, IterableVec, StoredIndex,
};
use crate::{Indexes, grouped::source::Source, indexes};
@@ -422,7 +422,7 @@ impl ComputedStandardDeviationVecsFromDateIndex {
starting_indexes: &Indexes,
exit: &Exit,
source: &impl CollectableVec<DateIndex, StoredF32>,
price_opt: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
price_opt: Option<&impl IterableVec<DateIndex, Dollars>>,
) -> Result<()> {
let min_date = DateIndex::try_from(Date::MIN_RATIO).unwrap();
@@ -449,9 +449,9 @@ impl ComputedStandardDeviationVecsFromDateIndex {
&mut self,
starting_indexes: &Indexes,
exit: &Exit,
sma_opt: Option<&impl AnyIterableVec<DateIndex, StoredF32>>,
sma_opt: Option<&impl IterableVec<DateIndex, StoredF32>>,
source: &impl CollectableVec<DateIndex, StoredF32>,
price_opt: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
price_opt: Option<&impl IterableVec<DateIndex, Dollars>>,
) -> Result<()> {
let sma = sma_opt.unwrap_or_else(|| unsafe {
std::mem::transmute(&self.sma.as_ref().unwrap().dateindex)

View File

@@ -1,10 +1,10 @@
use vecdb::AnyBoxedIterableVec;
use vecdb::IterableBoxedVec;
#[derive(Clone)]
pub enum Source<I, T> {
Compute,
None,
Vec(AnyBoxedIterableVec<I, T>),
Vec(IterableBoxedVec<I, T>),
}
impl<I, T> Source<I, T> {
@@ -20,7 +20,7 @@ impl<I, T> Source<I, T> {
matches!(self, Self::Vec(_))
}
pub fn vec(self) -> Option<AnyBoxedIterableVec<I, T>> {
pub fn vec(self) -> Option<IterableBoxedVec<I, T>> {
match self {
Self::Vec(v) => Some(v),
_ => None,
@@ -35,16 +35,16 @@ impl<I, T> From<bool> for Source<I, T> {
}
}
impl<I, T> From<AnyBoxedIterableVec<I, T>> for Source<I, T> {
impl<I, T> From<IterableBoxedVec<I, T>> for Source<I, T> {
#[inline]
fn from(value: AnyBoxedIterableVec<I, T>) -> Self {
fn from(value: IterableBoxedVec<I, T>) -> Self {
Self::Vec(value)
}
}
impl<I, T> From<Option<AnyBoxedIterableVec<I, T>>> for Source<I, T> {
impl<I, T> From<Option<IterableBoxedVec<I, T>>> for Source<I, T> {
#[inline]
fn from(value: Option<AnyBoxedIterableVec<I, T>>) -> Self {
fn from(value: Option<IterableBoxedVec<I, T>>) -> Self {
if let Some(v) = value {
Self::Vec(v)
} else {

View File

@@ -3,8 +3,8 @@ use brk_indexer::Indexer;
use brk_traversable::Traversable;
use brk_types::{Bitcoin, Close, Dollars, Height, Sats, TxIndex, Version};
use vecdb::{
AnyCloneableIterableVec, CollectableVec, Database, Exit, LazyVecFrom1, LazyVecFrom3,
StoredIndex, StoredVec,
CollectableVec, Database, Exit, IterableCloneableVec, LazyVecFrom1, LazyVecFrom3, StoredIndex,
StoredVec,
};
use crate::{Indexes, grouped::Source, indexes, price};

View File

@@ -13,8 +13,8 @@ use brk_types::{
YearIndex,
};
use vecdb::{
AnyCloneableIterableVec, Database, EagerVec, Exit, LazyVecFrom1, LazyVecFrom2, PAGE_SIZE,
StoredIndex, VecIteratorExtended,
Database, EagerVec, Exit, IterableCloneableVec, LazyVecFrom1, LazyVecFrom2, PAGE_SIZE,
StoredIndex, TypedVecIterator,
};
const VERSION: Version = Version::ZERO;

View File

@@ -3,9 +3,7 @@ use std::{path::Path, thread};
use brk_error::Result;
use brk_traversable::Traversable;
use brk_types::{Date, DateIndex, Dollars, Height, Sats, StoredF32, StoredU16, Version};
use vecdb::{
Database, EagerVec, Exit, GenericStoredVec, PAGE_SIZE, StoredIndex, VecIteratorExtended,
};
use vecdb::{Database, EagerVec, Exit, GenericStoredVec, PAGE_SIZE, StoredIndex, TypedVecIterator};
use crate::{
grouped::{ComputedStandardDeviationVecsFromDateIndex, Source, StandardDeviationVecsOptions},

View File

@@ -7,8 +7,8 @@ use brk_traversable::Traversable;
use brk_types::{Address, AddressBytes, Height, OutputType, PoolId, Pools, TxOutIndex, pools};
use rayon::prelude::*;
use vecdb::{
AnyIterableVec, AnyStoredVec, AnyVec, Database, Exit, GenericStoredVec, PAGE_SIZE, RawVec,
StoredIndex, VecIteratorExtended, Version,
AnyStoredVec, AnyVec, Database, Exit, GenericStoredVec, IterableVec, PAGE_SIZE, RawVec,
StoredIndex, TypedVecIterator, Version,
};
mod vecs;

View File

@@ -1,7 +1,7 @@
use brk_error::Result;
use brk_traversable::Traversable;
use brk_types::{Height, PoolId, Pools, Sats, StoredF32, StoredU16, StoredU32};
use vecdb::{AnyIterableVec, Database, Exit, GenericStoredVec, StoredIndex, Version};
use vecdb::{Database, Exit, GenericStoredVec, IterableVec, StoredIndex, Version};
use crate::{
chain,
@@ -164,7 +164,7 @@ impl Vecs {
&mut self,
indexes: &indexes::Vecs,
starting_indexes: &Indexes,
height_to_pool: &impl AnyIterableVec<Height, PoolId>,
height_to_pool: &impl IterableVec<Height, PoolId>,
chain: &chain::Vecs,
price: Option<&price::Vecs>,
exit: &Exit,

View File

@@ -7,7 +7,7 @@ use brk_types::{
OHLCDollars, OHLCSats, Open, QuarterIndex, Sats, SemesterIndex, Version, WeekIndex, YearIndex,
};
use vecdb::{
AnyIterableVec, AnyStoredVec, AnyVec, Database, EagerVec, Exit, GenericStoredVec, PAGE_SIZE,
AnyStoredVec, AnyVec, Database, EagerVec, Exit, GenericStoredVec, IterableVec, PAGE_SIZE,
RawVec, StoredIndex,
};

View File

@@ -4,8 +4,8 @@ use brk_error::Result;
use brk_traversable::Traversable;
use brk_types::{Bitcoin, DateIndex, Dollars, Height, StoredU64, Version};
use vecdb::{
AnyIterableVec, AnyStoredVec, AnyVec, Database, EagerVec, Exit, Format, GenericStoredVec,
VecIteratorExtended,
AnyStoredVec, AnyVec, Database, EagerVec, Exit, Format, GenericStoredVec, IterableVec,
TypedVecIterator,
};
use crate::{
@@ -216,12 +216,12 @@ impl CohortVecs for Vecs {
indexes: &indexes::Vecs,
price: Option<&price::Vecs>,
starting_indexes: &Indexes,
height_to_supply: &impl AnyIterableVec<Height, Bitcoin>,
dateindex_to_supply: &impl AnyIterableVec<DateIndex, Bitcoin>,
height_to_market_cap: Option<&impl AnyIterableVec<Height, Dollars>>,
dateindex_to_market_cap: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
height_to_realized_cap: Option<&impl AnyIterableVec<Height, Dollars>>,
dateindex_to_realized_cap: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
height_to_supply: &impl IterableVec<Height, Bitcoin>,
dateindex_to_supply: &impl IterableVec<DateIndex, Bitcoin>,
height_to_market_cap: Option<&impl IterableVec<Height, Dollars>>,
dateindex_to_market_cap: Option<&impl IterableVec<DateIndex, Dollars>>,
height_to_realized_cap: Option<&impl IterableVec<Height, Dollars>>,
dateindex_to_realized_cap: Option<&impl IterableVec<DateIndex, Dollars>>,
exit: &Exit,
) -> Result<()> {
self.inner.compute_rest_part2(

View File

@@ -5,7 +5,7 @@ use brk_grouper::{AddressGroups, ByAmountRange, ByGreatEqualAmount, ByLowerThanA
use brk_traversable::Traversable;
use brk_types::{Bitcoin, DateIndex, Dollars, Height, Version};
use derive_deref::{Deref, DerefMut};
use vecdb::{AnyIterableVec, Database, Exit, Format};
use vecdb::{Database, Exit, Format, IterableVec};
use crate::{
Indexes, indexes, price,
@@ -514,12 +514,12 @@ impl Vecs {
indexes: &indexes::Vecs,
price: Option<&price::Vecs>,
starting_indexes: &Indexes,
height_to_supply: &impl AnyIterableVec<Height, Bitcoin>,
dateindex_to_supply: &impl AnyIterableVec<DateIndex, Bitcoin>,
height_to_market_cap: Option<&impl AnyIterableVec<Height, Dollars>>,
dateindex_to_market_cap: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
height_to_realized_cap: Option<&impl AnyIterableVec<Height, Dollars>>,
dateindex_to_realized_cap: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
height_to_supply: &impl IterableVec<Height, Bitcoin>,
dateindex_to_supply: &impl IterableVec<DateIndex, Bitcoin>,
height_to_market_cap: Option<&impl IterableVec<Height, Dollars>>,
dateindex_to_market_cap: Option<&impl IterableVec<DateIndex, Dollars>>,
height_to_realized_cap: Option<&impl IterableVec<Height, Dollars>>,
dateindex_to_realized_cap: Option<&impl IterableVec<DateIndex, Dollars>>,
exit: &Exit,
) -> Result<()> {
self.0.iter_mut().map(Filtered::mut_t).try_for_each(|v| {

View File

@@ -1,7 +1,7 @@
use brk_grouper::ByAddressType;
use brk_types::Height;
use derive_deref::{Deref, DerefMut};
use vecdb::VecIteratorExtended;
use vecdb::TypedVecIterator;
use super::AddressTypeToHeightToAddressCount;

View File

@@ -4,8 +4,8 @@ use brk_types::{
Bitcoin, DateIndex, Dollars, Height, Sats, StoredF32, StoredF64, StoredU64, Version,
};
use vecdb::{
AnyCloneableIterableVec, AnyIterableVec, AnyStoredVec, AnyVec, Database, EagerVec, Exit,
Format, GenericStoredVec, VecIteratorExtended,
AnyStoredVec, AnyVec, Database, EagerVec, Exit, Format, GenericStoredVec, IterableCloneableVec,
IterableVec, TypedVecIterator,
};
use crate::{
@@ -2173,12 +2173,12 @@ impl Vecs {
indexes: &indexes::Vecs,
price: Option<&price::Vecs>,
starting_indexes: &Indexes,
height_to_supply: &impl AnyIterableVec<Height, Bitcoin>,
dateindex_to_supply: &impl AnyIterableVec<DateIndex, Bitcoin>,
height_to_market_cap: Option<&impl AnyIterableVec<Height, Dollars>>,
dateindex_to_market_cap: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
height_to_realized_cap: Option<&impl AnyIterableVec<Height, Dollars>>,
dateindex_to_realized_cap: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
height_to_supply: &impl IterableVec<Height, Bitcoin>,
dateindex_to_supply: &impl IterableVec<DateIndex, Bitcoin>,
height_to_market_cap: Option<&impl IterableVec<Height, Dollars>>,
dateindex_to_market_cap: Option<&impl IterableVec<DateIndex, Dollars>>,
height_to_realized_cap: Option<&impl IterableVec<Height, Dollars>>,
dateindex_to_realized_cap: Option<&impl IterableVec<DateIndex, Dollars>>,
exit: &Exit,
) -> Result<()> {
if let Some(v) = self.indexes_to_supply_rel_to_circulating_supply.as_mut() {

View File

@@ -16,9 +16,9 @@ use rayon::prelude::*;
use rustc_hash::FxHashMap;
use smallvec::SmallVec;
use vecdb::{
AnyCloneableIterableVec, AnyIterableVec, AnyStoredVec, AnyVec, BoxedVecIterator,
CollectableVec, Database, EagerVec, Exit, Format, GenericStoredVec, ImportOptions,
LazyVecFrom1, PAGE_SIZE, RawVec, Reader, Stamp, StoredIndex, VecIteratorExtended,
AnyStoredVec, AnyVec, BoxedVecIterator, CollectableVec, Database, EagerVec, Exit, Format,
GenericStoredVec, ImportOptions, IterableCloneableVec, IterableVec, LazyVecFrom1, PAGE_SIZE,
RawVec, Reader, Stamp, StoredIndex, TypedVecIterator,
};
use crate::{
@@ -782,8 +782,8 @@ impl Vecs {
let mut height_to_output_count_iter = height_to_output_count.into_iter();
let mut height_to_tx_count_iter = height_to_tx_count.into_iter();
let mut height_to_unclaimed_rewards_iter = height_to_unclaimed_rewards.into_iter();
let mut txindex_to_input_count_iter = txindex_to_input_count.boxed_iter();
let mut txindex_to_output_count_iter = txindex_to_output_count.boxed_iter();
let mut txindex_to_input_count_iter = txindex_to_input_count.iter();
let mut txindex_to_output_count_iter = txindex_to_output_count.iter();
let height_to_price_close_vec =
height_to_price_close.map(|height_to_price_close| height_to_price_close.collect());

View File

@@ -1,6 +1,6 @@
use brk_error::Result;
use brk_types::{Bitcoin, DateIndex, Dollars, Height, Version};
use vecdb::{AnyIterableVec, Exit};
use vecdb::{Exit, IterableVec};
use crate::{Indexes, indexes, price};
@@ -49,12 +49,12 @@ pub trait CohortVecs: DynCohortVecs {
indexes: &indexes::Vecs,
price: Option<&price::Vecs>,
starting_indexes: &Indexes,
height_to_supply: &impl AnyIterableVec<Height, Bitcoin>,
dateindex_to_supply: &impl AnyIterableVec<DateIndex, Bitcoin>,
height_to_market_cap: Option<&impl AnyIterableVec<Height, Dollars>>,
dateindex_to_market_cap: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
height_to_realized_cap: Option<&impl AnyIterableVec<Height, Dollars>>,
dateindex_to_realized_cap: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
height_to_supply: &impl IterableVec<Height, Bitcoin>,
dateindex_to_supply: &impl IterableVec<DateIndex, Bitcoin>,
height_to_market_cap: Option<&impl IterableVec<Height, Dollars>>,
dateindex_to_market_cap: Option<&impl IterableVec<DateIndex, Dollars>>,
height_to_realized_cap: Option<&impl IterableVec<Height, Dollars>>,
dateindex_to_realized_cap: Option<&impl IterableVec<DateIndex, Dollars>>,
exit: &Exit,
) -> Result<()>;
}

View File

@@ -3,7 +3,7 @@ use std::{ops::Deref, path::Path};
use brk_error::Result;
use brk_traversable::Traversable;
use brk_types::{Bitcoin, DateIndex, Dollars, Height, Version};
use vecdb::{AnyIterableVec, Database, Exit, Format};
use vecdb::{Database, Exit, Format, IterableVec};
use crate::{
Indexes, UTXOCohortState, indexes, price,
@@ -154,12 +154,12 @@ impl CohortVecs for Vecs {
indexes: &indexes::Vecs,
price: Option<&price::Vecs>,
starting_indexes: &Indexes,
height_to_supply: &impl AnyIterableVec<Height, Bitcoin>,
dateindex_to_supply: &impl AnyIterableVec<DateIndex, Bitcoin>,
height_to_market_cap: Option<&impl AnyIterableVec<Height, Dollars>>,
dateindex_to_market_cap: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
height_to_realized_cap: Option<&impl AnyIterableVec<Height, Dollars>>,
dateindex_to_realized_cap: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
height_to_supply: &impl IterableVec<Height, Bitcoin>,
dateindex_to_supply: &impl IterableVec<DateIndex, Bitcoin>,
height_to_market_cap: Option<&impl IterableVec<Height, Dollars>>,
dateindex_to_market_cap: Option<&impl IterableVec<DateIndex, Dollars>>,
height_to_realized_cap: Option<&impl IterableVec<Height, Dollars>>,
dateindex_to_realized_cap: Option<&impl IterableVec<DateIndex, Dollars>>,
exit: &Exit,
) -> Result<()> {
self.inner.compute_rest_part2(

View File

@@ -11,7 +11,7 @@ use brk_types::{
};
use derive_deref::{Deref, DerefMut};
use rustc_hash::FxHashMap;
use vecdb::{AnyIterableVec, Database, Exit, Format, StoredIndex};
use vecdb::{Database, Exit, Format, IterableVec, StoredIndex};
use crate::{
Indexes, indexes, price,
@@ -1718,12 +1718,12 @@ impl Vecs {
indexes: &indexes::Vecs,
price: Option<&price::Vecs>,
starting_indexes: &Indexes,
height_to_supply: &impl AnyIterableVec<Height, Bitcoin>,
dateindex_to_supply: &impl AnyIterableVec<DateIndex, Bitcoin>,
height_to_market_cap: Option<&impl AnyIterableVec<Height, Dollars>>,
dateindex_to_market_cap: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
height_to_realized_cap: Option<&impl AnyIterableVec<Height, Dollars>>,
dateindex_to_realized_cap: Option<&impl AnyIterableVec<DateIndex, Dollars>>,
height_to_supply: &impl IterableVec<Height, Bitcoin>,
dateindex_to_supply: &impl IterableVec<DateIndex, Bitcoin>,
height_to_market_cap: Option<&impl IterableVec<Height, Dollars>>,
dateindex_to_market_cap: Option<&impl IterableVec<DateIndex, Dollars>>,
height_to_realized_cap: Option<&impl IterableVec<Height, Dollars>>,
dateindex_to_realized_cap: Option<&impl IterableVec<DateIndex, Dollars>>,
exit: &Exit,
) -> Result<()> {
self.iter_mut().map(Filtered::mut_t).try_for_each(|v| {

View File

@@ -1,7 +1,7 @@
use brk_error::Result;
use brk_types::{Bitcoin, CheckedSub, Close, Date, DateIndex, Dollars, Sats, StoredF32};
use vecdb::{
AnyIterableVec, AnyStoredVec, AnyVec, EagerVec, Exit, GenericStoredVec, StoredIndex, Version,
AnyStoredVec, AnyVec, EagerVec, Exit, GenericStoredVec, IterableVec, StoredIndex, Version,
};
const DCA_AMOUNT: Dollars = Dollars::mint(100.0);
@@ -10,7 +10,7 @@ pub trait ComputeDCAStackViaLen {
fn compute_dca_stack_via_len(
&mut self,
max_from: DateIndex,
closes: &impl AnyIterableVec<DateIndex, Close<Dollars>>,
closes: &impl IterableVec<DateIndex, Close<Dollars>>,
len: usize,
exit: &Exit,
) -> Result<()>;
@@ -18,7 +18,7 @@ pub trait ComputeDCAStackViaLen {
fn compute_dca_stack_via_from(
&mut self,
max_from: DateIndex,
closes: &impl AnyIterableVec<DateIndex, Close<Dollars>>,
closes: &impl IterableVec<DateIndex, Close<Dollars>>,
from: DateIndex,
exit: &Exit,
) -> Result<()>;
@@ -27,7 +27,7 @@ impl ComputeDCAStackViaLen for EagerVec<DateIndex, Sats> {
fn compute_dca_stack_via_len(
&mut self,
max_from: DateIndex,
closes: &impl AnyIterableVec<DateIndex, Close<Dollars>>,
closes: &impl IterableVec<DateIndex, Close<Dollars>>,
len: usize,
exit: &Exit,
) -> Result<()> {
@@ -82,7 +82,7 @@ impl ComputeDCAStackViaLen for EagerVec<DateIndex, Sats> {
fn compute_dca_stack_via_from(
&mut self,
max_from: DateIndex,
closes: &impl AnyIterableVec<DateIndex, Close<Dollars>>,
closes: &impl IterableVec<DateIndex, Close<Dollars>>,
from: DateIndex,
exit: &Exit,
) -> Result<()> {
@@ -130,7 +130,7 @@ pub trait ComputeDCAAveragePriceViaLen {
fn compute_dca_avg_price_via_len(
&mut self,
max_from: DateIndex,
stacks: &impl AnyIterableVec<DateIndex, Sats>,
stacks: &impl IterableVec<DateIndex, Sats>,
len: usize,
exit: &Exit,
) -> Result<()>;
@@ -138,7 +138,7 @@ pub trait ComputeDCAAveragePriceViaLen {
fn compute_dca_avg_price_via_from(
&mut self,
max_from: DateIndex,
stacks: &impl AnyIterableVec<DateIndex, Sats>,
stacks: &impl IterableVec<DateIndex, Sats>,
from: DateIndex,
exit: &Exit,
) -> Result<()>;
@@ -147,7 +147,7 @@ impl ComputeDCAAveragePriceViaLen for EagerVec<DateIndex, Dollars> {
fn compute_dca_avg_price_via_len(
&mut self,
max_from: DateIndex,
stacks: &impl AnyIterableVec<DateIndex, Sats>,
stacks: &impl IterableVec<DateIndex, Sats>,
len: usize,
exit: &Exit,
) -> Result<()> {
@@ -185,7 +185,7 @@ impl ComputeDCAAveragePriceViaLen for EagerVec<DateIndex, Dollars> {
fn compute_dca_avg_price_via_from(
&mut self,
max_from: DateIndex,
stacks: &impl AnyIterableVec<DateIndex, Sats>,
stacks: &impl IterableVec<DateIndex, Sats>,
from: DateIndex,
exit: &Exit,
) -> Result<()> {
@@ -219,7 +219,7 @@ pub trait ComputeFromSats<I> {
fn compute_from_sats(
&mut self,
max_from: I,
sats: &impl AnyIterableVec<I, Sats>,
sats: &impl IterableVec<I, Sats>,
exit: &Exit,
) -> Result<()>;
}
@@ -230,7 +230,7 @@ where
fn compute_from_sats(
&mut self,
max_from: I,
sats: &impl AnyIterableVec<I, Sats>,
sats: &impl IterableVec<I, Sats>,
exit: &Exit,
) -> Result<()> {
self.validate_computed_version_or_reset(
@@ -256,8 +256,8 @@ pub trait ComputeFromBitcoin<I> {
fn compute_from_bitcoin(
&mut self,
max_from: I,
bitcoin: &impl AnyIterableVec<I, Bitcoin>,
price: &impl AnyIterableVec<I, Close<Dollars>>,
bitcoin: &impl IterableVec<I, Bitcoin>,
price: &impl IterableVec<I, Close<Dollars>>,
exit: &Exit,
) -> Result<()>;
}
@@ -268,8 +268,8 @@ where
fn compute_from_bitcoin(
&mut self,
max_from: I,
bitcoin: &impl AnyIterableVec<I, Bitcoin>,
price: &impl AnyIterableVec<I, Close<Dollars>>,
bitcoin: &impl IterableVec<I, Bitcoin>,
price: &impl IterableVec<I, Close<Dollars>>,
exit: &Exit,
) -> Result<()> {
self.validate_computed_version_or_reset(
@@ -298,8 +298,8 @@ pub trait ComputeDrawdown<I> {
fn compute_drawdown(
&mut self,
max_from: I,
close: &impl AnyIterableVec<I, Close<Dollars>>,
ath: &impl AnyIterableVec<I, Dollars>,
close: &impl IterableVec<I, Close<Dollars>>,
ath: &impl IterableVec<I, Dollars>,
exit: &Exit,
) -> Result<()>;
}
@@ -310,8 +310,8 @@ where
fn compute_drawdown(
&mut self,
max_from: I,
close: &impl AnyIterableVec<I, Close<Dollars>>,
ath: &impl AnyIterableVec<I, Dollars>,
close: &impl IterableVec<I, Close<Dollars>>,
ath: &impl IterableVec<I, Dollars>,
exit: &Exit,
) -> Result<()> {
self.validate_computed_version_or_reset(