Skip to main content

Module engine

Module engine 

Source
Expand description

In-place extraction, independent of the archive format.

Units are processed from the highest offset down. After each batch the archive is truncated to where the batch began, which every filesystem supports, FAT32 and exFAT included, so this path needs no hole punching.

A unit too large for the free space would need room for all of its output before any of its archive bytes could go. Where the filesystem can punch holes and the format can resume decoding mid-file, such a unit is streamed instead: every [stream_step] of output it is flushed, a resume point is journaled, and only then are the archive bytes before that point punched out. The archive’s length stays the same until the unit commits through the ordinary path.

A compressed tar is one stream that decodes only from the front, so it is one unit holding every entry, always streamed, front to back, with resume points between the files as well as inside them (see Run::stream_solid). Without hole punching it still streams, so a crash resumes from the last point, but nothing is freed until the end.

A format whose decoder finds a unit only by reading everything before it (RAR, through UnRAR) says so with Format::serial; its batches are decoded on one thread, lowest unit first, by one worker.

An extraction that keeps the archive (Journal::keep) runs the same batches, checks and commits, so it resumes the same way, but never truncates, punches or deletes: its storage is protected, and the run frees nothing, exactly like an output on another disk.

An extraction of some entries only (Job::select) must keep the archive, since truncating it would destroy the entries left out. Units with nothing selected are dropped from the job; a unit that holds both, such as a solid 7z block, is still decoded whole, and what was not selected is read and discarded.

Structs§

Job
Progress
Punch
What freeing an archive’s bytes costs around a punched range: margin is the most the filesystem may keep allocated at each end, which the space estimate reserves; overlap is how far before the last punch ended the next one starts, to free the block it kept. They differ by orders of magnitude on btrfs, where an extent is 128 MiB but a block is 4 KiB.
Run

Enums§

Outcome

Functions§

finish_orphaned
A run that crashed after deleting the archive but before cleaning up only has its links and side files left to deal with. Returns a warning for the person if the folders could not be set.
human
picks
Whether path is one of only or lies inside a folder among them.
selection_path
A path to select, as typed: docs, docs/ and ./docs are the same folder. Anything that could not be a path inside the archive is refused.