global: snapshot

This commit is contained in:
nym21
2026-03-04 17:10:15 +01:00
parent 891f0dad9e
commit 9e23de4ba1
313 changed files with 9087 additions and 4918 deletions
+6 -14
View File
@@ -1,11 +1,12 @@
use std::path::Path;
use brk_error::Result;
use brk_traversable::Traversable;
use brk_types::Version;
use vecdb::{Database, PAGE_SIZE};
use crate::indexes;
use crate::{
indexes,
internal::{finalize_db, open_db},
};
use super::{HashrateVecs, RewardsVecs, Vecs};
@@ -15,9 +16,7 @@ impl Vecs {
parent_version: Version,
indexes: &indexes::Vecs,
) -> Result<Self> {
let db = Database::open(&parent_path.join(super::DB_NAME))?;
db.set_min_len(PAGE_SIZE * 50_000_000)?;
let db = open_db(parent_path, super::DB_NAME, 50_000_000)?;
let version = parent_version;
let rewards = RewardsVecs::forced_import(&db, version, indexes)?;
@@ -28,14 +27,7 @@ impl Vecs {
rewards,
hashrate,
};
this.db.retain_regions(
this.iter_any_exportable()
.flat_map(|v| v.region_names())
.collect(),
)?;
this.db.compact()?;
finalize_db(&this.db, &this)?;
Ok(this)
}
}