Untest code for trans commit
[IRC.git] / Robust / src / Runtime / DSTM / interface / dstm.h
index 7ac0706a59af55bf5bbadf59fa92f891524a231f..82739f6cb29b157ff18007fd7202c2a1545dccc9 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _DSTM_H_
 #define _DSTM_H_
 
-//Client Messages
+//Coordinator Messages
 #define READ_REQUEST           1
 #define READ_MULT_REQUEST      2
 #define MOVE_REQUEST           3
@@ -9,23 +9,28 @@
 #define        TRANS_REQUEST           5
 #define        TRANS_ABORT             6
 #define TRANS_COMMIT           7
+#define TRANS_ABORT_BUT_RETRY_COMMIT   8
+#define TRANS_ABORT_BUT_RETRY_COMMIT_WITH_RELOCATING   9
 
-//Server Messages
-#define OBJECT_FOUND           8
-#define OBJECT_NOT_FOUND       9
-#define OBJECTS_FOUND          10
-#define OBJECTS_NOT_FOUND      11
-#define TRANS_AGREE            12
-#define TRANS_DISAGREE         13//for soft abort
-#define TRANS_DISAGREE_ABORT   14//for hard abort
-#define TRANS_SUCESSFUL                15//Not necessary for now
+//Participant Messages
+#define OBJECT_FOUND           10
+#define OBJECT_NOT_FOUND       11
+#define OBJECTS_FOUND          12
+#define OBJECTS_NOT_FOUND      13
+#define TRANS_AGREE            14
+#define TRANS_DISAGREE         15
+#define TRANS_AGREE_BUT_MISSING_OBJECTS        16
+#define TRANS_SOFT_ABORT       17
+#define TRANS_SUCESSFUL                18//Not necessary for now
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <pthread.h>
 #include "clookup.h"
 
 #define DEFAULT_OBJ_STORE_SIZE 1048510 //1MB
+#define TID_LEN 20
 //bit designations for status field of objheader
 #define DIRTY 0x01
 #define NEW   0x02
@@ -56,6 +61,18 @@ typedef struct pile {
        struct pile *next;
 }pile_t;
 
+//structure for passing multiple arguments to thread
+typedef struct thread_data_array {
+       int thread_id;
+       int mid;    
+       int pilecount;
+       char *buffer;           //buffer contains the packet for trans req
+       char *recvmsg;          //shared datastructure to keep track of the control message receiv
+       pthread_cond_t *threshold; //threshhold for waking up a thread
+       pthread_mutex_t *lock;    //lock the count variable
+       int *count;             //count variable
+}thread_data_array_t;
+
 /* Initialize main object store and lookup tables, start server thread. */
 int dstmInit(void);
 
@@ -79,6 +96,7 @@ void *dstmAccept(void *);
 transrecord_t *transStart();
 objheader_t *transRead(transrecord_t *record, unsigned int oid);
 objheader_t *transCreateObj(transrecord_t *record, unsigned short type); //returns oid
+void *transRequest(void *);
 int transCommit(transrecord_t *record); //return 0 if successful
 /* end transactions */