mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-02 10:30:00 -07:00
global: snapshot
This commit is contained in:
@@ -67,24 +67,30 @@ impl Vecs {
|
||||
self.annualized_volume
|
||||
.compute(prices, starting_indexes.height, exit)?;
|
||||
|
||||
self.tx_per_sec.height.compute_binary::<_, Timestamp, PerSec>(
|
||||
starting_indexes.height,
|
||||
&count_vecs.tx_count.height,
|
||||
&blocks.interval.height,
|
||||
exit,
|
||||
)?;
|
||||
self.inputs_per_sec.height.compute_binary::<_, Timestamp, PerSec>(
|
||||
starting_indexes.height,
|
||||
&inputs_count.full.sum,
|
||||
&blocks.interval.height,
|
||||
exit,
|
||||
)?;
|
||||
self.outputs_per_sec.height.compute_binary::<_, Timestamp, PerSec>(
|
||||
starting_indexes.height,
|
||||
&outputs_count.total_count.full.sum,
|
||||
&blocks.interval.height,
|
||||
exit,
|
||||
)?;
|
||||
self.tx_per_sec
|
||||
.height
|
||||
.compute_binary::<_, Timestamp, PerSec>(
|
||||
starting_indexes.height,
|
||||
&count_vecs.tx_count.height,
|
||||
&blocks.interval.height,
|
||||
exit,
|
||||
)?;
|
||||
self.inputs_per_sec
|
||||
.height
|
||||
.compute_binary::<_, Timestamp, PerSec>(
|
||||
starting_indexes.height,
|
||||
&inputs_count.full.sum,
|
||||
&blocks.interval.height,
|
||||
exit,
|
||||
)?;
|
||||
self.outputs_per_sec
|
||||
.height
|
||||
.compute_binary::<_, Timestamp, PerSec>(
|
||||
starting_indexes.height,
|
||||
&outputs_count.total_count.full.sum,
|
||||
&blocks.interval.height,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -16,11 +16,12 @@ impl Vecs {
|
||||
) -> Result<Self> {
|
||||
let v2 = Version::TWO;
|
||||
Ok(Self {
|
||||
sent_sum: ValueFromHeightRolling::forced_import(
|
||||
db, "sent_sum", version, indexes,
|
||||
)?,
|
||||
sent_sum: ValueFromHeightRolling::forced_import(db, "sent_sum", version, indexes)?,
|
||||
received_sum: ValueFromHeightRolling::forced_import(
|
||||
db, "received_sum", version, indexes,
|
||||
db,
|
||||
"received_sum",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
annualized_volume: ValueFromHeight::forced_import(
|
||||
db,
|
||||
@@ -28,12 +29,7 @@ impl Vecs {
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
tx_per_sec: ComputedFromHeight::forced_import(
|
||||
db,
|
||||
"tx_per_sec",
|
||||
version + v2,
|
||||
indexes,
|
||||
)?,
|
||||
tx_per_sec: ComputedFromHeight::forced_import(db, "tx_per_sec", version + v2, indexes)?,
|
||||
outputs_per_sec: ComputedFromHeight::forced_import(
|
||||
db,
|
||||
"outputs_per_sec",
|
||||
|
||||
@@ -2,11 +2,8 @@ use brk_traversable::Traversable;
|
||||
use brk_types::StoredF32;
|
||||
use vecdb::{Rw, StorageMode};
|
||||
|
||||
use crate::internal::{
|
||||
ComputedFromHeight, ValueFromHeight, ValueFromHeightRolling,
|
||||
};
|
||||
use crate::internal::{ComputedFromHeight, ValueFromHeight, ValueFromHeightRolling};
|
||||
|
||||
/// Volume metrics
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub sent_sum: ValueFromHeightRolling<M>,
|
||||
|
||||
Reference in New Issue
Block a user