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

Function verify_dependencies

atomic-core/src/apply/change.rs:62–75  ·  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

60/// }
61/// ```
62pub fn verify_dependencies<T: GraphTxnT>(
63 txn: &T,
64 change: &Change,
65) -> Result<Vec<Hash>, PristineError> {
66 let mut missing = Vec::new();
67
68 for dep_hash in change.dependencies() {
69 if txn.get_internal(dep_hash)?.is_none() {
70 missing.push(*dep_hash);
71 }
72 }
73
74 Ok(missing)
75}
76
77/// Check if a change has already been applied to a view.
78///

Callers 2

validate_can_applyFunction · 0.85

Calls 4

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

Tested by

no test coverage detected