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
* @version 1.0
*/
-public class IoTString {
+class IoTString {
private:
Array<char> *array;
IoTString() {}
* 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.
#include "KeyValue.h"
+#include "ByteBuffer.h"
+#include "IoTString.h"
/**
* KeyValue entry for Slot.
* @author Brian Demsky <bdemsky@uci.edu>
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) {
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() {
#include "NewKey.h"
#include "ByteBuffer.h"
+#include "IoTString.h"
Entry *decode(Slot *slot, ByteBuffer *bb) {
int keylength = bb->getInt();
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) {
}
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();
}
#ifndef NEWKEY_H
#define NEWKEY_H
+#include "common.h"
+#include "Entry.h"
/**
* This Entry records the abort sent by a given machine.
}
void RejectedMessage::removeWatcher(int64_t machineid) {
- if (watchset.remove(machineid))
- if (watchset.isEmpty())
+ if (watchset->remove(machineid))
+ if (watchset->isEmpty())
setDead();
}
/* 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),
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. */
#ifndef SLOT_H
#define SLOT_H
+#include "common.h"
+#include "Liveness.h"
+
+
#define SLOT_SIZE 2048
#define HMAC_SIZE 32
#include "SlotBuffer.h"
+#include "Slot.h"
/**
* Circular buffer that holds the live set of slots.
* @author Brian Demsky
}
}
-Slot SlotBuffer::getSlot(int64_t seqnum) {
+Slot * SlotBuffer::getSlot(int64_t seqnum) {
int32_t diff = (int32_t) (seqnum - oldestseqn);
int32_t index = diff + tail;
index -= array->length();
}
- if (index >= array->length) {
+ if (index >= array->length()) {
return NULL;
}
#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.
SlotIndexer(Array<Slot *> *_updates, SlotBuffer *_buffer);
Slot *getSlot(int64_t seqnum);
};
-#endif;
+#endif
class Transaction;
class TransactionPart;
class TransactionStatus;
+class Mac;
+class Error;
#define ASSERT(expr) \
do { \