$obj = Paranoid::IO::FileMultiplexer::Block::FileHeader->new( $filename, $bsize); $count = $obj->blocks; $version = $obj->version; %streams = $obj->streams; $max = $obj->maxStreams; %model = $obj->model; $rv = $obj->writeSig; $rv = $obj->readSig; $rv = $obj->writeBlocks; $count = $obj->readBlocks; $rv = $obj->incrBlocks; $rv = $obj->validateBlocks; $rv = $obj->writeStreams; $rv = $obj->readStreams; $rv = $obj->addStream($sname, $bn);
This module does presume that whatever file it is being used on has already been opened in the appropriate mode, and that the Paranoid::IO flock stack has been enabled. For the purposes of Paranoid::IO::FileMultiplexer, this is done in that class.
$obj = Paranoid::IO::FileMultiplexer::Block::FileHeader->new($file, $blockSize);
This creates a new instance of a file header block object. It requires the filename in order to retrieve the cached file handle from Paranoid::IO, and the size of the block. This always writes to the first block of the file.
$count = $obj->blocks;
This method returns the value of the blocks field in the file header. This is the total number of blocks allocated in the file to date. Note that this is only the cached value stored in the object. Other methods are provided for writing and reading the value from the file.
$ver = $obj->version;
%streams = $obj->streams;
$max = $obj->maxStreams;
$stats = $obj->model;
This method returns a hash with some basic statistical information on the file, in both raw and human-friendly values. The information provided is as follows:
Key Description --------------------------------------------------------------- intSize Size of Perl's native integers in bits curFileSize Current file size in bytes curFSHuman Current file size expressed w/unit suffixes curStreams Current number of streams allocated maxFileSize Maximum file size supported with Perl maxFSHuman Maximum file size expressed w/unit suffixes maxStreams Maximum number of streams that can be allocated maxStreamSize Maximum stream size maxSSHuman Maximum stream size expressed w/unit suffixes
$rv = $obj->writeSig;
This method writes the file header signature to disk, returning a boolean value denoting its success. Note that the signature contains the file format, version, block size, and number of allocated blocks, but not the list of allocated streams.
$rv = $obj->readSig;
This method reads the file header signature from disk and performs basic validation that the information in it is acceptable. It validates that the file size matches the block size * block count, that the block size is an acceptable value, and the file format and version are supported.
$rv = $obj->writeBlocks($count);
$count = $obj->readBlocks;
$rv = $obj->incrBlocks;
$rv = $obj->validateBlocks;
$rv = $obj->writeStreams;
$rv = $obj->readStreams;
$rv = $obj->addStream($sname, $bn);
a) the GNU General Public License <https://www.gnu.org/licenses/gpl-1.0.html> as published by the Free Software Foundation <http://www.fsf.org/>; either version 1 <https://www.gnu.org/licenses/gpl-1.0.html>, or any later version <https://www.gnu.org/licenses/license-list.html#GNUGPL>, or b) the Artistic License 2.0 <https://opensource.org/licenses/Artistic-2.0>,
subject to the following additional term: No trademark rights to ``Paranoid'' have been or are conveyed under any of the above licenses. However, ``Paranoid'' may be used fairly to describe this unmodified software, in good faith, but not as a trademark.
Copyright © 1997 - 2019, Arthur Corliss, all rights reserved.