Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

bloom::filter(3pm) [debian man page]

Filter(3pm)						User Contributed Perl Documentation					       Filter(3pm)

NAME
Bloom::Filter - Sample Perl Bloom filter implementation DESCRIPTION
A Bloom filter is a probabilistic algorithm for doing existence tests in less memory than a full list of keys would require. The tradeoff to using Bloom filters is a certain configurable risk of false positives. This module implements a simple Bloom filter with configurable capacity and false positive rate. Bloom filters were first described in a 1970 paper by Burton Bloom, see <http://portal.acm.org/citation.cfm?id=362692&dl=ACM&coll=portal>. SYNOPSIS
use Bloom::Filter my $bf = Bloom::Filter->new( capacity => 10, error_rate => .001 ); $bf->add( @keys ); while ( <> ) { chomp; print "Found $_ " if $bf->check( $_ ); } CONSTRUCTORS
new %PARAMS Create a brand new instance. Allowable params are "error_rate", "capacity". init Calculates the best number of hash functions and optimum filter length, creates some random salts, and generates a blank bit vector. Called automatically by constructor. ACCESSORS
capacity Returns the total capacity of the Bloom filter error_rate Returns the configured maximum error rate length Returns the length of the Bloom filter in bits key_count Returns the number of items currently stored in the filter on_bits Returns the number of 'on' bits in the filter salts Returns the list of salts used to create the hash functions PUBLIC METHODS
add @KEYS Adds the list of keys to the filter. Will fail, return "undef" and complain if the number of keys in the filter exceeds the configured capacity. check @KEYS Checks the provided key list against the Bloom filter, and returns a list of equivalent length, with true or false values depending on whether there was a match. INTERNAL METHODS
_calculate_shortest_filter_length CAPACITY ERR_RATE Given a desired error rate and maximum capacity, returns the optimum combination of vector length (in bits) and number of hash functions to use in building the filter, where "optimum" means shortest vector length. _get_cells KEY Given a key, hashes it using the list of salts and returns an array of cell indexes corresponding to the key. AUTHOR
Maciej Ceglowski <maciej@ceglowski.com> CHANGELOG
Feb 2007 big speedup by Dmitriy Ryaboy <dmitriy.ryaboy@ask.com> (thanks!) COPYRIGHT AND LICENSE
(c) 2004 Maciej Ceglowski This is free software, distributed under version 2 of the GNU Public License (GPL). perl v5.12.3 2011-05-13 Filter(3pm)

Check Out this Related Man Page

Mail::Filter(3) 					User Contributed Perl Documentation					   Mail::Filter(3)

NAME
Mail::Filter - Filter mail through multiple subroutines SYNOPSIS
use Mail::Filter; my $filter = Mail::Filter->new( &filter1, &filter2 ); my $mail = Mail::Internet->new( [<>] ); my $mail = $filter->filter($mail); my $folder = Mail::Folder->new( .... ); my $filter->filter($folder); DESCRIPTION
"Mail::Filter" provides an interface to filtering Email through multiple subroutines. "Mail::Filter" filters mail by calling each filter subroutine in turn. Each filter subroutine is called with two arguments, the first is the filter object and the second is the mail or folder object being filtered. The result from each filter sub is passed to the next filter as the mail object. If a filter subroutine returns undef, then "Mail::Filter" will abort and return immediately. The function returns the result from the last subroutine to operate on the mail object. METHODS
Constructors Mail::Filter->new([FILTER [, ... ]]) Create a new "Mail::Filter" object with the given filter subroutines. Each filter may be either a code reference or the name of a method to call on the <Mail::Filter> object. Accessors $obj->add(FILTER [, FILTER ...]) Add the given filters to the end of the filter list. Processing $obj->filter(MAIL-OBJECT | MAIL-FOLDER) If the first argument is a "Mail::Internet" object, then this object will be passed through the filter list. If the first argument is a "Mail::Folder" object, then each message in turn will be passed through the filter list. $obj->folder() While the "filter" method is called with a "Mail::Folder" object, these filter subroutines can call this method to obtain the folder object that is being processed. $obj->msgnum() If the "filter" method is called with a "Mail::Folder" object, then the filter subroutines may call this method to obtain the message number of the message that is being processed. SEE ALSO
This module is part of the MailTools distribution, http://perl.overmeer.net/mailtools/. AUTHORS
The MailTools bundle was developed by Graham Barr. Later, Mark Overmeer took over maintenance without commitment to further development. Mail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by Peter Orbaek <poe@cit.dk>. Mail::Mailer and Mail::Send by Tim Bunce <Tim.Bunce@ig.co.uk>. For other contributors see ChangeLog. LICENSE
Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2007 Mark Overmeer <perl@overmeer.net>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html perl v5.18.2 2014-01-05 Mail::Filter(3)
Man Page