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

Method span_in_closure

atomic-repository/src/repository/insert.rs:43–56  ·  view source on GitHub ↗

Inspect the complete closure before acquiring a reentrant operation lock.

(&self, roots: &[Hash])

Source from the content-addressed store, hash-verified

41impl Repository {
42 // Inspect the complete closure before acquiring a reentrant operation lock.
43 fn span_in_closure(&self, roots: &[Hash]) -> Result<bool, RepositoryError> {
44 let mut pending = roots.to_vec();
45 let mut seen = HashSet::new();
46 let mut has_spans = false;
47 while let Some(hash) = pending.pop() {
48 if !seen.insert(hash) {
49 continue;
50 }
51 let change = self.load_change(&hash)?;
52 has_spans |= change.hashed.span.is_some();
53 pending.extend_from_slice(change.dependencies());
54 }
55 Ok(has_spans)
56 }
57
58 // Simulate the entire closure in an aborted transaction before preparing
59 // any operation. This validates incoming indexes and the prospective

Callers 3

insert_changeMethod · 0.80
insert_change_recMethod · 0.80
insert_from_viewMethod · 0.80

Calls 3

insertMethod · 0.45
load_changeMethod · 0.45
dependenciesMethod · 0.45

Tested by

no test coverage detected