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

Function mark_directory_empty

atomic-repository/src/tracking/tree_ops.rs:178–194  ·  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

176/// * `txn` - A mutable transaction
177/// * `inode` - The directory's inode
178pub fn mark_directory_empty<T: MutTxnT + TreeTxnT>(
179 txn: &mut T,
180 inode: Inode,
181) -> TrackingResult<()> {
182 if let Some(flags) = txn
183 .get_directory_flags(inode)
184 .map_err(|e| TrackingError::Database(e.to_string()))?
185 {
186 // Add the DIR_EMPTY flag
187 let new_flags = flags | directory_flags::DIR_EMPTY;
188 if new_flags != flags {
189 txn.update_directory_flags(inode, new_flags)
190 .map_err(|e| TrackingError::Database(e.to_string()))?;
191 }
192 }
193 Ok(())
194}
195
196/// Remove a single file from tracking.
197///

Callers

nothing calls this directly

Calls 2

get_directory_flagsMethod · 0.45

Tested by

no test coverage detected