PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <math.h>
#include "common/hashfn.h"
#include "lib/bloomfilter.h"
#include "port/pg_bitutils.h"
Go to the source code of this file.
Data Structures | |
struct | bloom_filter |
Macros | |
#define | MAX_HASH_FUNCS 10 |
Functions | |
static int | my_bloom_power (uint64 target_bitset_bits) |
static int | optimal_k (uint64 bitset_bits, int64 total_elems) |
static void | k_hashes (bloom_filter *filter, uint32 *hashes, unsigned char *elem, size_t len) |
static uint32 | mod_m (uint32 val, uint64 m) |
bloom_filter * | bloom_create (int64 total_elems, int bloom_work_mem, uint64 seed) |
void | bloom_free (bloom_filter *filter) |
void | bloom_add_element (bloom_filter *filter, unsigned char *elem, size_t len) |
bool | bloom_lacks_element (bloom_filter *filter, unsigned char *elem, size_t len) |
double | bloom_prop_bits_set (bloom_filter *filter) |
#define MAX_HASH_FUNCS 10 |
Definition at line 42 of file bloomfilter.c.
void bloom_add_element | ( | bloom_filter * | filter, |
unsigned char * | elem, | ||
size_t | len | ||
) |
Definition at line 135 of file bloomfilter.c.
References bloom_filter::bitset, i, bloom_filter::k_hash_funcs, k_hashes(), len, and MAX_HASH_FUNCS.
Referenced by bt_target_page_check(), populate_with_dummy_strings(), and roles_list_append().
bloom_filter* bloom_create | ( | int64 | total_elems, |
int | bloom_work_mem, | ||
uint64 | seed | ||
) |
Definition at line 87 of file bloomfilter.c.
References BITS_PER_BYTE, bloom_filter::k_hash_funcs, bloom_filter::m, Max, Min, my_bloom_power(), optimal_k(), palloc0(), bloom_filter::seed, and UINT64CONST.
Referenced by bt_check_every_level(), create_and_test_bloom(), and roles_list_append().
void bloom_free | ( | bloom_filter * | filter | ) |
Definition at line 126 of file bloomfilter.c.
References pfree().
Referenced by bt_check_every_level(), create_and_test_bloom(), and roles_is_member_of().
bool bloom_lacks_element | ( | bloom_filter * | filter, |
unsigned char * | elem, | ||
size_t | len | ||
) |
Definition at line 157 of file bloomfilter.c.
References bloom_filter::bitset, i, bloom_filter::k_hash_funcs, k_hashes(), len, and MAX_HASH_FUNCS.
Referenced by bt_tuple_present_callback(), nfalsepos_for_missing_strings(), and roles_list_append().
double bloom_prop_bits_set | ( | bloom_filter * | filter | ) |
Definition at line 187 of file bloomfilter.c.
References BITS_PER_BYTE, bloom_filter::bitset, bloom_filter::m, and pg_popcount().
Referenced by bt_check_every_level(), and create_and_test_bloom().
|
static |
Definition at line 250 of file bloomfilter.c.
References DatumGetUInt64(), hash(), hash_any_extended(), i, bloom_filter::k_hash_funcs, len, bloom_filter::m, mod_m(), bloom_filter::seed, x, and y.
Referenced by bloom_add_element(), and bloom_lacks_element().
Definition at line 288 of file bloomfilter.c.
References Assert, PG_UINT32_MAX, UINT64CONST, and val.
Referenced by k_hashes().
|
static |
Definition at line 229 of file bloomfilter.c.
References Max, MAX_HASH_FUNCS, and Min.
Referenced by bloom_create().