chapter-tgz
This is a library for creating and consuming specially crafted .tar.gz files with the following properties:
-
Efficient access to specific predefined points in the tar ("chapter boundaries"). A chapter consists of zero or more consecutive tar entries. This can be used to skip over groups of tar entries in O(1) time without performing the work of gzip decompression on the intervening entries.
-
Parallel decompression: different chapters of the same tgz can be read simultaneously by different threads. Extracting a later entry is not stalled on processing all previous entries as in a conventional tgz file.
-
Perfectly compatible with existing readers that do not know about chapter information. All existing software will be able to read these files as ordinary tgz files. Chapter information is encoded in the form of valid empty gzip blocks with peculiar Huffman code alphabets.
-
Perfectly compatible with existing writers that do not embed chapter information. Tgz files without chapter information are handled as if there was a single chapter encompassing all of their entries.
Examples
Writing: this example demonstrates creating a tgz with several large files containing random data, each in its own chapter. (In general a chapter may consist of zero or more tar entries.)
use ;
use RngReader;
use SmallRng;
use fs;
use ;
Reading: this example demonstrates decompressing tgz chapters in parallel.
use TgzReader;
use fs;
use ;
use thread;