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
impl PartialOutput
Sourcepub fn claim(target: &OutputTarget, seek: SeekNeed) -> Result<Self, EncodeError>
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.
Sourcepub fn write_path(&self) -> &Path
pub fn write_path(&self) -> &Path
The staging file when the folder cannot seek, the partial file otherwise.
Sourcepub fn open_file(&self) -> Result<File, EncodeError>
pub fn open_file(&self) -> Result<File, EncodeError>
Sourcepub fn explain(&self, error: EncodeError) -> EncodeError
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.
Sourcepub fn wrote(&mut self, bytes: u64) -> Result<(), EncodeError>
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.
Sourcepub fn finish(
&mut self,
cancel: &CancelToken,
) -> Result<PublishReport, EncodeError>
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).
Sourcepub fn discard(&mut self) -> Result<(), EncodeError>
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
impl Drop for PartialOutput
Auto Trait Implementations§
impl Forget for PartialOutput
impl Freeze for PartialOutput
impl Move for PartialOutput
impl RefUnwindSafe for PartialOutputwhere
I32NotAllOnes: RefUnwindSafe,
impl Send for PartialOutput
impl Sync for PartialOutput
impl Unpin for PartialOutput
impl UnsafeUnpin for PartialOutput
impl UnwindSafe for PartialOutputwhere
RawVecInner: UnwindSafe,
I32NotAllOnes: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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