Utilities:Modules:Tie::DB_File::SplitHash

Tie::DB_File::SplitHash

Tie::DB_File::SplitHash is designed for support of file size limitted OSes. Transparently splits a DB_File database into as many distinct files as desired. Distributes hash entries between the files using a randomization algorithm. Has the effect of allowing DB_File hashes to grow to the full size of the partition. Requires 'Digest::SHA1' and 'DB_File' to be installed.

You can download the tarred and gzipped Perl Tie-DB_File-SplitHash-1.01.tar.gz module here. It is 100% Perl.


POD Documentation


NAME

Tie::DB_File::SplitHash - A wrapper around the DB_File Berkeley database system


SYNOPSIS

   use Tie::DB_File::SplitHash;
   [$X =] tie %hash,  'Tie::DB_File::SplitHash', $filename, $flags, $mode, $DB_HASH, $multi_n;
   $status = $X->del($key [, $flags]) ;
   $status = $X->put($key, $value [, $flags]) ;
   $status = $X->get($key, $value [, $flags]) ;
   $status = $X->seq($key, $value, $flags) ;
   $status = $X->sync([$flags]) ;
   $status = $X->fd ;
   untie %hash ;

$multi_n determines the 'spread out' or number of files the hash will be split between. The larger the number, the larger the final hash can be.


DESCRIPTION

Transparently splits a Berkeley database (DB_File) into multiple files to allow the exceeding of file system limits on file size. From the outside, it behaves identically with Berkeley DB hash support in general. This has the potential to greatly expand the amount of data that can be stored on a file size limitted file system.

It does so by taking a SHA1 hash of the key to be stored, folding the resulting hash into a value from 0 to X and storing the data to a db file selected by the value 0 to X. The randomizing behavior of the SHA1 and subsequent fold down distribute the records essentially randomly between the X+1 database files, raising the capacity of the database to (X+1) times the capacity of a single file database on the average.

NOTE: Using an 'in-memory' database is not supported by this. Use DB_File directly if you want to do that. Additionally, BTREE and RECNO DBs are not supported.

DESTROY;

Called when the tied object is being destroyed.


COPYRIGHT

Copyright 1999, Benjamin Franz (<URL:http://www.nihongo.org/snowhare/>) and FreeRun Technologies, Inc. (<URL:http://www.freeruntech.com/>). All Rights Reserved. This software may be copied or redistributed under the same terms as Perl itelf.


AUTHOR

Benjamin Franz


TODO

Testing.