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

Method render_if_present

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

Render `inode` through the shared context when its span root is visible; `None` means the file is graph-origin and must be read from the graph.

(
        &self,
        inode: Inode,
    )

Source from the content-addressed store, hash-verified

1134 /// visible; `None` means the file is graph-origin and must be read from
1135 /// the graph.
1136 pub(super) fn render_if_present(
1137 &self,
1138 inode: Inode,
1139 ) -> Result<Option<Vec<u8>>, RepositoryError> {
1140 if !has_visible_span_root(self.txn, self.store, inode, self.visibility)? {
1141 return Ok(None);
1142 }
1143 self.context()?
1144 .render(inode)
1145 .map(Some)
1146 .map_err(|error| RepositoryError::Database(error.to_string()))
1147 }
1148
1149 /// Build the context on the calling thread when any of `inodes` is
1150 /// span-rooted on this view, so that a parallel walk over them shares one

Calls 3

has_visible_span_rootFunction · 0.85
renderMethod · 0.45
contextMethod · 0.45