computer: simplified a bunch of things

This commit is contained in:
nym21
2026-02-26 19:37:22 +01:00
parent 9e4fe62de2
commit cccaf6b206
252 changed files with 3788 additions and 7279 deletions

View File

@@ -1,32 +1,29 @@
use brk_error::Result;
use brk_indexer::Indexer;
use brk_types::Version;
use vecdb::{Database, ReadableCloneableVec};
use vecdb::Database;
use super::Vecs;
use crate::{
indexes,
internal::{ComputedFromHeightCumFull, ComputedHeightDerivedCumFull},
internal::{ComputedFromHeightCumulativeFull, ComputedHeightDerivedCumulativeFull},
};
impl Vecs {
pub(crate) fn forced_import(
db: &Database,
version: Version,
indexer: &Indexer,
indexes: &indexes::Vecs,
) -> Result<Self> {
Ok(Self {
vbytes: ComputedFromHeightCumFull::forced_import(
vbytes: ComputedFromHeightCumulativeFull::forced_import(
db,
"block_vbytes",
version,
indexes,
)?,
size: ComputedHeightDerivedCumFull::forced_import(
size: ComputedHeightDerivedCumulativeFull::forced_import(
db,
"block_size",
indexer.vecs.blocks.total_size.read_only_boxed_clone(),
version,
indexes,
)?,

View File

@@ -2,10 +2,10 @@ use brk_traversable::Traversable;
use brk_types::StoredU64;
use vecdb::{Rw, StorageMode};
use crate::internal::{ComputedFromHeightCumFull, ComputedHeightDerivedCumFull};
use crate::internal::{ComputedFromHeightCumulativeFull, ComputedHeightDerivedCumulativeFull};
#[derive(Traversable)]
pub struct Vecs<M: StorageMode = Rw> {
pub vbytes: ComputedFromHeightCumFull<StoredU64, M>,
pub size: ComputedHeightDerivedCumFull<StoredU64, M>,
pub vbytes: ComputedFromHeightCumulativeFull<StoredU64, M>,
pub size: ComputedHeightDerivedCumulativeFull<StoredU64, M>,
}