mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-22 07:44:47 -07:00
global: add datasets and charts
This commit is contained in:
@@ -3,18 +3,11 @@ use brk_structs::{Height, Version};
|
||||
|
||||
pub trait AnyStore {
|
||||
fn commit(&mut self, height: Height) -> Result<()>;
|
||||
|
||||
fn persist(&self) -> Result<()>;
|
||||
|
||||
fn reset(&mut self) -> Result<()>;
|
||||
|
||||
fn name(&self) -> &'static str;
|
||||
|
||||
fn height(&self) -> Option<Height>;
|
||||
|
||||
fn has(&self, height: Height) -> bool;
|
||||
|
||||
fn needs(&self, height: Height) -> bool;
|
||||
|
||||
fn version(&self) -> Version;
|
||||
}
|
||||
|
||||
@@ -126,12 +126,12 @@ where
|
||||
// .map(|(k, v)| (K::from(ByteView::from(k)), V::from(ByteView::from(v)))))
|
||||
// }
|
||||
|
||||
// pub fn tx_iter(&self) -> impl Iterator<Item = (K, V)> {
|
||||
// self.rtx
|
||||
// .iter(&self.partition.load())
|
||||
// .map(|res| res.unwrap())
|
||||
// .map(|(k, v)| (K::from(ByteView::from(k)), V::from(ByteView::from(v))))
|
||||
// }
|
||||
pub fn iter(&self) -> impl Iterator<Item = (K, V)> {
|
||||
self.rtx
|
||||
.iter(self.partition.as_ref().unwrap())
|
||||
.map(|res| res.unwrap())
|
||||
.map(|(k, v)| (K::from(ByteView::from(k)), V::from(ByteView::from(v))))
|
||||
}
|
||||
|
||||
pub fn insert_if_needed(&mut self, key: K, value: V, height: Height) {
|
||||
if self.needs(height) {
|
||||
|
||||
Reference in New Issue
Block a user