computer: refactor

This commit is contained in:
nym21
2025-08-10 16:00:44 +02:00
parent a61926988a
commit ee5dc8fc41
10 changed files with 26 additions and 27 deletions
@@ -2,7 +2,7 @@ use brk_structs::{ByAddressType, Height};
use derive_deref::{Deref, DerefMut};
use vecdb::VecIterator;
use crate::stateful::addresstype_to_height_to_addresscount::AddressTypeToHeightToAddressCount;
use super::AddressTypeToHeightToAddressCount;
#[derive(Debug, Default, Deref, DerefMut)]
pub struct AddressTypeToAddressCount(ByAddressType<u64>);
@@ -1,9 +1,9 @@
use brk_error::Result;
use brk_structs::{ByAddressType, Height, StoredU64};
use vecdb::{EagerVec, Exit, GenericStoredVec};
use derive_deref::{Deref, DerefMut};
use vecdb::{EagerVec, Exit, GenericStoredVec};
use crate::stateful::addresstype_to_addresscount::AddressTypeToAddressCount;
use super::AddressTypeToAddressCount;
#[derive(Debug, Clone, Deref, DerefMut)]
pub struct AddressTypeToHeightToAddressCount(ByAddressType<EagerVec<Height, StoredU64>>);
@@ -3,10 +3,9 @@ use brk_structs::{ByAddressType, StoredU64};
use derive_deref::{Deref, DerefMut};
use vecdb::{AnyCollectableVec, Exit};
use crate::{
Indexes, grouped::ComputedVecsFromHeight, indexes,
stateful::addresstype_to_height_to_addresscount::AddressTypeToHeightToAddressCount,
};
use crate::{Indexes, grouped::ComputedVecsFromHeight, indexes};
use super::AddressTypeToHeightToAddressCount;
#[derive(Clone, Deref, DerefMut)]
pub struct AddressTypeToIndexesToAddressCount(ByAddressType<ComputedVecsFromHeight<StoredU64>>);
@@ -0,0 +1,13 @@
mod addresscount;
mod height_to_addresscount;
mod height_to_vec;
mod indexes_to_addresscount;
mod typeindex_tree;
mod vec;
pub use addresscount::*;
pub use height_to_addresscount::*;
pub use height_to_vec::*;
pub use indexes_to_addresscount::*;
pub use typeindex_tree::*;
pub use vec::*;
@@ -1,10 +1,8 @@
use std::{collections::BTreeMap, mem};
use brk_structs::TypeIndex;
use brk_structs::{ByAddressType, TypeIndex};
use derive_deref::{Deref, DerefMut};
use super::ByAddressType;
#[derive(Debug, Deref, DerefMut)]
pub struct AddressTypeToTypeIndexTree<T>(ByAddressType<BTreeMap<TypeIndex, T>>);
@@ -1,9 +1,8 @@
use std::mem;
use brk_structs::ByAddressType;
use derive_deref::{Deref, DerefMut};
use super::ByAddressType;
#[derive(Debug, Deref, DerefMut)]
pub struct AddressTypeToVec<T>(ByAddressType<Vec<T>>);
+3 -13
View File
@@ -25,28 +25,18 @@ use crate::{
mod address_cohort;
mod address_cohorts;
mod addresstype_to_addresscount;
mod addresstype_to_height_to_addresscount;
mod addresstype_to_indexes_to_addresscount;
mod addresstype_to_typeindex_tree;
mod addresstype_to_vec;
mod addresstype;
mod common;
mod height_to_addresstype_to_vec;
mod range_map;
mod r#trait;
mod utxo_cohort;
mod utxo_cohorts;
mod withaddressdatasource;
use addresstype_to_addresscount::*;
use addresstype_to_height_to_addresscount::*;
use addresstype_to_indexes_to_addresscount::*;
pub use addresstype_to_typeindex_tree::*;
pub use addresstype_to_vec::*;
use height_to_addresstype_to_vec::*;
use addresstype::*;
use range_map::*;
use r#trait::*;
pub use withaddressdatasource::WithAddressDataSource;
use withaddressdatasource::*;
const VERSION: Version = Version::new(21);
+1 -1
View File
@@ -82,7 +82,7 @@ fn req_to_response_res(
let guard_res = cache.get_value_or_guard(
&format!("{}{}{etag}", uri.path(), uri.query().unwrap_or("")),
Some(Duration::from_millis(500)),
Some(Duration::from_millis(50)),
);
let mut response = if let GuardResult::Value(v) = guard_res {
+1 -1
View File
@@ -88,7 +88,7 @@ fn path_to_response_(headers: &HeaderMap, app_state: &AppState, path: &Path) ->
let guard_res = if !must_revalidate {
Some(app_state.cache.get_value_or_guard(
&path.to_str().unwrap().to_owned(),
Some(Duration::from_millis(500)),
Some(Duration::from_millis(50)),
))
} else {
None