Skip to main content

UnpublishedArtifactGuard

Struct UnpublishedArtifactGuard 

Source
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

Source

pub fn identity(&self) -> Result<FileIdentity>

Return the immutable identity captured during descriptor setup.

§Errors

Returns an error before descriptor identity has been initialized.

Source

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.

Source

pub fn temporary_name(&self) -> Result<&OsStr>

Borrow the private original candidate name for durability-owner validation.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn sync_parent_with( &mut self, acknowledge: impl FnOnce(&StableDirectory) -> Result<()>, ) -> Result<()>

Acknowledge through the caller’s durability owner, then mark this guard.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for UnpublishedArtifactGuard

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for UnpublishedArtifactGuard

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.