| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | #ifndef DSHASH_H |
| | #define DSHASH_H |
| |
|
| | #include "utils/dsa.h" |
| |
|
| | |
| | struct dshash_table; |
| | typedef struct dshash_table dshash_table; |
| |
|
| | |
| | typedef dsa_pointer dshash_table_handle; |
| |
|
| | |
| | #define DSHASH_HANDLE_INVALID ((dshash_table_handle) InvalidDsaPointer) |
| |
|
| | |
| | typedef uint32 dshash_hash; |
| |
|
| | |
| | typedef int (*dshash_compare_function) (const void *a, const void *b, |
| | size_t size, void *arg); |
| |
|
| | |
| | typedef dshash_hash (*dshash_hash_function) (const void *v, size_t size, |
| | void *arg); |
| |
|
| | |
| | typedef void (*dshash_copy_function) (void *dest, const void *src, size_t size, |
| | void *arg); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | typedef struct dshash_parameters |
| | { |
| | size_t key_size; |
| | size_t entry_size; |
| | dshash_compare_function compare_function; |
| | dshash_hash_function hash_function; |
| | dshash_copy_function copy_function; |
| | int tranche_id; |
| | } dshash_parameters; |
| |
|
| | |
| | struct dshash_table_item; |
| | typedef struct dshash_table_item dshash_table_item; |
| |
|
| | |
| | |
| | |
| | |
| | typedef struct dshash_seq_status |
| | { |
| | dshash_table *hash_table; |
| | int curbucket; |
| | int nbuckets; |
| | dshash_table_item *curitem; |
| | dsa_pointer pnextitem; |
| | int curpartition; |
| | bool exclusive; |
| | } dshash_seq_status; |
| |
|
| | |
| | extern dshash_table *dshash_create(dsa_area *area, |
| | const dshash_parameters *params, |
| | void *arg); |
| | extern dshash_table *dshash_attach(dsa_area *area, |
| | const dshash_parameters *params, |
| | dshash_table_handle handle, |
| | void *arg); |
| | extern void dshash_detach(dshash_table *hash_table); |
| | extern dshash_table_handle dshash_get_hash_table_handle(dshash_table *hash_table); |
| | extern void dshash_destroy(dshash_table *hash_table); |
| |
|
| | |
| | extern void *dshash_find(dshash_table *hash_table, |
| | const void *key, bool exclusive); |
| | extern void *dshash_find_or_insert(dshash_table *hash_table, |
| | const void *key, bool *found); |
| | extern bool dshash_delete_key(dshash_table *hash_table, const void *key); |
| | extern void dshash_delete_entry(dshash_table *hash_table, void *entry); |
| | extern void dshash_release_lock(dshash_table *hash_table, void *entry); |
| |
|
| | |
| | extern void dshash_seq_init(dshash_seq_status *status, dshash_table *hash_table, |
| | bool exclusive); |
| | extern void *dshash_seq_next(dshash_seq_status *status); |
| | extern void dshash_seq_term(dshash_seq_status *status); |
| | extern void dshash_delete_current(dshash_seq_status *status); |
| |
|
| | |
| | |
| | |
| | |
| | extern int dshash_memcmp(const void *a, const void *b, size_t size, void *arg); |
| | extern dshash_hash dshash_memhash(const void *v, size_t size, void *arg); |
| | extern void dshash_memcpy(void *dest, const void *src, size_t size, void *arg); |
| |
|
| | |
| | |
| | |
| | |
| | extern int dshash_strcmp(const void *a, const void *b, size_t size, void *arg); |
| | extern dshash_hash dshash_strhash(const void *v, size_t size, void *arg); |
| | extern void dshash_strcpy(void *dest, const void *src, size_t size, void *arg); |
| |
|
| | |
| | extern void dshash_dump(dshash_table *hash_table); |
| |
|
| | #endif |
| |
|