use std::fs::File;
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: Vec<Hash>) -> Result<(), String>;
fn rewind(&mut self, position: u64, rewind_rm_pos: &Bitmap) -> Result<(), String>;
fn get_hash(&self, position: u64) -> Option<Hash>;
fn get_data(&self, position: u64) -> Option<T::E>;
fn get_from_file(&self, position: u64) -> Option<Hash>;
fn get_data_from_file(&self, position: u64) -> Option<T::E>;
fn leaf_pos_iter(&self) -> Box<dyn Iterator<Item = u64> + '_>;
fn n_unpruned_leaves(&self) -> u64;
fn leaf_idx_iter(&self, from_idx: u64) -> Box<dyn Iterator<Item = u64> + '_>;
fn remove(&mut self, position: u64) -> Result<(), String>;
fn data_as_temp_file(&self) -> Result<File, String>;
fn release_files(&mut self);
fn snapshot(&self, header: &BlockHeader) -> Result<(), String>;
fn dump_stats(&self);
}