mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-07 20:59:09 -07:00
kibo: move types around
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -144,6 +144,7 @@ impl Server {
|
||||
},
|
||||
)
|
||||
.on_body_chunk(())
|
||||
.on_failure(())
|
||||
.on_eos(());
|
||||
|
||||
let router = Router::new()
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user