nfs-ganesha 1.4
|
Implement an RBTree-based partitioend hash lookup. More...
#include <stdio.h>
#include <string.h>
#include <pthread.h>
#include "RW_Lock.h"
#include "HashTable.h"
#include "log.h"
#include <assert.h>
Go to the source code of this file.
Defines | |
#define | TRUE 1 |
#define | FALSE 0 |
Functions | |
const char * | hash_table_err_to_str (hash_error_t err) |
Return an error string for an error code. | |
struct hash_table * | HashTable_Init (struct hash_param *hparam) |
Initialize a new hash table. | |
hash_error_t | HashTable_Destroy (struct hash_table *ht, int(*free_func)(struct hash_buff, struct hash_buff)) |
Dispose of a hash table. | |
hash_error_t | HashTable_GetLatch (struct hash_table *ht, struct hash_buff *key, struct hash_buff *val, int may_write, struct hash_latch *latch) |
Look up an entry, latching the table. | |
void | HashTable_ReleaseLatched (struct hash_table *ht, struct hash_latch *latch) |
Release lock held on hash table. | |
hash_error_t | HashTable_SetLatched (struct hash_table *ht, struct hash_buff *key, struct hash_buff *val, struct hash_latch *latch, int overwrite, struct hash_buff *stored_key, struct hash_buff *stored_val) |
Set a value in a table following a previous GetLatch. | |
hash_error_t | HashTable_DeleteLatched (struct hash_table *ht, struct hash_buff *key, struct hash_latch *latch, struct hash_buff *stored_key, struct hash_buff *stored_val) |
Delete a value from the store following a previous GetLatch. | |
hash_error_t | HashTable_Delall (struct hash_table *ht, int(*free_func)(struct hash_buff, struct hash_buff)) |
Remove and free all (key,val) couples from the hash store. | |
void | HashTable_GetStats (struct hash_table *ht, struct hash_stat *hstat) |
Get information on the hash table. | |
size_t | HashTable_GetSize (struct hash_table *ht) |
Gets the number of entries in the hashtable. | |
void | HashTable_Log (log_components_t component, struct hash_table *ht) |
Log information about the hashtable. | |
hash_error_t | HashTable_Test_And_Set (struct hash_table *ht, struct hash_buff *key, struct hash_buff *val, hash_set_how_t how) |
Set a pair (key,value) into the Hash Table. | |
hash_error_t | HashTable_GetRef (hash_table_t *ht, hash_buffer_t *key, hash_buffer_t *val, void(*get_ref)(hash_buffer_t *)) |
Look up a value and take a reference. | |
hash_error_t | HashTable_Get_and_Del (hash_table_t *ht, hash_buffer_t *key, hash_buffer_t *val, hash_buffer_t *stored_key) |
Look up, return, and remove an entry. | |
hash_error_t | HashTable_DelRef (hash_table_t *ht, hash_buffer_t *key, hash_buffer_t *stored_key, hash_buffer_t *stored_val, int(*put_ref)(hash_buffer_t *)) |
Decrement the refcount of and possibly remove an entry. | |
hash_error_t | HashTable_DelSafe (hash_table_t *ht, hash_buffer_t *key, hash_buffer_t *val) |
Remove an entry if key and value both match. |
Implement an RBTree-based partitioend hash lookup.
This file implements a partitioned, tree-based, concurrent hash-lookup structure. For every key, two values are derived that determine its location within the structure: an index, which determines which of the partitions (each containing a tree and each separately locked), and a hash which acts as the key within an individual Red-Black Tree.
Definition in file HashTable.c.
#define FALSE 0 |
Definition at line 56 of file HashTable.c.
#define TRUE 1 |
Definition at line 52 of file HashTable.c.