Tie::Hash::MinPerfHashTwoLevel::OnDisk - construct or tie a "two level" minimal perfect hash based on disk
use Tie::Hash::MinPerfHashTwoLevel::OnDisk; Tie::Hash::MinPerfHashTwoLevel::OnDisk->make_file( file => $some_file, source_hash => $some_hash, comment => "this is a comment", debug => 0, ); my %hash; tie %hash, "Tie::Hash::MinPerfHashTwoLevel::OnDisk", $some_file;
This module allows one to either construct, or use a precomputed minimal perfect hash on disk via tied interface. The disk image of the hash is loaded by using mmap, which means that multiple processes may use the same disk image at the same time without memory duplication. The hash is readonly, and may only contain string values.
Construct a new file from a given 'source_hash' argument. The constructed buffer is written to the file specified by the 'file' argument. A comment may be added to the file via the 'comment' argument, note that comments may not contain null characters, although keys and value may. A predetermined seed may be provided to the hash function (16 bytes) via the 'seed' argument, however note that if it does not produce hash values that allow for the construction of a valid two level perfect hash then a different seed will be automatically selected (this will not affect the ability to use the constructed hash, it just may not be deterministic). The 'debug' argument outputs some basic status infromation about the construction process.
Validate the file specified by the 'file' argument. Returns a list of two values, 'version' and 'message'. If the file fails validation the 'version' will be undef and the 'message' will contain an error message. If the file passes validation the 'version' will specify the version of the file (currently only 0 is valid), and 'message' will contain some basic information about the file, such as how many keys it contains, the comment it was created with, etc.
None by default.
Algorithm::MinPerfHashTwoLevel
Yves Orton
Copyright (C) 2019 by Yves Orton
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.18.4 or, at your option, any later version of Perl 5 you may have available.
To install Algorithm::MinPerfHashTwoLevel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Algorithm::MinPerfHashTwoLevel
CPAN shell
perl -MCPAN -e shell install Algorithm::MinPerfHashTwoLevel
For more information on module installation, please visit the detailed CPAN module installation guide.