use croaring::Bitmap;
use crate::core::hash::Hash;
use crate::core::BlockHeader;
use crate::ser::PMMRable;
pub trait Backend<T: PMMRable> {
fn append(&mut self, data: &T, hashes: &[Hash]) -> Result<(), String>;
fn append_pruned_subtree(&mut self, hash: Hash, pos0: u64) -> Result<(), String>;
fn append_hash(&mut self, hash: Hash) -> Result<(), String>;
fn rewind(&mut self, pos1: u64, rewind_rm_pos: &Bitmap) -> Result<(), String>;
fn get_hash(&self, pos0: u64) -> Option<Hash>;
fn get_data(&self, pos0: u64) -> Option<T::E>;
fn get_from_file(&self, pos0: u64) -> Option<Hash>;
fn get_peak_from_file(&self, pos0: u64) -> Option<Hash>;
fn get_data_from_file(&self, pos0: u64) -> Option<T::E>;
fn leaf_pos_iter(&self) -> Box<dyn Iterator<Item = u64> + '_>;
fn n_unpruned_leaves(&self) -> u64;
fn n_unpruned_leaves_to_index(&self, to_index: u64) -> u64;
fn leaf_idx_iter(&self, from_idx: u64) -> Box<dyn Iterator<Item = u64> + '_>;
fn remove(&mut self, position: u64) -> Result<(), String>;
fn remove_from_leaf_set(&mut self, pos0: u64);
fn release_files(&mut self);
fn reset_prune_list(&mut self);
fn snapshot(&self, header: &BlockHeader) -> Result<(), String>;
fn dump_stats(&self);
}