start of new file
[IRC.git] / Robust / src / Runtime / DSTM / interface / llookup.h
index 93612322ceba7371cb6557635e3a9227937437e5..29c0d30471cd62db251756dcca87e3bb620a417e 100644 (file)
@@ -3,28 +3,38 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <pthread.h>
 
-#define LOADFACTOR 0.75
+#define SIMPLE_LLOOKUP
+
+#define LOADFACTOR 0.5
 #define HASH_SIZE 100
 
-typedef struct hashlistnode {
+typedef struct lhashlistnode {
        unsigned int oid;
        unsigned int mid;
-       struct hashlistnode *next;
+       struct lhashlistnode *next;
 } lhashlistnode_t;
 
-typedef struct hashtable {
+typedef struct lhashtable {
        lhashlistnode_t *table; // points to beginning of hash table
        unsigned int size;
        unsigned int numelements;
        float loadfactor;
+       pthread_mutex_t locktable;
 } lhashtable_t;
 
-unsigned int lhashCreate(unsigned int size, float loadfactor);// returns 1 for success and 0 for failure
-unsigned int lhashFunction(unsigned int oid); // returns 1 for success and 0 for failure
-unsigned int lhashInsert(unsigned int oid, unsigned int mid); // returns 1 for success and 0 for failure
-unsigned int lhashSearch(unsigned int oid); //returns mid, 0 if not found
-unsigned int lhashRemove(unsigned int oid); //returns 0 if not success
-unsigned int lhashResize(unsigned int newsize);  // returns 1 for success and 0 for failure
+//returns 0 for success and 1 for failure
+unsigned int lhashCreate(unsigned int size, float loadfactor);
+//returns 0 for success and 1 for failure
+unsigned int lhashInsert(unsigned int oid, unsigned int mid);
+//returns mid, 0 if not found
+unsigned int lhashSearch(unsigned int oid);
+//returns 0 for success and 1 for failure
+unsigned int lhashRemove(unsigned int oid);
+
+//helper functions
+unsigned int lhashResize(unsigned int newsize);
+unsigned int lhashFunction(unsigned int oid);
 
 #endif