X-Git-Url: https://pd.if.org/git/?p=nbds;a=blobdiff_plain;f=include%2Fstruct.h;h=9d12f73f120dc3beb466d72411050dd7f3400b09;hp=5894c0bb507eb3841312e49679d828817c3a8037;hb=2d93f3b29622488bde80b6cd18661fd7eb603eee;hpb=a1fae129c758d7ea83dfdbb5f14ec1df12f0aa34 diff --git a/include/struct.h b/include/struct.h index 5894c0b..9d12f73 100644 --- a/include/struct.h +++ b/include/struct.h @@ -7,13 +7,26 @@ #define EXPECT_EXISTS (-1) #define EXPECT_WHATEVER (-2) -typedef struct hti *hashtable_t; - +typedef struct ht 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); +void ht_free (hashtable_t *ht); + +typedef struct ll list_t; +list_t * ll_alloc (void); +uint64_t ll_lookup (list_t *ll, const void *key_data, uint32_t key_len); +uint64_t ll_cas (list_t *ll, const void *key_data, uint32_t key_len, uint64_t expected_val, uint64_t new_val); +uint64_t ll_remove (list_t *ll, const void *key_data, uint32_t key_len); +void ll_print (list_t *ll); + +typedef struct sl skiplist_t; +skiplist_t * sl_alloc (void); +uint64_t sl_lookup (skiplist_t *sl, const void *key_data, uint32_t key_len); +uint64_t sl_cas (skiplist_t *sl, const void *key_data, uint32_t key_len, uint64_t expected_val, uint64_t new_val); +uint64_t sl_remove (skiplist_t *sl, const void *key_data, uint32_t key_len); +void sl_print (skiplist_t *sl); #endif//STRUCT_H