path-packer-c/README.md

72 lines
2.1 KiB
Markdown
Raw Permalink Normal View History

Overview
========
2012-08-06 18:49:56 +00:00
2012-08-13 16:00:50 +00:00
A POC to take a list of content sets (basically a listing of directories) and
pack them into a format optimized for space efficieny and reading.
2012-08-06 18:49:56 +00:00
2012-08-22 14:50:53 +00:00
For details on the file format, please see `FORMAT.md`, `ALGORITHM.md`, and the
included source.
2012-08-13 17:33:29 +00:00
2012-08-13 16:00:50 +00:00
Compilation and Usage
=====================
2012-08-06 18:49:56 +00:00
2012-08-13 16:00:50 +00:00
This repo holds two commands, `thing.rb` (TODO: give it a better name) and
`unpack`. `thing.rb` is used to pack content sets into our custom data format.
`unpack` reads the format.
2012-08-06 18:49:56 +00:00
2012-08-13 16:00:50 +00:00
To compile the `unpack` command, just run `make`.
This requires make, gcc, and zlib-devel.
2012-08-06 18:49:56 +00:00
2012-08-13 16:00:50 +00:00
thing.rb
--------
2012-08-06 18:49:56 +00:00
2012-08-13 16:00:50 +00:00
`thing.rb` generates files in our packed data format from newline delimited
lists of content sets. It can also dump content sets from a hosted v1
entitlement certificate, and print the tree structure of the content sets.
Take in an v1 x509 certificate, and extract the content sets, output them to
newline delimited output
`./thing.rb d this-cert.pem`
This would produce a file named `this-cert.txt`
To see this txt list, in the tree format, do:
2012-08-13 16:00:50 +00:00
`./thing.rb p this-cert.txt | less`
Process this output to generate the packed data format:
`./thing.rb c this-cert.txt`
This would produce a file named `this-cert.bin`. The `c` command expects as
input a file containing a newline delimited list of content sets; you are free
to manipulate the output from a pem file or come up with your own crazy listing
to push the boundaries of the data format.
`thing.rb` supports a "-v" verbose flag to print debug information.
2012-08-13 16:00:50 +00:00
unpack
------
2012-08-06 18:49:56 +00:00
2012-08-13 16:00:50 +00:00
`unpack` can read and examine files in our data format.
2012-08-06 18:49:56 +00:00
2012-08-13 16:00:50 +00:00
To view stats on a packed file (size of dictionary, number of unique nodes,
etc):
2012-08-06 18:49:56 +00:00
2012-08-13 16:00:50 +00:00
`./unpack s this-cert.bin`
2012-08-06 18:49:56 +00:00
To dump the raw packed file as text:
`./unpack r this-cert.bin`
2012-08-13 16:00:50 +00:00
To reconstruct the content sets and dump them to stdout:
2012-08-06 18:49:56 +00:00
2012-08-13 16:00:50 +00:00
`./unpack d this-cert.bin`
2012-08-06 21:04:30 +00:00
2012-08-13 16:00:50 +00:00
To check if the path `/content/rhel/6/6Server/x86_64/os/repodata/repomd.xml`
matches a content set in `this-cert.bin`:
2012-08-06 18:49:56 +00:00
2012-08-13 16:00:50 +00:00
`./unpack c this-cert.bin /content/rhel/6/6Server/x86_64/os/repodata/repomd.xml`
2012-08-06 18:49:56 +00:00
2012-08-13 16:00:50 +00:00
There is also a WIP ruby version of unpack, unpack.rb