Remove create_col
from ClientDB trait
This commit is contained in:
parent
5b177a80b9
commit
f80d5ff0bd
@ -55,15 +55,7 @@ impl DiskDB {
|
|||||||
db,
|
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 a RocksDB column family. Corresponds to the
|
||||||
/// `create_cf()` function on the RocksDB API.
|
/// `create_cf()` function on the RocksDB API.
|
||||||
fn create_col(&mut self, col: &str)
|
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.
|
/// Get the value for some key on some column.
|
||||||
///
|
///
|
||||||
/// Corresponds to the `get_cf()` method on the RocksDB API.
|
/// Corresponds to the `get_cf()` method on the RocksDB API.
|
||||||
|
@ -45,12 +45,6 @@ impl MemoryDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ClientDB for 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.
|
/// Get the value of some key from the database. Returns `None` if the key does not exist.
|
||||||
fn get(&self, col: &str, key: &[u8])
|
fn get(&self, col: &str, key: &[u8])
|
||||||
-> Result<Option<DBValue>, DBError>
|
-> Result<Option<DBValue>, DBError>
|
||||||
|
@ -18,9 +18,6 @@ impl DBError {
|
|||||||
/// program to use a persistent on-disk database during production,
|
/// program to use a persistent on-disk database during production,
|
||||||
/// but use a transient database during tests.
|
/// but use a transient database during tests.
|
||||||
pub trait ClientDB: Sync + Send {
|
pub trait ClientDB: Sync + Send {
|
||||||
fn create_col(&mut self, col: &str)
|
|
||||||
-> Result<(), DBError>;
|
|
||||||
|
|
||||||
fn get(&self, col: &str, key: &[u8])
|
fn get(&self, col: &str, key: &[u8])
|
||||||
-> Result<Option<DBValue>, DBError>;
|
-> Result<Option<DBValue>, DBError>;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user