kibo: move types around

This commit is contained in:
nym21
2025-04-04 00:40:40 +02:00
parent 6700686e4b
commit 6a17ee414a
15 changed files with 193 additions and 247 deletions

View File

@@ -27,7 +27,7 @@ pub struct Store<Key, Value> {
}
const CHECK_COLLISISONS: bool = true;
const FJALL_VERSION: Version = Version::TWO;
const MAJOR_FJALL_VERSION: Version = Version::TWO;
impl<K, V> Store<K, V>
where
@@ -36,7 +36,7 @@ where
<V as TryFrom<ByteView>>::Error: error::Error + Send + Sync + 'static,
{
pub fn import(path: &Path, version: Version) -> color_eyre::Result<Self> {
let version = FJALL_VERSION + version;
let version = MAJOR_FJALL_VERSION + version;
let meta = StoreMeta::checked_open(path, version)?;
@@ -92,6 +92,10 @@ where
}
pub fn remove(&mut self, key: K) {
if self.is_empty() {
return;
}
if !self.puts.is_empty() {
unreachable!("Shouldn't reach this");
// self.puts.remove(&key);

View File

@@ -46,6 +46,13 @@ impl Stores {
vecs: &mut Vecs,
starting_indexes: &Indexes,
) -> color_eyre::Result<()> {
if self.addresshash_to_addressindex.is_empty()
&& self.blockhash_prefix_to_height.is_empty()
&& self.txid_prefix_to_txindex.is_empty()
{
return Ok(());
}
vecs.height_to_blockhash
.iter_from(starting_indexes.height, |(_, blockhash, ..)| {
let blockhash_prefix = BlockHashPrefix::from(blockhash);

View File

@@ -144,6 +144,7 @@ impl Server {
},
)
.on_body_chunk(())
.on_failure(())
.on_eos(());
let router = Router::new()

View File

@@ -200,6 +200,10 @@ where
.to_usize()
.unwrap();
if len == 0 {
return Err(Error::IndexTooHigh);
}
let from = from.map_or(0, |from| {
if from >= 0 {
from as usize