diff options
author | Alex Auvolat <alex@adnab.me> | 2022-06-06 14:01:44 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-06-06 14:01:44 +0200 |
commit | 7f2cf0b809f1fc5741990e2bfff94dc3ec41a04f (patch) | |
tree | d682dfba3c86d823b0447db21bd7740b2ab3d772 /src/table/merkle.rs | |
parent | 4539a6c2298cfb4578261060e4a5af739a45c99f (diff) | |
download | garage-7f2cf0b809f1fc5741990e2bfff94dc3ec41a04f.tar.gz garage-7f2cf0b809f1fc5741990e2bfff94dc3ec41a04f.zip |
Safe choice: return Vec<u8> and not some fancy zero-copy type
Diffstat (limited to 'src/table/merkle.rs')
-rw-r--r-- | src/table/merkle.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/table/merkle.rs b/src/table/merkle.rs index 92e1445b..dc67e8b7 100644 --- a/src/table/merkle.rs +++ b/src/table/merkle.rs @@ -292,7 +292,7 @@ where k: &MerkleNodeKey, ) -> db::TxResult<MerkleNode, Error> { let ent = tx.get(&self.data.merkle_tree, k.encode())?; - MerkleNode::decode_opt(ent).map_err(db::TxError::Abort) + MerkleNode::decode_opt(&ent).map_err(db::TxError::Abort) } fn put_node_txn( @@ -316,7 +316,7 @@ where // Access a node in the Merkle tree, used by the sync protocol pub(crate) fn read_node(&self, k: &MerkleNodeKey) -> Result<MerkleNode, Error> { let ent = self.data.merkle_tree.get(k.encode())?; - MerkleNode::decode_opt(ent) + MerkleNode::decode_opt(&ent) } pub fn merkle_tree_len(&self) -> usize { @@ -351,7 +351,7 @@ impl MerkleNodeKey { } impl MerkleNode { - fn decode_opt(ent: Option<db::Value<'_>>) -> Result<Self, Error> { + fn decode_opt(ent: &Option<db::Value>) -> Result<Self, Error> { match ent { None => Ok(MerkleNode::Empty), Some(v) => Ok(rmp_serde::decode::from_slice::<MerkleNode>(&v[..])?), |