From 78368cc2cdedf3e467ba664fe05993f22f8c33d2 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Tue, 21 May 2019 16:49:56 +1000 Subject: [PATCH] Make LevelDB key type concrete (not generic) --- beacon_node/db/src/leveldb_store.rs | 10 +++++----- beacon_node/db/src/lib.rs | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/beacon_node/db/src/leveldb_store.rs b/beacon_node/db/src/leveldb_store.rs index a06585b11d..10643d0cdb 100644 --- a/beacon_node/db/src/leveldb_store.rs +++ b/beacon_node/db/src/leveldb_store.rs @@ -6,11 +6,11 @@ use leveldb::error::Error as LevelDBError; use leveldb::options::{Options, ReadOptions, WriteOptions}; use std::path::Path; -pub struct LevelDB { - db: Database, +pub struct LevelDB { + db: Database, } -impl LevelDB { +impl LevelDB { pub fn open(path: &Path) -> Result { let mut options = Options::new(); @@ -21,7 +21,7 @@ impl LevelDB { Ok(Self { db }) } - fn read_options(&self) -> ReadOptions { + fn read_options(&self) -> ReadOptions { ReadOptions::new() } @@ -50,7 +50,7 @@ impl Key for BytesKey { } } -impl Store for LevelDB { +impl Store for LevelDB { fn get_bytes(&self, col: &str, key: &[u8]) -> Result, Error> { let column_key = Self::get_key_for_col(col, key); diff --git a/beacon_node/db/src/lib.rs b/beacon_node/db/src/lib.rs index c0b447c5fe..708ac698f4 100644 --- a/beacon_node/db/src/lib.rs +++ b/beacon_node/db/src/lib.rs @@ -5,7 +5,7 @@ mod impls; mod leveldb_store; mod memory_db; -pub use self::leveldb_store::LevelDB; +pub use self::leveldb_store::LevelDB as DiskDB; pub use self::memory_db::MemoryDB; pub use errors::Error; pub use types::*; @@ -151,10 +151,10 @@ mod tests { } #[test] - fn leveldb() { + fn diskdb() { let dir = tempdir().unwrap(); let path = dir.path(); - let store = LevelDB::open(&path).unwrap(); + let store = DiskDB::open(&path).unwrap(); test_impl(store); }