X-Git-Url: https://pd.if.org/git/?p=nbds;a=blobdiff_plain;f=include%2Fstruct.h;h=3dec0fac440c253b54e331e0cb4cc3ea23580119;hp=5894c0bb507eb3841312e49679d828817c3a8037;hb=b21e1c182a2e469240d2b1cbbda37f2dfeb880d9;hpb=a1fae129c758d7ea83dfdbb5f14ec1df12f0aa34 diff --git a/include/struct.h b/include/struct.h index 5894c0b..3dec0fa 100644 --- a/include/struct.h +++ b/include/struct.h @@ -8,12 +8,28 @@ #define EXPECT_WHATEVER (-2) typedef struct hti *hashtable_t; - hashtable_t *ht_alloc (void); void ht_free (hashtable_t *ht); -uint64_t ht_get (hashtable_t *ht, const char *key, uint32_t len); + uint64_t ht_compare_and_set (hashtable_t *ht, const char *key, uint32_t key_len, uint64_t expected_val, uint64_t val); +uint64_t ht_get (hashtable_t *ht, const char *key, uint32_t len); uint64_t ht_remove (hashtable_t *ht, const char *key, uint32_t len); -uint64_t ht_count (hashtable_t *ht); +uint64_t ht_count (hashtable_t *ht); + +typedef struct ll list_t; +list_t * ll_alloc (void); + +uint64_t ll_lookup (list_t *ll, uint64_t key); +uint64_t ll_add (list_t *ll, uint64_t key, uint64_t value); +uint64_t ll_remove (list_t *ll, uint64_t key); +void ll_print (list_t *ll); + +typedef struct sl skiplist_t; +skiplist_t * sl_alloc (void); + +uint64_t sl_lookup (skiplist_t *sl, uint64_t key); +uint64_t sl_add (skiplist_t *sl, uint64_t key, uint64_t value); +uint64_t sl_remove (skiplist_t *sl, uint64_t key); +void sl_print (skiplist_t *sl); #endif//STRUCT_H