mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 21:37:56 +00:00
@@ -18,7 +18,7 @@
|
||||
//! In-memory implementation of `Database`
|
||||
|
||||
use std::collections::HashMap;
|
||||
use crate::{Database, Transaction, ColumnId, Change};
|
||||
use crate::{Database, Change, ColumnId, Transaction, error};
|
||||
use parking_lot::RwLock;
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -29,7 +29,7 @@ pub struct MemDb<H: Clone + Send + Sync + Eq + PartialEq + Default + std::hash::
|
||||
impl<H> Database<H> for MemDb<H>
|
||||
where H: Clone + Send + Sync + Eq + PartialEq + Default + std::hash::Hash
|
||||
{
|
||||
fn commit(&self, transaction: Transaction<H>) {
|
||||
fn commit(&self, transaction: Transaction<H>) -> error::Result<()> {
|
||||
let mut s = self.0.write();
|
||||
for change in transaction.0.into_iter() {
|
||||
match change {
|
||||
@@ -39,6 +39,8 @@ impl<H> Database<H> for MemDb<H>
|
||||
Change::Release(hash) => { s.1.remove(&hash); },
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get(&self, col: ColumnId, key: &[u8]) -> Option<Vec<u8>> {
|
||||
|
||||
Reference in New Issue
Block a user