]> pd.if.org Git - nbds/blob - include/ht.h
rename files
[nbds] / include / ht.h
1 /* 
2  * Written by Josh Dybnis and released to the public domain, as explained at
3  * http://creativecommons.org/licenses/publicdomain
4  */
5 #ifndef HT_H
6 #define HT_H
7
8 #include "struct.h"
9
10 #define HT_EXPECT_NOT_EXISTS ( 0)
11 #define HT_EXPECT_EXISTS     (-1)
12 #define HT_EXPECT_WHATEVER   (-2)
13
14 typedef struct hash_table_i *hash_table_t;
15
16 hash_table_t *ht_alloc (void);
17 void ht_free (hash_table_t *ht);
18 uint64_t ht_get (hash_table_t *ht, const char *key, uint32_t len);
19 uint64_t ht_compare_and_set (hash_table_t *ht, const char *key, uint32_t key_len, uint64_t expected_val, uint64_t val);
20 uint64_t ht_remove (hash_table_t *ht, const char *key, uint32_t len);
21 uint64_t ht_count (hash_table_t *ht);
22
23 #endif//HT_H