reader: snap

This commit is contained in:
nym21
2026-04-14 01:37:04 +02:00
parent 283baca848
commit 4cd8d9eb56
17 changed files with 927 additions and 1144 deletions
+2 -2
View File
@@ -88,12 +88,12 @@ impl Blocks {
if count <= 10 {
State::new_rpc(client.clone(), start, end, hash_opt)
} else {
State::new_reader(reader.clone(), start, end, hash_opt)
State::new_reader(reader.clone(), start, end, hash_opt)?
}
}
Source::Rpc { client } => State::new_rpc(client.clone(), start, end, hash_opt),
Source::Reader { reader, .. } => {
State::new_reader(reader.clone(), start, end, hash_opt)
State::new_reader(reader.clone(), start, end, hash_opt)?
}
};
+5 -4
View File
@@ -1,5 +1,6 @@
use std::vec;
use brk_error::Result;
use brk_reader::{Reader, Receiver};
use brk_rpc::Client;
use brk_types::{BlockHash, Height, ReadBlock};
@@ -40,10 +41,10 @@ impl State {
start: Height,
end: Height,
after_hash: Option<BlockHash>,
) -> Self {
State::Reader {
receiver: reader.read(Some(start), Some(end)),
) -> Result<Self> {
Ok(State::Reader {
receiver: reader.range(start, end)?,
after_hash,
}
})
}
}