From: jdybnis Date: Sun, 23 Nov 2008 22:53:18 +0000 (+0000) Subject: move files around X-Git-Url: https://pd.if.org/git/?p=nbds;a=commitdiff_plain;h=177b35371e1918cb8d00211824acccca47688a4b move files around --- diff --git a/include/ht.h b/include/ht.h deleted file mode 100644 index 49198bb..0000000 --- a/include/ht.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Written by Josh Dybnis and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain - */ -#ifndef HT_H -#define HT_H - -#include "struct.h" - -#define HT_EXPECT_NOT_EXISTS ( 0) -#define HT_EXPECT_EXISTS (-1) -#define HT_EXPECT_WHATEVER (-2) - -typedef struct hash_table_i *hash_table_t; - -hash_table_t *ht_alloc (void); -void ht_free (hash_table_t *ht); -uint64_t ht_get (hash_table_t *ht, const char *key, uint32_t len); -uint64_t ht_compare_and_set (hash_table_t *ht, const char *key, uint32_t key_len, uint64_t expected_val, uint64_t val); -uint64_t ht_remove (hash_table_t *ht, const char *key, uint32_t len); -uint64_t ht_count (hash_table_t *ht); - -#endif//HT_H diff --git a/include/struct.h b/include/struct.h index fa3f704..bb5125a 100644 --- a/include/struct.h +++ b/include/struct.h @@ -3,4 +3,17 @@ #define DOES_NOT_EXIST 0 +#define HT_EXPECT_NOT_EXISTS ( 0) +#define HT_EXPECT_EXISTS (-1) +#define HT_EXPECT_WHATEVER (-2) + +typedef struct hash_table_i *hash_table_t; + +hash_table_t *ht_alloc (void); +void ht_free (hash_table_t *ht); +uint64_t ht_get (hash_table_t *ht, const char *key, uint32_t len); +uint64_t ht_compare_and_set (hash_table_t *ht, const char *key, uint32_t key_len, uint64_t expected_val, uint64_t val); +uint64_t ht_remove (hash_table_t *ht, const char *key, uint32_t len); +uint64_t ht_count (hash_table_t *ht); + #endif//STRUCT_H diff --git a/include/txn.h b/include/txn.h index 9b80e17..b000074 100644 --- a/include/txn.h +++ b/include/txn.h @@ -4,7 +4,7 @@ */ #ifndef TXN_H #define TXN_H -#include "ht.h" +#include "struct.h" typedef enum { TXN_READ_WRITE, TXN_READ_ONLY, TXN_BLIND_WRITE } txn_access_t; typedef enum { TXN_DIRTY_READ, TXN_READ_COMMITTED, TXN_REPEATABLE_READ } txn_isolation_t; diff --git a/makefile b/makefile index bc31f32..a4700ef 100644 --- a/makefile +++ b/makefile @@ -16,8 +16,8 @@ TEST_SRCS := $(RUNTIME_SRCS) rcu_test_SRCS := $(TEST_SRCS) list_test_SRCS := $(TEST_SRCS) struct/list.c skiplist_test_SRCS := $(TEST_SRCS) struct/skiplist.c -ht_test_SRCS := $(TEST_SRCS) struct/ht.c test/ht_test.c test/CuTest.c -txn_test_SRCS := $(TEST_SRCS) struct/ht.c txn/txn.c +ht_test_SRCS := $(TEST_SRCS) struct/hashtable.c test/ht_test.c test/CuTest.c +txn_test_SRCS := $(TEST_SRCS) struct/hashtable.c txn/txn.c tests: $(TESTS) diff --git a/struct/hashtable.c b/struct/hashtable.c index 953200d..45c9ffc 100644 --- a/struct/hashtable.c +++ b/struct/hashtable.c @@ -13,7 +13,6 @@ */ #include "common.h" -#include "ht.h" #include "murmur.h" #include "mem.h" #include "struct.h" diff --git a/test/ht_test.c b/test/ht_test.c index eda9c51..6d4a53b 100644 --- a/test/ht_test.c +++ b/test/ht_test.c @@ -7,7 +7,7 @@ #include "runtime.h" #include "CuTest.h" #include "common.h" -#include "ht.h" +#include "struct.h" #include "mem.h" #include "lwt.h" diff --git a/todo b/todo index e8684e1..a54afec 100644 --- a/todo +++ b/todo @@ -3,3 +3,5 @@ - investigate 16 byte CAS; ht can store GUIDs inline instead of pointers to actual keys - test ht + optimize tracing code, still too much overhead +- use NULL instead of a sentinal node in skiplist and list +- make interfaces for all data structures consistent