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

Method load

atomic-repository/src/repository/synthesis.rs:1030–1073  ·  view source on GitHub ↗
(
        loader: &dyn Fn(&Hash) -> Result<Change, String>,
        txn: &atomic_core::pristine::WriteTxn<'_>,
        trunk: atomic_core::crdt::TrunkId,
        visibility: &atomic_core::pristine::Gr

Source from the content-addressed store, hash-verified

1028
1029impl SemanticDeletionEvidence {
1030 pub(super) fn load(
1031 loader: &dyn Fn(&Hash) -> Result<Change, String>,
1032 txn: &atomic_core::pristine::WriteTxn<'_>,
1033 trunk: atomic_core::crdt::TrunkId,
1034 visibility: &atomic_core::pristine::GraphVisibilityClosure,
1035 ) -> Result<Self, String> {
1036 use atomic_core::pristine::GraphTxnT;
1037 let mut evidence = Self::default();
1038 for (change_id, hash) in txn.list_registered_changes().map_err(|e| e.to_string())? {
1039 // Registration alone is never proof that FileOps executed.
1040 if !txn
1041 .was_change_applied(change_id)
1042 .map_err(|e| e.to_string())?
1043 {
1044 continue;
1045 }
1046 let Ok(change) = loader(&hash) else { continue };
1047 for ops in change.file_ops() {
1048 if !file_ops_target_trunk(ops, change_id, trunk) {
1049 continue;
1050 }
1051 for line in ops.line_ops() {
1052 if !matches!(
1053 line.operation(),
1054 atomic_core::crdt::BranchOp::Delete { .. }
1055 | atomic_core::crdt::BranchOp::Modify { .. }
1056 ) {
1057 continue;
1058 }
1059 let raw = line.branch_id();
1060 let branch = if raw.change_id().is_root() {
1061 atomic_core::crdt::BranchId::new(change_id, raw.branch_idx())
1062 } else {
1063 raw
1064 };
1065 evidence.applied.insert(branch);
1066 if !visibility.contains(change_id) {
1067 evidence.outside.insert(branch);
1068 }
1069 }
1070 }
1071 }
1072 Ok(evidence)
1073 }
1074}
1075
1076/// Review E1: whether the GLOBAL graph genuinely proves `branch`'s bound

Callers 5

status_innerMethod · 0.45
cloneMethod · 0.45
emitMethod · 0.45
refresh_consentMethod · 0.45

Calls 11

file_ops_target_trunkFunction · 0.85
was_change_appliedMethod · 0.80
branch_idxMethod · 0.80
file_opsMethod · 0.45
line_opsMethod · 0.45
branch_idMethod · 0.45
is_rootMethod · 0.45
change_idMethod · 0.45
insertMethod · 0.45
containsMethod · 0.45