Skip to main content

Job

Struct Job 

Source
pub struct Job {
    pub storage: Arc<Storage>,
    pub format_name: &'static str,
    pub units: Vec<Unit>,
    pub tail_start: u64,
    pub top: u64,
    /* private fields */
}

Fields§

§storage: Arc<Storage>§format_name: &'static str§units: Vec<Unit>

Units still to do, highest offset first.

§tail_start: u64§top: u64

Where the archive currently ends: its original length, or wherever the last commit truncated it.

Implementations§

Source§

impl Job

Source

pub fn open( path: &Path, writable: bool, password: Option<&str>, reads: Arc<Reads>, ) -> Result<Self>

password is only needed for encrypted archives. A missing one shows up as archive::PasswordNeeded, from here or from Job::check_password. What opening reads is counted in reads.

Source

pub fn resume( journal: &Journal, tail: Arc<Tail>, writable: bool, password: Option<&str>, reads: Arc<Reads>, ) -> Result<Self>

Reopens an archive a previous run already started on. A read-only open leaves a pending truncation for the next writable one. The password is never stored, so an encrypted archive needs it again.

Source

pub fn punch_support(&self) -> Option<u64>

Some(granule) if holes punched in the archive give its space back, where granule is how much may stay allocated at each end of a punched range. None on filesystems that can only truncate, such as FAT32 and exFAT, which keep today’s whole-unit behavior.

Source

pub fn encrypted(&self) -> bool

Source

pub fn is_stream(&self) -> bool

The archive is one compressed stream, extracted front to back.

Source

pub fn kept_whole(&self, reclaims: bool) -> bool

The archive is one compressed stream that stays whole until the run ends, because the filesystem can’t free space inside it: the disk has to hold the archive and every extracted file at once.

Source

pub fn check_password(&self) -> Result<()>

Proves the password before anything is deleted: decrypts the smallest encrypted unit, which checks its CRC, up to a limit so a huge solid block doesn’t stall. ZipCrypto accepts about one wrong password in 256 at first sight; reading the data catches those.

Source

pub fn slow_password_check(&self) -> Option<(&Path, u64)>

When check_password has to decode a whole file to prove the password, as for RAR 4: that file and its size, so a front end can say the check may take a while.

Source

pub fn in_place_refusal(&self) -> Option<String>

Why the archive can’t be extracted in place, if it can’t. It can still be extracted while it is kept.

Source

pub fn item_count(&self) -> usize

Source

pub fn remaining_size(&self) -> u64

Source

pub fn space_needed(&self, fresh: bool, reclaims: bool) -> (u64, i128)

Replays the extraction one unit at a time and returns (peak, end): the most free space it ever consumes beyond what is free now, and how much it consumes once finished. fresh means the tail hasn’t been saved yet; reclaims that freed archive space lands on the output’s disk.

Source

pub fn uncommitted(&self, out: &Path) -> Vec<(PathBuf, u64)>

Output a crashed run wrote for units it never committed. Nothing was at those paths when it started, or it was moved aside before the first entry was extracted, so anything there now is ours. A half-streamed file is not in the list: its archive bytes may be gone, so it is the only copy of its first part. For a compressed tar that is the entry its point is in; the files after the point are still in the archive.

Source

pub fn past_resume_point(&self, out: &Path) -> u64

Output a crashed stream wrote past its last resume point. It is cut off before the stream continues, so it counts as free.

Source

pub fn verify(&self, on_bytes: &(dyn Fn(u64) + Sync)) -> Result<()>

Reads every unit and lets the decoders check their checksums, writing nothing.

Auto Trait Implementations§

§

impl !Freeze for Job

§

impl !RefUnwindSafe for Job

§

impl !UnwindSafe for Job

§

impl Forget for Job

§

impl Send for Job

§

impl Sync for Job

§

impl Unpin for Job

§

impl UnsafeUnpin for Job

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

Source§

type Output = T

Should always be Self
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.