DiaColloDB

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

	* changed db structure for more efficient 2-pass Cofreqs queries (f2 bug-fix)
	  - Cofreqs now 3-level (id1 -> (date -> (id2->f)))
	  - Unigrams now 2-level (id1 -> (date -> f))
	  - Relation::subprofile1() and subprofile2() calling conventions changed
	  - changed temporary file format for "tokens.dat" used by DiaColloDB::create(): added dates
	* changed export text file formats
	  - Unigrams: added dates
	  - Cofreqs: added dates and un-collocated f1 lines
	  - "x-tuple" exports replaced by corresponding "t-tuple" exports xenum->tenum, ATTR_2x.*->ATTR_2t, etc.
	* added upgrade package v0_10_x2t
	  - added compatibility wrappers Compat::v0_09::* for transparent use of old indices
	* added auto-backup of changed files to upgrade framework
	  - upgraders are now instantiated as objects, not just packages: cache header & options
	* added DiaColloDB::Upgrade::Base::revert() method and -revert option to dcdb-upgrade.perl
	  - default implementation relies on subclass revert_created() and revert_updated() methods
	* added dcdb-upgrade.perl options -keep, -[no]backup
	* added DiaColloDB::Utils functions copyto(), moveto(), copyto_a(), cp_a()
	* added DiaColloDB::Persistent method-wrappers copyto(), moveto(), copyto_a()
	* added optimized PackedFile::MMap::bsearch() method
	  - for faster v0.10.x Cofreqs 'onepass' mode; still not as fast as v0.09.x 1-pass but it's incorrect anyways
	* removed unused methods Cofreqs::f1(), Cofreqs::f12()

DiaColloDB/Utils.pm  view on Meta::CPAN

sub packeq {
  shift if (UNIVERSAL::isa($_[0],__PACKAGE__));
  my ($fmt1,$fmt2,$val) = @_;
  $val //= 0x12345678;
  return pack($fmt1,$val) eq pack($fmt2,$val);
}

## \&filter_sub = PACKAGE::packFilterStore($pack_template)
## \&filter_sub = PACKAGE::packFilterStore([$pack_template_store, $pack_template_fetch])
## \&filter_sub = PACKAGE::packFilterStore([\&pack_code_store,   \&pack_code_fetch])
##   + returns a DB_File-style STORE-filter sub for transparent packing of data to $pack_template
sub packFilterStore {
  my $that   = UNIVERSAL::isa($_[0],__PACKAGE__) ? shift : __PACKAGE__;
  my $packas = shift;
  $packas    = $packas->[0] if (UNIVERSAL::isa($packas,'ARRAY'));
  return $packas  if (UNIVERSAL::isa($packas,'CODE'));
  return undef    if (!$packas || $packas eq 'raw');
  if ($that->packsingle($packas)) {
    return sub {
      $_ = pack($packas,$_) if (defined($_));
    };
  } else {
    return sub {
      $_ = pack($packas, ref($_) ? @$_ : split(/\t/,$_)) if (defined($_));
    };
  }
}

## \&filter_sub = PACKAGE::packFilterFetch($pack_template)
## \&filter_sub = PACKAGE::packFilterFetch([$pack_template_store, $pack_template_fetch])
## \&filter_sub = PACKAGE::packFilterFetch([\&pack_code_store,   \&pack_code_fetch])
##   + returns a DB_File-style FETCH-filter sub for transparent unpacking of data from $pack_template
sub packFilterFetch {
  my $that   = UNIVERSAL::isa($_[0],__PACKAGE__) ? shift : __PACKAGE__;
  my $packas = shift;
  $packas    = $packas->[1] if (UNIVERSAL::isa($packas,'ARRAY'));
  return $packas  if (UNIVERSAL::isa($packas,'CODE'));
  return undef    if (!$packas || $packas eq 'raw');
  if ($that->packsingle($packas)) {
    return sub {
      $_ = unpack($packas,$_);
    };

DiaColloDB/Utils.pod  view on Meta::CPAN

 $len = PACKAGE::packsize($packfmt,@args);

get pack-size for $packfmt with args @args

=item packFilterStore

 \&filter_sub = PACKAGE::packFilterStore($pack_template);
 \&filter_sub = PACKAGE::packFilterStore([$pack_template_store, $pack_template_fetch]);
 \&filter_sub = PACKAGE::packFilterStore([\&pack_code_store,   \&pack_code_fetch]);

returns a L<DB_File|DB_File>-style STORE-filter sub for transparent packing of data to $pack_template

=item packFilterFetch

 \&filter_sub = PACKAGE::packFilterFetch($pack_template);
 \&filter_sub = PACKAGE::packFilterFetch([$pack_template_store, $pack_template_fetch]);
 \&filter_sub = PACKAGE::packFilterFetch([\&pack_code_store,   \&pack_code_fetch]);

returns a L<DB_File|DB_File>-style FETCH-filter sub for transparent unpacking of data from $pack_template.

=back

=cut

##----------------------------------------------------------------
## DESCRIPTION: DiaColloDB::Utils: Math stuff
=pod

=head2 Math stuff



( run in 0.361 second using v1.01-cache-2.11-cpan-0a6323c29d9 )