The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

DiaColloDB::EnumFile::MMap - diachronic collocation db, symbol<->integer enum, mmap

DESCRIPTION

DiaColloDB::EnumFile::MMap uses the File::Map module to provide a fast mmap()-based interface to the symbol<->integer mapping files used by DiaColloDB::EnumFile, from which it inherits.

new() %args, object structure:

##-- EnumFile: basic options
base => $base,       ##-- database basename; use files "${base}.es", "${base}.esx", "${base}.eix", "${base}.hdr"
perms => $perms,     ##-- default: 0666 & ~umask
flags => $flags,     ##-- default: 'r'
pack_i => $pack_i,   ##-- integer pack template (default='N')
pack_o => $pack_o,   ##-- file offset pack template (default='N')
pack_l => $pack_l,   ##-- string-length pack template (default='n')
pack_s => $pack_s,   ##-- string pack template (default=undef) for text i/o
size => $size,       ##-- number of mapped symbols, like scalar(@i2s)
utf8 => $bool,       ##-- true iff strings are stored as utf8 (default, used by re2i())
##
##-- EnumFile: in-memory construction and caching
s2i => \%s2i,        ##-- maps symbols to integers
i2s => \@i2s,        ##-- maps integers to symbols
dirty => $bool,      ##-- true if in-memory structures are not in-sync with file data
loaded => $bool,     ##-- true if file data has been loaded to memory
shared => $bool,     ##-- true to avoid closing filehandles on close() or DESTROY() (default=false)
##
##-- EnumFile: pack lengths (after open())
len_i => $len_i,     ##-- bytes::length(pack($pack_i,0))
len_o => $len_o,     ##-- bytes::length(pack($pack_o,0))
len_l => $len_l,     ##-- bytes::length(pack($pack_l,0))
len_sx => $len_sx,   ##-- $len_o + $len_i
##
##-- EnumFile: filehandles (after open())
sfh  => $sfh,        ##-- $base.es  : pack("(${pack_l}/A)*", @$i2s)
ixfh => $ixfh,       ##-- $base.eix : [$i] => pack("${pack_o}",          $offset_in_sfh_of_string_with_id_i)
sxfh => $sxfh,       ##-- $base.esx : [$j] => pack("${pack_o}${pack_i}", $offset_in_sfh_of_string_with_sortindex_j_and_id_i, $i)
##
##-- EnumFile::MMap: buffers
sbufr  => \$sbuf,     ##-- mmap $base.es
ixbufr => \$ixbuf,    ##-- mmap $base.eix
sxbufr => \$sxbuf,    ##-- mmap $base.esx

AUTHOR

Bryan Jurish <moocow@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2015-2020 by Bryan Jurish

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.

SEE ALSO

DiaColloDB::EnumFile(3pm), DiaColloDB(3pm), perl(1), ...