mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-25 07:09:59 -07:00
global: snapshot
This commit is contained in:
@@ -4,22 +4,18 @@ use brk_types::{Height, Indexes, OutputType, Sats, TxOutIndex};
|
||||
use vecdb::{AnyStoredVec, AnyVec, Exit, ReadableVec, VecIndex, WritableVec};
|
||||
|
||||
use super::Vecs;
|
||||
use crate::{blocks, prices};
|
||||
use crate::prices;
|
||||
|
||||
impl Vecs {
|
||||
pub(crate) fn compute(
|
||||
&mut self,
|
||||
indexer: &Indexer,
|
||||
count_vecs: &blocks::CountVecs,
|
||||
prices: &prices::Vecs,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
let window_starts = count_vecs.window_starts();
|
||||
|
||||
self.opreturn.compute(
|
||||
self.opreturn.compute_with(
|
||||
starting_indexes.height,
|
||||
&window_starts,
|
||||
prices,
|
||||
exit,
|
||||
|height_vec| {
|
||||
|
||||
@@ -3,7 +3,7 @@ use brk_types::Version;
|
||||
use vecdb::Database;
|
||||
|
||||
use super::Vecs;
|
||||
use crate::{indexes, internal::ValueFromHeightFull};
|
||||
use crate::{indexes, internal::ValueFromHeightCumulative};
|
||||
|
||||
impl Vecs {
|
||||
pub(crate) fn forced_import(
|
||||
@@ -12,7 +12,12 @@ impl Vecs {
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
Ok(Self {
|
||||
opreturn: ValueFromHeightFull::forced_import(db, "opreturn_value", version, indexes)?,
|
||||
opreturn: ValueFromHeightCumulative::forced_import(
|
||||
db,
|
||||
"opreturn_value",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use brk_traversable::Traversable;
|
||||
use vecdb::{Rw, StorageMode};
|
||||
|
||||
use crate::internal::ValueFromHeightFull;
|
||||
use crate::internal::ValueFromHeightCumulative;
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub opreturn: ValueFromHeightFull<M>,
|
||||
pub opreturn: ValueFromHeightCumulative<M>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user