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

Function verify_dependencies

atomic-core/src/apply/change.rs:66–79  ·  view source on GitHub ↗

Verify that all dependencies of a change are present in the repository. Before a change can be applied, all changes it depends on must already be registered in the repository. This function checks for any missing dependencies. # Arguments `txn` - The transaction to check against `change` - The change whose dependencies to verify # Returns A vector of missing dependency hashes. Empty if all de

(
    txn: &T,
    change: &Change,
)

Source from the content-addressed store, hash-verified

64/// }
65/// ```
66pub fn verify_dependencies<T: GraphTxnT>(
67 txn: &T,
68 change: &Change,
69) -> Result<Vec<Hash>, PristineError> {
70 let mut missing = Vec::new();
71
72 for dep_hash in change.dependencies() {
73 if txn.get_internal(dep_hash)?.is_none() {
74 missing.push(*dep_hash);
75 }
76 }
77
78 Ok(missing)
79}
80
81/// Verify every causal-frontier root and its complete transitive dependency index.
82///

Callers 2

Calls 4

is_noneMethod · 0.80
dependenciesMethod · 0.45
get_internalMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected