hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cf_shash.h File Reference
#include <pthread.h>
#include <stddef.h>
#include <stdint.h>
#include "citrusleaf/cf_base_types.h"
Include dependency graph for cf_shash.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  shash_elem_s
struct  shash_s

Macros

#define SHASH_ERR_FOUND   -4
#define SHASH_ERR_NOTFOUND   -3
#define SHASH_ERR_BUFSZ   -2
#define SHASH_ERR   -1
#define SHASH_OK   0
#define SHASH_ELEM_KEY_PTR(_h, _e)   ( (void *) _e->data )
#define SHASH_ELEM_VALUE_PTR(_h, _e)   ( (void *) (_e->data + _h->key_len) )
#define SHASH_ELEM_SZ(_h)   ( sizeof(shash_elem) + (_h->key_len) + (_h->value_len) )
#define SHASH_CR_RESIZE   0x01
#define SHASH_CR_GRAB   0x02
#define SHASH_CR_MT_BIGLOCK   0x04
#define SHASH_CR_MT_MANYLOCK   0x08
#define SHASH_REDUCE_DELETE   (1)

Typedefs

typedef uint8_t byte
typedef uint32_t(* shash_hash_fn )(void *key)
typedef int(* shash_reduce_fn )(void *key, void *data, void *udata)
typedef struct shash_elem_s shash_elem
typedef struct shash_s shash

Functions

int shash_create (shash **h, shash_hash_fn h_fn, uint32_t key_len, uint32_t value_len, uint32_t sz, unsigned int flags)
int shash_put (shash *h, void *key, void *value)
int shash_put_unique (shash *h, void *key, void *value)
int shash_get (shash *h, void *key, void *value)
int shash_get_vlock (shash *h, void *key, void **value, pthread_mutex_t **vlock)
int shash_get_and_delete (shash *h, void *key, void *value)
int shash_delete (shash *h, void *key)
int shash_delete_lockfree (shash *h, void *key)
uint32_t shash_get_size (shash *h)
int shash_grab (shash *h, void *key, uint32_t key_len, void **value, uint32_t *value_len)
int shash_return (shash *h, void *value)
int shash_reduce (shash *h, shash_reduce_fn reduce_fn, void *udata)
int shash_reduce_delete (shash *h, shash_reduce_fn reduce_fn, void *udata)
void shash_destroy (shash *h)

Macro Definition Documentation

#define SHASH_CR_GRAB   0x02

Definition at line 105 of file cf_shash.h.

#define SHASH_CR_MT_BIGLOCK   0x04

Definition at line 106 of file cf_shash.h.

#define SHASH_CR_MT_MANYLOCK   0x08

Definition at line 107 of file cf_shash.h.

#define SHASH_CR_RESIZE   0x01

Definition at line 104 of file cf_shash.h.

#define SHASH_ELEM_KEY_PTR (   _h,
  _e 
)    ( (void *) _e->data )

Definition at line 85 of file cf_shash.h.

#define SHASH_ELEM_SZ (   _h)    ( sizeof(shash_elem) + (_h->key_len) + (_h->value_len) )

Definition at line 102 of file cf_shash.h.

#define SHASH_ELEM_VALUE_PTR (   _h,
  _e 
)    ( (void *) (_e->data + _h->key_len) )

Definition at line 87 of file cf_shash.h.

#define SHASH_ERR   -1

Definition at line 23 of file cf_shash.h.

#define SHASH_ERR_BUFSZ   -2

Definition at line 22 of file cf_shash.h.

#define SHASH_ERR_FOUND   -4

Definition at line 20 of file cf_shash.h.

#define SHASH_ERR_NOTFOUND   -3

Definition at line 21 of file cf_shash.h.

#define SHASH_OK   0

Definition at line 24 of file cf_shash.h.

#define SHASH_REDUCE_DELETE   (1)

Definition at line 109 of file cf_shash.h.

Typedef Documentation

typedef uint8_t byte

Definition at line 29 of file cf_shash.h.

typedef struct shash_s shash
typedef struct shash_elem_s shash_elem
typedef uint32_t(* shash_hash_fn)(void *key)

Definition at line 67 of file cf_shash.h.

typedef int(* shash_reduce_fn)(void *key, void *data, void *udata)

Definition at line 74 of file cf_shash.h.

Function Documentation

int shash_create ( shash **  h,
shash_hash_fn  h_fn,
uint32_t  key_len,
uint32_t  value_len,
uint32_t  sz,
unsigned int  flags 
)
int shash_delete ( shash h,
void *  key 
)
int shash_delete_lockfree ( shash h,
void *  key 
)
void shash_destroy ( shash h)
int shash_get ( shash h,
void *  key,
void *  value 
)
int shash_get_and_delete ( shash h,
void *  key,
void *  value 
)
uint32_t shash_get_size ( shash h)
int shash_get_vlock ( shash h,
void *  key,
void **  value,
pthread_mutex_t **  vlock 
)
int shash_grab ( shash h,
void *  key,
uint32_t  key_len,
void **  value,
uint32_t *  value_len 
)
int shash_put ( shash h,
void *  key,
void *  value 
)
int shash_put_unique ( shash h,
void *  key,
void *  value 
)
int shash_reduce ( shash h,
shash_reduce_fn  reduce_fn,
void *  udata 
)
int shash_reduce_delete ( shash h,
shash_reduce_fn  reduce_fn,
void *  udata 
)
int shash_return ( shash h,
void *  value 
)