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

Function causal_ancestors

atomic-core/src/pristine/attribute.rs:275–295  ·  view source on GitHub ↗
(
    txn: &T,
    change: NodeId,
)

Source from the content-addressed store, hash-verified

273}
274
275fn causal_ancestors<T: GraphTxnT + ?Sized>(
276 txn: &T,
277 change: NodeId,
278) -> PristineResult<BTreeSet<NodeId>> {
279 let mut result = BTreeSet::new();
280 let mut pending = vec![change];
281 while let Some(current) = pending.pop() {
282 for hash in txn.get_indexed_change_deps(current)? {
283 let dependency =
284 txn.get_internal(&hash)?
285 .ok_or(PristineError::MissingRegisteredDependency {
286 change_id: current.get(),
287 dependency: hash.to_string(),
288 })?;
289 if result.insert(dependency) {
290 pending.push(dependency);
291 }
292 }
293 }
294 Ok(result)
295}
296
297#[cfg(test)]
298mod tests {

Callers 1

Calls 5

getMethod · 0.65
get_internalMethod · 0.45
insertMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected