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

Method first_foreign_change

atomic-repository/src/repository/remote_cache.rs:762–785  ·  view source on GitHub ↗

The first of `hashes` that `view` cannot see, if any — for checking that what a sandbox's provenance explains is its own view's work.

(
        &self,
        view: &str,
        hashes: &[Hash],
    )

Source from the content-addressed store, hash-verified

760 /// The first of `hashes` that `view` cannot see, if any — for checking
761 /// that what a sandbox's provenance explains is its own view's work.
762 pub fn first_foreign_change(
763 &self,
764 view: &str,
765 hashes: &[Hash],
766 ) -> Result<Option<Hash>, RepositoryError> {
767 if hashes.is_empty() {
768 return Ok(None);
769 }
770 let txn = self.pristine.read_txn().map_err(db)?;
771 let state =
772 txn.get_view(view)
773 .map_err(db)?
774 .ok_or_else(|| RepositoryError::ViewNotFound {
775 name: view.to_string(),
776 })?;
777 let visible = super::graph_visibility_closure(&txn, &state)?;
778 for hash in hashes {
779 match txn.get_internal(hash).map_err(db)? {
780 Some(id) if visible.contains(id) => {}
781 _ => return Ok(Some(*hash)),
782 }
783 }
784 Ok(None)
785 }
786
787 /// Cache side: the changes the view has that this cache holds no file
788 /// for.

Callers 2

check_turn_scopeFunction · 0.80
on_viewMethod · 0.80

Calls 6

graph_visibility_closureFunction · 0.85
read_txnMethod · 0.80
is_emptyMethod · 0.45
get_viewMethod · 0.45
get_internalMethod · 0.45
containsMethod · 0.45

Tested by 1

on_viewMethod · 0.64