|
NAMEGenezzo::Block::RDBlk_NN.pm - Row Directory Block Not Null (array) tied hash class.This class converts the Genezzo::Block::RDBlkA operations from a conventional array to a "Not Null" array. Genezzo::Block::RDBArray uses this class as the basis of a tied array. Note: Like its parent RDBlock, this class is almost, but not quite, a pushhash. SYNOPSISuse Genezzo::Block::RDBlk_NN; use Genezzo::Block::Std; local $Genezzo::Block::Std::DEFBLOCKSIZE = 500; my $buff = "\0" x 500; # construct an empty byte buffer my %tied_hash = (); my $tie_val = tie %tied_hash, 'Genezzo::Block::RDBlk_NN', (refbufstr => \$buff); # pushhash style # (note that the "PUSH" pseudo key is not supported)... my $newkey = $tie_val->HPush("this is a test"); # or array style, your choice my $pushcount = $tie_val->PUSH(qw(push lots of data)); $tied_hash{$newkey} = "update this entry"; # a hash that supports array style FETCHSIZE my $getcount = $tie_val->FETCHSIZE(); # Note: not HCount # splice it my $err_str; my @a1 = $tie_val->HeSplice(\$err_str, 5, 3, qw(more stuff to splice)); DESCRIPTIONWhile RDBlkA adds array-like splice capabilities to RDBlock, violating the standard hash abstraction, RDBlk_NN violates the array abstraction, creating an array subclass called a "Not Null" array, a sort of priority queue."Not Null" arraysNot Null arrays are designed to store non-null entries. Entries in the array which correspond to deleted values or metadata (see Genezzo::Block::RDBlock) may sometimes get returned as null entries, so various array manipulation algorithms should be adjusted to reflect this quirk. RDBlkA performs a good approximation of a well-behaved array, but the requirement to map a strictly ascending series of array offsets onto the normal data in RDBlock, which may be interspersed with deleted values and metadata, performs at O(n), versus O(1) for the "Not Null" version.
FUNCTIONSRDBlk_NN support all standard hash operations, with the exception that you cannot create or insert a user key -- you must push new entries and use the generated key or basic iteration to retrieve your data.In addition to the RDBlock standard public methods, RDBlk_NN adds HSplice and HeSplice.
EXPORTnoneTODO
AUTHORJeffrey I. Cohen, jcohen@genezzo.comSEE ALSOperl(1).Copyright (c) 2004 Jeffrey I Cohen. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Address bug reports and comments to: jcohen@genezzo.com For more information, please visit the Genezzo homepage at <http://www.genezzo.com>
Visit the GSP FreeBSD Man Page Interface. |