From 3876c0261aea03af1a2e47bffae05e36b7950d14 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Tue, 18 Sep 2018 10:27:29 +1000 Subject: [PATCH] Implement get and put on ClientDB trait --- lighthouse/db/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lighthouse/db/mod.rs b/lighthouse/db/mod.rs index 23ddb9a37..6472e7f62 100644 --- a/lighthouse/db/mod.rs +++ b/lighthouse/db/mod.rs @@ -4,18 +4,23 @@ mod disk_db; pub use self::disk_db::DiskDB; +type DBValue = Vec; + #[derive(Debug)] pub struct DBError { message: String } impl DBError { - fn new(message: String) -> Self { + pub fn new(message: String) -> Self { Self { message } } } pub trait ClientDB: Sync + Send { fn get(&self, col: &str, key: &[u8]) - -> Result, DBError>; + -> Result, DBError>; + + fn put(&self, col: &str, key: &[u8], val: &[u8]) + -> Result<(), DBError>; }