BloomFilterBundle
in package
A BloomFilterBundle is a directory of BloomFilterFile.
The filter bundle, like a Bloom filter, also acts as a set, but once the active filter in it fills up a new filter is added to the bundle so that more data can be stored.
Tags
Table of Contents
- default_filter_size = 10000000
- The default maximum size of a filter in a filter bundle
- $current_filter : object
- Reference to the filter which will be used to store new data
- $current_filter_count : int
- The number of items which have been stored in the current filter
- $dir_name : string
- The folder name of this filter bundle
- $filter_size : int
- The maximum capacity of a filter in this filter bundle
- $num_filters : int
- Total number of filter that this filter bundle currently has
- __construct() : mixed
- Creates or loads if already exists the directory structure and BloomFilterFiles used by this bundle
- add() : mixed
- Inserts a $value into the BloomFilterBundle
- differenceFilter() : mixed
- Removes from the passed array those elements $elt who either are in the filter bundle or whose $elt[$field_name] is in the bundle.
- forceSave() : mixed
- Used to save to disk all the file data associated with this bundle
- loadMetaData() : mixed
- Loads from the filter bundles' meta.txt the meta data associated with this filter bundle and stores this data into field variables
- reset() : mixed
- Empties the contents of the bloom filter bundle and resets it to start storing new data.
- saveMetaData() : mixed
- Saves the meta data (number of filter, number of items stored, and size) of the bundle
Constants
default_filter_size
The default maximum size of a filter in a filter bundle
public
mixed
default_filter_size
= 10000000
Properties
$current_filter
Reference to the filter which will be used to store new data
public
object
$current_filter
$current_filter_count
The number of items which have been stored in the current filter
public
int
$current_filter_count
$dir_name
The folder name of this filter bundle
public
string
$dir_name
$filter_size
The maximum capacity of a filter in this filter bundle
public
int
$filter_size
$num_filters
Total number of filter that this filter bundle currently has
public
int
$num_filters
Methods
__construct()
Creates or loads if already exists the directory structure and BloomFilterFiles used by this bundle
public
__construct( $dir_name[, $filter_size = self::default_filter_size ]) : mixed
Parameters
- $dir_name :
-
directory when this bundles data is stored
- $filter_size : = self::default_filter_size
-
the size of an individual filter in this bundle once a filter is filled a new one is added to the directory
Return values
mixed —add()
Inserts a $value into the BloomFilterBundle
public
add(string $value) : mixed
This involves inserting into the current filter, if the filter is full, a new filter is added before the value is added
Parameters
- $value : string
-
a item to add to the filter bundle
Return values
mixed —differenceFilter()
Removes from the passed array those elements $elt who either are in the filter bundle or whose $elt[$field_name] is in the bundle.
public
differenceFilter(array<string|int, mixed> &$arr[, array<string|int, mixed> $field_names = null ]) : mixed
Parameters
- $arr : array<string|int, mixed>
-
the array to remove elements from
- $field_names : array<string|int, mixed> = null
-
if not null an array of field names of $arr to use to do filtering. If null assumes elts of $arr are strings and directly checks those stings.
Return values
mixed —forceSave()
Used to save to disk all the file data associated with this bundle
public
forceSave() : mixed
Return values
mixed —loadMetaData()
Loads from the filter bundles' meta.txt the meta data associated with this filter bundle and stores this data into field variables
public
loadMetaData() : mixed
Return values
mixed —reset()
Empties the contents of the bloom filter bundle and resets it to start storing new data.
public
reset() : mixed
Return values
mixed —saveMetaData()
Saves the meta data (number of filter, number of items stored, and size) of the bundle
public
saveMetaData() : mixed