mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
global: snapshot
This commit is contained in:
@@ -4195,15 +4195,15 @@ impl MetricsTree_Mining_Hashrate_HashRateSma {
|
|||||||
|
|
||||||
/// Metrics tree node.
|
/// Metrics tree node.
|
||||||
pub struct MetricsTree_Positions {
|
pub struct MetricsTree_Positions {
|
||||||
pub block_position: MetricPattern18<BlkPosition>,
|
pub block: MetricPattern18<BlkPosition>,
|
||||||
pub tx_position: MetricPattern19<BlkPosition>,
|
pub tx: MetricPattern19<BlkPosition>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetricsTree_Positions {
|
impl MetricsTree_Positions {
|
||||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||||
Self {
|
Self {
|
||||||
block_position: MetricPattern18::new(client.clone(), "position".to_string()),
|
block: MetricPattern18::new(client.clone(), "position".to_string()),
|
||||||
tx_position: MetricPattern19::new(client.clone(), "position".to_string()),
|
tx: MetricPattern19::new(client.clone(), "position".to_string()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4376,47 +4376,47 @@ impl MetricsTree_Cointime_ReserveRisk {
|
|||||||
|
|
||||||
/// Metrics tree node.
|
/// Metrics tree node.
|
||||||
pub struct MetricsTree_Constants {
|
pub struct MetricsTree_Constants {
|
||||||
pub constant_0: MetricPattern1<StoredU16>,
|
pub _0: MetricPattern1<StoredU16>,
|
||||||
pub constant_1: MetricPattern1<StoredU16>,
|
pub _1: MetricPattern1<StoredU16>,
|
||||||
pub constant_2: MetricPattern1<StoredU16>,
|
pub _2: MetricPattern1<StoredU16>,
|
||||||
pub constant_3: MetricPattern1<StoredU16>,
|
pub _3: MetricPattern1<StoredU16>,
|
||||||
pub constant_4: MetricPattern1<StoredU16>,
|
pub _4: MetricPattern1<StoredU16>,
|
||||||
pub constant_20: MetricPattern1<StoredU16>,
|
pub _20: MetricPattern1<StoredU16>,
|
||||||
pub constant_30: MetricPattern1<StoredU16>,
|
pub _30: MetricPattern1<StoredU16>,
|
||||||
pub constant_38_2: MetricPattern1<StoredF32>,
|
pub _38_2: MetricPattern1<StoredF32>,
|
||||||
pub constant_50: MetricPattern1<StoredU16>,
|
pub _50: MetricPattern1<StoredU16>,
|
||||||
pub constant_61_8: MetricPattern1<StoredF32>,
|
pub _61_8: MetricPattern1<StoredF32>,
|
||||||
pub constant_70: MetricPattern1<StoredU16>,
|
pub _70: MetricPattern1<StoredU16>,
|
||||||
pub constant_80: MetricPattern1<StoredU16>,
|
pub _80: MetricPattern1<StoredU16>,
|
||||||
pub constant_100: MetricPattern1<StoredU16>,
|
pub _100: MetricPattern1<StoredU16>,
|
||||||
pub constant_600: MetricPattern1<StoredU16>,
|
pub _600: MetricPattern1<StoredU16>,
|
||||||
pub constant_minus_1: MetricPattern1<StoredI8>,
|
pub minus_1: MetricPattern1<StoredI8>,
|
||||||
pub constant_minus_2: MetricPattern1<StoredI8>,
|
pub minus_2: MetricPattern1<StoredI8>,
|
||||||
pub constant_minus_3: MetricPattern1<StoredI8>,
|
pub minus_3: MetricPattern1<StoredI8>,
|
||||||
pub constant_minus_4: MetricPattern1<StoredI8>,
|
pub minus_4: MetricPattern1<StoredI8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetricsTree_Constants {
|
impl MetricsTree_Constants {
|
||||||
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
pub fn new(client: Arc<BrkClientBase>, base_path: String) -> Self {
|
||||||
Self {
|
Self {
|
||||||
constant_0: MetricPattern1::new(client.clone(), "constant_0".to_string()),
|
_0: MetricPattern1::new(client.clone(), "constant_0".to_string()),
|
||||||
constant_1: MetricPattern1::new(client.clone(), "constant_1".to_string()),
|
_1: MetricPattern1::new(client.clone(), "constant_1".to_string()),
|
||||||
constant_2: MetricPattern1::new(client.clone(), "constant_2".to_string()),
|
_2: MetricPattern1::new(client.clone(), "constant_2".to_string()),
|
||||||
constant_3: MetricPattern1::new(client.clone(), "constant_3".to_string()),
|
_3: MetricPattern1::new(client.clone(), "constant_3".to_string()),
|
||||||
constant_4: MetricPattern1::new(client.clone(), "constant_4".to_string()),
|
_4: MetricPattern1::new(client.clone(), "constant_4".to_string()),
|
||||||
constant_20: MetricPattern1::new(client.clone(), "constant_20".to_string()),
|
_20: MetricPattern1::new(client.clone(), "constant_20".to_string()),
|
||||||
constant_30: MetricPattern1::new(client.clone(), "constant_30".to_string()),
|
_30: MetricPattern1::new(client.clone(), "constant_30".to_string()),
|
||||||
constant_38_2: MetricPattern1::new(client.clone(), "constant_38_2".to_string()),
|
_38_2: MetricPattern1::new(client.clone(), "constant_38_2".to_string()),
|
||||||
constant_50: MetricPattern1::new(client.clone(), "constant_50".to_string()),
|
_50: MetricPattern1::new(client.clone(), "constant_50".to_string()),
|
||||||
constant_61_8: MetricPattern1::new(client.clone(), "constant_61_8".to_string()),
|
_61_8: MetricPattern1::new(client.clone(), "constant_61_8".to_string()),
|
||||||
constant_70: MetricPattern1::new(client.clone(), "constant_70".to_string()),
|
_70: MetricPattern1::new(client.clone(), "constant_70".to_string()),
|
||||||
constant_80: MetricPattern1::new(client.clone(), "constant_80".to_string()),
|
_80: MetricPattern1::new(client.clone(), "constant_80".to_string()),
|
||||||
constant_100: MetricPattern1::new(client.clone(), "constant_100".to_string()),
|
_100: MetricPattern1::new(client.clone(), "constant_100".to_string()),
|
||||||
constant_600: MetricPattern1::new(client.clone(), "constant_600".to_string()),
|
_600: MetricPattern1::new(client.clone(), "constant_600".to_string()),
|
||||||
constant_minus_1: MetricPattern1::new(client.clone(), "constant_minus_1".to_string()),
|
minus_1: MetricPattern1::new(client.clone(), "constant_minus_1".to_string()),
|
||||||
constant_minus_2: MetricPattern1::new(client.clone(), "constant_minus_2".to_string()),
|
minus_2: MetricPattern1::new(client.clone(), "constant_minus_2".to_string()),
|
||||||
constant_minus_3: MetricPattern1::new(client.clone(), "constant_minus_3".to_string()),
|
minus_3: MetricPattern1::new(client.clone(), "constant_minus_3".to_string()),
|
||||||
constant_minus_4: MetricPattern1::new(client.clone(), "constant_minus_4".to_string()),
|
minus_4: MetricPattern1::new(client.clone(), "constant_minus_4".to_string()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,24 +10,24 @@ pub const DB_NAME: &str = "constants";
|
|||||||
|
|
||||||
#[derive(Clone, Traversable)]
|
#[derive(Clone, Traversable)]
|
||||||
pub struct Vecs {
|
pub struct Vecs {
|
||||||
pub constant_0: ConstantVecs<StoredU16>,
|
pub _0: ConstantVecs<StoredU16>,
|
||||||
pub constant_1: ConstantVecs<StoredU16>,
|
pub _1: ConstantVecs<StoredU16>,
|
||||||
pub constant_2: ConstantVecs<StoredU16>,
|
pub _2: ConstantVecs<StoredU16>,
|
||||||
pub constant_3: ConstantVecs<StoredU16>,
|
pub _3: ConstantVecs<StoredU16>,
|
||||||
pub constant_4: ConstantVecs<StoredU16>,
|
pub _4: ConstantVecs<StoredU16>,
|
||||||
pub constant_20: ConstantVecs<StoredU16>,
|
pub _20: ConstantVecs<StoredU16>,
|
||||||
pub constant_30: ConstantVecs<StoredU16>,
|
pub _30: ConstantVecs<StoredU16>,
|
||||||
pub constant_38_2: ConstantVecs<StoredF32>,
|
pub _38_2: ConstantVecs<StoredF32>,
|
||||||
pub constant_50: ConstantVecs<StoredU16>,
|
pub _50: ConstantVecs<StoredU16>,
|
||||||
pub constant_61_8: ConstantVecs<StoredF32>,
|
pub _61_8: ConstantVecs<StoredF32>,
|
||||||
pub constant_70: ConstantVecs<StoredU16>,
|
pub _70: ConstantVecs<StoredU16>,
|
||||||
pub constant_80: ConstantVecs<StoredU16>,
|
pub _80: ConstantVecs<StoredU16>,
|
||||||
pub constant_100: ConstantVecs<StoredU16>,
|
pub _100: ConstantVecs<StoredU16>,
|
||||||
pub constant_600: ConstantVecs<StoredU16>,
|
pub _600: ConstantVecs<StoredU16>,
|
||||||
pub constant_minus_1: ConstantVecs<StoredI8>,
|
pub _minus_1: ConstantVecs<StoredI8>,
|
||||||
pub constant_minus_2: ConstantVecs<StoredI8>,
|
pub _minus_2: ConstantVecs<StoredI8>,
|
||||||
pub constant_minus_3: ConstantVecs<StoredI8>,
|
pub _minus_3: ConstantVecs<StoredI8>,
|
||||||
pub constant_minus_4: ConstantVecs<StoredI8>,
|
pub _minus_4: ConstantVecs<StoredI8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Vecs {
|
impl Vecs {
|
||||||
@@ -35,24 +35,24 @@ impl Vecs {
|
|||||||
let v = version;
|
let v = version;
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
constant_0: ConstantVecs::new::<ReturnU16<0>>("constant_0", v, indexes),
|
_0: ConstantVecs::new::<ReturnU16<0>>("constant_0", v, indexes),
|
||||||
constant_1: ConstantVecs::new::<ReturnU16<1>>("constant_1", v, indexes),
|
_1: ConstantVecs::new::<ReturnU16<1>>("constant_1", v, indexes),
|
||||||
constant_2: ConstantVecs::new::<ReturnU16<2>>("constant_2", v, indexes),
|
_2: ConstantVecs::new::<ReturnU16<2>>("constant_2", v, indexes),
|
||||||
constant_3: ConstantVecs::new::<ReturnU16<3>>("constant_3", v, indexes),
|
_3: ConstantVecs::new::<ReturnU16<3>>("constant_3", v, indexes),
|
||||||
constant_4: ConstantVecs::new::<ReturnU16<4>>("constant_4", v, indexes),
|
_4: ConstantVecs::new::<ReturnU16<4>>("constant_4", v, indexes),
|
||||||
constant_20: ConstantVecs::new::<ReturnU16<20>>("constant_20", v, indexes),
|
_20: ConstantVecs::new::<ReturnU16<20>>("constant_20", v, indexes),
|
||||||
constant_30: ConstantVecs::new::<ReturnU16<30>>("constant_30", v, indexes),
|
_30: ConstantVecs::new::<ReturnU16<30>>("constant_30", v, indexes),
|
||||||
constant_38_2: ConstantVecs::new::<ReturnF32Tenths<382>>("constant_38_2", v, indexes),
|
_38_2: ConstantVecs::new::<ReturnF32Tenths<382>>("constant_38_2", v, indexes),
|
||||||
constant_50: ConstantVecs::new::<ReturnU16<50>>("constant_50", v, indexes),
|
_50: ConstantVecs::new::<ReturnU16<50>>("constant_50", v, indexes),
|
||||||
constant_61_8: ConstantVecs::new::<ReturnF32Tenths<618>>("constant_61_8", v, indexes),
|
_61_8: ConstantVecs::new::<ReturnF32Tenths<618>>("constant_61_8", v, indexes),
|
||||||
constant_70: ConstantVecs::new::<ReturnU16<70>>("constant_70", v, indexes),
|
_70: ConstantVecs::new::<ReturnU16<70>>("constant_70", v, indexes),
|
||||||
constant_80: ConstantVecs::new::<ReturnU16<80>>("constant_80", v, indexes),
|
_80: ConstantVecs::new::<ReturnU16<80>>("constant_80", v, indexes),
|
||||||
constant_100: ConstantVecs::new::<ReturnU16<100>>("constant_100", v, indexes),
|
_100: ConstantVecs::new::<ReturnU16<100>>("constant_100", v, indexes),
|
||||||
constant_600: ConstantVecs::new::<ReturnU16<600>>("constant_600", v, indexes),
|
_600: ConstantVecs::new::<ReturnU16<600>>("constant_600", v, indexes),
|
||||||
constant_minus_1: ConstantVecs::new::<ReturnI8<-1>>("constant_minus_1", v, indexes),
|
_minus_1: ConstantVecs::new::<ReturnI8<-1>>("constant_minus_1", v, indexes),
|
||||||
constant_minus_2: ConstantVecs::new::<ReturnI8<-2>>("constant_minus_2", v, indexes),
|
_minus_2: ConstantVecs::new::<ReturnI8<-2>>("constant_minus_2", v, indexes),
|
||||||
constant_minus_3: ConstantVecs::new::<ReturnI8<-3>>("constant_minus_3", v, indexes),
|
_minus_3: ConstantVecs::new::<ReturnI8<-3>>("constant_minus_3", v, indexes),
|
||||||
constant_minus_4: ConstantVecs::new::<ReturnI8<-4>>("constant_minus_4", v, indexes),
|
_minus_4: ConstantVecs::new::<ReturnI8<-4>>("constant_minus_4", v, indexes),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use std::path::Path;
|
|||||||
use brk_error::Result;
|
use brk_error::Result;
|
||||||
use brk_types::{Age, Cents, CentsCompact, CentsSats, CentsSquaredSats, CostBasisSnapshot, Height, Sats, SupplyState};
|
use brk_types::{Age, Cents, CentsCompact, CentsSats, CentsSquaredSats, CostBasisSnapshot, Height, Sats, SupplyState};
|
||||||
|
|
||||||
use super::super::cost_basis::{Accumulate, CostBasisData, CostBasisOps, PendingDelta, RealizedOps, UnrealizedState};
|
use super::super::{cost_basis::{Accumulate, CostBasisData, CostBasisOps, RealizedOps, UnrealizedState}, pending::PendingDelta};
|
||||||
|
|
||||||
pub struct SendPrecomputed {
|
pub struct SendPrecomputed {
|
||||||
pub sats: Sats,
|
pub sats: Sats,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use std::{
|
use std::{
|
||||||
collections::{btree_map::Entry, BTreeMap},
|
collections::{BTreeMap, btree_map::Entry},
|
||||||
fs,
|
fs,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
};
|
};
|
||||||
@@ -12,34 +12,11 @@ use rustc_hash::FxHashMap;
|
|||||||
use vecdb::{Bytes, unlikely};
|
use vecdb::{Bytes, unlikely};
|
||||||
|
|
||||||
use super::{Accumulate, CachedUnrealizedState, UnrealizedState};
|
use super::{Accumulate, CachedUnrealizedState, UnrealizedState};
|
||||||
|
use crate::distribution::state::pending::{PendingCapDelta, PendingDelta, PendingInvestorCapDelta};
|
||||||
|
|
||||||
/// Type alias for the price-to-sats map used in cost basis data.
|
/// Type alias for the price-to-sats map used in cost basis data.
|
||||||
pub(super) type CostBasisMap = BTreeMap<CentsCompact, Sats>;
|
pub(super) type CostBasisMap = BTreeMap<CentsCompact, Sats>;
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default)]
|
|
||||||
struct PendingRaw {
|
|
||||||
cap_inc: CentsSats,
|
|
||||||
cap_dec: CentsSats,
|
|
||||||
investor_cap_inc: CentsSquaredSats,
|
|
||||||
investor_cap_dec: CentsSquaredSats,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PendingRaw {
|
|
||||||
fn is_zero(&self) -> bool {
|
|
||||||
self.cap_inc == CentsSats::ZERO
|
|
||||||
&& self.cap_dec == CentsSats::ZERO
|
|
||||||
&& self.investor_cap_inc == CentsSquaredSats::ZERO
|
|
||||||
&& self.investor_cap_dec == CentsSquaredSats::ZERO
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Pending increments and decrements for a single price bucket.
|
|
||||||
#[derive(Clone, Copy, Debug, Default)]
|
|
||||||
pub struct PendingDelta {
|
|
||||||
pub inc: Sats,
|
|
||||||
pub dec: Sats,
|
|
||||||
}
|
|
||||||
|
|
||||||
const STATE_TO_KEEP: usize = 10;
|
const STATE_TO_KEEP: usize = 10;
|
||||||
|
|
||||||
/// Common interface for cost basis tracking.
|
/// Common interface for cost basis tracking.
|
||||||
@@ -90,14 +67,14 @@ impl RawState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Lightweight cost basis tracking: only cap_raw and investor_cap_raw scalars.
|
/// Lightweight cost basis tracking: only cap_raw scalar.
|
||||||
/// No BTreeMap, no unrealized computation, no pending map.
|
/// No BTreeMap, no unrealized computation, no pending map.
|
||||||
/// Used by cohorts that only need realized cap on restart (amount_range, address).
|
/// Used by cohorts that only need realized cap on restart (amount_range, address).
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct CostBasisRaw {
|
pub struct CostBasisRaw {
|
||||||
pathbuf: PathBuf,
|
pathbuf: PathBuf,
|
||||||
state: Option<RawState>,
|
state: Option<RawState>,
|
||||||
pending_raw: PendingRaw,
|
pending_cap: PendingCapDelta,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CostBasisRaw {
|
impl CostBasisRaw {
|
||||||
@@ -136,24 +113,24 @@ impl CostBasisRaw {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn apply_pending_raw(&mut self) {
|
fn apply_pending_raw(&mut self) {
|
||||||
if self.pending_raw.is_zero() {
|
if self.pending_cap.is_zero() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let state = self.state.as_mut().unwrap();
|
let state = self.state.as_mut().unwrap();
|
||||||
|
|
||||||
state.cap_raw += self.pending_raw.cap_inc;
|
state.cap_raw += self.pending_cap.inc;
|
||||||
if unlikely(state.cap_raw.inner() < self.pending_raw.cap_dec.inner()) {
|
if unlikely(state.cap_raw.inner() < self.pending_cap.dec.inner()) {
|
||||||
panic!(
|
panic!(
|
||||||
"CostBasis cap_raw underflow!\n\
|
"CostBasis cap_raw underflow!\n\
|
||||||
Path: {:?}\n\
|
Path: {:?}\n\
|
||||||
Current cap_raw (after increments): {}\n\
|
Current cap_raw (after increments): {}\n\
|
||||||
Trying to decrement by: {}",
|
Trying to decrement by: {}",
|
||||||
self.pathbuf, state.cap_raw, self.pending_raw.cap_dec
|
self.pathbuf, state.cap_raw, self.pending_cap.dec
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
state.cap_raw -= self.pending_raw.cap_dec;
|
state.cap_raw -= self.pending_cap.dec;
|
||||||
|
|
||||||
self.pending_raw = PendingRaw::default();
|
self.pending_cap = PendingCapDelta::default();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_and_cleanup(&mut self, height: Height, cleanup: bool) -> Result<()> {
|
fn write_and_cleanup(&mut self, height: Height, cleanup: bool) -> Result<()> {
|
||||||
@@ -175,7 +152,7 @@ impl CostBasisOps for CostBasisRaw {
|
|||||||
Self {
|
Self {
|
||||||
pathbuf: path.join(format!("{name}_cost_basis")),
|
pathbuf: path.join(format!("{name}_cost_basis")),
|
||||||
state: None,
|
state: None,
|
||||||
pending_raw: PendingRaw::default(),
|
pending_cap: PendingCapDelta::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,12 +173,12 @@ impl CostBasisOps for CostBasisRaw {
|
|||||||
let (_, rest) = CostBasisDistribution::deserialize_with_rest(&data)?;
|
let (_, rest) = CostBasisDistribution::deserialize_with_rest(&data)?;
|
||||||
RawState::deserialize(rest)?
|
RawState::deserialize(rest)?
|
||||||
});
|
});
|
||||||
self.pending_raw = PendingRaw::default();
|
self.pending_cap = PendingCapDelta::default();
|
||||||
Ok(height)
|
Ok(height)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cap_raw(&self) -> CentsSats {
|
fn cap_raw(&self) -> CentsSats {
|
||||||
debug_assert!(self.pending_raw.is_zero());
|
debug_assert!(self.pending_cap.is_zero());
|
||||||
self.state.as_ref().unwrap().cap_raw
|
self.state.as_ref().unwrap().cap_raw
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +194,7 @@ impl CostBasisOps for CostBasisRaw {
|
|||||||
price_sats: CentsSats,
|
price_sats: CentsSats,
|
||||||
_investor_cap: CentsSquaredSats,
|
_investor_cap: CentsSquaredSats,
|
||||||
) {
|
) {
|
||||||
self.pending_raw.cap_inc += price_sats;
|
self.pending_cap.inc += price_sats;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
@@ -228,7 +205,7 @@ impl CostBasisOps for CostBasisRaw {
|
|||||||
price_sats: CentsSats,
|
price_sats: CentsSats,
|
||||||
_investor_cap: CentsSquaredSats,
|
_investor_cap: CentsSquaredSats,
|
||||||
) {
|
) {
|
||||||
self.pending_raw.cap_dec += price_sats;
|
self.pending_cap.dec += price_sats;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn apply_pending(&mut self) {
|
fn apply_pending(&mut self) {
|
||||||
@@ -237,7 +214,7 @@ impl CostBasisOps for CostBasisRaw {
|
|||||||
|
|
||||||
fn init(&mut self) {
|
fn init(&mut self) {
|
||||||
self.state.replace(RawState::default());
|
self.state.replace(RawState::default());
|
||||||
self.pending_raw = PendingRaw::default();
|
self.pending_cap = PendingCapDelta::default();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clean(&mut self) -> Result<()> {
|
fn clean(&mut self) -> Result<()> {
|
||||||
@@ -273,6 +250,8 @@ pub struct CostBasisData<S: Accumulate> {
|
|||||||
cache: Option<CachedUnrealizedState<S>>,
|
cache: Option<CachedUnrealizedState<S>>,
|
||||||
rounding_digits: Option<i32>,
|
rounding_digits: Option<i32>,
|
||||||
generation: u64,
|
generation: u64,
|
||||||
|
investor_cap_raw: CentsSquaredSats,
|
||||||
|
pending_investor_cap: PendingInvestorCapDelta,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: Accumulate> CostBasisData<S> {
|
impl<S: Accumulate> CostBasisData<S> {
|
||||||
@@ -285,7 +264,7 @@ impl<S: Accumulate> CostBasisData<S> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn map(&self) -> &CostBasisMap {
|
pub(crate) fn map(&self) -> &CostBasisMap {
|
||||||
debug_assert!(self.pending.is_empty() && self.raw.pending_raw.is_zero());
|
debug_assert!(self.pending.is_empty() && self.raw.pending_cap.is_zero());
|
||||||
&self.map.as_ref().unwrap().map
|
&self.map.as_ref().unwrap().map
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,6 +354,8 @@ impl<S: Accumulate> CostBasisOps for CostBasisData<S> {
|
|||||||
cache: None,
|
cache: None,
|
||||||
rounding_digits: None,
|
rounding_digits: None,
|
||||||
generation: 0,
|
generation: 0,
|
||||||
|
investor_cap_raw: CentsSquaredSats::ZERO,
|
||||||
|
pending_investor_cap: PendingInvestorCapDelta::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,8 +373,10 @@ impl<S: Accumulate> CostBasisOps for CostBasisData<S> {
|
|||||||
let (base, rest) = CostBasisDistribution::deserialize_with_rest(&data)?;
|
let (base, rest) = CostBasisDistribution::deserialize_with_rest(&data)?;
|
||||||
self.map = Some(base);
|
self.map = Some(base);
|
||||||
self.raw.state = Some(RawState::deserialize(rest)?);
|
self.raw.state = Some(RawState::deserialize(rest)?);
|
||||||
|
self.investor_cap_raw = CentsSquaredSats::from_bytes(&rest[16..32])?;
|
||||||
self.pending.clear();
|
self.pending.clear();
|
||||||
self.raw.pending_raw = PendingRaw::default();
|
self.raw.pending_cap = PendingCapDelta::default();
|
||||||
|
self.pending_investor_cap = PendingInvestorCapDelta::default();
|
||||||
self.cache = None;
|
self.cache = None;
|
||||||
Ok(height)
|
Ok(height)
|
||||||
}
|
}
|
||||||
@@ -403,7 +386,7 @@ impl<S: Accumulate> CostBasisOps for CostBasisData<S> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn investor_cap_raw(&self) -> CentsSquaredSats {
|
fn investor_cap_raw(&self) -> CentsSquaredSats {
|
||||||
self.raw.investor_cap_raw()
|
self.investor_cap_raw
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
@@ -416,9 +399,9 @@ impl<S: Accumulate> CostBasisOps for CostBasisData<S> {
|
|||||||
) {
|
) {
|
||||||
let price = self.round_price(price);
|
let price = self.round_price(price);
|
||||||
self.pending.entry(price.into()).or_default().inc += sats;
|
self.pending.entry(price.into()).or_default().inc += sats;
|
||||||
self.raw.pending_raw.cap_inc += price_sats;
|
self.raw.pending_cap.inc += price_sats;
|
||||||
if investor_cap != CentsSquaredSats::ZERO {
|
if investor_cap != CentsSquaredSats::ZERO {
|
||||||
self.raw.pending_raw.investor_cap_inc += investor_cap;
|
self.pending_investor_cap.inc += investor_cap;
|
||||||
}
|
}
|
||||||
if let Some(cache) = self.cache.as_mut() {
|
if let Some(cache) = self.cache.as_mut() {
|
||||||
cache.on_receive(price, sats);
|
cache.on_receive(price, sats);
|
||||||
@@ -435,9 +418,9 @@ impl<S: Accumulate> CostBasisOps for CostBasisData<S> {
|
|||||||
) {
|
) {
|
||||||
let price = self.round_price(price);
|
let price = self.round_price(price);
|
||||||
self.pending.entry(price.into()).or_default().dec += sats;
|
self.pending.entry(price.into()).or_default().dec += sats;
|
||||||
self.raw.pending_raw.cap_dec += price_sats;
|
self.raw.pending_cap.dec += price_sats;
|
||||||
if investor_cap != CentsSquaredSats::ZERO {
|
if investor_cap != CentsSquaredSats::ZERO {
|
||||||
self.raw.pending_raw.investor_cap_dec += investor_cap;
|
self.pending_investor_cap.dec += investor_cap;
|
||||||
}
|
}
|
||||||
if let Some(cache) = self.cache.as_mut() {
|
if let Some(cache) = self.cache.as_mut() {
|
||||||
cache.on_send(price, sats);
|
cache.on_send(price, sats);
|
||||||
@@ -447,6 +430,9 @@ impl<S: Accumulate> CostBasisOps for CostBasisData<S> {
|
|||||||
fn apply_pending(&mut self) {
|
fn apply_pending(&mut self) {
|
||||||
self.apply_map_pending();
|
self.apply_map_pending();
|
||||||
self.raw.apply_pending_raw();
|
self.raw.apply_pending_raw();
|
||||||
|
self.investor_cap_raw += self.pending_investor_cap.inc;
|
||||||
|
self.investor_cap_raw -= self.pending_investor_cap.dec;
|
||||||
|
self.pending_investor_cap = PendingInvestorCapDelta::default();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init(&mut self) {
|
fn init(&mut self) {
|
||||||
@@ -454,6 +440,8 @@ impl<S: Accumulate> CostBasisOps for CostBasisData<S> {
|
|||||||
self.map.replace(CostBasisDistribution::default());
|
self.map.replace(CostBasisDistribution::default());
|
||||||
self.pending.clear();
|
self.pending.clear();
|
||||||
self.cache = None;
|
self.cache = None;
|
||||||
|
self.investor_cap_raw = CentsSquaredSats::ZERO;
|
||||||
|
self.pending_investor_cap = PendingInvestorCapDelta::default();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clean(&mut self) -> Result<()> {
|
fn clean(&mut self) -> Result<()> {
|
||||||
@@ -469,6 +457,7 @@ impl<S: Accumulate> CostBasisOps for CostBasisData<S> {
|
|||||||
let raw_state = self.raw.state.as_ref().unwrap();
|
let raw_state = self.raw.state.as_ref().unwrap();
|
||||||
let mut buffer = self.map.as_ref().unwrap().serialize()?;
|
let mut buffer = self.map.as_ref().unwrap().serialize()?;
|
||||||
buffer.extend(raw_state.cap_raw.to_bytes());
|
buffer.extend(raw_state.cap_raw.to_bytes());
|
||||||
|
buffer.extend(self.investor_cap_raw.to_bytes());
|
||||||
fs::write(self.raw.path_state(height), buffer)?;
|
fs::write(self.raw.path_state(height), buffer)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
mod block;
|
mod block;
|
||||||
mod cohort;
|
mod cohort;
|
||||||
mod cost_basis;
|
mod cost_basis;
|
||||||
|
mod pending;
|
||||||
mod transacted;
|
mod transacted;
|
||||||
|
|
||||||
pub use block::*;
|
pub use block::*;
|
||||||
pub use cohort::*;
|
pub use cohort::*;
|
||||||
pub use cost_basis::*;
|
pub use cost_basis::*;
|
||||||
|
pub use pending::*;
|
||||||
pub use transacted::*;
|
pub use transacted::*;
|
||||||
|
|||||||
26
crates/brk_computer/src/distribution/state/pending.rs
Normal file
26
crates/brk_computer/src/distribution/state/pending.rs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
use brk_types::{CentsSats, CentsSquaredSats, Sats};
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Default)]
|
||||||
|
pub(crate) struct PendingCapDelta {
|
||||||
|
pub inc: CentsSats,
|
||||||
|
pub dec: CentsSats,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PendingCapDelta {
|
||||||
|
pub fn is_zero(&self) -> bool {
|
||||||
|
self.inc == CentsSats::ZERO && self.dec == CentsSats::ZERO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Default)]
|
||||||
|
pub(crate) struct PendingInvestorCapDelta {
|
||||||
|
pub inc: CentsSquaredSats,
|
||||||
|
pub dec: CentsSquaredSats,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Pending increments and decrements for a single price bucket.
|
||||||
|
#[derive(Clone, Copy, Debug, Default)]
|
||||||
|
pub struct PendingDelta {
|
||||||
|
pub inc: Sats,
|
||||||
|
pub dec: Sats,
|
||||||
|
}
|
||||||
@@ -240,6 +240,15 @@ impl Vecs {
|
|||||||
|
|
||||||
// 1. Find minimum height we have data for across stateful vecs
|
// 1. Find minimum height we have data for across stateful vecs
|
||||||
let current_height = Height::from(self.supply_state.len());
|
let current_height = Height::from(self.supply_state.len());
|
||||||
|
debug!("supply_state.len={}", self.supply_state.len());
|
||||||
|
debug!("utxo_cohorts.min={}", self.utxo_cohorts.min_separate_stateful_height_len());
|
||||||
|
debug!("address_cohorts.min={}", self.address_cohorts.min_separate_stateful_height_len());
|
||||||
|
debug!("address_indexes.min={}", self.any_address_indexes.min_stamped_height());
|
||||||
|
debug!("addresses_data.min={}", self.addresses_data.min_stamped_height());
|
||||||
|
debug!("addr_count.min={}", self.addr_count.min_stateful_height());
|
||||||
|
debug!("empty_addr_count.min={}", self.empty_addr_count.min_stateful_height());
|
||||||
|
debug!("address_activity.min={}", self.address_activity.min_stateful_height());
|
||||||
|
debug!("coinblocks_destroyed.raw.height.len={}", self.coinblocks_destroyed.raw.height.len());
|
||||||
let min_stateful = self.min_stateful_height_len();
|
let min_stateful = self.min_stateful_height_len();
|
||||||
|
|
||||||
// 2. Determine start mode and recover/reset state
|
// 2. Determine start mode and recover/reset state
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ pub const DB_NAME: &str = "positions";
|
|||||||
pub struct Vecs<M: StorageMode = Rw> {
|
pub struct Vecs<M: StorageMode = Rw> {
|
||||||
db: Database,
|
db: Database,
|
||||||
|
|
||||||
pub block_position: M::Stored<PcoVec<Height, BlkPosition>>,
|
pub block: M::Stored<PcoVec<Height, BlkPosition>>,
|
||||||
pub tx_position: M::Stored<PcoVec<TxIndex, BlkPosition>>,
|
pub tx: M::Stored<PcoVec<TxIndex, BlkPosition>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Vecs {
|
impl Vecs {
|
||||||
@@ -29,8 +29,8 @@ impl Vecs {
|
|||||||
let version = parent_version;
|
let version = parent_version;
|
||||||
|
|
||||||
let this = Self {
|
let this = Self {
|
||||||
block_position: PcoVec::forced_import(&db, "position", version + Version::TWO)?,
|
block: PcoVec::forced_import(&db, "position", version + Version::TWO)?,
|
||||||
tx_position: PcoVec::forced_import(&db, "position", version + Version::TWO)?,
|
tx: PcoVec::forced_import(&db, "position", version + Version::TWO)?,
|
||||||
db,
|
db,
|
||||||
};
|
};
|
||||||
finalize_db(&this.db, &this)?;
|
finalize_db(&this.db, &this)?;
|
||||||
@@ -62,8 +62,8 @@ impl Vecs {
|
|||||||
Some(c) if c == current => return Ok(()),
|
Some(c) if c == current => return Ok(()),
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
info!("XOR bytes changed, resetting positions...");
|
info!("XOR bytes changed, resetting positions...");
|
||||||
self.block_position.reset()?;
|
self.block.reset()?;
|
||||||
self.tx_position.reset()?;
|
self.tx.reset()?;
|
||||||
}
|
}
|
||||||
None => {}
|
None => {}
|
||||||
}
|
}
|
||||||
@@ -85,12 +85,12 @@ impl Vecs {
|
|||||||
// Validate computed versions against dependencies
|
// Validate computed versions against dependencies
|
||||||
let dep_version = indexer.vecs.transactions.first_txindex.version()
|
let dep_version = indexer.vecs.transactions.first_txindex.version()
|
||||||
+ indexer.vecs.transactions.height.version();
|
+ indexer.vecs.transactions.height.version();
|
||||||
self.block_position
|
self.block
|
||||||
.validate_computed_version_or_reset(dep_version)?;
|
.validate_computed_version_or_reset(dep_version)?;
|
||||||
self.tx_position
|
self.tx
|
||||||
.validate_computed_version_or_reset(dep_version)?;
|
.validate_computed_version_or_reset(dep_version)?;
|
||||||
|
|
||||||
let min_txindex = TxIndex::from(self.tx_position.len()).min(starting_indexes.txindex);
|
let min_txindex = TxIndex::from(self.tx.len()).min(starting_indexes.txindex);
|
||||||
|
|
||||||
let Some(min_height) = indexer
|
let Some(min_height) = indexer
|
||||||
.vecs
|
.vecs
|
||||||
@@ -116,7 +116,7 @@ impl Vecs {
|
|||||||
.try_for_each(|block| -> Result<()> {
|
.try_for_each(|block| -> Result<()> {
|
||||||
let height = block.height();
|
let height = block.height();
|
||||||
|
|
||||||
self.block_position
|
self.block
|
||||||
.truncate_push(height, block.metadata().position())?;
|
.truncate_push(height, block.metadata().position())?;
|
||||||
|
|
||||||
let txindex = first_txindex_cursor.next().unwrap();
|
let txindex = first_txindex_cursor.next().unwrap();
|
||||||
@@ -124,7 +124,7 @@ impl Vecs {
|
|||||||
block.tx_metadata().iter().enumerate().try_for_each(
|
block.tx_metadata().iter().enumerate().try_for_each(
|
||||||
|(index, metadata)| -> Result<()> {
|
|(index, metadata)| -> Result<()> {
|
||||||
let txindex = txindex + index;
|
let txindex = txindex + index;
|
||||||
self.tx_position
|
self.tx
|
||||||
.truncate_push(txindex, metadata.position())?;
|
.truncate_push(txindex, metadata.position())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
@@ -132,16 +132,16 @@ impl Vecs {
|
|||||||
|
|
||||||
if *height % 1_000 == 0 {
|
if *height % 1_000 == 0 {
|
||||||
let _lock = exit.lock();
|
let _lock = exit.lock();
|
||||||
self.block_position.flush()?;
|
self.block.flush()?;
|
||||||
self.tx_position.flush()?;
|
self.tx.flush()?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let _lock = exit.lock();
|
let _lock = exit.lock();
|
||||||
self.block_position.flush()?;
|
self.block.flush()?;
|
||||||
self.tx_position.flush()?;
|
self.tx.flush()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
1
crates/brk_query/.gitignore
vendored
Normal file
1
crates/brk_query/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*.txt
|
||||||
@@ -5,8 +5,7 @@ use brk_indexer::Indexer;
|
|||||||
use brk_query::Vecs;
|
use brk_query::Vecs;
|
||||||
use vecdb::ReadOnlyClone;
|
use vecdb::ReadOnlyClone;
|
||||||
|
|
||||||
pub fn main() -> color_eyre::Result<()> {
|
pub fn main() -> brk_error::Result<()> {
|
||||||
color_eyre::install()?;
|
|
||||||
|
|
||||||
let tmp = env::temp_dir().join("brk_search_gen");
|
let tmp = env::temp_dir().join("brk_search_gen");
|
||||||
fs::create_dir_all(&tmp)?;
|
fs::create_dir_all(&tmp)?;
|
||||||
|
|||||||
@@ -20,11 +20,7 @@ impl Query {
|
|||||||
return Err(Error::OutOfRange("Block height out of range".into()));
|
return Err(Error::OutOfRange("Block height out of range".into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
let position = computer
|
let position = computer.positions.block.collect_one(height).unwrap();
|
||||||
.positions
|
|
||||||
.block_position
|
|
||||||
.collect_one(height)
|
|
||||||
.unwrap();
|
|
||||||
let size = indexer.vecs.blocks.total_size.collect_one(height).unwrap();
|
let size = indexer.vecs.blocks.total_size.collect_one(height).unwrap();
|
||||||
|
|
||||||
reader.read_raw_bytes(position, *size as usize)
|
reader.read_raw_bytes(position, *size as usize)
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ impl Query {
|
|||||||
.first_txinindex
|
.first_txinindex
|
||||||
.collect_one(txindex)
|
.collect_one(txindex)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let position = computer.positions.tx_position.collect_one(txindex).unwrap();
|
let position = computer.positions.tx.collect_one(txindex).unwrap();
|
||||||
|
|
||||||
// Get block info for status
|
// Get block info for status
|
||||||
let block_hash = indexer.vecs.blocks.blockhash.read_once(height)?;
|
let block_hash = indexer.vecs.blocks.blockhash.read_once(height)?;
|
||||||
@@ -344,7 +344,7 @@ impl Query {
|
|||||||
.total_size
|
.total_size
|
||||||
.collect_one(txindex)
|
.collect_one(txindex)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let position = computer.positions.tx_position.collect_one(txindex).unwrap();
|
let position = computer.positions.tx.collect_one(txindex).unwrap();
|
||||||
|
|
||||||
let buffer = reader.read_raw_bytes(position, *total_size as usize)?;
|
let buffer = reader.read_raw_bytes(position, *total_size as usize)?;
|
||||||
|
|
||||||
|
|||||||
@@ -4764,8 +4764,8 @@ function createRawPattern(client, acc) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} MetricsTree_Positions
|
* @typedef {Object} MetricsTree_Positions
|
||||||
* @property {MetricPattern18<BlkPosition>} blockPosition
|
* @property {MetricPattern18<BlkPosition>} block
|
||||||
* @property {MetricPattern19<BlkPosition>} txPosition
|
* @property {MetricPattern19<BlkPosition>} tx
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4841,24 +4841,24 @@ function createRawPattern(client, acc) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} MetricsTree_Constants
|
* @typedef {Object} MetricsTree_Constants
|
||||||
* @property {MetricPattern1<StoredU16>} constant0
|
* @property {MetricPattern1<StoredU16>} _0
|
||||||
* @property {MetricPattern1<StoredU16>} constant1
|
* @property {MetricPattern1<StoredU16>} _1
|
||||||
* @property {MetricPattern1<StoredU16>} constant2
|
* @property {MetricPattern1<StoredU16>} _2
|
||||||
* @property {MetricPattern1<StoredU16>} constant3
|
* @property {MetricPattern1<StoredU16>} _3
|
||||||
* @property {MetricPattern1<StoredU16>} constant4
|
* @property {MetricPattern1<StoredU16>} _4
|
||||||
* @property {MetricPattern1<StoredU16>} constant20
|
* @property {MetricPattern1<StoredU16>} _20
|
||||||
* @property {MetricPattern1<StoredU16>} constant30
|
* @property {MetricPattern1<StoredU16>} _30
|
||||||
* @property {MetricPattern1<StoredF32>} constant382
|
* @property {MetricPattern1<StoredF32>} _382
|
||||||
* @property {MetricPattern1<StoredU16>} constant50
|
* @property {MetricPattern1<StoredU16>} _50
|
||||||
* @property {MetricPattern1<StoredF32>} constant618
|
* @property {MetricPattern1<StoredF32>} _618
|
||||||
* @property {MetricPattern1<StoredU16>} constant70
|
* @property {MetricPattern1<StoredU16>} _70
|
||||||
* @property {MetricPattern1<StoredU16>} constant80
|
* @property {MetricPattern1<StoredU16>} _80
|
||||||
* @property {MetricPattern1<StoredU16>} constant100
|
* @property {MetricPattern1<StoredU16>} _100
|
||||||
* @property {MetricPattern1<StoredU16>} constant600
|
* @property {MetricPattern1<StoredU16>} _600
|
||||||
* @property {MetricPattern1<StoredI8>} constantMinus1
|
* @property {MetricPattern1<StoredI8>} minus1
|
||||||
* @property {MetricPattern1<StoredI8>} constantMinus2
|
* @property {MetricPattern1<StoredI8>} minus2
|
||||||
* @property {MetricPattern1<StoredI8>} constantMinus3
|
* @property {MetricPattern1<StoredI8>} minus3
|
||||||
* @property {MetricPattern1<StoredI8>} constantMinus4
|
* @property {MetricPattern1<StoredI8>} minus4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -7401,8 +7401,8 @@ class BrkClient extends BrkClientBase {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
positions: {
|
positions: {
|
||||||
blockPosition: createMetricPattern18(this, 'position'),
|
block: createMetricPattern18(this, 'position'),
|
||||||
txPosition: createMetricPattern19(this, 'position'),
|
tx: createMetricPattern19(this, 'position'),
|
||||||
},
|
},
|
||||||
cointime: {
|
cointime: {
|
||||||
activity: {
|
activity: {
|
||||||
@@ -7453,24 +7453,24 @@ class BrkClient extends BrkClientBase {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
constants: {
|
constants: {
|
||||||
constant0: createMetricPattern1(this, 'constant_0'),
|
_0: createMetricPattern1(this, 'constant_0'),
|
||||||
constant1: createMetricPattern1(this, 'constant_1'),
|
_1: createMetricPattern1(this, 'constant_1'),
|
||||||
constant2: createMetricPattern1(this, 'constant_2'),
|
_2: createMetricPattern1(this, 'constant_2'),
|
||||||
constant3: createMetricPattern1(this, 'constant_3'),
|
_3: createMetricPattern1(this, 'constant_3'),
|
||||||
constant4: createMetricPattern1(this, 'constant_4'),
|
_4: createMetricPattern1(this, 'constant_4'),
|
||||||
constant20: createMetricPattern1(this, 'constant_20'),
|
_20: createMetricPattern1(this, 'constant_20'),
|
||||||
constant30: createMetricPattern1(this, 'constant_30'),
|
_30: createMetricPattern1(this, 'constant_30'),
|
||||||
constant382: createMetricPattern1(this, 'constant_38_2'),
|
_382: createMetricPattern1(this, 'constant_38_2'),
|
||||||
constant50: createMetricPattern1(this, 'constant_50'),
|
_50: createMetricPattern1(this, 'constant_50'),
|
||||||
constant618: createMetricPattern1(this, 'constant_61_8'),
|
_618: createMetricPattern1(this, 'constant_61_8'),
|
||||||
constant70: createMetricPattern1(this, 'constant_70'),
|
_70: createMetricPattern1(this, 'constant_70'),
|
||||||
constant80: createMetricPattern1(this, 'constant_80'),
|
_80: createMetricPattern1(this, 'constant_80'),
|
||||||
constant100: createMetricPattern1(this, 'constant_100'),
|
_100: createMetricPattern1(this, 'constant_100'),
|
||||||
constant600: createMetricPattern1(this, 'constant_600'),
|
_600: createMetricPattern1(this, 'constant_600'),
|
||||||
constantMinus1: createMetricPattern1(this, 'constant_minus_1'),
|
minus1: createMetricPattern1(this, 'constant_minus_1'),
|
||||||
constantMinus2: createMetricPattern1(this, 'constant_minus_2'),
|
minus2: createMetricPattern1(this, 'constant_minus_2'),
|
||||||
constantMinus3: createMetricPattern1(this, 'constant_minus_3'),
|
minus3: createMetricPattern1(this, 'constant_minus_3'),
|
||||||
constantMinus4: createMetricPattern1(this, 'constant_minus_4'),
|
minus4: createMetricPattern1(this, 'constant_minus_4'),
|
||||||
},
|
},
|
||||||
indexes: {
|
indexes: {
|
||||||
address: {
|
address: {
|
||||||
|
|||||||
@@ -3691,8 +3691,8 @@ class MetricsTree_Positions:
|
|||||||
"""Metrics tree node."""
|
"""Metrics tree node."""
|
||||||
|
|
||||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||||
self.block_position: MetricPattern18[BlkPosition] = MetricPattern18(client, 'position')
|
self.block: MetricPattern18[BlkPosition] = MetricPattern18(client, 'position')
|
||||||
self.tx_position: MetricPattern19[BlkPosition] = MetricPattern19(client, 'position')
|
self.tx: MetricPattern19[BlkPosition] = MetricPattern19(client, 'position')
|
||||||
|
|
||||||
class MetricsTree_Cointime_Activity:
|
class MetricsTree_Cointime_Activity:
|
||||||
"""Metrics tree node."""
|
"""Metrics tree node."""
|
||||||
@@ -3777,24 +3777,24 @@ class MetricsTree_Constants:
|
|||||||
"""Metrics tree node."""
|
"""Metrics tree node."""
|
||||||
|
|
||||||
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
def __init__(self, client: BrkClientBase, base_path: str = ''):
|
||||||
self.constant_0: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_0')
|
self._0: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_0')
|
||||||
self.constant_1: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_1')
|
self._1: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_1')
|
||||||
self.constant_2: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_2')
|
self._2: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_2')
|
||||||
self.constant_3: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_3')
|
self._3: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_3')
|
||||||
self.constant_4: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_4')
|
self._4: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_4')
|
||||||
self.constant_20: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_20')
|
self._20: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_20')
|
||||||
self.constant_30: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_30')
|
self._30: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_30')
|
||||||
self.constant_38_2: MetricPattern1[StoredF32] = MetricPattern1(client, 'constant_38_2')
|
self._38_2: MetricPattern1[StoredF32] = MetricPattern1(client, 'constant_38_2')
|
||||||
self.constant_50: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_50')
|
self._50: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_50')
|
||||||
self.constant_61_8: MetricPattern1[StoredF32] = MetricPattern1(client, 'constant_61_8')
|
self._61_8: MetricPattern1[StoredF32] = MetricPattern1(client, 'constant_61_8')
|
||||||
self.constant_70: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_70')
|
self._70: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_70')
|
||||||
self.constant_80: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_80')
|
self._80: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_80')
|
||||||
self.constant_100: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_100')
|
self._100: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_100')
|
||||||
self.constant_600: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_600')
|
self._600: MetricPattern1[StoredU16] = MetricPattern1(client, 'constant_600')
|
||||||
self.constant_minus_1: MetricPattern1[StoredI8] = MetricPattern1(client, 'constant_minus_1')
|
self.minus_1: MetricPattern1[StoredI8] = MetricPattern1(client, 'constant_minus_1')
|
||||||
self.constant_minus_2: MetricPattern1[StoredI8] = MetricPattern1(client, 'constant_minus_2')
|
self.minus_2: MetricPattern1[StoredI8] = MetricPattern1(client, 'constant_minus_2')
|
||||||
self.constant_minus_3: MetricPattern1[StoredI8] = MetricPattern1(client, 'constant_minus_3')
|
self.minus_3: MetricPattern1[StoredI8] = MetricPattern1(client, 'constant_minus_3')
|
||||||
self.constant_minus_4: MetricPattern1[StoredI8] = MetricPattern1(client, 'constant_minus_4')
|
self.minus_4: MetricPattern1[StoredI8] = MetricPattern1(client, 'constant_minus_4')
|
||||||
|
|
||||||
class MetricsTree_Indexes_Address_P2pk33:
|
class MetricsTree_Indexes_Address_P2pk33:
|
||||||
"""Metrics tree node."""
|
"""Metrics tree node."""
|
||||||
|
|||||||
Reference in New Issue
Block a user