mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 04:09:23 +00:00
Support reloading the mempool from disk
This commit is contained in:
@@ -29,8 +29,8 @@ pub trait Db: 'static + Send + Sync + Clone + Debug + Get {
|
||||
}
|
||||
|
||||
/// An atomic operation for the in-memory databae.
|
||||
#[derive(Debug)]
|
||||
#[must_use]
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub struct MemDbTxn<'a>(&'a MemDb, HashMap<Vec<u8>, Vec<u8>>, HashSet<Vec<u8>>);
|
||||
|
||||
impl<'a> Get for MemDbTxn<'a> {
|
||||
@@ -65,6 +65,13 @@ impl<'a> DbTxn for MemDbTxn<'a> {
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct MemDb(Arc<RwLock<HashMap<Vec<u8>, Vec<u8>>>>);
|
||||
|
||||
impl PartialEq for MemDb {
|
||||
fn eq(&self, other: &MemDb) -> bool {
|
||||
*self.0.read().unwrap() == *other.0.read().unwrap()
|
||||
}
|
||||
}
|
||||
impl Eq for MemDb {}
|
||||
|
||||
impl Default for MemDb {
|
||||
fn default() -> MemDb {
|
||||
MemDb(Arc::new(RwLock::new(HashMap::new())))
|
||||
|
||||
Reference in New Issue
Block a user