![]() |
#include <citrusleaf/alloc.h>
#include <citrusleaf/cf_types.h>
#include <inttypes.h>
#include <stdint.h>
#include <pthread.h>
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | cf_rchash_elem_f |
struct | cf_rchash_elem_v |
struct | cf_rchash |
Macros | |
#define | CF_RCHASH_CR_GRAB 0x02 |
#define | CF_RCHASH_CR_MT_BIGLOCK 0x04 |
#define | CF_RCHASH_CR_MT_BIGLOCK 0x04 |
#define | CF_RCHASH_CR_MT_LOCKPOOL 0x08 |
#define | CF_RCHASH_CR_MT_MANYLOCK 0x08 |
#define | CF_RCHASH_CR_NOSIZE 0x10 |
#define | CF_RCHASH_CR_RESIZE 0x01 |
#define | CF_RCHASH_CR_RESIZE 0x01 |
#define | CF_RCHASH_ERR -1 |
#define | CF_RCHASH_ERR_BUFSZ -2 |
#define | CF_RCHASH_ERR_FOUND -4 |
#define | CF_RCHASH_ERR_NOTFOUND -3 |
#define | CF_RCHASH_OK 0 |
#define | CF_RCHASH_REDUCE_DELETE (1) |
Typedefs | |
typedef void(* | cf_rchash_destructor_fn )(void *object) |
typedef uint32_t(* | cf_rchash_hash_fn )(void *value, uint32_t value_len) |
typedef int(* | cf_rchash_reduce_fn )(void *key, uint32_t keylen, void *object, void *udata) |
Functions | |
int | cf_rchash_create (cf_rchash **h, cf_rchash_hash_fn h_fn, cf_rchash_destructor_fn d_fn, uint32_t key_len, uint32_t sz, uint flags) |
int | cf_rchash_delete (cf_rchash *h, void *key, uint32_t key_len) |
void | cf_rchash_destroy (cf_rchash *h) |
int | cf_rchash_get (cf_rchash *h, void *key, uint32_t key_len, void **object) |
uint32_t | cf_rchash_get_size (cf_rchash *h) |
int | cf_rchash_put (cf_rchash *h, void *key, uint32_t key_len, void *value) |
int | cf_rchash_put_unique (cf_rchash *h, void *key, uint32_t key_len, void *value) |
void | cf_rchash_reduce (cf_rchash *h, cf_rchash_reduce_fn reduce_fn, void *udata) |
void | cf_rchash_reduce_delete (cf_rchash *h, cf_rchash_reduce_fn reduce_fn, void *udata) |
int | cf_rchash_set_nlocks (cf_rchash *h, int n_locks) |
#define CF_RCHASH_CR_GRAB 0x02 |
support 'grab' call (requires more memory)
Definition at line 60 of file target/Linux-x86_64/include/citrusleaf/cf_rchash.h.
#define CF_RCHASH_CR_MT_BIGLOCK 0x04 |
support multithreaded access with a single big lock
Definition at line 85 of file target/Linux-x86_64/include/citrusleaf/cf_rchash.h.
#define CF_RCHASH_CR_MT_BIGLOCK 0x04 |
support multithreaded access with a single big lock
Definition at line 85 of file target/Linux-x86_64/include/citrusleaf/cf_rchash.h.
#define CF_RCHASH_CR_MT_LOCKPOOL 0x08 |
support multithreaded access with a pool of object loccks
Definition at line 90 of file target/Linux-x86_64/include/citrusleaf/cf_rchash.h.
#define CF_RCHASH_CR_MT_MANYLOCK 0x08 |
support multithreaded access with a pool of object loccks
Definition at line 70 of file target/Linux-x86_64/include/citrusleaf/cf_rchash.h.
#define CF_RCHASH_CR_NOSIZE 0x10 |
don't calculate the size on every call, which makes 'getsize' expensive if you ever call it
Definition at line 75 of file target/Linux-x86_64/include/citrusleaf/cf_rchash.h.
#define CF_RCHASH_CR_RESIZE 0x01 |
support resizes (will sometimes hang for long periods)
Definition at line 80 of file target/Linux-x86_64/include/citrusleaf/cf_rchash.h.
#define CF_RCHASH_CR_RESIZE 0x01 |
support resizes (will sometimes hang for long periods)
Definition at line 80 of file target/Linux-x86_64/include/citrusleaf/cf_rchash.h.
#define CF_RCHASH_ERR -1 |
Definition at line 49 of file target/Linux-x86_64/include/citrusleaf/cf_rchash.h.
#define CF_RCHASH_ERR_BUFSZ -2 |
Definition at line 48 of file target/Linux-x86_64/include/citrusleaf/cf_rchash.h.
#define CF_RCHASH_ERR_FOUND -4 |
Definition at line 46 of file target/Linux-x86_64/include/citrusleaf/cf_rchash.h.
#define CF_RCHASH_ERR_NOTFOUND -3 |
Definition at line 47 of file target/Linux-x86_64/include/citrusleaf/cf_rchash.h.
#define CF_RCHASH_OK 0 |
Definition at line 50 of file target/Linux-x86_64/include/citrusleaf/cf_rchash.h.
#define CF_RCHASH_REDUCE_DELETE (1) |
indicate that a delete should be done during reduction
Definition at line 95 of file target/Linux-x86_64/include/citrusleaf/cf_rchash.h.
typedef void(* cf_rchash_destructor_fn)(void *object) |
need a destructor for the object.
Importantly - since the hash table knows about the reference-counted nature of the stored objects, a 'delete' will have to decrement the reference count, thus likely will need to call a function to clean the internals of the object. this destructor should not free the object, and will be called only when the reference count is 0. If you don't have any internal state in the object, you can pass NULL as the destructor.
This function is also called if there's a 'reduce' that returns 'delete'
Definition at line 129 of file target/Linux-x86_64/include/citrusleaf/cf_rchash.h.
typedef uint32_t(* cf_rchash_hash_fn)(void *value, uint32_t value_len) |
A generic call for hash functions the user can create
Definition at line 108 of file target/Linux-x86_64/include/citrusleaf/cf_rchash.h.
typedef int(* cf_rchash_reduce_fn)(void *key, uint32_t keylen, void *object, void *udata) |
Typedef for a "reduce" fuction that is called on every node (Note about return value: some kinds of reduces can manipulate the hash table, allowing deletion. See the particulars of the reduce call.)
Definition at line 115 of file target/Linux-x86_64/include/citrusleaf/cf_rchash.h.
int cf_rchash_create | ( | cf_rchash ** | h, |
cf_rchash_hash_fn | h_fn, | ||
cf_rchash_destructor_fn | d_fn, | ||
uint32_t | key_len, | ||
uint32_t | sz, | ||
uint | flags | ||
) |
int cf_rchash_delete | ( | cf_rchash * | h, |
void * | key, | ||
uint32_t | key_len | ||
) |
void cf_rchash_destroy | ( | cf_rchash * | h) |
int cf_rchash_get | ( | cf_rchash * | h, |
void * | key, | ||
uint32_t | key_len, | ||
void ** | object | ||
) |
uint32_t cf_rchash_get_size | ( | cf_rchash * | h) |
int cf_rchash_put | ( | cf_rchash * | h, |
void * | key, | ||
uint32_t | key_len, | ||
void * | value | ||
) |
int cf_rchash_put_unique | ( | cf_rchash * | h, |
void * | key, | ||
uint32_t | key_len, | ||
void * | value | ||
) |
void cf_rchash_reduce | ( | cf_rchash * | h, |
cf_rchash_reduce_fn | reduce_fn, | ||
void * | udata | ||
) |
void cf_rchash_reduce_delete | ( | cf_rchash * | h, |
cf_rchash_reduce_fn | reduce_fn, | ||
void * | udata | ||
) |
int cf_rchash_set_nlocks | ( | cf_rchash * | h, |
int | n_locks | ||
) |