global: snapshot

This commit is contained in:
nym21
2026-03-17 12:37:56 +01:00
parent f62943199c
commit 42540fba99
22 changed files with 736 additions and 794 deletions

View File

@@ -16,7 +16,7 @@ impl Vecs {
exit: &Exit,
) -> Result<()> {
self.spent
.compute(&self.db, indexer, starting_indexes, exit)?;
.compute(indexer, starting_indexes, exit)?;
self.count
.compute(indexer, indexes, blocks, starting_indexes, exit)?;

View File

@@ -2,7 +2,7 @@ use brk_error::Result;
use brk_indexer::Indexer;
use brk_types::{Indexes, Sats, TxIndex, TxOutIndex, Vout};
use tracing::info;
use vecdb::{AnyStoredVec, AnyVec, Database, Exit, ReadableVec, VecIndex, WritableVec};
use vecdb::{AnyStoredVec, AnyVec, Exit, ReadableVec, VecIndex, WritableVec};
use super::Vecs;
@@ -11,7 +11,6 @@ const BATCH_SIZE: usize = 2 * 1024 * 1024 * 1024 / size_of::<Entry>();
impl Vecs {
pub(crate) fn compute(
&mut self,
db: &Database,
indexer: &Indexer,
starting_indexes: &Indexes,
exit: &Exit,
@@ -105,14 +104,13 @@ impl Vecs {
self.value.push(out_value[i]);
}
if batch_end < target {
info!("TxIns: {:.2}%", batch_end as f64 / target as f64 * 100.0);
}
let _lock = exit.lock();
self.txout_index.write()?;
self.value.write()?;
db.flush()?;
if batch_end < target {
info!("TxIns: {:.2}%", batch_end as f64 / target as f64 * 100.0);
}
batch_start = batch_end;
}