pub struct UnpublishedArtifactGuard { /* private fields */ }Expand description
Single-owner capability for one exclusively created, unpublished child.
The guard follows the owned inode across an atomic rename and removes any still-uncommitted name on explicit cleanup or drop. Callers must retain the guard until every higher-level publication invariant, including parent directory synchronization and manifest/receipt inclusion, is complete.
Implementations§
Source§impl UnpublishedArtifactGuard
impl UnpublishedArtifactGuard
Sourcepub fn identity(&self) -> Result<FileIdentity>
pub fn identity(&self) -> Result<FileIdentity>
Return the immutable identity captured during descriptor setup.
§Errors
Returns an error before descriptor identity has been initialized.
Sourcepub fn verify_identity_with(
&mut self,
setup_check: impl FnOnce() -> Result<()>,
) -> Result<FileIdentity>
pub fn verify_identity_with( &mut self, setup_check: impl FnOnce() -> Result<()>, ) -> Result<FileIdentity>
Re-read the retained descriptor identity and run a setup check before the descriptor is transferred to a writer.
§Errors
Returns an error when identity observation, setup_check, or the
identity comparison fails.
Sourcepub fn temporary_name(&self) -> Result<&OsStr>
pub fn temporary_name(&self) -> Result<&OsStr>
Borrow the private original candidate name for durability-owner validation.
Sourcepub fn open_sibling(&self, name: &OsStr) -> Result<File>
pub fn open_sibling(&self, name: &OsStr) -> Result<File>
Open one sibling through the retained no-follow parent capability.
§Errors
Returns an error when the child is absent, special, linked, or the retained directory authority changed.
Sourcepub fn take_file(&mut self) -> Result<File>
pub fn take_file(&mut self) -> Result<File>
Transfer the retained data descriptor into its durable writer.
§Errors
Returns an error if identity observation fails or the descriptor was already transferred.
Sourcepub fn transfer_unpublished_owner(
self,
file: &File,
) -> Result<(StableDirectory, OsString, FileIdentity)>
pub fn transfer_unpublished_owner( self, file: &File, ) -> Result<(StableDirectory, OsString, FileIdentity)>
Transfer exclusive unpublished cleanup to a new owner of this same file. A published guard cannot relinquish its semantic commit obligations.
Sourcepub fn transfer_unpublished_owner_in(
self,
directory: StableDirectory,
file: &File,
) -> Result<(StableDirectory, OsString, FileIdentity)>
pub fn transfer_unpublished_owner_in( self, directory: StableDirectory, file: &File, ) -> Result<(StableDirectory, OsString, FileIdentity)>
Transfer an already-owned retained parent without duplicating its handle.
Sourcepub fn install_child(&mut self, target: &OsStr) -> Result<()>
pub fn install_child(&mut self, target: &OsStr) -> Result<()>
Atomically install target while retaining cleanup ownership.
§Errors
Returns an error when identity-safe installation fails.
Sourcepub fn sync_parent(&mut self) -> Result<()>
pub fn sync_parent(&mut self) -> Result<()>
Synchronize the retained parent directory while remaining armed.
§Errors
Returns an error when the directory durability barrier fails.
Sourcepub fn sync_parent_with(
&mut self,
acknowledge: impl FnOnce(&StableDirectory) -> Result<()>,
) -> Result<()>
pub fn sync_parent_with( &mut self, acknowledge: impl FnOnce(&StableDirectory) -> Result<()>, ) -> Result<()>
Acknowledge through the caller’s durability owner, then mark this guard.
Sourcepub fn commit(self) -> Result<()>
pub fn commit(self) -> Result<()>
Disarm cleanup after every publication invariant is complete.
§Errors
Returns an error if the descriptor is still held by the guard or the atomic publication and parent barrier have not both completed.
Sourcepub fn cleanup(&mut self) -> Result<()>
pub fn cleanup(&mut self) -> Result<()>
Remove every possible uncommitted name and synchronize the parent.
Names that are absent or no longer identify the exclusively created inode are left untouched.
§Errors
Returns sanitized cleanup failure context after attempting every unlink and the final parent-directory barrier.
Sourcepub fn cleanup_checked(
&mut self,
finalization_check: impl FnOnce() -> Result<()>,
) -> Result<()>
pub fn cleanup_checked( &mut self, finalization_check: impl FnOnce() -> Result<()>, ) -> Result<()>
Perform full identity-safe cleanup and its parent barrier, then run one caller-supplied finalization check.
§Errors
Returns sanitized cleanup or finalization context after both have been attempted.