edits
authorbdemsky <bdemsky@uci.edu>
Fri, 19 Jan 2018 21:49:28 +0000 (13:49 -0800)
committerbdemsky <bdemsky@uci.edu>
Fri, 19 Jan 2018 21:49:28 +0000 (13:49 -0800)
13 files changed:
version2/src/C/ByteBuffer.h
version2/src/C/IoTString.h
version2/src/C/KeyValue.cc
version2/src/C/NewKey.cc
version2/src/C/NewKey.h
version2/src/C/RejectedMessage.cc
version2/src/C/RejectedMessage.h
version2/src/C/Slot.cc
version2/src/C/Slot.h
version2/src/C/SlotBuffer.cc
version2/src/C/SlotIndexer.cc
version2/src/C/SlotIndexer.h
version2/src/C/common.h

index 92d4f16ee8e112015582e5aceed0e9a17bf508b8..a89ca243613ca1cefc6d560adef3b8991232e942 100644 (file)
@@ -5,9 +5,13 @@
 class ByteBuffer {
 public:
        void put(char c);
+       void putInt(int32_t l);
        void putLong(int64_t l);
+       void put(Array<char> * array);
        int64_t getLong();
+       int32_t getInt();
        char get();
-private:
+       void get(Array<char> * array);
+ private:
 };
 #endif
index bbd0c775df095b87fdb5a1748e3669bddc8220f6..f22324b84e43e9fefdac44adb23822c5320b73ab 100644 (file)
@@ -9,7 +9,7 @@
  * @version 1.0
  */
 
