6 #define CAS_EXPECT_DOES_NOT_EXIST ( 0)
7 #define CAS_EXPECT_EXISTS (-1)
8 #define CAS_EXPECT_WHATEVER (-2)
10 typedef void * (*map_alloc_t) (const datatype_t *);
11 typedef uint64_t (*map_cas_t) (void *, void *, uint64_t, uint64_t);
12 typedef uint64_t (*map_get_t) (void *, void *);
13 typedef uint64_t (*map_remove_t) (void *, void *);
14 typedef uint64_t (*map_count_t) (void *);
15 typedef void (*map_print_t) (void *);
16 typedef void (*map_free_t) (void *);
18 typedef struct map_impl {
28 typedef struct ht hashtable_t;
29 typedef struct sl skiplist_t;
30 typedef struct ll list_t;
32 hashtable_t * ht_alloc (const datatype_t *key_type);
33 skiplist_t * sl_alloc (const datatype_t *key_type);
34 list_t * ll_alloc (const datatype_t *key_type);
36 uint64_t ht_cas (hashtable_t *ht, void *key, uint64_t expected_val, uint64_t val);
37 uint64_t ht_get (hashtable_t *ht, void *key);
38 uint64_t ht_remove (hashtable_t *ht, void *key);
39 uint64_t ht_count (hashtable_t *ht);
40 void ht_print (hashtable_t *ht);
41 void ht_free (hashtable_t *ht);
43 uint64_t sl_cas (skiplist_t *sl, void *key, uint64_t expected_val, uint64_t new_val);
44 uint64_t sl_lookup (skiplist_t *sl, void *key);
45 uint64_t sl_remove (skiplist_t *sl, void *key);
46 uint64_t sl_count (skiplist_t *sl);
47 void sl_print (skiplist_t *sl);
48 void sl_free (skiplist_t *sl);
50 uint64_t ll_cas (list_t *ll, void *key, uint64_t expected_val, uint64_t new_val);
51 uint64_t ll_lookup (list_t *ll, void *key);
52 uint64_t ll_remove (list_t *ll, void *key);
53 uint64_t ll_count (list_t *ll);
54 void ll_print (list_t *ll);
55 void ll_free (list_t *ll);