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

Function mark_directory_empty

atomic-repository/src/tracking/tree_ops.rs:732–748  ·  view source on GitHub ↗

Mark a directory as empty (no children). This is called when the last file is removed from a tracked directory. # Arguments `txn` - A mutable transaction `inode` - The directory's inode

(
    txn: &mut T,
    inode: Inode,
)

Source from the content-addressed store, hash-verified

730/// * `txn` - A mutable transaction
731/// * `inode` - The directory's inode
732pub fn mark_directory_empty<T: MutTxnT + TreeTxnT>(
733 txn: &mut T,
734 inode: Inode,
735) -> TrackingResult<()> {
736 if txn
737 .get_directory_flags(inode)
738 .map_err(|e| TrackingError::Database(e.to_string()))?
739 .is_some()
740 {
741 TreeProjectionPlan::plan(
742 txn,
743 [TreeProjectionOperation::DirectoryOccupancy { inode, empty: true }],
744 )?
745 .apply(txn)?;
746 }
747 Ok(())
748}
749
750/// Classify a tracked inode by the state that tracking itself owns for it.
751///

Callers

nothing calls this directly

Calls 3

planFunction · 0.85
get_directory_flagsMethod · 0.45
applyMethod · 0.45

Tested by

no test coverage detected