global: snapshot

This commit is contained in:
nym21
2025-02-27 12:32:54 +01:00
parent 677aca7a03
commit 877f9299e1
53 changed files with 259 additions and 203 deletions

View File

@@ -1,5 +1,5 @@
mod fjalls;
mod storable_vecs;
mod stores;
mod vecs;
pub use fjalls::*;
pub use storable_vecs::*;
pub use stores::*;
pub use vecs::*;

View File

@@ -2,14 +2,14 @@ use std::path::Path;
use brk_core::{AddressindexTxoutindex, Unit};
use brk_indexer::Store;
use storable_vec::Version;
use brk_vec::Version;
pub struct Fjalls {
pub struct Stores {
pub address_to_utxos_received: Store<AddressindexTxoutindex, Unit>,
pub address_to_utxos_spent: Store<AddressindexTxoutindex, Unit>,
}
impl Fjalls {
impl Stores {
pub fn import(path: &Path) -> color_eyre::Result<Self> {
let address_to_utxos_received = Store::import(&path.join("address_to_utxos_received"), Version::from(1))?;
let address_to_utxos_spent = Store::import(&path.join("address_to_utxos_spent"), Version::from(1))?;

View File

@@ -4,13 +4,13 @@ use brk_core::{
Addressindex, Cents, Close, Date, Dateindex, Dollars, Feerate, Height, High, Low, Open, Sats, Timestamp, Txindex,
Txinindex, Txoutindex,
};
use storable_vec::{StorableVec, Version};
use brk_vec::{StorableVec, Version};
// mod base;
// use base::*;
pub struct StorableVecs<const MODE: u8> {
pub struct Vecs<const MODE: u8> {
pub dateindex_to_first_height: StorableVec<Dateindex, Height, MODE>,
// pub dateindex_to_last_height: StorableVec<Dateindex, Height, MODE>,
// pub height_to_block_interval: StorableVec<Height, Timestamp, MODE>,
@@ -56,7 +56,7 @@ pub struct StorableVecs<const MODE: u8> {
pub txindex_to_outputs_sum: StorableVec<Txindex, Sats, MODE>,
}
impl<const MODE: u8> StorableVecs<MODE> {
impl<const MODE: u8> Vecs<MODE> {
pub fn import(path: &Path) -> color_eyre::Result<Self> {
fs::create_dir_all(path)?;