mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 21:37:56 +00:00
@@ -19,7 +19,7 @@
|
||||
|
||||
use ::kvdb::{DBTransaction, KeyValueDB};
|
||||
|
||||
use crate::{Database, Change, Transaction, ColumnId};
|
||||
use crate::{Database, Change, ColumnId, Transaction, error};
|
||||
|
||||
struct DbAdapter<D: KeyValueDB + 'static>(D);
|
||||
|
||||
@@ -38,7 +38,7 @@ pub fn as_database<D: KeyValueDB + 'static, H: Clone>(db: D) -> std::sync::Arc<d
|
||||
}
|
||||
|
||||
impl<D: KeyValueDB, H: Clone> Database<H> for DbAdapter<D> {
|
||||
fn commit(&self, transaction: Transaction<H>) {
|
||||
fn commit(&self, transaction: Transaction<H>) -> error::Result<()> {
|
||||
let mut tx = DBTransaction::new();
|
||||
for change in transaction.0.into_iter() {
|
||||
match change {
|
||||
@@ -47,7 +47,7 @@ impl<D: KeyValueDB, H: Clone> Database<H> for DbAdapter<D> {
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
handle_err(self.0.write(tx));
|
||||
self.0.write(tx).map_err(|e| error::DatabaseError(Box::new(e)))
|
||||
}
|
||||
|
||||
fn get(&self, col: ColumnId, key: &[u8]) -> Option<Vec<u8>> {
|
||||
|
||||
Reference in New Issue
Block a user