NAME
DiaColloDB::MultiMapFile::MMap - collocation db, integer->integer* multimap file, using mmap
SYNOPSIS
##========================================================================
## PRELIMINARIES
use DiaColloDB::MultiMapFile::MMap;
##========================================================================
## Constructors etc.
$mmf = CLASS_OR_OBJECT->new(%args);
##========================================================================
## I/O: open/close (file)
$mmf_or_undef = $mmf->open($base,$flags);
$mmf_or_undef = $mmf->remap();
$mmf_or_undef = $mmf->unmap();
$mmf_or_undef = $mmf->close();
$bool = $mmf->opened();
\@a2b = $mmf->toArray();
##========================================================================
## Methods: lookup
$bs_packed = $mmf->fetchraw($a);
DESCRIPTION
Globals & Constants
- Variable: @ISA
-
DiaColloDB::MultiMapFile::MMap inherits from DiaColloDB::MultiMapFile and supports the DiaColloDB::MultiMapFile read-access API.
Constructors etc.
- new
-
$mmf = CLASS_OR_OBJECT->new(%args);
%args, object structure:
( ##-- MultiMapFile: basic options base => $base, ##-- database basename; use files "${base}.ma", "${base}.mb", "${base}.hdr" perms => $perms, ##-- default: 0666 & ~umask flags => $flags, ##-- default: 'r' pack_i => $pack_i, ##-- integer pack template (default='N') size => $size, ##-- number of mapped , like scalar(@data) ## ##-- MultiMapFile: in-memory construction a2b => \@a2b, ##-- maps source integers to (packed) target integer-sets: [$a] => pack("${pack_i}*", @bs) ## ##-- MultiMapFile: computed pack templates and lengths (after open()) pack_a => $pack_a, ##-- "($pack_i)[2]" pack_b => $pack_a, ##-- "($pack_i)*" len_i => $len_i, ##-- bytes::length(pack($pack_i,0)) len_a => $len_a, ##-- bytes::length(pack($pack_a,0)) ## ##-- MultiMapFile: filehandles (after open()) afh => $afh, ##-- $base.ma : [$a] => pack(${pack_a}, $bidx_a, $blen_a) : $byte_offset_in_bfh = $len_i*$bidx_a bfh => $bfh, ##-- $base.mb : $bidx_a : pack(${pack_b}, @targets_for_a) : $byte_length_in_bfh = $len_i*$blen_a ## ##-- MultiMapFile::MMap: buffers abufr => \$abuf, ##-- mmap $base.ma bbufr => \$bbuf, ##-- mmap $base.mb )
I/O: open/close (file)
- open
-
$mmf_or_undef = $mmf->open($base,$flags); $mmf_or_undef = $mmf->open($base); $mmf_or_undef = $mmf->open();
Open underlying files. See DiaColloDB::MultiMapFile::open().
- remap
-
$mmf_or_undef = $mmf->remap();
mmaps local buffers
@$mmf{qw(abufr bbufr)}
from@$mmf{qw(afh bfh)}
. - unmap
-
$mmf_or_undef = $mmf->unmap();
un-references local buffers
@$mmf{qw(abufr bbufr)}
. object will be unuseable after this. - close
-
$mmf_or_undef = $mmf->close();
Close underlying files. Implicitly calls flush() if opened for writing.
- opened
-
$bool = $mmf->opened();
Returns true iff underlying files are opened and local buffers are defined.
- toArray
-
\@a2b = $mmf->toArray();
Methods: lookup
- fetchraw
-
$bs_packed = $mmf->fetchraw($a);
Returns a packed array
$bs_packed = pack($mmf->{pack_b}, @bs)
of targets for $a, or undef if not found. multimap must be opened.
AUTHOR
Bryan Jurish <moocow@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2016 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
dcdb-create.per(1), dcdb-query.perl(1), dcdb-info.perl(1), dcdb-export.perl(1), dcdb-dump.perl(1), DiaColloDB(3pm), perl(1), ...