-public class IoTString {
+class IoTString {
 private:
        Array<char> *array;
        IoTString() {}
@@ -34,7 +34,7 @@ public:
         * Returns a copy of the underlying char string.
         */
 
-       Array<char> *getBytes() { return new Array<Char>(&array); }
+       Array<char> *getBytes() { return new Array<char>(array); }
 
        /**
         * Returns the length in chars of the IoTString.
index 561ae80a6e076414255460cd0366db20fd487aaf..96d740d9bfeb3cffc217eb215999ed4e2d11e7a7 100644 (file)
@@ -1,4 +1,6 @@
 #include "KeyValue.h"
+#include "ByteBuffer.h"
+#include "IoTString.h"
 /**
  * KeyValue entry for Slot.
  * @author Brian Demsky <bdemsky@uci.edu>
@@ -8,7 +10,7 @@
 KeyValue *KeyValue_decode(ByteBuffer *bb) {
        int keylength = bb->getInt();
        int valuelength = bb->getInt();
-       Array<char> *key = new Array<char> *(keylength);
+       Array<char> *key = new Array<char>(keylength);
        bb->get(key);
 
        if (valuelength != 0) {
@@ -41,7 +43,7 @@ int KeyValue::getSize() {
                return 2 * sizeof(int32_t) + key->length() + value->length();
        }
 
-       return 2 * sizeof(int32_t) + key.length();
+       return 2 * sizeof(int32_t) + key->length();
 }
 
 KeyValue *KeyValue::getCopy() {
index c6afe550743d7104abba059b0d45249510f37ae8..a8a9526a12a5e6699c19af19f54a3c2d345b8706 100644 (file)
@@ -1,5 +1,6 @@
 #include "NewKey.h"
 #include "ByteBuffer.h"
+#include "IoTString.h"
 
 Entry *decode(Slot *slot, ByteBuffer *bb) {
        int keylength = bb->getInt();
@@ -7,7 +8,7 @@ Entry *decode(Slot *slot, ByteBuffer *bb) {
        bb->get(key);
        int64_t machineid = bb->getLong();
 
-       return new NewKey(slot, IoTString.shallow(key), machineid);
+       return new NewKey(slot, IoTString_shallow(key), machineid);
 }
 
 void NewKey::encode(ByteBuffer *bb) {
@@ -18,5 +19,5 @@ void NewKey::encode(ByteBuffer *bb) {
 }
 
 int NewKey::getSize() {
-       return sizeof(int64_t) + sizeof(char) + sizeof(int32_t) + key.length();
+       return sizeof(int64_t) + sizeof(char) + sizeof(int32_t) + key->length();
 }
index 74b9dbccb897101443459cfaa2680251b1748e84..ffb577ac9401c6a16dc55b6036c9f36c1eef6d12 100644 (file)
@@ -1,5 +1,7 @@
 #ifndef NEWKEY_H
 #define NEWKEY_H
+#include "common.h"
+#include "Entry.h"
 
 /**
  * This Entry records the abort sent by a given machine.
index 05d37f6c224b200f188b9f08b6bd82cbbfe9df93..da5d574e3b0428c4fe2e50bd503e6f1c3a3ef434 100644 (file)
@@ -19,8 +19,8 @@ Entry *RejectedMessage_decode(Slot *slot, ByteBuffer *bb) {
 }
 
 void RejectedMessage::removeWatcher(int64_t machineid) {
-       if (watchset.remove(machineid))
-               if (watchset.isEmpty())
+       if (watchset->remove(machineid))
+               if (watchset->isEmpty())
                        setDead();
 }
 
index 86a005e97769ce5ed547a71eeeb72e201f3a5895..3816d193eab6c6f2f60118410256ad7c3146ba44 100644 (file)
@@ -26,7 +26,8 @@ private:
        /* Set of machines that have not received notification. */
        Hashset<int64_t> *watchset;
 
-       RejectedMessage(Slot *slot, int64_t _sequencenum, int64_t _machineid, int64_t _oldseqnum, int64_t _newseqnum, bool _equalto) : Entry(slot),
+ public:
+ RejectedMessage(Slot *slot, int64_t _sequencenum, int64_t _machineid, int64_t _oldseqnum, int64_t _newseqnum, bool _equalto) : Entry(slot),
                sequencenum(_sequencenum),
                machineid(_machineid),
                oldseqnum(_oldseqnum),
index 982b87b485ebf0c40517c0f6274ff85441440e86..2ee69817cd398a60b3fd4410397900a576edfe21 100644 (file)
@@ -78,7 +78,7 @@ Slot *Slotdecode(Table *table, char *array, Mac *mac) {
        return slot;
 }
 
-char *Slot::encode(Mac mac) {
+char *Slot::encode(Mac mac) {
        char *array = new char[SLOT_SIZE];
        ByteBuffer *bb = ByteBuffer_wrap(array);
        /* Leave space for the slot HMAC.  */
index 1138fbf3f5afd7b6e929fdfefbfb95ba8399a0f4..76e0fb4e5fbe3d62e6a54afcaf5da0011036cd59 100644 (file)
@@ -1,6 +1,10 @@
 #ifndef SLOT_H
 #define SLOT_H
 
+#include "common.h"
+#include "Liveness.h"
+
+
 #define SLOT_SIZE 2048
 #define HMAC_SIZE 32
 
index 4ddf4ba3c7b0c4d12c3ac519f7a12b4118d487d4..ad78b3eeedf638a011828b1832cf326832cf33ae 100644 (file)
@@ -1,4 +1,5 @@
 #include "SlotBuffer.h"
+#include "Slot.h"
 /**
  * Circular buffer that holds the live set of slots.
  * @author Brian Demsky
@@ -76,7 +77,7 @@ void SlotBuffer::putSlot(Slot *s) {
        }
 }
 
-Slot SlotBuffer::getSlot(int64_t seqnum) {
+Slot SlotBuffer::getSlot(int64_t seqnum) {
        int32_t diff = (int32_t) (seqnum - oldestseqn);
        int32_t index = diff + tail;
 
@@ -92,7 +93,7 @@ Slot SlotBuffer::getSlot(int64_t seqnum) {
                index -= array->length();
        }
 
-       if (index >= array->length) {
+       if (index >= array->length()) {
 
                return NULL;
        }
index 2b4cdf4a9b604eeec3dd6d9cf1a353cfb3a9aa90..e3b7fa76478cc95780a2ec59b98b11c2e14cadca 100644 (file)
@@ -1,5 +1,7 @@
 #include "SlotIndexer.h"
-
+#include "Slot.h"
+#include "Error.h"
+#include "SlotBuffer.h"
 /**
  * Slot indexer allows slots in both the slot buffer and the new
  * server response to looked up in a consistent fashion.
index d1004d390e8b590bf743306d19ddfa45c1c8b446..9dee2bb8972c1dcce267228b6b568fb65169b502 100644 (file)
@@ -18,4 +18,4 @@ public:
        SlotIndexer(Array<Slot *> *_updates, SlotBuffer *_buffer);
        Slot *getSlot(int64_t seqnum);
 };
-#endif;
+#endif
index afa511f262e7e6fd360c08a47ca6e3d85920349c..5ce508e8250f4da6ba3d5b96537194865bcba489 100644 (file)
@@ -36,6 +36,8 @@ class TimingSingleton;
 class Transaction;
 class TransactionPart;
 class TransactionStatus;
+class Mac;
+class Error;
 
 #define ASSERT(expr) \
        do {                                                                                             \