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

Method can_unrecord

atomic-repository/src/repository/history.rs:421–439  ·  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

419 /// Information about the change's dependencies and whether it can be
420 /// safely unrecorded.
421 pub fn can_unrecord(
422 &self,
423 hash: &Hash,
424 ) -> Result<crate::unrecord::UnrecordDependencyInfo, RepositoryError> {
425 let txn = self
426 .pristine
427 .read_txn()
428 .map_err(|e| RepositoryError::Database(e.to_string()))?;
429
430 let view = txn
431 .get_view(&self.current_view)
432 .map_err(|e| RepositoryError::Database(e.to_string()))?
433 .ok_or_else(|| RepositoryError::ViewNotFound {
434 name: self.current_view.clone(),
435 })?;
436
437 crate::unrecord::check_can_unrecord(&txn, &view, hash, &UnrecordOptions::default())
438 .map_err(|e| RepositoryError::Unrecord(e.to_string()))
439 }
440}

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