Skip to main content

PartialOutput

Struct PartialOutput 

Source
pub struct PartialOutput { /* private fields */ }
Expand description

The partial file of one output from claim to publish or removal: its path, its lock, and any staging file.

Sinks declare it after their writer field so the writer closes first on drop, since Windows cannot rename or remove an open file without delete sharing. Dropped while writing it removes the file; dropped finished but unpublished it keeps it (EncodeError::Publish).

Implementations§

Source§

impl PartialOutput

Source

pub fn claim(target: &OutputTarget, seek: SeekNeed) -> Result<Self, EncodeError>

Claims the partial file of an output at target: refuses an existing output (or, replacing, anything but a regular file), creates and locks the partial (replacing a stale one), then probes the folder. A folder that cannot seek gets a staging file when seek requires it.

§Errors

For a refused target, a partial a live export holds (PARTIAL_OUTPUT_IN_USE), a non-UTF-8 file name, a folder that cannot rename without replacing, or a file-system failure.

Source

pub fn write_path(&self) -> &Path

The staging file when the folder cannot seek, the partial file otherwise.

Source

pub fn open_file(&self) -> Result<File, EncodeError>

Opens Self::write_path for this process to write.

§Errors

When the file system refuses.

Source

pub fn explain(&self, error: EncodeError) -> EncodeError

Adds to a write failure that the output went to a staging file, since a small temporary directory can fill where the output folder would not.

Source

pub fn wrote(&mut self, bytes: u64) -> Result<(), EncodeError>

Counts bytes handed to the writer of Self::write_path, and syncs what was written once PERIODIC_SYNC_BYTES went since the last sync.

§Errors

When the sync fails.

Source

pub fn finish( &mut self, cancel: &CancelToken, ) -> Result<PublishReport, EncodeError>

Publishes the finished output after its writer closed it: copies any staging file into the partial, syncs it, moves it into place (retrying up to 10 s on Windows sharing conflicts while beating the encode watch), and syncs the folder.

§Errors

EncodeError::Cancelled when cancel stopped the staging copy or the retries (the partial and any staging file are removed). Any other failure keeps the finished file beside the target (EncodeError::Publish).

Source

pub fn discard(&mut self) -> Result<(), EncodeError>

Removes the partial of an output that will not finish.

The partial is first renamed, still locked, to a process-private name and removed after the lock closes, so no other export takes the name over and a FUSE server that writes back on close writes back the discard name. If the rename fails it is removed under its own name. A finished output is kept instead and its path printed to stderr, since no caller receives the error.

§Errors

When the file system refuses the removal.

Trait Implementations§

Source§

impl Drop for PartialOutput

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,