global: snapshot

This commit is contained in:
nym21
2025-04-03 14:31:39 +02:00
parent 4c2da31bb3
commit e8c34dd59b
51 changed files with 2561 additions and 5501 deletions

View File

@@ -12,8 +12,10 @@ pub struct Stores {
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))?;
let address_to_utxos_received =
Store::import(&path.join("address_to_utxos_received"), Version::ONE)?;
let address_to_utxos_spent =
Store::import(&path.join("address_to_utxos_spent"), Version::ONE)?;
Ok(Self {
address_to_utxos_received,

View File

@@ -137,7 +137,7 @@ where
F: FnMut((A, B, &mut Self, &mut brk_vec::StorableVec<A, B>)) -> (I, T),
{
self.validate_computed_version_or_reset_file(
Version::from(0) + self.version() + other.version(),
Version::ZERO + self.version() + other.version(),
)?;
let index = max_from.min(A::from(self.len()));
@@ -160,7 +160,7 @@ where
T: StoredIndex,
{
self.validate_computed_version_or_reset_file(
Version::from(0) + self.version() + other.version(),
Version::ZERO + self.version() + other.version(),
)?;
let index = max_from.min(self.vec.get_last()?.cloned().unwrap_or_default());
@@ -188,7 +188,7 @@ where
T: StoredIndex,
{
self.validate_computed_version_or_reset_file(
Version::from(0) + self.version() + first_indexes.version() + last_indexes.version(),
Version::ZERO + self.version() + first_indexes.version() + last_indexes.version(),
)?;
let index = max_from.min(T::from(self.len()));
@@ -213,7 +213,7 @@ where
T: Copy + From<usize> + CheckedSub<T> + StoredIndex,
{
self.validate_computed_version_or_reset_file(
Version::from(0) + self.version() + first_indexes.version(),
Version::ZERO + self.version() + first_indexes.version(),
)?;
let index = max_from.min(I::from(self.len()));
@@ -250,7 +250,7 @@ where
<T2 as TryInto<T>>::Error: error::Error + 'static,
{
self.validate_computed_version_or_reset_file(
Version::from(0) + self.version() + first_indexes.version() + last_indexes.version(),
Version::ZERO + self.version() + first_indexes.version() + last_indexes.version(),
)?;
let index = max_from.min(I::from(self.len()));
@@ -278,7 +278,7 @@ where
A: StoredIndex + StoredType,
{
self.validate_computed_version_or_reset_file(
Version::from(0) + self.version() + self_to_other.version() + other_to_self.version(),
Version::ZERO + self.version() + self_to_other.version() + other_to_self.version(),
)?;
let index = max_from.min(I::from(self.len()));
@@ -302,7 +302,7 @@ where
<T2 as TryInto<T>>::Error: error::Error + 'static,
{
self.validate_computed_version_or_reset_file(
Version::from(0) + self.version() + first_indexes.version() + last_indexes.version(),
Version::ZERO + self.version() + first_indexes.version() + last_indexes.version(),
)?;
let index = max_from.min(I::from(self.len()));

View File

@@ -25,7 +25,7 @@ impl Vecs {
Ok(Self {
height_to_block_interval: StorableVec::forced_import(
&path.join("height_to_block_interval"),
Version::from(1),
Version::ONE,
compressed,
)?,
indexes_to_block_interval_stats: StorableVecsStatsFromHeight::forced_import(
@@ -38,12 +38,12 @@ impl Vecs {
)?,
dateindex_to_block_count: StorableVec::forced_import(
&path.join("dateindex_to_block_count"),
Version::from(1),
Version::ONE,
compressed,
)?,
dateindex_to_total_block_count: StorableVec::forced_import(
&path.join("dateindex_to_total_block_count"),
Version::from(1),
Version::ONE,
compressed,
)?,
})

View File

@@ -71,242 +71,242 @@ impl Vecs {
Ok(Self {
dateindex_to_date: StorableVec::forced_import(
&path.join("dateindex_to_date"),
Version::from(1),
Version::ONE,
compressed,
)?,
dateindex_to_dateindex: StorableVec::forced_import(
&path.join("dateindex_to_dateindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
dateindex_to_first_height: StorableVec::forced_import(
&path.join("dateindex_to_first_height"),
Version::from(1),
Version::ONE,
compressed,
)?,
dateindex_to_last_height: StorableVec::forced_import(
&path.join("dateindex_to_last_height"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_real_date: StorableVec::forced_import(
&path.join("height_to_real_date"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_fixed_date: StorableVec::forced_import(
&path.join("height_to_fixed_date"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_dateindex: StorableVec::forced_import(
&path.join("height_to_dateindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_height: StorableVec::forced_import(
&path.join("height_to_height"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_last_txindex: StorableVec::forced_import(
&path.join("height_to_last_txindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
txindex_to_last_txinindex: StorableVec::forced_import(
&path.join("txindex_to_last_txinindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
txindex_to_last_txoutindex: StorableVec::forced_import(
&path.join("txindex_to_last_txoutindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
difficultyepoch_to_first_height: StorableVec::forced_import(
&path.join("difficultyepoch_to_first_height"),
Version::from(1),
Version::ONE,
compressed,
)?,
difficultyepoch_to_last_height: StorableVec::forced_import(
&path.join("difficultyepoch_to_last_height"),
Version::from(1),
Version::ONE,
compressed,
)?,
halvingepoch_to_first_height: StorableVec::forced_import(
&path.join("halvingepoch_to_first_height"),
Version::from(1),
Version::ONE,
compressed,
)?,
halvingepoch_to_last_height: StorableVec::forced_import(
&path.join("halvingepoch_to_last_height"),
Version::from(1),
Version::ONE,
compressed,
)?,
weekindex_to_first_dateindex: StorableVec::forced_import(
&path.join("weekindex_to_first_dateindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
weekindex_to_last_dateindex: StorableVec::forced_import(
&path.join("weekindex_to_last_dateindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
monthindex_to_first_dateindex: StorableVec::forced_import(
&path.join("monthindex_to_first_dateindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
monthindex_to_last_dateindex: StorableVec::forced_import(
&path.join("monthindex_to_last_dateindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
yearindex_to_first_monthindex: StorableVec::forced_import(
&path.join("yearindex_to_first_monthindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
yearindex_to_last_monthindex: StorableVec::forced_import(
&path.join("yearindex_to_last_monthindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
decadeindex_to_first_yearindex: StorableVec::forced_import(
&path.join("decadeindex_to_first_yearindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
decadeindex_to_last_yearindex: StorableVec::forced_import(
&path.join("decadeindex_to_last_yearindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
dateindex_to_weekindex: StorableVec::forced_import(
&path.join("dateindex_to_weekindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
dateindex_to_monthindex: StorableVec::forced_import(
&path.join("dateindex_to_monthindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
monthindex_to_yearindex: StorableVec::forced_import(
&path.join("monthindex_to_yearindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
yearindex_to_decadeindex: StorableVec::forced_import(
&path.join("yearindex_to_decadeindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_difficultyepoch: StorableVec::forced_import(
&path.join("height_to_difficultyepoch"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_halvingepoch: StorableVec::forced_import(
&path.join("height_to_halvingepoch"),
Version::from(1),
Version::ONE,
compressed,
)?,
weekindex_to_weekindex: StorableVec::forced_import(
&path.join("weekindex_to_weekindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
monthindex_to_monthindex: StorableVec::forced_import(
&path.join("monthindex_to_monthindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
yearindex_to_yearindex: StorableVec::forced_import(
&path.join("yearindex_to_yearindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
decadeindex_to_decadeindex: StorableVec::forced_import(
&path.join("decadeindex_to_decadeindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
difficultyepoch_to_difficultyepoch: StorableVec::forced_import(
&path.join("difficultyepoch_to_difficultyepoch"),
Version::from(1),
Version::ONE,
compressed,
)?,
halvingepoch_to_halvingepoch: StorableVec::forced_import(
&path.join("halvingepoch_to_halvingepoch"),
Version::from(1),
Version::ONE,
compressed,
)?,
dateindex_to_timestamp: StorableVec::forced_import(
&path.join("dateindex_to_timestamp"),
Version::from(1),
Version::ONE,
compressed,
)?,
decadeindex_to_timestamp: StorableVec::forced_import(
&path.join("decadeindex_to_timestamp"),
Version::from(1),
Version::ONE,
compressed,
)?,
difficultyepoch_to_timestamp: StorableVec::forced_import(
&path.join("difficultyepoch_to_timestamp"),
Version::from(1),
Version::ONE,
compressed,
)?,
halvingepoch_to_timestamp: StorableVec::forced_import(
&path.join("halvingepoch_to_timestamp"),
Version::from(1),
Version::ONE,
compressed,
)?,
monthindex_to_timestamp: StorableVec::forced_import(
&path.join("monthindex_to_timestamp"),
Version::from(1),
Version::ONE,
compressed,
)?,
weekindex_to_timestamp: StorableVec::forced_import(
&path.join("weekindex_to_timestamp"),
Version::from(1),
Version::ONE,
compressed,
)?,
yearindex_to_timestamp: StorableVec::forced_import(
&path.join("yearindex_to_timestamp"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_fixed_timestamp: StorableVec::forced_import(
&path.join("height_to_fixed_timestamp"),
Version::from(1),
Version::ONE,
compressed,
)?,
monthindex_to_quarterindex: StorableVec::forced_import(
&path.join("monthindex_to_quarterindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
quarterindex_to_first_monthindex: StorableVec::forced_import(
&path.join("quarterindex_to_first_monthindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
quarterindex_to_last_monthindex: StorableVec::forced_import(
&path.join("quarterindex_to_last_monthindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
quarterindex_to_quarterindex: StorableVec::forced_import(
&path.join("quarterindex_to_quarterindex"),
Version::from(1),
Version::ONE,
compressed,
)?,
quarterindex_to_timestamp: StorableVec::forced_import(
&path.join("quarterindex_to_timestamp"),
Version::from(1),
Version::ONE,
compressed,
)?,
})

View File

@@ -66,112 +66,112 @@ impl Vecs {
Ok(Self {
dateindex_to_ohlc_in_cents: StorableVec::forced_import(
&path.join("dateindex_to_ohlc_in_cents"),
Version::from(1),
Version::ONE,
compressed,
)?,
dateindex_to_ohlc: StorableVec::forced_import(
&path.join("dateindex_to_ohlc"),
Version::from(1),
Version::ONE,
compressed,
)?,
dateindex_to_close_in_cents: StorableVec::forced_import(
&path.join("dateindex_to_close_in_cents"),
Version::from(1),
Version::ONE,
compressed,
)?,
dateindex_to_close: StorableVec::forced_import(
&path.join("dateindex_to_close"),
Version::from(1),
Version::ONE,
compressed,
)?,
dateindex_to_high_in_cents: StorableVec::forced_import(
&path.join("dateindex_to_high_in_cents"),
Version::from(1),
Version::ONE,
compressed,
)?,
dateindex_to_high: StorableVec::forced_import(
&path.join("dateindex_to_high"),
Version::from(1),
Version::ONE,
compressed,
)?,
dateindex_to_low_in_cents: StorableVec::forced_import(
&path.join("dateindex_to_low_in_cents"),
Version::from(1),
Version::ONE,
compressed,
)?,
dateindex_to_low: StorableVec::forced_import(
&path.join("dateindex_to_low"),
Version::from(1),
Version::ONE,
compressed,
)?,
dateindex_to_open_in_cents: StorableVec::forced_import(
&path.join("dateindex_to_open_in_cents"),
Version::from(1),
Version::ONE,
compressed,
)?,
dateindex_to_open: StorableVec::forced_import(
&path.join("dateindex_to_open"),
Version::from(1),
Version::ONE,
compressed,
)?,
dateindex_to_sats_per_dollar: StorableVec::forced_import(
&path.join("dateindex_to_sats_per_dollar"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_ohlc_in_cents: StorableVec::forced_import(
&path.join("height_to_ohlc_in_cents"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_ohlc: StorableVec::forced_import(
&path.join("height_to_ohlc"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_close_in_cents: StorableVec::forced_import(
&path.join("height_to_close_in_cents"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_close: StorableVec::forced_import(
&path.join("height_to_close"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_high_in_cents: StorableVec::forced_import(
&path.join("height_to_high_in_cents"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_high: StorableVec::forced_import(
&path.join("height_to_high"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_low_in_cents: StorableVec::forced_import(
&path.join("height_to_low_in_cents"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_low: StorableVec::forced_import(
&path.join("height_to_low"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_open_in_cents: StorableVec::forced_import(
&path.join("height_to_open_in_cents"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_open: StorableVec::forced_import(
&path.join("height_to_open"),
Version::from(1),
Version::ONE,
compressed,
)?,
height_to_sats_per_dollar: StorableVec::forced_import(
&path.join("height_to_sats_per_dollar"),
Version::from(1),
Version::ONE,
compressed,
)?,
timeindexes_to_open: StorableVecsStatsFromDate::forced_import(
@@ -226,33 +226,33 @@ impl Vecs {
)?,
weekindex_to_ohlc: StorableVec::forced_import(
&path.join("weekindex_to_ohlc"),
Version::from(1),
Version::ONE,
compressed,
)?,
difficultyepoch_to_ohlc: StorableVec::forced_import(
&path.join("difficultyepoch_to_ohlc"),
Version::from(1),
Version::ONE,
compressed,
)?,
monthindex_to_ohlc: StorableVec::forced_import(
&path.join("monthindex_to_ohlc"),
Version::from(1),
Version::ONE,
compressed,
)?,
quarterindex_to_ohlc: StorableVec::forced_import(
&path.join("quarterindex_to_ohlc"),
Version::from(1),
Version::ONE,
compressed,
)?,
yearindex_to_ohlc: StorableVec::forced_import(
&path.join("yearindex_to_ohlc"),
Version::from(1),
Version::ONE,
compressed,
)?,
// halvingepoch_to_ohlc: StorableVec::forced_import(&path.join("halvingepoch_to_ohlc"), Version::from(1), compressed)?,
// halvingepoch_to_ohlc: StorableVec::forced_import(&path.join("halvingepoch_to_ohlc"), Version::ONE, compressed)?,
decadeindex_to_ohlc: StorableVec::forced_import(
&path.join("decadeindex_to_ohlc"),
Version::from(1),
Version::ONE,
compressed,
)?,
})

View File

@@ -44,43 +44,42 @@ where
let s = Self {
first: options.first.then(|| {
StorableVec::forced_import(&prefix("first"), Version::from(1), compressed).unwrap()
StorableVec::forced_import(&prefix("first"), Version::ONE, compressed).unwrap()
}),
last: options.last.then(|| {
StorableVec::forced_import(
&path.with_file_name(format!("{key}_to_{name}")),
Version::from(1),
Version::ONE,
compressed,
)
.unwrap()
}),
min: options.min.then(|| {
StorableVec::forced_import(&suffix("min"), Version::from(1), compressed).unwrap()
StorableVec::forced_import(&suffix("min"), Version::ONE, compressed).unwrap()
}),
max: options.max.then(|| {
StorableVec::forced_import(&suffix("max"), Version::from(1), compressed).unwrap()
StorableVec::forced_import(&suffix("max"), Version::ONE, compressed).unwrap()
}),
median: options.median.then(|| {
StorableVec::forced_import(&suffix("median"), Version::from(1), compressed).unwrap()
StorableVec::forced_import(&suffix("median"), Version::ONE, compressed).unwrap()
}),
average: options.average.then(|| {
StorableVec::forced_import(&suffix("average"), Version::from(1), compressed)
.unwrap()
StorableVec::forced_import(&suffix("average"), Version::ONE, compressed).unwrap()
}),
sum: options.sum.then(|| {
StorableVec::forced_import(&suffix("sum"), Version::from(1), compressed).unwrap()
StorableVec::forced_import(&suffix("sum"), Version::ONE, compressed).unwrap()
}),
_90p: options._90p.then(|| {
StorableVec::forced_import(&suffix("90p"), Version::from(1), compressed).unwrap()
StorableVec::forced_import(&suffix("90p"), Version::ONE, compressed).unwrap()
}),
_75p: options._75p.then(|| {
StorableVec::forced_import(&suffix("75p"), Version::from(1), compressed).unwrap()
StorableVec::forced_import(&suffix("75p"), Version::ONE, compressed).unwrap()
}),
_25p: options._25p.then(|| {
StorableVec::forced_import(&suffix("25p"), Version::from(1), compressed).unwrap()
StorableVec::forced_import(&suffix("25p"), Version::ONE, compressed).unwrap()
}),
_10p: options._10p.then(|| {
StorableVec::forced_import(&suffix("10p"), Version::from(1), compressed).unwrap()
StorableVec::forced_import(&suffix("10p"), Version::ONE, compressed).unwrap()
}),
};

View File

@@ -33,52 +33,52 @@ impl Vecs {
fs::create_dir_all(path)?;
Ok(Self {
// height_to_fee: StorableVec::forced_import(&path.join("height_to_fee"), Version::from(1))?,
// height_to_fee: StorableVec::forced_import(&path.join("height_to_fee"), Version::ONE)?,
// height_to_input_count: StorableVec::forced_import(
// &path.join("height_to_input_count"),
// Version::from(1),
// Version::ONE,
// )?,
// 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_maxfeerate: StorableVec::forced_import(&path.join("height_to_maxfeerate"), Version::ONE)?,
// height_to_medianfeerate: StorableVec::forced_import(&path.join("height_to_medianfeerate"), Version::ONE)?,
// height_to_minfeerate: StorableVec::forced_import(&path.join("height_to_minfeerate"), Version::ONE)?,
// height_to_output_count: StorableVec::forced_import(
// &path.join("height_to_output_count"),
// Version::from(1),
// Version::ONE,
// )?,
// 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))?,
// height_to_subsidy: StorableVec::forced_import(&path.join("height_to_subsidy"), Version::ONE)?,
// height_to_totalfees: StorableVec::forced_import(&path.join("height_to_totalfees"), Version::ONE)?,
// height_to_txcount: StorableVec::forced_import(&path.join("height_to_txcount"), Version::ONE)?,
// txindex_to_fee: StorableVec::forced_import(
// &path.join("txindex_to_fee"),
// Version::from(1),
// Version::ONE,
// )?,
txindex_to_is_coinbase: StorableVec::forced_import(
&path.join("txindex_to_is_coinbase"),
Version::from(1),
Version::ONE,
compressed,
)?,
// txindex_to_feerate: StorableVec::forced_import(&path.join("txindex_to_feerate"), Version::from(1))?,
// txindex_to_feerate: StorableVec::forced_import(&path.join("txindex_to_feerate"), Version::ONE)?,
txindex_to_inputs_count: StorableVec::forced_import(
&path.join("txindex_to_inputs_count"),
Version::from(1),
Version::ONE,
compressed,
)?,
// txindex_to_inputs_sum: StorableVec::forced_import(
// &path.join("txindex_to_inputs_sum"),
// Version::from(1),
// Version::ONE,
// )?,
txindex_to_outputs_count: StorableVec::forced_import(
&path.join("txindex_to_outputs_count"),
Version::from(1),
Version::ONE,
compressed,
)?,
// txindex_to_outputs_sum: StorableVec::forced_import(
// &path.join("txindex_to_outputs_sum"),
// Version::from(1),
// Version::ONE,
// )?,
// txinindex_to_value: StorableVec::forced_import(
// &path.join("txinindex_to_value"),
// Version::from(1),
// Version::ONE,
// compressed,
// )?,
})