Warehouse::Manifest -- API for working with warehouse manifests, aka lists of subdirectories, files, and contents
Version 0.01
use Warehouse::Manifest;
my $manifest = Warehouse::Manifest->new (whc => $whc);
my $manifest = Warehouse::Manifest->new (whc => $whc,
key => $key);
my $manifest = Warehouse::Manifest->new (whc => $whc,
data => \$manifestdata);
my $file_data_ref = $manifest->get_file_data ($filename) or die $manifest->errstr;
$manifest->set_file_data ($filename, \$file_data) or die $manifest->errstr;
my $key = $manifest->write or die $manifest->errstr;
my $manifestdata = $manifest->data;
my $manifest = Warehouse::Manifest->new (whc => $whc,
key => $manifestkey);
Creates a new manifest. Returns the new object on success. Dies on failure.
If scalar ``key'' is provided, data is retrieved from warehouse.
If scalarref ``data'' is provided, it is taken as the plain text manifest.
my $file_data_ref = $manifest->get_file_data ($filename);
Returns the contents of the named file in a scalarref. Returns undef, and makes an error message available via errstr, if the file cannot be retrieved.
manifest := subdir subdir subdir ...
subdir := subdirname <space> stream <newline>
subdirname := <period>
or <period> <slash> string (not ending with slash)
stream := blocklist <space> filelist
blocklist := block block block ...
block := blockshortness <space> md5sum (deprecated)
or md5sum blockshortness hint hint ... (deprecated)
or md5sum plusblocklength hint hint ...
or md5sum hint hint ...
or md5sum
blockshortness := -0 (meaning the block is 2^26 bytes long)
or -N (meaning the block is 2^26 - N bytes long)
plusblocklength := +N (meaning the block is N bytes long)
hint := + K keepbitvector @ warehousename
or + ... (other kinds of hints yet to be defined)
keepbitvector := little-endian hex representation: if bit P is on,
the block is stored on the warehouse named
"warehousename", on the node which appears at
position P in the probe order for md5sum (eg. if
probe order is 6,34,1,9,12,22,21,44 and
keepbitvector "03" signifies nodes 6 and 34;
keepbitvector "06" signifies nodes 34 and 9;
keepbitvector "81" signifies nodes 6 and 44)
md5sum := [0-9a-f]{32}
filelist := file file file ...
file := position <colon> size <colon> name
position := decimal number of bytes from start of stream to beginning
of this file's data
size := decimal number of bytes
. b739bca6df51d8c189de04e59571f09b+1666 0:1666:INSTALL ./subdir1 2da5e40fa3dbb2531da9713144d2070b-0 f0766d92a869fcaeb765c18ca9eabef9+38108802 0:1666:INSTALL 1666:105216000:slurm-1.2.19.tar
Note:
2^26 + 38108802 = 105217666 1666 + 105216000 = 105217666
. -67107198 b739bca6df51d8c189de04e59571f09b 0:1666:INSTALL ./subdir1 -0 2da5e40fa3dbb2531da9713144d2070b -29000062 f0766d92a869fcaeb765c18ca9eabef9 0:1666:INSTALL 1666:105216000:slurm-1.2.19.tar
Note:
2^26 - 0 + 2^26 - 29000062 = 105217666
1666 + 105216000 = 105217666