diff --git a/beacon_node/db/src/leveldb_store.rs b/beacon_node/db/src/leveldb_store.rs index c60e34283..a06585b11 100644 --- a/beacon_node/db/src/leveldb_store.rs +++ b/beacon_node/db/src/leveldb_store.rs @@ -4,11 +4,10 @@ use leveldb::database::kv::KV; use leveldb::database::Database; use leveldb::error::Error as LevelDBError; use leveldb::options::{Options, ReadOptions, WriteOptions}; -use parking_lot::RwLock; use std::path::Path; pub struct LevelDB { - db: RwLock>, + db: Database, } impl LevelDB { @@ -19,9 +18,7 @@ impl LevelDB { let db = Database::open(path, options)?; - Ok(Self { - db: RwLock::new(db), - }) + Ok(Self { db }) } fn read_options(&self) -> ReadOptions { @@ -58,7 +55,6 @@ impl Store for LevelDB { let column_key = Self::get_key_for_col(col, key); self.db - .read() .get(self.read_options(), column_key) .map_err(Into::into) } @@ -67,7 +63,6 @@ impl Store for LevelDB { let column_key = Self::get_key_for_col(col, key); self.db - .write() .put(self.write_options(), column_key, val) .map_err(Into::into) } @@ -76,7 +71,6 @@ impl Store for LevelDB { let column_key = Self::get_key_for_col(col, key); self.db - .read() .get(self.read_options(), column_key) .map_err(Into::into) .and_then(|val| Ok(val.is_some())) @@ -85,7 +79,6 @@ impl Store for LevelDB { fn key_delete(&self, col: &str, key: &[u8]) -> Result<(), Error> { let column_key = Self::get_key_for_col(col, key); self.db - .write() .delete(self.write_options(), column_key) .map_err(Into::into) }