mirror of https://github.com/vacp2p/pmtree.git
style: add new lines to hasher & database modules
This commit is contained in:
parent
e650af8ee4
commit
e400803cbe
|
@ -4,12 +4,16 @@ use crate::*;
|
||||||
pub trait Database {
|
pub trait Database {
|
||||||
/// Creates new instance of db
|
/// Creates new instance of db
|
||||||
fn new(dbpath: &str) -> Self;
|
fn new(dbpath: &str) -> Self;
|
||||||
|
|
||||||
/// Loades existing db (existence check required)
|
/// Loades existing db (existence check required)
|
||||||
fn load(dbpath: &str) -> Self;
|
fn load(dbpath: &str) -> Self;
|
||||||
|
|
||||||
/// Returns value from db by the key
|
/// Returns value from db by the key
|
||||||
fn get(&self, key: DBKey) -> Result<Option<Value>>;
|
fn get(&self, key: DBKey) -> Result<Option<Value>>;
|
||||||
|
|
||||||
/// Puts the value to the db by the key
|
/// Puts the value to the db by the key
|
||||||
fn put(&mut self, key: DBKey, value: Value) -> Result<()>;
|
fn put(&mut self, key: DBKey, value: Value) -> Result<()>;
|
||||||
|
|
||||||
/// Deletes the key from db
|
/// Deletes the key from db
|
||||||
fn delete(&mut self, key: DBKey) -> Result<()>;
|
fn delete(&mut self, key: DBKey) -> Result<()>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,10 @@ pub trait Hasher {
|
||||||
|
|
||||||
/// Creates new hash-function instance
|
/// Creates new hash-function instance
|
||||||
fn new() -> Self;
|
fn new() -> Self;
|
||||||
|
|
||||||
/// Outputs the default leaf (Fr::default())
|
/// Outputs the default leaf (Fr::default())
|
||||||
fn default_leaf() -> Self::Fr;
|
fn default_leaf() -> Self::Fr;
|
||||||
|
|
||||||
/// Calculates hash-function
|
/// Calculates hash-function
|
||||||
fn hash(input: &[Self::Fr]) -> Self::Fr;
|
fn hash(input: &[Self::Fr]) -> Self::Fr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue