pub fn commit_existing_directory_with<E>(
staging: &Path,
canonical: &Path,
prepare: impl FnOnce(&File, &Path) -> Result<(), E>,
at_step: impl FnMut(DirectoryCommitStep, &Path) -> Result<()>,
) -> Result<DirectoryCommitOutcome, DirectoryCommitError<E>>Expand description
Admit, prepare and publish one existing directory without replacing another name.
prepare receives the held no-follow directory descriptor and must verify and
synchronize every required child and the root before returning success. It is
invoked exactly once, on staging for a fresh commit or canonical for recovery.
The parent is then synchronized after publication or recovery. No temporary
tree is created or removed, and no failed evidence is cleaned up. A failed
post-rename sync or hook requires caller reconciliation before retrying.
The caller owns stable parent namespace, exclusive writers, complete byte
verification, tree traversal limits and the meaning of a recovered tree.
This is not root confinement or a lock. at_step is for deterministic failure
qualification; it must not issue other publication effects.
ยงErrors
Returns path shape/conflict/missing, caller preparation or phase-aware I/O errors.