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

Method first_foreign_change

atomic-repository/src/repository/remote_cache.rs:767–790  ·  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

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