mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-28 03:08:10 -07:00
global: snapshot
This commit is contained in:
@@ -5,14 +5,28 @@ use vecdb::Database;
|
||||
use super::Vecs;
|
||||
use crate::{
|
||||
indexes,
|
||||
internal::{ComputedFromHeightFull, ComputedFromHeightLast},
|
||||
internal::{ComputedFromHeightAggregated, ComputedFromHeight},
|
||||
};
|
||||
|
||||
impl Vecs {
|
||||
pub(crate) fn forced_import(db: &Database, version: Version, indexes: &indexes::Vecs) -> Result<Self> {
|
||||
pub(crate) fn forced_import(
|
||||
db: &Database,
|
||||
version: Version,
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
Ok(Self {
|
||||
total_count: ComputedFromHeightFull::forced_import(db, "output_count", version, indexes)?,
|
||||
utxo_count: ComputedFromHeightLast::forced_import(db, "exact_utxo_count", version, indexes)?,
|
||||
total_count: ComputedFromHeightAggregated::forced_import(
|
||||
db,
|
||||
"output_count",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
utxo_count: ComputedFromHeight::forced_import(
|
||||
db,
|
||||
"exact_utxo_count",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@ use brk_traversable::Traversable;
|
||||
use brk_types::StoredU64;
|
||||
use vecdb::{Rw, StorageMode};
|
||||
|
||||
use crate::internal::{ComputedFromHeightFull, ComputedFromHeightLast};
|
||||
use crate::internal::{ComputedFromHeightAggregated, ComputedFromHeight};
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub total_count: ComputedFromHeightFull<StoredU64, M>,
|
||||
pub utxo_count: ComputedFromHeightLast<StoredU64, M>,
|
||||
pub total_count: ComputedFromHeightAggregated<StoredU64, M>,
|
||||
pub utxo_count: ComputedFromHeight<StoredU64, M>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user