nfs-ganesha 1.4
Classes | Defines | Typedefs | Enumerations | Functions

HashTable.h File Reference

Header for hash functionality. More...

#include <rbt_node.h>
#include <rbt_tree.h>
#include <pthread.h>
#include "HashData.h"
#include "log.h"
#include "lookup3.h"
#include "abstract_mem.h"

Go to the source code of this file.

Classes

struct  hash_param
struct  hash_stat
struct  hash_partition
 Represents an individual partition. More...
struct  hash_table
struct  hash_latch

Defines

#define TRUE   1
#define FALSE   0
#define HT_FLAG_NONE   0x0000
#define HT_FLAG_CACHE   0x0001

Typedefs

typedef struct hash_param hash_parameter_t
typedef uint32_t(* index_function_t )(struct hash_param *, struct hash_buff *)
typedef uint64_t(* rbthash_function_t )(struct hash_param *, struct hash_buff *)
typedef int(* both_function_t )(struct hash_param *, struct hash_buff *, uint32_t *, uint64_t *)
typedef int(* hash_buff_comparator_t )(struct hash_buff *, struct hash_buff *)
typedef int(* key_display_function_t )(struct hash_buff *, char *)
typedef int(* val_display_function_t )(struct hash_buff *, char *)
typedef struct hash_stat hash_stat_t
typedef struct hash_table hash_table_t
typedef enum hash_set_how hash_set_how_t
typedef enum hash_error hash_error_t

Enumerations

enum  hash_set_how { HASHTABLE_SET_HOW_TEST_ONLY = 1, HASHTABLE_SET_HOW_SET_OVERWRITE = 2, HASHTABLE_SET_HOW_SET_NO_OVERWRITE = 3 }
enum  hash_error {
  HASHTABLE_SUCCESS = 0, HASHTABLE_UNKNOWN_HASH_TYPE = 1, HASHTABLE_INSERT_MALLOC_ERROR = 2, HASHTABLE_ERROR_NO_SUCH_KEY = 3,
  HASHTABLE_ERROR_KEY_ALREADY_EXISTS = 4, HASHTABLE_ERROR_INVALID_ARGUMENT = 5, HASHTABLE_ERROR_DELALL_FAIL = 6, HASHTABLE_NOT_DELETED = 7,
  HASHTABLE_OVERWRITTEN = 8
}

Functions

const char * hash_table_err_to_str (hash_error_t err)
 Return an error string for an error code.
struct hash_tableHashTable_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, enum hash_set_how how)
hash_error_t HashTable_GetRef (struct hash_table *ht, struct hash_buff *key, struct hash_buff *val, void(*get_ref)(struct hash_buff *))
hash_error_t HashTable_Get_and_Del (struct hash_table *ht, struct hash_buff *key, struct hash_buff *val, struct hash_buff *stored_key)
 Look up, return, and remove an entry.
hash_error_t HashTable_DelRef (struct hash_table *ht, struct hash_buff *key, struct hash_buff *stored_key, struct hash_buff *stored_val, int(*put_ref)(struct hash_buff *))
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.

Detailed Description

Header for hash functionality.

This file defines the functions and data structures for use with the Ganesha red-black tree based, concurrent hash store.

Definition in file HashTable.h.


Define Documentation

#define FALSE   0

Definition at line 51 of file HashTable.h.

#define TRUE   1

Definition at line 47 of file HashTable.h.


Typedef Documentation

typedef enum hash_error hash_error_t

Enumeration Type Documentation

enum hash_error
Enumerator:
HASHTABLE_SUCCESS 
HASHTABLE_UNKNOWN_HASH_TYPE 
HASHTABLE_INSERT_MALLOC_ERROR 
HASHTABLE_ERROR_NO_SUCH_KEY 
HASHTABLE_ERROR_KEY_ALREADY_EXISTS 
HASHTABLE_ERROR_INVALID_ARGUMENT 
HASHTABLE_ERROR_DELALL_FAIL 
HASHTABLE_NOT_DELETED 
HASHTABLE_OVERWRITTEN 

Definition at line 179 of file HashTable.h.


Function Documentation

hash_error_t HashTable_DelRef ( struct hash_table ht,
struct hash_buff key,
struct hash_buff stored_key,
struct hash_buff stored_val,
int(*)(struct hash_buff *)  put_ref 
)
hash_error_t HashTable_GetRef ( struct hash_table ht,
struct hash_buff key,
struct hash_buff val,
void(*)(struct hash_buff *)  get_ref 
)
hash_error_t HashTable_Test_And_Set ( struct hash_table ht,
struct hash_buff key,
struct hash_buff val,
enum hash_set_how  how 
)