MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / get_crdt_trunk

Method get_crdt_trunk

atomic-core/src/pristine/txn/read.rs:1746–1760  ·  view source on GitHub ↗
(
        &self,
        key: &[u8; 12],
    )

Source from the content-addressed store, hash-verified

1744
1745impl crate::pristine::traits::CrdtTxnT for ReadTxn {
1746 fn get_crdt_trunk(
1747 &self,
1748 key: &[u8; 12],
1749 ) -> PristineResult<Option<crate::crdt::tables::SerializedTrunk>> {
1750 use crate::crdt::tables::{decode_trunk_value, TRUNKS};
1751 let table = crdt_table_opt!(self, TRUNKS);
1752 let result = match table.get(key)? {
1753 Some(guard) => {
1754 let bytes_copy: Vec<u8> = guard.value().to_vec();
1755 decode_trunk_value(&bytes_copy)
1756 }
1757 None => None,
1758 };
1759 Ok(result)
1760 }
1761
1762 fn get_crdt_inode_trunk(&self, inode: u64) -> PristineResult<Option<[u8; 12]>> {
1763 use crate::crdt::tables::INODE_TRUNK;

Calls 3

decode_trunk_valueFunction · 0.85
valueMethod · 0.80
getMethod · 0.65