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

Method prime

atomic-repository/src/repository/content.rs:1153–1168  ·  view source on GitHub ↗

Build the context on the calling thread when any of `inodes` is span-rooted on this view, so that a parallel walk over them shares one build instead of every worker that arrives early making its own. A failure is left for the walk to report at the path that hits it.

(&self, inodes: impl IntoIterator<Item = Inode>)

Source from the content-addressed store, hash-verified

1151 /// build instead of every worker that arrives early making its own. A
1152 /// failure is left for the walk to report at the path that hits it.
1153 pub(super) fn prime(&self, inodes: impl IntoIterator<Item = Inode>) {
1154 let any_span_root = inodes.into_iter().any(|inode| {
1155 // Only an indexed root can need the context. Asking about a file
1156 // without one would load its origin change, which the walk does
1157 // for each file on its own workers.
1158 matches!(self.txn.span_root(inode), Ok(Some(_)))
1159 && matches!(
1160 has_visible_span_root(self.txn, self.store, inode, self.visibility),
1161 Ok(true)
1162 )
1163 });
1164 if any_span_root {
1165 // The outcome, an error included, is stored for the renders.
1166 let _stored = self.context();
1167 }
1168 }
1169
1170 fn context(
1171 &self,

Calls 2

into_iterMethod · 0.45
contextMethod · 0.45