mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-29 21:59:27 -07:00
global: snapshot
This commit is contained in:
@@ -7,8 +7,8 @@ use brk_traversable::Traversable;
|
||||
use brk_types::{Address, AddressBytes, Height, OutputType, PoolId, Pools, TxOutIndex, pools};
|
||||
use rayon::prelude::*;
|
||||
use vecdb::{
|
||||
AnyStoredVec, AnyVec, Database, Exit, GenericStoredVec, IterableVec, PAGE_SIZE, RawVec,
|
||||
TypedVecIterator, VecIndex, Version,
|
||||
AnyStoredVec, AnyVec, BytesVec, Database, Exit, GenericStoredVec, Importable, IterableVec,
|
||||
PAGE_SIZE, TypedVecIterator, VecIndex, Version,
|
||||
};
|
||||
|
||||
mod vecs;
|
||||
@@ -24,7 +24,7 @@ pub struct Vecs {
|
||||
db: Database,
|
||||
pools: &'static Pools,
|
||||
|
||||
pub height_to_pool: RawVec<Height, PoolId>,
|
||||
pub height_to_pool: BytesVec<Height, PoolId>,
|
||||
pub vecs: BTreeMap<PoolId, vecs::Vecs>,
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ impl Vecs {
|
||||
let version = parent_version + Version::new(3) + Version::new(pools.len() as u64);
|
||||
|
||||
let this = Self {
|
||||
height_to_pool: RawVec::forced_import(&db, "pool", version + Version::ZERO)?,
|
||||
height_to_pool: BytesVec::forced_import(&db, "pool", version + Version::ZERO)?,
|
||||
vecs: pools
|
||||
.iter()
|
||||
.map(|pool| {
|
||||
@@ -62,7 +62,7 @@ impl Vecs {
|
||||
};
|
||||
|
||||
this.db.retain_regions(
|
||||
this.iter_any_writable()
|
||||
this.iter_any_exportable()
|
||||
.flat_map(|v| v.region_names())
|
||||
.collect(),
|
||||
)?;
|
||||
|
||||
@@ -353,7 +353,7 @@ impl Vecs {
|
||||
if prev.is_none() {
|
||||
let i = i.to_usize();
|
||||
prev.replace(if i > 0 {
|
||||
slf.get_or_read_at_unwrap_once(i - 1)
|
||||
slf.get_pushed_or_read_at_unwrap_once(i - 1)
|
||||
} else {
|
||||
StoredU16::ZERO
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user