global: versions

This commit is contained in:
nym21
2025-05-26 11:34:37 +02:00
parent a8ee4cf57f
commit 34919aba05
32 changed files with 883 additions and 577 deletions

View File

@@ -66,11 +66,12 @@ pub struct Vecs {
}
const VERSION: Version = Version::ZERO;
const VERSION_IN_SATS: Version = Version::ONE;
const VERSION_IN_SATS: Version = Version::ZERO;
impl Vecs {
pub fn forced_import(
path: &Path,
version: Version,
_computation: Computation,
compressed: Compressed,
) -> color_eyre::Result<Self> {
@@ -84,236 +85,271 @@ impl Vecs {
dateindex_to_ohlc_in_cents: EagerVec::forced_import(
&fetched_path,
"ohlc_in_cents",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
)?,
dateindex_to_ohlc: EagerVec::forced_import(
path,
"ohlc",
version + VERSION + Version::ZERO,
compressed,
)?,
dateindex_to_ohlc: EagerVec::forced_import(path, "ohlc", Version::ZERO, compressed)?,
dateindex_to_ohlc_in_sats: EagerVec::forced_import(
path,
"ohlc_in_sats",
VERSION + VERSION_IN_SATS + Version::ZERO,
version + VERSION + VERSION_IN_SATS + Version::ZERO,
compressed,
)?,
dateindex_to_close_in_cents: EagerVec::forced_import(
path,
"close_in_cents",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
)?,
dateindex_to_high_in_cents: EagerVec::forced_import(
path,
"high_in_cents",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
)?,
dateindex_to_low_in_cents: EagerVec::forced_import(
path,
"low_in_cents",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
)?,
dateindex_to_open_in_cents: EagerVec::forced_import(
path,
"open_in_cents",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
)?,
height_to_ohlc_in_cents: EagerVec::forced_import(
&fetched_path,
"ohlc_in_cents",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
)?,
height_to_ohlc: EagerVec::forced_import(
path,
"ohlc",
version + VERSION + Version::ZERO,
compressed,
)?,
height_to_ohlc: EagerVec::forced_import(path, "ohlc", Version::ZERO, compressed)?,
height_to_ohlc_in_sats: EagerVec::forced_import(
path,
"ohlc_in_sats",
VERSION + VERSION_IN_SATS + Version::ZERO,
version + VERSION + VERSION_IN_SATS + Version::ZERO,
compressed,
)?,
height_to_close_in_cents: EagerVec::forced_import(
path,
"close_in_cents",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
)?,
height_to_high_in_cents: EagerVec::forced_import(
path,
"high_in_cents",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
)?,
height_to_low_in_cents: EagerVec::forced_import(
path,
"low_in_cents",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
)?,
height_to_open_in_cents: EagerVec::forced_import(
path,
"open_in_cents",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
)?,
timeindexes_to_open: ComputedVecsFromDateIndex::forced_import(
path,
"open",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
StorableVecGeneatorOptions::default().add_first(),
)?,
timeindexes_to_high: ComputedVecsFromDateIndex::forced_import(
path,
"high",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
StorableVecGeneatorOptions::default().add_max(),
)?,
timeindexes_to_low: ComputedVecsFromDateIndex::forced_import(
path,
"low",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
StorableVecGeneatorOptions::default().add_min(),
)?,
timeindexes_to_close: ComputedVecsFromDateIndex::forced_import(
path,
"close",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
StorableVecGeneatorOptions::default().add_last(),
)?,
timeindexes_to_open_in_sats: ComputedVecsFromDateIndex::forced_import(
path,
"open_in_sats",
VERSION + VERSION_IN_SATS + Version::ZERO,
version + VERSION + VERSION_IN_SATS + Version::ZERO,
compressed,
StorableVecGeneatorOptions::default().add_first(),
)?,
timeindexes_to_high_in_sats: ComputedVecsFromDateIndex::forced_import(
path,
"high_in_sats",
VERSION + VERSION_IN_SATS + Version::ZERO,
version + VERSION + VERSION_IN_SATS + Version::ZERO,
compressed,
StorableVecGeneatorOptions::default().add_max(),
)?,
timeindexes_to_low_in_sats: ComputedVecsFromDateIndex::forced_import(
path,
"low_in_sats",
VERSION + VERSION_IN_SATS + Version::ZERO,
version + VERSION + VERSION_IN_SATS + Version::ZERO,
compressed,
StorableVecGeneatorOptions::default().add_min(),
)?,
timeindexes_to_close_in_sats: ComputedVecsFromDateIndex::forced_import(
path,
"close_in_sats",
VERSION + VERSION_IN_SATS + Version::ZERO,
version + VERSION + VERSION_IN_SATS + Version::ZERO,
compressed,
StorableVecGeneatorOptions::default().add_last(),
)?,
chainindexes_to_open: ComputedVecsFromHeightStrict::forced_import(
path,
"open",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
StorableVecGeneatorOptions::default().add_first(),
)?,
chainindexes_to_high: ComputedVecsFromHeightStrict::forced_import(
path,
"high",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
StorableVecGeneatorOptions::default().add_max(),
)?,
chainindexes_to_low: ComputedVecsFromHeightStrict::forced_import(
path,
"low",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
StorableVecGeneatorOptions::default().add_min(),
)?,
chainindexes_to_close: ComputedVecsFromHeightStrict::forced_import(
path,
"close",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
StorableVecGeneatorOptions::default().add_last(),
)?,
chainindexes_to_open_in_sats: ComputedVecsFromHeightStrict::forced_import(
path,
"open_in_sats",
VERSION + VERSION_IN_SATS + Version::ZERO,
version + VERSION + VERSION_IN_SATS + Version::ZERO,
compressed,
StorableVecGeneatorOptions::default().add_first(),
)?,
chainindexes_to_high_in_sats: ComputedVecsFromHeightStrict::forced_import(
path,
"high_in_sats",
VERSION + VERSION_IN_SATS + Version::ZERO,
version + VERSION + VERSION_IN_SATS + Version::ZERO,
compressed,
StorableVecGeneatorOptions::default().add_max(),
)?,
chainindexes_to_low_in_sats: ComputedVecsFromHeightStrict::forced_import(
path,
"low_in_sats",
VERSION + VERSION_IN_SATS + Version::ZERO,
version + VERSION + VERSION_IN_SATS + Version::ZERO,
compressed,
StorableVecGeneatorOptions::default().add_min(),
)?,
chainindexes_to_close_in_sats: ComputedVecsFromHeightStrict::forced_import(
path,
"close_in_sats",
VERSION + VERSION_IN_SATS + Version::ZERO,
version + VERSION + VERSION_IN_SATS + Version::ZERO,
compressed,
StorableVecGeneatorOptions::default().add_last(),
)?,
weekindex_to_ohlc: EagerVec::forced_import(path, "ohlc", Version::ZERO, compressed)?,
weekindex_to_ohlc: EagerVec::forced_import(
path,
"ohlc",
version + VERSION + Version::ZERO,
compressed,
)?,
weekindex_to_ohlc_in_sats: EagerVec::forced_import(
path,
"ohlc_in_sats",
VERSION + VERSION_IN_SATS + Version::ZERO,
version + VERSION + VERSION_IN_SATS + Version::ZERO,
compressed,
)?,
difficultyepoch_to_ohlc: EagerVec::forced_import(
path,
"ohlc",
Version::ZERO,
version + VERSION + Version::ZERO,
compressed,
)?,
difficultyepoch_to_ohlc_in_sats: EagerVec::forced_import(
path,
"ohlc_in_sats",
VERSION + VERSION_IN_SATS + Version::ZERO,
version + VERSION + VERSION_IN_SATS + Version::ZERO,
compressed,
)?,
monthindex_to_ohlc: EagerVec::forced_import(
path,
"ohlc",
version + VERSION + Version::ZERO,
compressed,
)?,
monthindex_to_ohlc: EagerVec::forced_import(path, "ohlc", Version::ZERO, compressed)?,
monthindex_to_ohlc_in_sats: EagerVec::forced_import(
path,
"ohlc_in_sats",
VERSION + VERSION_IN_SATS + Version::ZERO,
version + VERSION + VERSION_IN_SATS + Version::ZERO,
compressed,
)?,
quarterindex_to_ohlc: EagerVec::forced_import(
path,
"ohlc",
version + VERSION + Version::ZERO,
compressed,
)?,
quarterindex_to_ohlc: EagerVec::forced_import(path, "ohlc", Version::ZERO, compressed)?,
quarterindex_to_ohlc_in_sats: EagerVec::forced_import(
path,
"ohlc_in_sats",
VERSION + VERSION_IN_SATS + Version::ZERO,
version + VERSION + VERSION_IN_SATS + Version::ZERO,
compressed,
)?,
yearindex_to_ohlc: EagerVec::forced_import(
path,
"ohlc",
version + VERSION + Version::ZERO,
compressed,
)?,
yearindex_to_ohlc: EagerVec::forced_import(path, "ohlc", Version::ZERO, compressed)?,
yearindex_to_ohlc_in_sats: EagerVec::forced_import(
path,
"ohlc_in_sats",
VERSION + VERSION_IN_SATS + Version::ZERO,
version + VERSION + VERSION_IN_SATS + Version::ZERO,
compressed,
)?,
// halvingepoch_to_ohlc: StorableVec::forced_import(path,
// "halvingepoch_to_ohlc"), Version::ZERO, compressed)?,
decadeindex_to_ohlc: EagerVec::forced_import(path, "ohlc", Version::ZERO, compressed)?,
// "halvingepoch_to_ohlc"), version + VERSION + Version::ZERO, compressed)?,
decadeindex_to_ohlc: EagerVec::forced_import(
path,
"ohlc",
version + VERSION + Version::ZERO,
compressed,
)?,
decadeindex_to_ohlc_in_sats: EagerVec::forced_import(
path,
"ohlc_in_sats",
VERSION + VERSION_IN_SATS + Version::ZERO,
version + VERSION + VERSION_IN_SATS + Version::ZERO,
compressed,
)?,
})