diff --git a/src/bin/backfill_strategy_bench.rs b/src/bin/backfill_strategy_bench.rs index 65f5101..14a520a 100644 --- a/src/bin/backfill_strategy_bench.rs +++ b/src/bin/backfill_strategy_bench.rs @@ -9,7 +9,6 @@ mod sparse_mst; use std::collections::BTreeMap; use std::io::Write; -use std::sync::Arc; use std::time::{Duration, Instant}; use cid::Cid as IpldCid; @@ -23,7 +22,6 @@ use jacquard_common::types::cid::Cid as AtCid; use jacquard_common::types::did::Did; use jacquard_common::types::string::{Nsid, RecordKey}; use jacquard_common::xrpc::{XrpcError, XrpcExt}; -use jacquard_repo::{BlockStore, MemoryBlockStore, Mst}; use miette::{IntoDiagnostic, Result, WrapErr}; use serde::Deserialize; use smol_str::SmolStr; @@ -297,22 +295,17 @@ async fn bench_full( let bytes = car.body.len(); let parse_start = Instant::now(); - let parsed = jacquard_repo::car::reader::parse_car_bytes(&car.body) - .await - .into_diagnostic() - .wrap_err_with(|| format!("parse getRepo CAR for {did} ({} bytes)", car.body.len()))?; + let parsed = car::parse_car(car.body, false) + .wrap_err_with(|| format!("parse getRepo CAR for {did} ({bytes} bytes)"))?; let blocks = parsed.blocks.len(); - let store = Arc::new(MemoryBlockStore::new_from_blocks(parsed.blocks)); - let root_bytes = store + let root_bytes = parsed + .blocks .get(&parsed.root) - .await - .into_diagnostic()? .ok_or_else(|| miette::miette!("root block missing from getRepo car"))?; let root_commit = - jacquard_repo::commit::Commit::::from_cbor(&root_bytes) + jacquard_repo::commit::Commit::::from_cbor(root_bytes) .into_diagnostic()?; - let mst: Mst = Mst::load(store, root_commit.data, None); - let leaves = mst.leaves().await.into_diagnostic()?; + let leaves = mst::leaves(&parsed.blocks, root_commit.data)?; let matching = leaves .iter() .filter(|(key, _)| ranges.iter().any(|range| range.contains(key)))