From 3e54762d57367b1ce049830b42f00950055d8527 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Fri, 19 Jan 2018 23:01:37 -0800 Subject: [PATCH] edits --- version2/src/C/Abort.cc | 4 +- version2/src/C/Abort.h | 4 +- version2/src/C/ArbitrationRound.cc | 25 +++-------- version2/src/C/ArbitrationRound.h | 2 +- version2/src/C/CommitPart.cc | 14 +++--- version2/src/C/CommitPart.h | 9 ++-- version2/src/C/IoTString.h | 12 ++++- version2/src/C/Table.cc | 72 +++++++++++++++--------------- version2/src/C/Table.h | 16 +++---- version2/src/C/Transaction.cc | 2 +- version2/src/C/Transaction.h | 4 +- version2/src/C/TransactionPart.cc | 4 +- version2/src/C/TransactionPart.h | 12 ++--- 13 files changed, 89 insertions(+), 91 deletions(-) diff --git a/version2/src/C/Abort.cc b/version2/src/C/Abort.cc index 77e1653..f653e97 100644 --- a/version2/src/C/Abort.cc +++ b/version2/src/C/Abort.cc @@ -8,7 +8,7 @@ Abort::Abort(Slot *slot, int64_t _transactionClientLocalSequenceNumber, int64_t transactionMachineId(_transactionMachineId), transactionArbitrator(_transactionArbitrator), arbitratorLocalSequenceNumber(_arbitratorLocalSequenceNumber), - abortId(new Pair(transactionMachineId, transactionClientLocalSequenceNumber)) { + abortId(Pair(transactionMachineId, transactionClientLocalSequenceNumber)) { } Abort::Abort(Slot *slot, int64_t _transactionClientLocalSequenceNumber, int64_t _transactionSequenceNumber, int64_t _sequenceNumber, int64_t _transactionMachineId, int64_t _transactionArbitrator, int64_t _arbitratorLocalSequenceNumber) : @@ -19,7 +19,7 @@ Abort::Abort(Slot *slot, int64_t _transactionClientLocalSequenceNumber, int64_t transactionMachineId(_transactionMachineId), transactionArbitrator(_transactionArbitrator), arbitratorLocalSequenceNumber(_arbitratorLocalSequenceNumber), - abortId(new Pair(transactionMachineId, transactionClientLocalSequenceNumber)) { + abortId(Pair(transactionMachineId, transactionClientLocalSequenceNumber)) { } Entry *Abort_decode(Slot *slot, ByteBuffer *bb) { diff --git a/version2/src/C/Abort.h b/version2/src/C/Abort.h index 4a420d1..84b8c41 100644 --- a/version2/src/C/Abort.h +++ b/version2/src/C/Abort.h @@ -12,13 +12,13 @@ private: int64_t transactionMachineId; int64_t transactionArbitrator; int64_t arbitratorLocalSequenceNumber; - Pair *abortId; + Pair abortId; public: Abort(Slot *slot, int64_t _transactionClientLocalSequenceNumber, int64_t _transactionSequenceNumber, int64_t _transactionMachineId, int64_t _transactionArbitrator, int64_t _arbitratorLocalSequenceNumber); Abort(Slot *slot, int64_t _transactionClientLocalSequenceNumber, int64_t _transactionSequenceNumber, int64_t _sequenceNumber, int64_t _transactionMachineId, int64_t _transactionArbitrator, int64_t _arbitratorLocalSequenceNumber); - Pair *getAbortId() {return abortId;} + Pair getAbortId() {return abortId;} int64_t getTransactionMachineId() { return transactionMachineId; } int64_t getTransactionSequenceNumber() { return transactionSequenceNumber; } diff --git a/version2/src/C/ArbitrationRound.cc b/version2/src/C/ArbitrationRound.cc index da21dda..3ddf5cb 100644 --- a/version2/src/C/ArbitrationRound.cc +++ b/version2/src/C/ArbitrationRound.cc @@ -17,33 +17,19 @@ ArbitrationRound::ArbitrationRound(Commit *_commit, Hashset *_abortsBef currentSize += abortsBefore->size(); } -/* - void ArbitrationRound::generateParts() { - if (didGenerateParts) { - return; - } - parts = new Vector((Vector *)abortsBefore); - if (commit != NULL) { - parts->addAll(commit->getParts()->values()); - } - }*/ +ArbitrationRound::~ArbitrationRound() { + delete abortsBefore; + delete parts; +} Vector *ArbitrationRound::getParts() { return parts; } -/* - void ArbitrationRound::removeParts(Vector * removeParts) { - parts->removeAll(removeParts); - didSendPart = true; - } - */ - bool ArbitrationRound::isDoneSending() { if ((commit == NULL) && abortsBefore->isEmpty()) { return true; } - return parts->isEmpty(); } @@ -85,10 +71,9 @@ int ArbitrationRound::getCurrentSize() { } bool ArbitrationRound::isFull() { - return currentSize >= MAX_PARTS; + return currentSize >= ArbitrationRound_MAX_PARTS; } bool ArbitrationRound::getDidSendPart() { return didSendPart; } - diff --git a/version2/src/C/ArbitrationRound.h b/version2/src/C/ArbitrationRound.h index b91469d..ba4ed86 100644 --- a/version2/src/C/ArbitrationRound.h +++ b/version2/src/C/ArbitrationRound.h @@ -1,7 +1,7 @@ #ifndef ARBITRATIONROUND_H #define ARBITRATIONROUND_H -#define MAX_PARTS 10 +#define ArbitrationRound_MAX_PARTS 10 #include "common.h" class ArbitrationRound { diff --git a/version2/src/C/CommitPart.cc b/version2/src/C/CommitPart.cc index ea7c36e..3f3208d 100644 --- a/version2/src/C/CommitPart.cc +++ b/version2/src/C/CommitPart.cc @@ -9,8 +9,12 @@ CommitPart::CommitPart(Slot *s, int64_t _machineId, int64_t _sequenceNumber, int partNumber(_partNumber), fldisLastPart(_isLastPart), data(_data), - partId(new Pair(sequenceNumber, partNumber)), - commitId(new Pair(machineId, sequenceNumber)) { + partId(Pair(sequenceNumber, partNumber)), + commitId(Pair(machineId, sequenceNumber)) { +} + +CommitPart::~CommitPart() { + delete data; } int CommitPart::getSize() { @@ -36,11 +40,11 @@ Array *CommitPart::getData() { return data; } -Pair *CommitPart::getPartId() { +Pair CommitPart::getPartId() { return partId; } -Pair *CommitPart::getCommitId() { +Pair CommitPart::getCommitId() { return commitId; } @@ -97,5 +101,5 @@ char CommitPart::getType() { } Entry *CommitPart::getCopy(Slot *s) { - return new CommitPart(s, machineId, sequenceNumber, transactionSequenceNumber, partNumber, data, fldisLastPart); + return new CommitPart(s, machineId, sequenceNumber, transactionSequenceNumber, partNumber, new Array(data), fldisLastPart); } diff --git a/version2/src/C/CommitPart.h b/version2/src/C/CommitPart.h index e0a0d91..8c8e926 100644 --- a/version2/src/C/CommitPart.h +++ b/version2/src/C/CommitPart.h @@ -17,18 +17,19 @@ private: bool fldisLastPart; Array *data; - Pair *partId; - Pair *commitId; + Pair partId; + Pair commitId; public: CommitPart(Slot *s, int64_t _machineId, int64_t _sequenceNumber, int64_t _transactionSequenceNumber, int _partNumber, Array *_data, bool _isLastPart); + ~CommitPart(); int getSize(); void setSlot(Slot *s); int getPartNumber(); int getDataSize(); Array *getData(); - Pair *getPartId(); - Pair *getCommitId(); + Pair getPartId(); + Pair getCommitId(); bool isLastPart(); int64_t getMachineId(); int64_t getTransactionSequenceNumber(); diff --git a/version2/src/C/IoTString.h b/version2/src/C/IoTString.h index 8c07f8e..a7343db 100644 --- a/version2/src/C/IoTString.h +++ b/version2/src/C/IoTString.h @@ -2,7 +2,7 @@ #define IOTSTRING_H #include "array.h" - +#include /** * IoTString wraps the underlying char string. * @author Brian Demsky @@ -21,7 +21,15 @@ private: public: IoTString(Array *_array) : array(new Array(_array)) {} - ~IoTString() {} + IoTString(const char *_array) { + int32_t len = strlen(_array); + array = new Array(len); + strcpy(array->internalArray(), _array); + } + + ~IoTString() { + delete array; + } /** * Internal method to grab a reference to our char array. Caller diff --git a/version2/src/C/Table.cc b/version2/src/C/Table.cc index 22d62a2..d598f15 100644 --- a/version2/src/C/Table.cc +++ b/version2/src/C/Table.cc @@ -150,15 +150,15 @@ void Table::init() { speculatedKeyValueTable = new Hashtable(); pendingTransactionSpeculatedKeyValueTable = new Hashtable(); liveNewKeyTable = new Hashtable(); - lastMessageTable = new Hashtable *>(); + lastMessageTable = new Hashtable >(); rejectedMessageWatchVectorTable = new Hashtable * >(); arbitratorTable = new Hashtable(); - liveAbortTable = new Hashtable *, Abort *>(); - newTransactionParts = new Hashtable *, TransactionPart *> *>(); - newCommitParts = new Hashtable *, CommitPart *> *>(); + liveAbortTable = new Hashtable, Abort *>(); + newTransactionParts = new Hashtable, TransactionPart *> *>(); + newCommitParts = new Hashtable, CommitPart *> *>(); lastArbitratedTransactionNumberByArbitratorTable = new Hashtable(); liveTransactionBySequenceNumberTable = new Hashtable(); - liveTransactionByTransactionIdTable = new Hashtable *, Transaction *>(); + liveTransactionByTransactionIdTable = new Hashtable, Transaction *>(); liveCommitsTable = new Hashtable >(); liveCommitsByKeyTable = new Hashtable(); lastCommitSeenSequenceNumberByArbitratorTable = new Hashtable(); @@ -168,7 +168,7 @@ void Table::init() { transactionPartsSent = new Hashtable *>(); outstandingTransactionStatus = new Hashtable(); liveAbortsGeneratedByLocal = new Hashtable(); - offlineTransactionsCommittedAndAtServer = new Hashset *>(); + offlineTransactionsCommittedAndAtServer = new Hashset >(); localCommunicationTable = new Hashtable >(); lastTransactionSeenFromMachineFromServer = new Hashtable(); pendingSendArbitrationRounds = new Vector(); @@ -411,7 +411,7 @@ TransactionStatus *Table::commitTransaction() { continue; } - Pair *sendReturn = sendTransactionToLocal(transaction); + Pair sendReturn = sendTransactionToLocal(transaction); if (sendReturn->getFirst()) { // Failed to contact over local @@ -456,7 +456,7 @@ bool Table::sendToServer(NewKey *newKey) { Array *newSlots = cloud->getSlots(sequenceNumber + 1); if (newSlots->length() == 0) { fromRetry = true; - ThreeTuple *> *sendSlotsReturn = sendSlotsToServer(lastSlotAttemptedToSend, lastNewSize, lastIsNewKey); + ThreeTuple *> sendSlotsReturn = sendSlotsToServer(lastSlotAttemptedToSend, lastNewSize, lastIsNewKey); if (sendSlotsReturn->getFirst()) { if (newKey != NULL) { @@ -850,7 +850,7 @@ Pair Table::sendTransactionToLocal(Transaction *transaction) { if (localCommunicationInformation == NULL) { // Cant talk to that device locally so do nothing - return new Pair(true, false); + return Pair(true, false); } // Get the size of the send data @@ -882,7 +882,7 @@ Pair Table::sendTransactionToLocal(Transaction *transaction) { if (returnData == NULL) { // Could not contact server - return new Pair(true, false); + return Pair(true, false); } // Decode the data @@ -926,7 +926,7 @@ Pair Table::sendTransactionToLocal(Transaction *transaction) { } } - return new Pair(false, true); + return Pair(false, true); } Array *Table::acceptDataFromLocal(Array *data) { @@ -1036,7 +1036,7 @@ Array *Table::acceptDataFromLocal(Array *data) { return returnData; } -ThreeTuple *> *Table::sendSlotsToServer(Slot *slot, int newSize, bool isNewKey) { +ThreeTuple *> Table::sendSlotsToServer(Slot *slot, int newSize, bool isNewKey) { bool attemptedToSendToServerTmp = attemptedToSendToServer; attemptedToSendToServer = true; @@ -1096,13 +1096,13 @@ ThreeTuple *> *Table::sendSlotsToServer(Slot *slot, in } } - return new ThreeTuple *>(inserted, lastTryInserted, array); + return ThreeTuple *>(inserted, lastTryInserted, array); } /** * Returns false if a resize was needed */ -ThreeTuple *Table::fillSlot(Slot *slot, bool resize, NewKey *newKeyEntry) { +ThreeTuple Table::fillSlot(Slot *slot, bool resize, NewKey *newKeyEntry) { int newSize = 0; @@ -1130,7 +1130,7 @@ ThreeTuple *Table::fillSlot(Slot *slot, bool resize, NewKey if (needsResize && !resize) { // We need to resize but we are not resizing so return false - return new ThreeTuple(true, NULL, NULL); + return ThreeTuple(true, NULL, NULL); } bool inserted = false; @@ -1216,7 +1216,7 @@ ThreeTuple *Table::fillSlot(Slot *slot, bool resize, NewKey // Fill the remainder of the slot with rescue data doOptionalRescue(slot, seenLiveSlot, currentRescueSequenceNumber, resize); - return new ThreeTuple(false, newSize, inserted); + return ThreeTuple(false, newSize, inserted); } void Table::doRejectedMessages(Slot *s) { @@ -1298,14 +1298,14 @@ ThreeTuple Table::doMandatoryResuce(Slot *slot, bool resize } else if (currentSequenceNumber == firstIfFull) { //if there's no space but the entry is about to fall off the queue System->out->println("B"); //? - return new ThreeTuple(true, seenLiveSlot, currentSequenceNumber); + return ThreeTuple(true, seenLiveSlot, currentSequenceNumber); } } } // Did not resize - return new ThreeTuple(false, seenLiveSlot, currentSequenceNumber); + return ThreeTuple(false, seenLiveSlot, currentSequenceNumber); } void Table::doOptionalRescue(Slot *s, bool seenliveslot, int64_t seqn, bool resize) { @@ -1518,10 +1518,10 @@ void Table::processNewTransactionParts() { // Iterate through all the machine Ids that we received new parts for for (int64_t machineId : newTransactionParts->keySet()) { - Hashtable *, TransactionPart *> *parts = newTransactionParts->get(machineId); + Hashtable, TransactionPart *> *parts = newTransactionParts->get(machineId); // Iterate through all the parts for that machine Id - for (Pair *partId : parts->keySet()) { + for (Pair partId : parts->keySet()) { TransactionPart *part = parts->get(partId); int64_t lastTransactionNumber = lastArbitratedTransactionNumberByArbitratorTable->get(part->getArbitratorId()); @@ -1684,13 +1684,13 @@ Pair Table::arbitrateOnLocalTransaction(Transaction *transaction) { // Check if this machine arbitrates for this transaction if not then we cant arbitrate this transaction if (transaction->getArbitrator() != localMachineId) { - return new Pair(false, false); + return Pair(false, false); } if (!transaction->isComplete()) { // Will arbitrate in incorrect order if we continue so just break // Most likely this - return new Pair(false, false); + return Pair(false, false); } if (transaction->getMachineId() != localMachineId) { @@ -1698,7 +1698,7 @@ Pair Table::arbitrateOnLocalTransaction(Transaction *transaction) { if (lastTransactionSeenFromMachineFromServer->get(transaction->getMachineId()) != NULL) { if (lastTransactionSeenFromMachineFromServer->get(transaction->getMachineId()) > transaction->getClientLocalSequenceNumber()) { // We've have already seen this from the server - return new Pair(false, false); + return Pair(false, false); } } } @@ -1742,7 +1742,7 @@ Pair Table::arbitrateOnLocalTransaction(Transaction *transaction) { } updateLiveStateFromLocal(); - return new Pair(true, true); + return Pair(true, true); } else { if (transaction->getMachineId() == localMachineId) { @@ -1782,7 +1782,7 @@ Pair Table::arbitrateOnLocalTransaction(Transaction *transaction) { } updateLiveStateFromLocal(); - return new Pair(true, false); + return Pair(true, false); } } @@ -1889,10 +1889,10 @@ bool Table::updateCommittedTable() { // Iterate through all the machine Ids that we received new parts for for (int64_t machineId : newCommitParts->keySet()) { - Hashtable *, CommitPart *> *parts = newCommitParts->get(machineId); + Hashtable, CommitPart *> *parts = newCommitParts->get(machineId); // Iterate through all the parts for that machine Id - for (Pair *partId : parts->keySet()) { + for (Pair partId : parts->keySet()) { CommitPart *part = parts->get(partId); // Get the transaction object for that sequence number @@ -2323,7 +2323,7 @@ void Table::processEntry(RejectedMessage *entry, SlotIndexer *indexer) { // Create a list of clients to watch until they see this rejected message entry-> Hashset *deviceWatchSet = new Hashset(); - for (Map->Entry *> *lastMessageEntry : lastMessageTable->entrySet()) { + for (Map->Entry > *lastMessageEntry : lastMessageTable->entrySet()) { // Machine ID for the last message entry int64_t lastMessageEntryMachineId = lastMessageEntry->getKey(); @@ -2334,7 +2334,7 @@ void Table::processEntry(RejectedMessage *entry, SlotIndexer *indexer) { continue; } - Pair *lastMessageValue = lastMessageEntry->getValue(); + Pair lastMessageValue = lastMessageEntry->getValue(); int64_t entrySequenceNumber = lastMessageValue->getFirst(); if (entrySequenceNumber < seq) { @@ -2409,7 +2409,7 @@ void Table::processEntry(Abort *entry) { // Set dead a transaction if we can - Transaction *transactionToSetDead = liveTransactionByTransactionIdTable->remove(new Pair(entry->getTransactionMachineId(), entry->getTransactionClientLocalSequenceNumber())); + Transaction *transactionToSetDead = liveTransactionByTransactionIdTable->remove(Pair(entry->getTransactionMachineId(), entry->getTransactionClientLocalSequenceNumber())); if (transactionToSetDead != NULL) { liveTransactionBySequenceNumberTable->remove(transactionToSetDead->getSequenceNumber()); } @@ -2438,11 +2438,11 @@ void Table::processEntry(TransactionPart *entry) { } // This part is still alive - Hashtable *, TransactionPart *> *transactionPart = newTransactionParts->get(entry->getMachineId()); + Hashtable, TransactionPart *> *transactionPart = newTransactionParts->get(entry->getMachineId()); if (transactionPart == NULL) { // Dont have a table for this machine Id yet so make one - transactionPart = new Hashtable *, TransactionPart *>(); + transactionPart = new Hashtable, TransactionPart *>(); newTransactionParts->put(entry->getMachineId(), transactionPart); } @@ -2470,11 +2470,11 @@ void Table::processEntry(CommitPart *entry) { - Hashtable *, CommitPart *> *commitPart = newCommitParts->get(entry->getMachineId()); + Hashtable, CommitPart *> *commitPart = newCommitParts->get(entry->getMachineId()); if (commitPart == NULL) { // Don't have a table for this machine Id yet so make one - commitPart = new Hashtable *, CommitPart *>(); + commitPart = new Hashtable, CommitPart *>(); newCommitParts->put(entry->getMachineId(), commitPart); } @@ -2520,7 +2520,7 @@ void Table::updateLastMessage(int64_t machineId, int64_t seqNum, Liveness *liven } // Set dead the abort - for (IteratorEntry *, Abort *> > i = liveAbortTable->entrySet()->iterator(); i->hasNext();) { + for (IteratorEntry, Abort *> > i = liveAbortTable->entrySet()->iterator(); i->hasNext();) { Abort *abort = i->next()->getValue(); if ((abort->getTransactionMachineId() == machineId) && (abort->getSequenceNumber() <= seqNum)) { @@ -2547,7 +2547,7 @@ void Table::updateLastMessage(int64_t machineId, int64_t seqNum, Liveness *liven } // Get the old last message for this device - Pair *lastMessageEntry = lastMessageTable->put(machineId, new Pair(seqNum, liveness)); + Pair lastMessageEntry = lastMessageTable->put(machineId, Pair(seqNum, liveness)); if (lastMessageEntry == NULL) { // If no last message then there is nothing else to process return; diff --git a/version2/src/C/Table.h b/version2/src/C/Table.h index 3f52214..a5ea0dc 100644 --- a/version2/src/C/Table.h +++ b/version2/src/C/Table.h @@ -62,15 +62,15 @@ private: Hashtable *speculatedKeyValueTable; // Table of speculated key value pairs, if there is a speculative value Hashtable *pendingTransactionSpeculatedKeyValueTable; // Table of speculated key value pairs, if there is a speculative value from the pending transactions Hashtable *liveNewKeyTable; // Table of live new keys - Hashtable *> *lastMessageTable; // Last message sent by a client machine id -> (Seq Num, Slot or LastMessage); + Hashtable > *lastMessageTable; // Last message sent by a client machine id -> (Seq Num, Slot or LastMessage); Hashtable *> *rejectedMessageWatchVectorTable; // Table of machine Ids and the set of rejected messages they have not seen yet Hashtable *arbitratorTable;// Table of keys and their arbitrators - Hashtable *, Abort *> *liveAbortTable;// Table live abort messages - Hashtable *, TransactionPart *> *> *newTransactionParts; // transaction parts that are seen in this latest round of slots from the server - Hashtable *, CommitPart *> *> *newCommitParts; // commit parts that are seen in this latest round of slots from the server + Hashtable, Abort *> *liveAbortTable;// Table live abort messages + Hashtable, TransactionPart *> *> *newTransactionParts; // transaction parts that are seen in this latest round of slots from the server + Hashtable, CommitPart *> *> *newCommitParts; // commit parts that are seen in this latest round of slots from the server Hashtable *lastArbitratedTransactionNumberByArbitratorTable; // Last transaction sequence number that an arbitrator arbitrated on Hashtable *liveTransactionBySequenceNumberTable; // live transaction grouped by the sequence number - Hashtable *, Transaction *> *liveTransactionByTransactionIdTable; // live transaction grouped by the transaction ID + Hashtable, Transaction *> *liveTransactionByTransactionIdTable; // live transaction grouped by the transaction ID Hashtable > *liveCommitsTable; Hashtable *liveCommitsByKeyTable; Hashtable *lastCommitSeenSequenceNumberByArbitratorTable; @@ -81,7 +81,7 @@ private: Hashtable *> *transactionPartsSent; Hashtable *outstandingTransactionStatus; Hashtable *liveAbortsGeneratedByLocal; - Hashset *> *offlineTransactionsCommittedAndAtServer; + Hashset > *offlineTransactionsCommittedAndAtServer; Hashtable > *localCommunicationTable; Hashtable *lastTransactionSeenFromMachineFromServer; Hashtable *lastArbitrationDataLocalSequenceNumberSeenFromArbitrator; @@ -97,11 +97,11 @@ private: bool sendToServer(NewKey *newKey); bool updateFromLocal(int64_t machineId); Pair sendTransactionToLocal(Transaction *transaction); - ThreeTuple *> *sendSlotsToServer(Slot *slot, int newSize, bool isNewKey); + ThreeTuple *> sendSlotsToServer(Slot *slot, int newSize, bool isNewKey); /** * Returns false if a resize was needed */ - ThreeTuple *fillSlot(Slot *slot, bool resize, NewKey *newKeyEntry); + ThreeTuple fillSlot(Slot *slot, bool resize, NewKey *newKeyEntry); void doRejectedMessages(Slot *s); ThreeTuple doMandatoryResuce(Slot *slot, bool resize); diff --git a/version2/src/C/Transaction.cc b/version2/src/C/Transaction.cc index b5b8e50..a3083ee 100644 --- a/version2/src/C/Transaction.cc +++ b/version2/src/C/Transaction.cc @@ -183,7 +183,7 @@ bool Transaction::isComplete() { return fldisComplete; } -Pair *Transaction::getId() { +Pair Transaction::getId() { return transactionId; } diff --git a/version2/src/C/Transaction.h b/version2/src/C/Transaction.h index f18bd70..4be64ff 100644 --- a/version2/src/C/Transaction.h +++ b/version2/src/C/Transaction.h @@ -17,7 +17,7 @@ private: int64_t clientLocalSequenceNumber; int64_t arbitratorId; int64_t machineId; - Pair *transactionId; + Pair transactionId; int nextPartToSend; bool flddidSendAPartToServer; TransactionStatus *transactionStatus; @@ -49,7 +49,7 @@ public: int64_t getMachineId(); int64_t getArbitrator(); bool isComplete(); - Pair *getId(); + Pair getId(); void setDead(); TransactionPart *getPart(int32_t index); bool evaluateGuard(Hashtable *committedKeyValueTable, Hashtable *speculatedKeyValueTable, Hashtable *pendingTransactionSpeculatedKeyValueTable); diff --git a/version2/src/C/TransactionPart.cc b/version2/src/C/TransactionPart.cc index fef588e..86393d0 100644 --- a/version2/src/C/TransactionPart.cc +++ b/version2/src/C/TransactionPart.cc @@ -12,7 +12,7 @@ void TransactionPart::setSlot(Slot *s) { parentslot = s; } -Pair *TransactionPart::getTransactionId() { +Pair TransactionPart::getTransactionId() { return transactionId; } @@ -20,7 +20,7 @@ int64_t TransactionPart::getArbitratorId() { return arbitratorId; } -Pair *TransactionPart::getPartId() { +Pair TransactionPart::getPartId() { return partId; } diff --git a/version2/src/C/TransactionPart.h b/version2/src/C/TransactionPart.h index 51f8f88..f832c30 100644 --- a/version2/src/C/TransactionPart.h +++ b/version2/src/C/TransactionPart.h @@ -16,8 +16,8 @@ private: int32_t partNumber; // Parts position in the bool fldisLastPart; - Pair *transactionId; - Pair *partId; + Pair transactionId; + Pair partId; Array *data; @@ -29,16 +29,16 @@ public: clientLocalSequenceNumber(_clientLocalSequenceNumber), partNumber(_partNumber), fldisLastPart(_isLastPart), - transactionId(new Pair(machineId, clientLocalSequenceNumber)), - partId(new Pair(clientLocalSequenceNumber, partNumber)), + transactionId(Pair(machineId, clientLocalSequenceNumber)), + partId(Pair(clientLocalSequenceNumber, partNumber)), data(_data) { } int getSize(); void setSlot(Slot *s); - Pair *getTransactionId(); + Pair getTransactionId(); int64_t getArbitratorId(); - Pair *getPartId(); + Pair getPartId(); int getPartNumber(); int getDataSize(); Array *getData(); -- 2.34.1