edits
authorbdemsky <bdemsky@uci.edu>
Fri, 19 Jan 2018 07:08:41 +0000 (23:08 -0800)
committerbdemsky <bdemsky@uci.edu>
Fri, 19 Jan 2018 07:08:41 +0000 (23:08 -0800)
13 files changed:
version2/src/C/Abort.cc
version2/src/C/Abort.h
version2/src/C/ByteBuffer.h
version2/src/C/CommitPart.cc
version2/src/C/CommitPart.h
version2/src/C/Entry.cc
version2/src/C/Entry.h
version2/src/C/LocalComm.cc
version2/src/C/NewKey.h
version2/src/C/RejectedMessage.h
version2/src/C/Table.cc
version2/src/C/TransactionPart.h
version2/src/C/common.h

index bd0c6a2763de1473a839ebd7cc60b5e86e2de821..77e16537345073da6c704f84d3d61ac13ddafe04 100644 (file)
@@ -22,7 +22,7 @@ Abort::Abort(Slot *slot, int64_t _transactionClientLocalSequenceNumber, int64_t
        abortId(new Pair<int64_t, int64_t>(transactionMachineId, transactionClientLocalSequenceNumber)) {
 }
 
-Entry *Abortdecode(Slot *slot, ByteBuffer *bb) {
+Entry *Abort_decode(Slot *slot, ByteBuffer *bb) {
        int64_t transactionClientLocalSequenceNumber = bb->getLong();
        int64_t transactionSequenceNumber = bb->getLong();
        int64_t sequenceNumber = bb->getLong();
index ad54c4fd09221e545934a9ab0d76840c3c0f5e91..4a420d1d8971e5fb37928775778d0aab5545ec84 100644 (file)
@@ -35,5 +35,5 @@ public:
        Entry *getCopy(Slot *s) { return new Abort(s, transactionClientLocalSequenceNumber, transactionSequenceNumber, sequenceNumber, transactionMachineId, transactionArbitrator, arbitratorLocalSequenceNumber); }
 };
 
-Entry *Abortdecode(Slot *slot, ByteBuffer *bb);
+Entry *Abort_decode(Slot *slot, ByteBuffer *bb);
 #endif
index ec98caf151c2a12649178e12557dc7ea35cde966..92d4f16ee8e112015582e5aceed0e9a17bf508b8 100644 (file)
@@ -7,6 +7,7 @@ public:
        void put(char c);
        void putLong(int64_t l);
        int64_t getLong();
+       char get();
 private:
 };
 #endif
index fd560d9d970529379165d31745f5b500b541f92f..08cd46bf5bb1b787d049f053a173bac4ec6fc931 100644 (file)
@@ -7,7 +7,7 @@ CommitPart::CommitPart(Slot *s, int64_t _machineId, int64_t _sequenceNumber, int
        sequenceNumber(_sequenceNumber),
        transactionSequenceNumber(_transactionSequenceNumber),
        partNumber(_partNumber),
-       isLastPart(_isLastPart),
+       fldisLastPart(_isLastPart),
        data(_data),
        partId(new Pair<int64_t int32_t>(sequenceNumber, partNumber)),
        commitId(new Pair<int64_t, int64_t>(machineId, sequenceNumber)) {
@@ -45,7 +45,7 @@ Pair<int64_t, int64_t> *CommitPart::getCommitId() {
 }
 
 bool CommitPart::isLastPart() {
-       return isLastPart;
+       return fldisLastPart;
 }
 
 int64_t CommitPart::getMachineId() {
@@ -83,7 +83,7 @@ void CommitPart::encode(ByteBuffer bb) {
        bb->putInt(partNumber);
        bb->putInt(data.length);
 
-       if (isLastPart) {
+       if (fldisLastPart) {
                bb->put((char)1);
        } else {
                bb->put((char)0);
@@ -97,5 +97,5 @@ char CommitPart::getType() {
 }
 
 Entry *CommitPart::getCopy(Slot *s) {
-       return new CommitPart(s, machineId, sequenceNumber, transactionSequenceNumber, partNumber, data, isLastPart);
+       return new CommitPart(s, machineId, sequenceNumber, transactionSequenceNumber, partNumber, data, fldisLastPart);
 }
index 6d179982a424f2b569f55c079bd5f8f7a8a402d7..19e8b7af9421fc2ddf9524e57277cbb52c587978 100644 (file)
@@ -13,10 +13,10 @@ private:
        int64_t sequenceNumber; // commit sequence number for this arbitrator
        int64_t transactionSequenceNumber;
        int32_t partNumber;     // Parts position in the
-       bool isLastPart;
+       bool fldisLastPart;
        Array<char> *data;
 
-       Pair<int64_t int32_t> *partId;
+       Pair<int64_t, int32_t> *partId;
        Pair<int64_t, int64_t> *commitId;
 
 public:
@@ -26,7 +26,7 @@ public:
        int getPartNumber();
        int getDataSize();
        Array<char> *getData();
-       Pair<int64_t int32_t> *getPartId();
+       Pair<int64_t, int32_t> *getPartId();
        Pair<int64_t, int64_t> *getCommitId();
        bool isLastPart();
        int64_t getMachineId();
index 7d0a039b17efa6e65769cbad9b440c34fc340b8e..538a68631caaf0e1a1aa2a66dc2655c6fe1e504a 100644 (file)
@@ -1,5 +1,13 @@
 #include "Entry.h"
-
+#include "Slot.h"
+#include "ByteBuffer.h"
+#include "Abort.h"
+#include "CommitPart.h"
+#include "NewKey.h"
+#include "LastMessage.h"
+#include "RejectedMessage.h"
+#include "TableStatus.h"
+#include "TransactionPart.h"
 /**
  * Generic class that wraps all the different types of information
  * that can be stored in a Slot.
@@ -28,7 +36,6 @@ Entry *Entry_decode(Slot *slot, ByteBuffer *bb) {
 
        case TypeRejectedMessage:
                return RejectedMessage_decode(slot, bb);
-
        case TypeTableStatus:
                return TableStatus_decode(slot, bb);
 
index 1ec48b1955d37199b78996ce561f06a1199169b6..363b771d9e25dfb25b7b9990f238846879107e85 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include "Liveness.h"
+#include "common.h"
 
 #define TypeCommitPart 1
 #define TypeAbort 2
index 18ba37fa6efe64bd34cbb480c38bc910127e38c0..9640277e0095881adc81b838427c55ee21789175 100644 (file)
@@ -1,5 +1,5 @@
 #include "LocalComm.h"
-Array<char> *LocalComm::sendDataToLocalDevice(int64_t deviceId, Array<char> *data) throws InterruptedException {
+Array<char> *LocalComm::sendDataToLocalDevice(int64_t deviceId, Array<char> *data) {
        printf("Passing Locally\n");
 
        if (deviceId == t1->getMachineId()) {
index 019d66ca92fe4a72bd80a82ada5ea405fceca792..74b9dbccb897101443459cfaa2680251b1748e84 100644 (file)
@@ -35,3 +35,4 @@ public:
 
 Entry *NewKey_decode(Slot *slot, ByteBuffer *bb);
 
+#endif
index 5259f68065781524da2edf1afe2cae7fce4a7bcb..86a005e97769ce5ed547a71eeeb72e201f3a5895 100644 (file)
@@ -39,7 +39,7 @@ private:
        bool getEqual() { return equalto; }
        int64_t getMachineID() { return machineid; }
        int64_t getSequenceNumber() { return sequencenum; }
-       void setWatchSet(HashSet<int64_t> *_watchset) { watchset = _watchset;  }
+       void setWatchSet(Hashset<int64_t> *_watchset) { watchset = _watchset;  }
        void removeWatcher(int64_t machineid);
        void encode(ByteBuffer *bb);
        int getSize() { return 4 * sizeof(int64_t) + 2 * sizeof(char); }
@@ -50,4 +50,4 @@ private:
 };
 
 Entry *RejectedMessage_decode(Slot *slot, ByteBuffer *bb);
-#ifndef
+#endif
index de0a1dafa95a15df4f784b17bd21a292a29ea1ca..1148e9343aa931eff202757b1724b23699f3dfce 100644 (file)
@@ -144,7 +144,7 @@ synchronized void Table::printSlots() {
  * Initialize the table by inserting a table status as the first entry into the table status
  * also initialize the crypto stuff.
  */
-synchronized void Table::initTable() throws ServerException {
+synchronized void Table::initTable() {
        cloud.initSecurity();
 
        // Create the first insertion into the block chain which is the table status
@@ -169,7 +169,7 @@ synchronized void Table::initTable() throws ServerException {
 /**
  * Rebuild the table from scratch by pulling the latest block chain from the server.
  */
-synchronized void Table::rebuild() throws ServerException {
+synchronized void Table::rebuild() {
        // Just pull the latest slots from the server
        Slot[] newslots = cloud.getSlots(sequenceNumber + 1);
        validateAndUpdate(newslots, true);
@@ -305,7 +305,7 @@ synchronized bool Table::update()  {
        return false;
 }
 
-synchronized bool Table::createNewKey(IoTString keyName, int64_t machineId) throws ServerException {
+synchronized bool Table::createNewKey(IoTString keyName, int64_t machineId) {
        while (true) {
                if (arbitratorTable.get(keyName) != NULL) {
                        // There is already an arbitrator
@@ -436,7 +436,7 @@ int64_t Table::getLocalSequenceNumber() {
 
 bool lastInsertedNewKey = false;
 
-bool Table::sendToServer(NewKey newKey) throws ServerException {
+bool Table::sendToServer(NewKey newKey) {
 
        bool fromRetry = false;
 
@@ -1061,8 +1061,7 @@ synchronized Array<char> *Table::acceptDataFromLocal(Array<char> *data) {
        return returnData;
 }
 
-ThreeTuple<bool, bool, Slot[]> Table::sendSlotsToServer(Slot slot, int newSize, bool isNewKey)  throws ServerException {
-
+ThreeTuple<bool, bool, Slot[]> Table::sendSlotsToServer(Slot slot, int newSize, bool isNewKey) {
        bool attemptedToSendToServerTmp = attemptedToSendToServer;
        attemptedToSendToServer = true;
 
index d00a01ae5bac4056e882d53880f41d4d714ae0bf..84aa1b4b4a1ad5004e6a435a3870ae50c57408ff 100644 (file)
@@ -8,17 +8,17 @@
 
 class TransactionPart : public Entry {
 private:
-       int64_t sequenceNumber = -1;
-       int64_t machineId = -1;
-       int64_t arbitratorId = -1;
-       int64_t clientLocalSequenceNumber = -1;         // Sequence number of the transaction that this is a part of
-       int partNumber = -1;    // Parts position in the
-       bool isLastPart = false;
+       int64_t sequenceNumber;
+       int64_t machineId;
+       int64_t arbitratorId;
+       int64_t clientLocalSequenceNumber;              // Sequence number of the transaction that this is a part of
+       int partNumber; // Parts position in the
+       bool fldisLastPart;
 
-       Pair<int64_t, int64_t> *transactionId = NULL;
-       Pair<int64_t int32_t> *partId = NULL;
+       Pair<int64_t, int64_t> *transactionId;
+       Pair<int64_t, int32_t> *partId;
 
-       Array<char> *data = NULL;
+       Array<char> *data;
 
 public:
        TransactionPart(Slot *s, int64_t _machineId, int64_t _arbitratorId, int64_t _clientLocalSequenceNumber, int _partNumber, Array<char> *_data, bool _isLastPart) : Entry(s),
@@ -27,9 +27,9 @@ public:
                arbitratorId(_arbitratorId),
                clientLocalSequenceNumber(_clientLocalSequenceNumber),
                partNumber(_partNumber),
-               isLastPart(_isLastPart)
+               fldisLastPart(_isLastPart),
                transactionId(new Pair<int64_t, int64_t>(machineId, clientLocalSequenceNumber)),
-               partId(new Pair<int64_t int32_t>(clientLocalSequenceNumber, partNumber)),
+               partId(new Pair<int64_t, int32_t>(clientLocalSequenceNumber, partNumber)),
                data(_data) {
        }
 
@@ -37,7 +37,7 @@ public:
        void setSlot(Slot s);
        Pair<int64_t, int64_t> *getTransactionId();
        int64_t getArbitratorId();
-       Pair<int64_t int32_t> *getPartId();
+       Pair<int64_t, int32_t> *getPartId();
        int getPartNumber();
        int getDataSize();
        Array<char> *getData();
index f23a5266980c5db606916594aeecb00afe30271e..afa511f262e7e6fd360c08a47ca6e3d85920349c 100644 (file)
@@ -37,4 +37,13 @@ class Transaction;
 class TransactionPart;
 class TransactionStatus;
 
+#define ASSERT(expr) \
+       do {                                                                                             \
+               if (!(expr)) {                                                                                                                                                                                                                  \
+                       fprintf(stderr, "Error: assertion failed in %s at line %d\n", __FILE__, __LINE__); \
+                       /* print_trace(); // Trace printing may cause dynamic memory allocation */ \
+                       exit(EXIT_FAILURE);                                                                                                                                                                                             \
+               }                                                                                                                                                                                                                                                                               \
+       } while (0)
+
 #endif