Added trans.c for transaction funtions. Implemented transStart() and transCreateObj...
[IRC.git] / Robust / src / Runtime / DSTM / interface / trans.c
1 #include "dstm.h"
2 #include "clookup.h"
3 #include "mlookup.h"
4 #include "llookup.h"
5
6 transrecord_t *transStart()
7 {
8         transrecord_t *tmp = malloc(sizeof(transrecord_t));
9         tmp->cache = objstrCreate(1048576);
10         tmp->lookupTable = cachehashCreate(HASH_SIZE, LOADFACTOR);
11         return tmp;
12 }
13
14 objheader_t *transRead(transrecord_t *record, unsigned int oid)
15 {
16                 //check cache
17                 //else check machine lookup table
18                 //else check location lookup table
19                 //else broadcast
20 }
21
22 objheader_t *transCreateObj(transrecord_t *record, unsigned short type)
23 {
24         objheader_t *tmp = objstrAlloc(record->cache, classsize[type]);
25         tmp->oid = getNewOID();
26         tmp->type = type;
27         tmp->version = 1;
28         tmp->rcount = 0; //? not sure how to handle this yet
29         tmp->status |= NEW;
30         cachehashInsert(record->lookupTable, tmp->oid, tmp);
31         return tmp;
32 }
33
34 int transCommit(transrecord_t *record)
35 {
36         
37 }
38