use std::{fs, path::Path}; use indexer::{Addressindex, Height, Sats, Timestamp, Txindex, Txinindex, Txoutindex}; use pricer::{Date, Dateindex}; use storable_vec::{StorableVec, Version}; use crate::structs::Feerate; // mod base; // use base::*; pub struct StorableVecs { pub dateindex_to_first_height: StorableVec, // pub dateindex_to_last_height: StorableVec, // pub height_to_block_interval: StorableVec, pub height_to_date: StorableVec, pub height_to_dateindex: StorableVec, // pub height_to_fee: StorableVec, // pub height_to_inputcount: StorableVec, // pub height_to_last_addressindex: StorableVec, pub height_to_last_txindex: StorableVec, // pub height_to_last_txoutindex: StorableVec, // pub height_to_maxfeerate: StorableVec, // pub height_to_medianfeerate: StorableVec, // pub height_to_minfeerate: StorableVec, // pub height_to_outputcount: StorableVec, // pub height_to_subsidy: StorableVec, // pub height_to_totalfees: StorableVec, // pub height_to_txcount: StorableVec, pub txindex_to_fee: StorableVec, pub txindex_to_height: StorableVec, pub txindex_to_is_coinbase: StorableVec, // pub txindex_to_feerate: StorableVec, pub txindex_to_inputs_count: StorableVec, pub txindex_to_inputs_sum: StorableVec, pub txindex_to_last_txinindex: StorableVec, pub txindex_to_last_txoutindex: StorableVec, pub txindex_to_outputs_count: StorableVec, pub txindex_to_outputs_sum: StorableVec, } impl StorableVecs { pub fn import(path: &Path) -> color_eyre::Result { fs::create_dir_all(path)?; Ok(Self { dateindex_to_first_height: StorableVec::forced_import( &path.join("dateindex_to_first_height"), Version::from(1), )?, // height_to_block_interval: StorableVec::forced_import(&path.join("height_to_block_interval"), Version::from(1))?, height_to_date: StorableVec::forced_import(&path.join("height_to_date"), Version::from(1))?, height_to_dateindex: StorableVec::forced_import(&path.join("height_to_dateindex"), Version::from(1))?, // height_to_fee: StorableVec::forced_import(&path.join("height_to_fee"), Version::from(1))?, // height_to_inputcount: StorableVec::forced_import(&path.join("height_to_inputcount"), Version::from(1))?, // height_to_last_addressindex: StorableVec::forced_import( // &path.join("height_to_last_addressindex"), // Version::from(1), // )?, height_to_last_txindex: StorableVec::forced_import(&path.join("height_to_last_txindex"), Version::from(1))?, // height_to_last_txoutindex: StorableVec::forced_import(&path.join("height_to_last_txoutindex"), Version::from(1))?, // height_to_maxfeerate: StorableVec::forced_import(&path.join("height_to_maxfeerate"), Version::from(1))?, // height_to_medianfeerate: StorableVec::forced_import(&path.join("height_to_medianfeerate"), Version::from(1))?, // height_to_minfeerate: StorableVec::forced_import(&path.join("height_to_minfeerate"), Version::from(1))?, // height_to_outputcount: StorableVec::forced_import(&path.join("height_to_outputcount"), Version::from(1))?, // height_to_subsidy: StorableVec::forced_import(&path.join("height_to_subsidy"), Version::from(1))?, // height_to_totalfees: StorableVec::forced_import(&path.join("height_to_totalfees"), Version::from(1))?, // height_to_txcount: StorableVec::forced_import(&path.join("height_to_txcount"), Version::from(1))?, txindex_to_fee: StorableVec::forced_import(&path.join("txindex_to_fee"), Version::from(1))?, txindex_to_height: StorableVec::forced_import(&path.join("txindex_to_height"), Version::from(1))?, txindex_to_is_coinbase: StorableVec::forced_import(&path.join("txindex_to_is_coinbase"), Version::from(1))?, // txindex_to_feerate: StorableVec::forced_import(&path.join("txindex_to_feerate"), Version::from(1))?, txindex_to_inputs_count: StorableVec::forced_import( &path.join("txindex_to_inputs_count"), Version::from(1), )?, txindex_to_inputs_sum: StorableVec::forced_import(&path.join("txindex_to_inputs_sum"), Version::from(1))?, txindex_to_last_txinindex: StorableVec::forced_import( &path.join("txindex_to_last_txinindex"), Version::from(1), )?, txindex_to_last_txoutindex: StorableVec::forced_import( &path.join("txindex_to_last_txoutindex"), Version::from(1), )?, txindex_to_outputs_count: StorableVec::forced_import( &path.join("txindex_to_outputs_count"), Version::from(1), )?, txindex_to_outputs_sum: StorableVec::forced_import(&path.join("txindex_to_outputs_sum"), Version::from(1))?, }) } // pub fn as_slice(&self) -> [&dyn AnyComputedStorableVec; 1] { // [&self.dateindex_to_first_height] // } // pub fn as_mut_slice(&mut self) -> [&mut dyn AnyComputedStorableVec; 1] { // [&mut self.dateindex_to_first_height] // } }