Remove create_col from ClientDB trait

This commit is contained in:
Paul Hauner 2018-09-21 14:12:53 +10:00
parent 5b177a80b9
commit f80d5ff0bd
No known key found for this signature in database
GPG Key ID: 303E4494BB28068C
3 changed files with 9 additions and 17 deletions

View File

@ -55,15 +55,7 @@ impl DiskDB {
db,
}
}
}
impl From<RocksError> for DBError {
fn from(e: RocksError) -> Self {
Self { message: e.to_string() }
}
}
impl ClientDB for DiskDB {
/// Create a RocksDB column family. Corresponds to the
/// `create_cf()` function on the RocksDB API.
fn create_col(&mut self, col: &str)
@ -75,6 +67,15 @@ impl ClientDB for DiskDB {
}
}
}
impl From<RocksError> for DBError {
fn from(e: RocksError) -> Self {
Self { message: e.to_string() }
}
}
impl ClientDB for DiskDB {
/// Get the value for some key on some column.
///
/// Corresponds to the `get_cf()` method on the RocksDB API.

View File

@ -45,12 +45,6 @@ impl MemoryDB {
}
impl ClientDB for MemoryDB {
fn create_col(&mut self, col: &str)
-> Result<(), DBError>
{
Ok(()) // This field is not used. Will remove from trait.
}
/// Get the value of some key from the database. Returns `None` if the key does not exist.
fn get(&self, col: &str, key: &[u8])
-> Result<Option<DBValue>, DBError>

View File

@ -18,9 +18,6 @@ impl DBError {
/// program to use a persistent on-disk database during production,
/// but use a transient database during tests.
pub trait ClientDB: Sync + Send {
fn create_col(&mut self, col: &str)
-> Result<(), DBError>;
fn get(&self, col: &str, key: &[u8])
-> Result<Option<DBValue>, DBError>;