mirror of https://github.com/vacp2p/pmtree.git
make get_elem public (#14)
This commit is contained in:
parent
a48c3d9400
commit
33adfaffef
|
@ -13,7 +13,7 @@ const NEXT_INDEX_KEY: DBKey = u64::MAX.to_be_bytes();
|
||||||
// Denotes keys (depth, index) in Merkle Tree. Can be converted to DBKey
|
// Denotes keys (depth, index) in Merkle Tree. Can be converted to DBKey
|
||||||
// TODO! Think about using hashing for that
|
// TODO! Think about using hashing for that
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
struct Key(usize, usize);
|
pub struct Key(usize, usize);
|
||||||
impl From<Key> for DBKey {
|
impl From<Key> for DBKey {
|
||||||
fn from(key: Key) -> Self {
|
fn from(key: Key) -> Self {
|
||||||
let cantor_pairing = ((key.0 + key.1) * (key.0 + key.1 + 1) / 2 + key.1) as u64;
|
let cantor_pairing = ((key.0 + key.1) * (key.0 + key.1 + 1) / 2 + key.1) as u64;
|
||||||
|
@ -177,7 +177,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns elem by the key
|
// Returns elem by the key
|
||||||
fn get_elem(&self, key: Key) -> PmtreeResult<H::Fr> {
|
pub fn get_elem(&self, key: Key) -> PmtreeResult<H::Fr> {
|
||||||
let res = self
|
let res = self
|
||||||
.db
|
.db
|
||||||
.get(key.into())?
|
.get(key.into())?
|
||||||
|
|
Loading…
Reference in New Issue