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

Method crdt_span_edit_authors

atomic-core/src/pristine/txn/read.rs:1746–1771  ·  view source on GitHub ↗
(&self, trunk: crate::crdt::TrunkId)

Source from the content-addressed store, hash-verified

1744
1745impl crate::pristine::traits::CrdtTxnT for ReadTxn {
1746 fn crdt_span_edit_authors(&self, trunk: crate::crdt::TrunkId) -> PristineResult<Vec<NodeId>> {
1747 use crate::pristine::span_patch_storage::SpanPatchReadTxn;
1748 let table = match self.txn.open_table(crate::crdt::tables::INODE_TRUNK) {
1749 Ok(table) => table,
1750 Err(redb::TableError::TableDoesNotExist(_)) => return Ok(Vec::new()),
1751 Err(error) => return Err(error.into()),
1752 };
1753 let mut authors = std::collections::BTreeSet::new();
1754 for row in table.iter()? {
1755 let (inode, stored) = row?;
1756 if *stored.value() == trunk.to_bytes() {
1757 let inode = crate::Inode::new(inode.value());
1758 for (_, edit) in
1759 self.span_edits_for_inode(inode)
1760 .map_err(|e| PristineError::Inconsistent {
1761 message: e.to_string(),
1762 })?
1763 {
1764 authors.insert(NodeId::new(u64::from_be_bytes(
1765 edit[16..24].try_into().unwrap(),
1766 )));
1767 }
1768 }
1769 }
1770 Ok(authors.into_iter().collect())
1771 }
1772 fn get_crdt_trunk(
1773 &self,
1774 key: &[u8; 12],

Callers 1

output_trunk_via_crdtFunction · 0.45

Calls 8

iterMethod · 0.45
valueMethod · 0.45
to_bytesMethod · 0.45
span_edits_for_inodeMethod · 0.45
insertMethod · 0.45
unwrapMethod · 0.45
collectMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected