global: BIG snapshot

This commit is contained in:
nym21
2026-01-04 01:47:03 +01:00
parent c33444a92e
commit 3cae817915
127 changed files with 4750 additions and 9474 deletions

View File

@@ -16,8 +16,6 @@ impl Vecs {
indexer: &Indexer,
indexes: &indexes::Vecs,
) -> Result<Self> {
let v0 = Version::ZERO;
let full_stats = || {
VecBuilderOptions::default()
.add_average()
@@ -29,7 +27,7 @@ impl Vecs {
let txindex_to_is_coinbase = LazyVecFrom2::init(
"is_coinbase",
version + v0,
version,
indexer.vecs.tx.txindex_to_height.boxed_clone(),
indexer.vecs.tx.height_to_first_txindex.boxed_clone(),
|index: TxIndex, txindex_to_height_iter, height_to_first_txindex_iter| {
@@ -45,7 +43,7 @@ impl Vecs {
db,
"tx_count",
Source::Compute,
version + v0,
version,
indexes,
full_stats(),
)?,

View File

@@ -5,8 +5,9 @@ use vecdb::{Database, EagerVec, ImportableVec, IterableCloneableVec};
use super::Vecs;
use crate::{
indexes, price,
indexes,
internal::{ComputedValueVecsFromTxindex, ComputedVecsFromTxindex, Source, VecBuilderOptions},
price,
};
impl Vecs {
@@ -17,8 +18,6 @@ impl Vecs {
indexes: &indexes::Vecs,
price: Option<&price::Vecs>,
) -> Result<Self> {
let v0 = Version::ZERO;
let stats = || {
VecBuilderOptions::default()
.add_average()
@@ -26,10 +25,10 @@ impl Vecs {
.add_percentiles()
};
let txindex_to_input_value = EagerVec::forced_import(db, "input_value", version + v0)?;
let txindex_to_output_value = EagerVec::forced_import(db, "output_value", version + v0)?;
let txindex_to_fee = EagerVec::forced_import(db, "fee", version + v0)?;
let txindex_to_fee_rate = EagerVec::forced_import(db, "fee_rate", version + v0)?;
let txindex_to_input_value = EagerVec::forced_import(db, "input_value", version)?;
let txindex_to_output_value = EagerVec::forced_import(db, "output_value", version)?;
let txindex_to_fee = EagerVec::forced_import(db, "fee", version)?;
let txindex_to_fee_rate = EagerVec::forced_import(db, "fee_rate", version)?;
Ok(Self {
txindex_to_input_value,
@@ -42,7 +41,7 @@ impl Vecs {
indexer,
indexes,
Source::Vec(txindex_to_fee.boxed_clone()),
version + v0,
version,
price,
VecBuilderOptions::default()
.add_sum()
@@ -55,7 +54,7 @@ impl Vecs {
db,
"fee_rate",
Source::Vec(txindex_to_fee_rate.boxed_clone()),
version + v0,
version,
indexes,
stats(),
)?,

View File

@@ -21,7 +21,7 @@ impl Vecs {
let db = Database::open(&parent_path.join(super::DB_NAME))?;
db.set_min_len(PAGE_SIZE * 50_000_000)?;
let version = parent_version + Version::ZERO;
let version = parent_version;
let compute_dollars = price.is_some();
let count = CountVecs::forced_import(&db, version, indexer, indexes)?;

View File

@@ -16,8 +16,6 @@ impl Vecs {
indexer: &Indexer,
indexes: &indexes::Vecs,
) -> Result<Self> {
let v0 = Version::ZERO;
let stats = || {
VecBuilderOptions::default()
.add_average()
@@ -27,7 +25,7 @@ impl Vecs {
let txindex_to_weight = LazyVecFrom2::init(
"weight",
version + v0,
version,
indexer.vecs.tx.txindex_to_base_size.boxed_clone(),
indexer.vecs.tx.txindex_to_total_size.boxed_clone(),
|index: TxIndex, txindex_to_base_size_iter, txindex_to_total_size_iter| {
@@ -42,7 +40,7 @@ impl Vecs {
// Derive directly from eager sources to avoid Lazy <- Lazy
let txindex_to_vsize = LazyVecFrom2::init(
"vsize",
version + v0,
version,
indexer.vecs.tx.txindex_to_base_size.boxed_clone(),
indexer.vecs.tx.txindex_to_total_size.boxed_clone(),
|index: TxIndex, txindex_to_base_size_iter, txindex_to_total_size_iter| {
@@ -59,7 +57,7 @@ impl Vecs {
db,
"tx_vsize",
Source::Vec(txindex_to_vsize.boxed_clone()),
version + v0,
version,
indexes,
stats(),
)?,
@@ -67,7 +65,7 @@ impl Vecs {
db,
"tx_weight",
Source::Vec(txindex_to_weight.boxed_clone()),
version + v0,
version,
indexes,
stats(),
)?,

View File

@@ -9,12 +9,7 @@ use crate::{
};
impl Vecs {
pub fn forced_import(
db: &Database,
version: Version,
indexes: &indexes::Vecs,
) -> Result<Self> {
let v0 = Version::ZERO;
pub fn forced_import(db: &Database, version: Version, indexes: &indexes::Vecs) -> Result<Self> {
let sum_cum = || VecBuilderOptions::default().add_sum().add_cumulative();
Ok(Self {
@@ -22,7 +17,7 @@ impl Vecs {
db,
"tx_v1",
Source::Compute,
version + v0,
version,
indexes,
sum_cum(),
)?,
@@ -30,7 +25,7 @@ impl Vecs {
db,
"tx_v2",
Source::Compute,
version + v0,
version,
indexes,
sum_cum(),
)?,
@@ -38,7 +33,7 @@ impl Vecs {
db,
"tx_v3",
Source::Compute,
version + v0,
version,
indexes,
sum_cum(),
)?,

View File

@@ -4,8 +4,8 @@ use vecdb::Database;
use super::Vecs;
use crate::{
internal::{ComputedValueVecsFromHeight, ComputedVecsFromDateIndex, Source, VecBuilderOptions},
indexes,
internal::{ComputedValueVecsFromHeight, ComputedVecsFromDateIndex, Source, VecBuilderOptions},
};
impl Vecs {
@@ -15,7 +15,6 @@ impl Vecs {
indexes: &indexes::Vecs,
compute_dollars: bool,
) -> Result<Self> {
let v0 = Version::ZERO;
let v2 = Version::TWO;
let last = || VecBuilderOptions::default().add_last();
@@ -24,7 +23,7 @@ impl Vecs {
db,
"sent_sum",
Source::Compute,
version + v0,
version,
VecBuilderOptions::default().add_sum(),
compute_dollars,
indexes,
@@ -33,7 +32,7 @@ impl Vecs {
db,
"annualized_volume",
Source::Compute,
version + v0,
version,
indexes,
last(),
)?,
@@ -41,7 +40,7 @@ impl Vecs {
db,
"annualized_volume_btc",
Source::Compute,
version + v0,
version,
indexes,
last(),
)?,
@@ -49,7 +48,7 @@ impl Vecs {
db,
"annualized_volume_usd",
Source::Compute,
version + v0,
version,
indexes,
last(),
)?,