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

Function canonical_effect_writers

atomic-core/src/pristine/applied_changes.rs:37–74  ·  view source on GitHub ↗
(
    graph: &impl ReadableMultimapTable<&'static [u8; 24], &'static [u8; 24]>,
    attrs: &impl ReadableMultimapTable<&'static [u8; 17], &'static [u8; 13]>,
    views: &impl ReadableTable<&'static [u

Source from the content-addressed store, hash-verified

35}
36
37fn canonical_effect_writers(
38 graph: &impl ReadableMultimapTable<&'static [u8; 24], &'static [u8; 24]>,
39 attrs: &impl ReadableMultimapTable<&'static [u8; 17], &'static [u8; 13]>,
40 views: &impl ReadableTable<&'static [u8; 16], u64>,
41) -> PristineResult<HashSet<u64>> {
42 let mut ids = HashSet::new();
43 for entry in graph.iter()? {
44 let (key, edges) = entry?;
45 let (owner, _, _) = decode_vertex(key.value());
46 if owner != 0 {
47 ids.insert(owner);
48 }
49 for edge in edges {
50 let edge = super::txn::helpers::deserialize_edge(edge?.value());
51 let writer = edge.introduced_by();
52 if !writer.is_root() {
53 ids.insert(writer.get());
54 }
55 }
56 }
57 for entry in attrs.iter()? {
58 let (_, events) = entry?;
59 for event in events {
60 ids.insert(decode_inode_attr_event(event?.value())?.introduced_by.get());
61 }
62 }
63 // View membership is published only after successful ingestion in the
64 // same transaction. It also preserves completion evidence for empty
65 // changes, which have no graph or attribute effects to discover.
66 for entry in views.iter()? {
67 let (_, id) = entry?;
68 if id.value() != 0 {
69 ids.insert(id.value());
70 }
71 }
72 ids.remove(&0);
73 Ok(ids)
74}
75
76impl ReadTxn {
77 /// Whether canonical effects were ingested, independently of current

Callers 2

initializeFunction · 0.85
was_change_appliedMethod · 0.85

Calls 10

decode_vertexFunction · 0.85
decode_inode_attr_eventFunction · 0.85
valueMethod · 0.80
getMethod · 0.65
removeMethod · 0.65
deserialize_edgeFunction · 0.50
iterMethod · 0.45
insertMethod · 0.45
introduced_byMethod · 0.45
is_rootMethod · 0.45

Tested by

no test coverage detected