Parano...Header(3pm)
π Paranoid...Header β like, the manual page for Paranoid::IO::FileMultiplexer::Block::FileHeader (3pm)
okay bestie, so this is a User Contributed Perl Documentation page, and the whole vibe is: this class is the little file-header-block gremlin that lives inside the Paranoid::IO::FileMultiplexer machine. she's not for direct use, she's a supporting icon π
β¨ NAME β¨
Paranoid::IO::FileMultiplexer::Block::FileHeader β File Header Block. that's it, that's the name, periodt π
πΈ VERSION πΈ
$Id: lib/Paranoid/IO/FileMultiplexer/Block/FileHeader.pm, 2.10
2022/03/08 00:01:04 acorliss $
π¦ SYNOPSIS π¦
$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);
π DESCRIPTION π
so basically, bestie: this class is not meant to be used directly. it's a supporting cast member for Paranoid::IO::FileMultiplexer functionality β it provides the functionality necessary for manipulation of the file header block. π
it also does presume that whatever file it's being used on has already been opened in the appropriate mode, and that the Paranoid::IO flock stack has been enabled. and for the purposes of Paranoid::IO::FileMultiplexer, that whole setup thing? already done in that class. so not your problem, she's handled π«Ά
π SUBROUTINES/METHODS π
π new
$obj =
Paranoid::IO::FileMultiplexer::Block::FileHeader->new($file, $blockSize);
this creates a new instance of a file header block object. she requires the filename in order to retrieve the cached file handle from Paranoid::IO, plus the size of the block. and she always writes to the first block of the file. the literal first block. no negotiation π
NOTE: creating an object does not automatically create the file and/or write a signature. you have to do that yourself using the methods below. she doesn't do it for you, she's not your mom π
β blocks
$count = $obj->blocks;
returns the value of the blocks field in the file header. that's the total number of blocks allocated in the file to date. but heads up β this is only the cached value stored in the object. other methods down below are the ones that actually write and read the value from the file. iykyk β¨
π version
$ver = $obj->version;
returns the file format version as a string. simple, clean, iconic.
πΈ streams
%streams = $obj->streams;
returns a hash of streams allocated in the file, in the format of stream name => block number. cute little map, love that for us πΊοΈ
π¦ maxStreams
$max = $obj->maxStreams;
returns the maximum number of streams supported by this file header. the ceiling. the limit. the "that's enough bestie" number.
π model
$stats = $obj->model;
returns a hash with some basic statistical information on the file, in both raw and human-friendly values. the info provided is as follows:
intSizeβ Size of Perl's native integers in bitscurFileSizeβ Current file size in bytescurFSHumanβ Current file size expressed w/unit suffixescurStreamsβ Current number of streams allocatedmaxFileSizeβ Maximum file size supported with PerlmaxFSHumanβ Maximum file size expressed w/unit suffixesmaxStreamsβ Maximum number of streams that can be allocatedmaxStreamSizeβ Maximum stream sizemaxSSHumanβ Maximum stream size expressed w/unit suffixes
π₯ writeSig
$rv = $obj->writeSig;
writes the file header signature to disk, and returns 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. ok? ok π
π readSig
$rv = $obj->readSig;
reads the file header signature from disk and performs basic validation that the information in it is acceptable. she validates that:
- the file size matches the block size * block count,
- the block size is an acceptable value,
- and the file format and version are supported.
if the method call was successful it will update the cached values in the object. note that this is only the signature values, not the stream index records. don't get it twisted π
π§ writeBlocks
$rv = $obj->writeBlocks($count);
writes the passed block count value to disk, and returns a boolean value denoting success. she did the thing, and she'll tell you if it worked β¨
π readBlocks
$count = $obj->readBlocks;
reads the block count field from disk and returns it. but if there are any errors reading or extracting the value, she returns undef. no value, no vibe, just undef π
π incrBlocks
$rv = $obj->incrBlocks;
calls writeBlocks with a value of one greater than what's currently cached. one more. one more block. slay.
π validateBlocks
$rv = $obj->validateBlocks;
compares the cached block count value to what's actually written in the file. super useful for determining whether an external process has potentially modified the file. a lil vibe check for your disk π«Ά
π writeStreams
$rv = $obj->writeStreams;
writes the stream index records to the header block, and returns a boolean denoting success. go off, index records π
π readStreams
$rv = $obj->readStreams;
reads the stream index records from the file, and returns a boolean value denoting success. if the read is successful, this will update the cached streams information in the object. she remembers now, bestie π
π addStream
$rv = $obj->addStream($sname, $bn);
does some basic validation of the requested stream, and if it passes, updates the stream indices on the disk. gatekeeping the invalid streams, as she should β¨
πΈ DEPENDENCIES πΈ
FcntlParanoidParanoid::DebugParanoid::DataParanoid::IOParanoid::IO::FileMultiplexer::BlockParanoid::IO::FileMultiplexer::Block::BATHeaderParanoid::IO::FileMultiplexer::Block::StreamHeader
π BUGS AND LIMITATIONS π
...and that's the whole section. it's giving silence. it's giving nothing. no known bugs or limitations were listed in this page, and honestly? she's thriving πβ¨
π AUTHOR π
Arthur Corliss (corliss@digitalmages.com)
π¦ LICENSE AND COPYRIGHT π¦
This software is free software. Similar to Perl, you can redistribute it and/or modify it under the terms of either:
- 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
- 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.
(c) 2005 - 2021, Arthur Corliss (corliss@digitalmages.com) (tm) 2008 - 2021, Paranoid Inc. (www.paranoid.com)
and that's a wrap, bestie π«Ά this was perl v5.38.2, dated 2024-03-07 β genuinely iconic, no notes, mwah π
πβ¨
π¦ where this page comes from
- debian trixie: libparanoid-perl 2.10-2 Β· other
- ubuntu resolute: libparanoid-perl 2.10-2 Β· other
- ubuntu stonking: libparanoid-perl 2.10-2 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms