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

Method can_unrecord

atomic-repository/src/repository/history.rs:701–719  ·  view source on GitHub ↗

Check if a change can be unrecorded. This checks whether the change is in the view and whether it has any dependents that would also need to be unrecorded. # Arguments `hash` - Hash of the change to check # Returns Information about the change's dependencies and whether it can be safely unrecorded.

(
        &self,
        hash: &Hash,
    )

Source from the content-addressed store, hash-verified

699 /// Information about the change's dependencies and whether it can be
700 /// safely unrecorded.
701 pub fn can_unrecord(
702 &self,
703 hash: &Hash,
704 ) -> Result<crate::unrecord::UnrecordDependencyInfo, RepositoryError> {
705 let txn = self
706 .pristine
707 .read_txn()
708 .map_err(|e| RepositoryError::Database(e.to_string()))?;
709
710 let view = txn
711 .get_view(&self.current_view)
712 .map_err(|e| RepositoryError::Database(e.to_string()))?
713 .ok_or_else(|| RepositoryError::ViewNotFound {
714 name: self.current_view.clone(),
715 })?;
716
717 crate::unrecord::check_can_unrecord(&txn, &view, hash, &UnrecordOptions::default())
718 .map_err(|e| RepositoryError::Unrecord(e.to_string()))
719 }
720}

Callers

nothing calls this directly

Calls 5

check_can_unrecordFunction · 0.85
UnrecordClass · 0.85
read_txnMethod · 0.80
get_viewMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected