Clean exit when no space left on device (#6339)

Fixes #6305
This commit is contained in:
Cecile Tonglet
2020-07-09 14:58:29 +02:00
committed by GitHub
parent ef8572f10d
commit a4427f3635
16 changed files with 97 additions and 43 deletions
+7 -2
View File
@@ -25,6 +25,7 @@ use std::{
use crate::{columns, Database, DbHash, Transaction};
use parking_lot::Mutex;
use log::error;
/// Offchain local storage
#[derive(Clone)]
@@ -64,7 +65,9 @@ impl sp_core::offchain::OffchainStorage for LocalStorage {
let mut tx = Transaction::new();
tx.set(columns::OFFCHAIN, &key, value);
self.db.commit(tx);
if let Err(err) = self.db.commit(tx) {
error!("Error setting on local storage: {}", err)
}
}
fn remove(&mut self, prefix: &[u8], key: &[u8]) {
@@ -72,7 +75,9 @@ impl sp_core::offchain::OffchainStorage for LocalStorage {
let mut tx = Transaction::new();
tx.remove(columns::OFFCHAIN, &key);
self.db.commit(tx);
if let Err(err) = self.db.commit(tx) {
error!("Error removing on local storage: {}", err)
}
}
fn get(&self, prefix: &[u8], key: &[u8]) -> Option<Vec<u8>> {