From: bdemsky Date: Fri, 19 Jan 2018 02:23:58 +0000 (-0800) Subject: edits X-Git-Url: http://plrg.eecs.uci.edu/git/?p=iotcloud.git;a=commitdiff_plain;h=41ff9c95ca5d4b707386c1b7e66df033169bf68d;hp=4087b948a1cb6980a347cbc5ceebd40fade99b82 edits --- diff --git a/version2/src/C/ArbitrationRound.cc b/version2/src/C/ArbitrationRound.cc index f788671..2e2105d 100644 --- a/version2/src/C/ArbitrationRound.cc +++ b/version2/src/C/ArbitrationRound.cc @@ -27,11 +27,11 @@ void ArbitrationRound::generateParts() { } } -List * ArbitrationRound::getParts() { +Vector * ArbitrationRound::getParts() { return parts; } -void ArbitrationRound::removeParts(List * removeParts) { +void ArbitrationRound::removeParts(Vector * removeParts) { parts->removeAll(removeParts); didSendPart = true; } diff --git a/version2/src/C/Commit.cc b/version2/src/C/Commit.cc index 5c61692..a5b952d 100644 --- a/version2/src/C/Commit.cc +++ b/version2/src/C/Commit.cc @@ -41,7 +41,7 @@ void Commit::addPartDecode(CommitPart newPart) { // Set dead the old one since the new one is a rescued version of this part previoslySeenPart.setDead(); } else if (newPart.isLastPart()) { - missingParts = new HashSet(); + missingParts = new HashSet(); hasLastPart = true; for (int i = 0; i < newPart.getPartNumber(); i++) { @@ -81,7 +81,7 @@ void Commit::addPartDecode(CommitPart newPart) { return transactionSequenceNumber; } - Hashtable getParts() { + Hashtable getParts() { return parts; } @@ -116,7 +116,7 @@ int32_t getNumberOfParts() { isDead = true; // Make all the parts of this transaction dead - for (Integer partNumber : parts.keySet()) { + for (int32_t partNumber : parts.keySet()) { CommitPart part = parts.get(partNumber); part.setDead(); } diff --git a/version2/src/C/CommitPart.cc b/version2/src/C/CommitPart.cc index d17f334..4de55c9 100644 --- a/version2/src/C/CommitPart.cc +++ b/version2/src/C/CommitPart.cc @@ -16,7 +16,7 @@ class CommitPart extends Entry{ Boolean isLastPart = false; char[] data = NULL; - Pair partId = NULL; + Pair partId = NULL; Pair commitId = NULL; @@ -29,7 +29,7 @@ class CommitPart extends Entry{ isLastPart = _isLastPart; data = _data; - partId = new Pair(sequenceNumber, partNumber); + partId = new Pair(sequenceNumber, partNumber); commitId = new Pair(machineId, sequenceNumber); } @@ -56,7 +56,7 @@ class CommitPart extends Entry{ return data; } - Pair getPartId() { + Pair getPartId() { return partId; } diff --git a/version2/src/C/CommitPart.h b/version2/src/C/CommitPart.h index 9a5772f..e121aad 100644 --- a/version2/src/C/CommitPart.h +++ b/version2/src/C/CommitPart.h @@ -16,7 +16,7 @@ class CommitPart extends Entry{ private Boolean isLastPart = false; private char[] data = NULL; - private Pair partId = NULL; + private Pair partId = NULL; private Pair commitId = NULL; @@ -29,7 +29,7 @@ class CommitPart extends Entry{ isLastPart = _isLastPart; data = _data; - partId = new Pair(sequenceNumber, partNumber); + partId = new Pair(sequenceNumber, partNumber); commitId = new Pair(machineId, sequenceNumber); } @@ -56,7 +56,7 @@ class CommitPart extends Entry{ return data; } - public Pair getPartId() { + public Pair getPartId() { return partId; } diff --git a/version2/src/C/Table.cc b/version2/src/C/Table.cc index 0a70459..508609e 100644 --- a/version2/src/C/Table.cc +++ b/version2/src/C/Table.cc @@ -48,8 +48,8 @@ final class Table { Slot lastSlotAttemptedToSend = NULL; bool lastIsNewKey = false; int lastNewSize = 0; - Hashtable> lastTransactionPartsSent = NULL; - List lastPendingSendArbitrationEntriesToDelete = NULL; + Hashtable> lastTransactionPartsSent = NULL; + Vector lastPendingSendArbitrationEntriesToDelete = NULL; NewKey lastNewKey = NULL; @@ -58,27 +58,27 @@ final class Table { Hashtable speculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value Hashtable pendingTransactionSpeculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value from the pending transactions Hashtable liveNewKeyTable = NULL; // Table of live new keys - Hashtable> lastMessageTable = NULL; // Last message sent by a client machine id -> (Seq Num, Slot or LastMessage); - Hashtable> rejectedMessageWatchListTable = NULL; // Table of machine Ids and the set of rejected messages they have not seen yet + Hashtable> lastMessageTable = NULL; // Last message sent by a client machine id -> (Seq Num, Slot or LastMessage); + Hashtable> rejectedMessageWatchVectorTable = NULL; // Table of machine Ids and the set of rejected messages they have not seen yet Hashtable arbitratorTable = NULL; // Table of keys and their arbitrators Hashtable, Abort> liveAbortTable = NULL; // Table live abort messages - Hashtable, TransactionPart>> newTransactionParts = NULL; // transaction parts that are seen in this latest round of slots from the server - Hashtable, CommitPart>> newCommitParts = NULL; // commit parts that are seen in this latest round of slots from the server + Hashtable, TransactionPart>> newTransactionParts = NULL; // transaction parts that are seen in this latest round of slots from the server + Hashtable, CommitPart>> newCommitParts = NULL; // commit parts that are seen in this latest round of slots from the server Hashtable lastArbitratedTransactionNumberByArbitratorTable = NULL; // Last transaction sequence number that an arbitrator arbitrated on - Hashtable liveTransactionBySequenceNumberTable = NULL; // live transaction grouped by the sequence number + Hashtable liveTransactionBySequenceNumberTable = NULL; // live transaction grouped by the sequence number Hashtable, Transaction> liveTransactionByTransactionIdTable = NULL; // live transaction grouped by the transaction ID - Hashtable> liveCommitsTable = NULL; + Hashtable> liveCommitsTable = NULL; Hashtable liveCommitsByKeyTable = NULL; Hashtable lastCommitSeenSequenceNumberByArbitratorTable = NULL; - Vector rejectedSlotList = NULL; // List of rejected slots that have yet to be sent to the server - List pendingTransactionQueue = NULL; - List pendingSendArbitrationRounds = NULL; - List pendingSendArbitrationEntriesToDelete = NULL; - Hashtable> transactionPartsSent = NULL; - Hashtable outstandingTransactionStatus = NULL; - Hashtable liveAbortsGeneratedByLocal = NULL; + Vector rejectedSlotVector = NULL; // Vector of rejected slots that have yet to be sent to the server + Vector pendingTransactionQueue = NULL; + Vector pendingSendArbitrationRounds = NULL; + Vector pendingSendArbitrationEntriesToDelete = NULL; + Hashtable> transactionPartsSent = NULL; + Hashtable outstandingTransactionStatus = NULL; + Hashtable liveAbortsGeneratedByLocal = NULL; Set> offlineTransactionsCommittedAndAtServer = NULL; - Hashtable> localCommunicationTable = NULL; + Hashtable> localCommunicationTable = NULL; Hashtable lastTransactionSeenFromMachineFromServer = NULL; Hashtable lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = NULL; @@ -114,28 +114,28 @@ final class Table { speculatedKeyValueTable = new Hashtable(); pendingTransactionSpeculatedKeyValueTable = new Hashtable(); liveNewKeyTable = new Hashtable(); - lastMessageTable = new Hashtable>(); - rejectedMessageWatchListTable = new Hashtable>(); + lastMessageTable = new Hashtable>(); + rejectedMessageWatchVectorTable = new Hashtable>(); arbitratorTable = new Hashtable(); liveAbortTable = new Hashtable, Abort>(); - newTransactionParts = new Hashtable, TransactionPart>>(); - newCommitParts = new Hashtable, CommitPart>>(); + newTransactionParts = new Hashtable, TransactionPart>>(); + newCommitParts = new Hashtable, CommitPart>>(); lastArbitratedTransactionNumberByArbitratorTable = new Hashtable(); - liveTransactionBySequenceNumberTable = new Hashtable(); + liveTransactionBySequenceNumberTable = new Hashtable(); liveTransactionByTransactionIdTable = new Hashtable, Transaction>(); - liveCommitsTable = new Hashtable>(); + liveCommitsTable = new Hashtable>(); liveCommitsByKeyTable = new Hashtable(); lastCommitSeenSequenceNumberByArbitratorTable = new Hashtable(); - rejectedSlotList = new Vector(); - pendingTransactionQueue = new ArrayList(); - pendingSendArbitrationEntriesToDelete = new ArrayList(); - transactionPartsSent = new Hashtable>(); - outstandingTransactionStatus = new Hashtable(); - liveAbortsGeneratedByLocal = new Hashtable(); + rejectedSlotVector = new Vector(); + pendingTransactionQueue = new Vector(); + pendingSendArbitrationEntriesToDelete = new Vector(); + transactionPartsSent = new Hashtable>(); + outstandingTransactionStatus = new Hashtable(); + liveAbortsGeneratedByLocal = new Hashtable(); offlineTransactionsCommittedAndAtServer = new HashSet>(); - localCommunicationTable = new Hashtable>(); + localCommunicationTable = new Hashtable>(); lastTransactionSeenFromMachineFromServer = new Hashtable(); - pendingSendArbitrationRounds = new ArrayList(); + pendingSendArbitrationRounds = new Vector(); lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = new Hashtable(); @@ -276,7 +276,7 @@ final class Table { // } synchronized void addLocalCommunication(int64_t arbitrator, String hostName, int portNumber) { - localCommunicationTable.put(arbitrator, new Pair(hostName, portNumber)); + localCommunicationTable.put(arbitrator, new Pair(hostName, portNumber)); } synchronized Long getArbitrator(IoTString key) { @@ -732,7 +732,7 @@ final class Table { localSequenceNumber++; // Try to fill the slot with data - ThreeTuple fillSlotsReturn = fillSlot(slot, false, newKey); + ThreeTuple fillSlotsReturn = fillSlot(slot, false, newKey); bool needsResize = fillSlotsReturn.getFirst(); int newSize = fillSlotsReturn.getSecond(); Boolean insertedNewKey = fillSlotsReturn.getThird(); @@ -761,8 +761,8 @@ final class Table { lastInsertedNewKey = insertedNewKey; lastNewSize = newSize; lastNewKey = newKey; - lastTransactionPartsSent = new Hashtable>(transactionPartsSent); - lastPendingSendArbitrationEntriesToDelete = new ArrayList(pendingSendArbitrationEntriesToDelete); + lastTransactionPartsSent = new Hashtable>(transactionPartsSent); + lastPendingSendArbitrationEntriesToDelete = new Vector(pendingSendArbitrationEntriesToDelete); ThreeTuple sendSlotsReturn = sendSlotsToServer(slot, newSize, newKey != NULL); @@ -880,8 +880,8 @@ final class Table { // if (!fromRetry) { - // lastTransactionPartsSent = new Hashtable>(transactionPartsSent); - // lastPendingSendArbitrationEntriesToDelete = new ArrayList(pendingSendArbitrationEntriesToDelete); + // lastTransactionPartsSent = new Hashtable>(transactionPartsSent); + // lastPendingSendArbitrationEntriesToDelete = new Vector(pendingSendArbitrationEntriesToDelete); // } // Nothing was able to be sent to the server so just clear these data structures @@ -901,7 +901,7 @@ final class Table { } synchronized bool updateFromLocal(int64_t machineId) { - Pair localCommunicationInformation = localCommunicationTable.get(machineId); + Pair localCommunicationInformation = localCommunicationTable.get(machineId); if (localCommunicationInformation == NULL) { // Cant talk to that device locally so do nothing return false; @@ -954,7 +954,7 @@ final class Table { Pair sendTransactionToLocal(Transaction transaction) { // Get the devices local communications - Pair localCommunicationInformation = localCommunicationTable.get(transaction.getArbitrator()); + Pair localCommunicationInformation = localCommunicationTable.get(transaction.getArbitrator()); if (localCommunicationInformation == NULL) { // Cant talk to that device locally so do nothing @@ -1073,10 +1073,10 @@ final class Table { // The data to send back int returnDataSize = 0; - List unseenArbitrations = new ArrayList(); + Vector unseenArbitrations = new Vector(); // Get the aborts to send back - List abortLocalSequenceNumbers = new ArrayList(liveAbortsGeneratedByLocal.keySet()); + Vector abortLocalSequenceNumbers = new Vector(liveAbortsGeneratedByLocal.keySet()); Collections.sort(abortLocalSequenceNumbers); for (Long localSequenceNumber : abortLocalSequenceNumbers) { if (localSequenceNumber <= lastArbitratedSequenceNumberSeen) { @@ -1089,9 +1089,9 @@ final class Table { } // Get the commits to send back - Hashtable commitForClientTable = liveCommitsTable.get(localMachineId); + Hashtable commitForClientTable = liveCommitsTable.get(localMachineId); if (commitForClientTable != NULL) { - List commitLocalSequenceNumbers = new ArrayList(commitForClientTable.keySet()); + Vector commitLocalSequenceNumbers = new Vector(commitForClientTable.keySet()); Collections.sort(commitLocalSequenceNumbers); for (Long localSequenceNumber : commitLocalSequenceNumbers) { @@ -1155,7 +1155,7 @@ final class Table { Slot[] array = cloud.putSlot(slot, newSize); if (array == NULL) { array = new Slot[] {slot}; - rejectedSlotList.clear(); + rejectedSlotVector.clear(); inserted = true; } else { if (array.length == 0) { @@ -1193,13 +1193,13 @@ final class Table { } if (!isInserted) { - rejectedSlotList.add(slot.getSequenceNumber()); + rejectedSlotVector.add(slot.getSequenceNumber()); lastTryInserted = false; } else { lastTryInserted = true; } } else { - rejectedSlotList.add(slot.getSequenceNumber()); + rejectedSlotVector.add(slot.getSequenceNumber()); lastTryInserted = false; } } @@ -1210,7 +1210,7 @@ final class Table { /** * Returns false if a resize was needed */ - ThreeTuple fillSlot(Slot slot, bool resize, NewKey newKeyEntry) { + ThreeTuple fillSlot(Slot slot, bool resize, NewKey newKeyEntry) { int newSize = 0; @@ -1238,7 +1238,7 @@ final class Table { if (needsResize && !resize) { // We need to resize but we are not resizing so return false - return new ThreeTuple(true, NULL, NULL); + return new ThreeTuple(true, NULL, NULL); } bool inserted = false; @@ -1258,7 +1258,7 @@ final class Table { for (ArbitrationRound round : pendingSendArbitrationRounds) { bool isFull = false; round.generateParts(); - List parts = round.getParts(); + Vector parts = round.getParts(); // Insert pending arbitration data for (Entry arbitrationData : parts) { @@ -1308,9 +1308,9 @@ final class Table { if (slot.hasSpace(part)) { slot.addEntry(part); - List partsSent = transactionPartsSent.get(transaction); + Vector partsSent = transactionPartsSent.get(transaction); if (partsSent == NULL) { - partsSent = new ArrayList(); + partsSent = new Vector(); transactionPartsSent.put(transaction, partsSent); } partsSent.add(part.getPartNumber()); @@ -1324,26 +1324,26 @@ final class Table { // Fill the remainder of the slot with rescue data doOptionalRescue(slot, seenLiveSlot, currentRescueSequenceNumber, resize); - return new ThreeTuple(false, newSize, inserted); + return new ThreeTuple(false, newSize, inserted); } void doRejectedMessages(Slot s) { - if (! rejectedSlotList.isEmpty()) { + if (! rejectedSlotVector.isEmpty()) { /* TODO: We should avoid generating a rejected message entry if * there is already a sufficient entry in the queue (e.g., * equalsto value of true and same sequence number). */ - int64_t old_seqn = rejectedSlotList.firstElement(); - if (rejectedSlotList.size() > REJECTED_THRESHOLD) { - int64_t new_seqn = rejectedSlotList.lastElement(); + int64_t old_seqn = rejectedSlotVector.firstElement(); + if (rejectedSlotVector.size() > REJECTED_THRESHOLD) { + int64_t new_seqn = rejectedSlotVector.lastElement(); RejectedMessage rm = new RejectedMessage(s, s.getSequenceNumber(), localMachineId, old_seqn, new_seqn, false); s.addEntry(rm); } else { int64_t prev_seqn = -1; int i = 0; /* Go through list of missing messages */ - for (; i < rejectedSlotList.size(); i++) { - int64_t curr_seqn = rejectedSlotList.get(i); + for (; i < rejectedSlotVector.size(); i++) { + int64_t curr_seqn = rejectedSlotVector.get(i); Slot s_msg = buffer.getSlot(curr_seqn); if (s_msg != NULL) break; @@ -1355,8 +1355,8 @@ final class Table { s.addEntry(rm); } /* Generate rejected message entries for present messages */ - for (; i < rejectedSlotList.size(); i++) { - int64_t curr_seqn = rejectedSlotList.get(i); + for (; i < rejectedSlotVector.size(); i++) { + int64_t curr_seqn = rejectedSlotVector.get(i); Slot s_msg = buffer.getSlot(curr_seqn); int64_t machineid = s_msg.getMachineID(); RejectedMessage rm = new RejectedMessage(s, s.getSequenceNumber(), machineid, curr_seqn, curr_seqn, true); @@ -1626,10 +1626,10 @@ final class Table { // Iterate through all the machine Ids that we received new parts for for (Long 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); Long lastTransactionNumber = lastArbitratedTransactionNumberByArbitratorTable.get(part.getArbitratorId()); @@ -1671,7 +1671,7 @@ final class Table { } // Get the transaction sequence numbers and sort from oldest to newest - List transactionSequenceNumbers = new ArrayList(liveTransactionBySequenceNumberTable.keySet()); + Vector transactionSequenceNumbers = new Vector(liveTransactionBySequenceNumberTable.keySet()); Collections.sort(transactionSequenceNumbers); // Collection of key value pairs that are @@ -2000,18 +2000,18 @@ final class Table { // Iterate through all the machine Ids that we received new parts for for (Long 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 - Hashtable commitForClientTable = liveCommitsTable.get(part.getMachineId()); + Hashtable commitForClientTable = liveCommitsTable.get(part.getMachineId()); if (commitForClientTable == NULL) { // This is the first commit from this device - commitForClientTable = new Hashtable(); + commitForClientTable = new Hashtable(); liveCommitsTable.put(part.getMachineId(), commitForClientTable); } @@ -2040,10 +2040,10 @@ final class Table { for (Long arbitratorId : liveCommitsTable.keySet()) { // Get all the commits for a specific arbitrator - Hashtable commitForClientTable = liveCommitsTable.get(arbitratorId); + Hashtable commitForClientTable = liveCommitsTable.get(arbitratorId); // Sort the commits in order - List commitSequenceNumbers = new ArrayList(commitForClientTable.keySet()); + Vector commitSequenceNumbers = new Vector(commitForClientTable.keySet()); Collections.sort(commitSequenceNumbers); // Get the last commit seen from this arbitrator @@ -2170,7 +2170,7 @@ final class Table { } // Create a list of the transaction sequence numbers and sort them from oldest to newest - List transactionSequenceNumbersSorted = new ArrayList(liveTransactionBySequenceNumberTable.keySet()); + Vector transactionSequenceNumbersSorted = new Vector(liveTransactionBySequenceNumberTable.keySet()); Collections.sort(transactionSequenceNumbersSorted); bool hasGapInTransactionSequenceNumbers = transactionSequenceNumbersSorted.get(0) != oldestTransactionSequenceNumberSpeculatedOn; @@ -2282,7 +2282,7 @@ final class Table { void updateLiveTransactionsAndStatus() { // Go through each of the transactions - for (Iterator> iter = liveTransactionBySequenceNumberTable.entrySet().iterator(); iter.hasNext();) { + for (Iterator> iter = liveTransactionBySequenceNumberTable.entrySet().iterator(); iter.hasNext();) { Transaction transaction = iter.next().getValue(); // Check if the transaction is dead @@ -2299,7 +2299,7 @@ final class Table { } // Go through each of the transactions - for (Iterator> iter = outstandingTransactionStatus.entrySet().iterator(); iter.hasNext();) { + for (Iterator> iter = outstandingTransactionStatus.entrySet().iterator(); iter.hasNext();) { TransactionStatus status = iter.next().getValue(); // Check if the transaction is dead @@ -2435,7 +2435,7 @@ final class Table { // 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(); @@ -2446,13 +2446,13 @@ final class Table { continue; } - Pair lastMessageValue = lastMessageEntry.getValue(); + Pair lastMessageValue = lastMessageEntry.getValue(); int64_t entrySequenceNumber = lastMessageValue.getFirst(); if (entrySequenceNumber < seq) { // Add this rejected message to the set of messages that this machine ID did not see yet - addWatchList(lastMessageEntryMachineId, entry); + addWatchVector(lastMessageEntryMachineId, entry); // This client did not see this rejected message yet so add it to the watch set to monitor deviceWatchSet.add(lastMessageEntryMachineId); @@ -2553,11 +2553,11 @@ final class Table { } // 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); } @@ -2587,11 +2587,11 @@ final class Table { - 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); } @@ -2614,7 +2614,7 @@ final class Table { machineSet.remove(machineId); // Get the set of rejected messages that this machine Id is has not seen yet - HashSet watchset = rejectedMessageWatchListTable.get(machineId); + HashSet watchset = rejectedMessageWatchVectorTable.get(machineId); // If there is a rejected message that this machine Id has not seen yet if (watchset != NULL) { @@ -2664,7 +2664,7 @@ final class Table { } // Get the old last message for this device - Pair lastMessageEntry = lastMessageTable.put(machineId, new Pair(seqNum, liveness)); + Pair lastMessageEntry = lastMessageTable.put(machineId, new Pair(seqNum, liveness)); if (lastMessageEntry == NULL) { // If no last message then there is nothing else to process return; @@ -2710,12 +2710,12 @@ final class Table { * Add a rejected message entry to the watch set to keep track of which clients have seen that * rejected message entry and which have not. */ - void addWatchList(int64_t machineId, RejectedMessage entry) { - HashSet entries = rejectedMessageWatchListTable.get(machineId); + void addWatchVector(int64_t machineId, RejectedMessage entry) { + HashSet entries = rejectedMessageWatchVectorTable.get(machineId); if (entries == NULL) { // There is no set for this machine ID yet so create one entries = new HashSet(); - rejectedMessageWatchListTable.put(machineId, entries); + rejectedMessageWatchVectorTable.put(machineId, entries); } entries.add(entry); } diff --git a/version2/src/C/Table.h b/version2/src/C/Table.h index 4463c8d..b353fdf 100644 --- a/version2/src/C/Table.h +++ b/version2/src/C/Table.h @@ -50,8 +50,8 @@ class Table { Slot * lastSlotAttemptedToSend = NULL; bool lastIsNewKey = false; int lastNewSize = 0; - Hashtable *> lastTransactionPartsSent = NULL; - List *lastPendingSendArbitrationEntriesToDelete = NULL; + Hashtable *> lastTransactionPartsSent = NULL; + Vector *lastPendingSendArbitrationEntriesToDelete = NULL; NewKey * lastNewKey = NULL; @@ -61,7 +61,7 @@ class Table { Hashtable * pendingTransactionSpeculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value from the pending transactions Hashtable * liveNewKeyTable = NULL; // Table of live new keys Hashtable*> *lastMessageTable = NULL; // Last message sent by a client machine id -> (Seq Num, Slot or LastMessage); - Hashtable*> *rejectedMessageWatchListTable = NULL; // Table of machine Ids and the set of rejected messages they have not seen yet + Hashtable*> *rejectedMessageWatchVectorTable = NULL; // Table of machine Ids and the set of rejected messages they have not seen yet Hashtable *arbitratorTable = NULL; // Table of keys and their arbitrators Hashtable*, Abort*> *liveAbortTable = NULL; // Table live abort messages Hashtable*, TransactionPart*>*> *newTransactionParts = NULL; // transaction parts that are seen in this latest round of slots from the server @@ -72,11 +72,11 @@ class Table { Hashtable> *liveCommitsTable = NULL; Hashtable *liveCommitsByKeyTable = NULL; Hashtable *lastCommitSeenSequenceNumberByArbitratorTable = NULL; - Vector * rejectedSlotList = NULL; // List of rejected slots that have yet to be sent to the server - List *pendingTransactionQueue = NULL; - List *pendingSendArbitrationRounds = NULL; - List *pendingSendArbitrationEntriesToDelete = NULL; - Hashtable*> *transactionPartsSent = NULL; + Vector * rejectedSlotVector = NULL; // Vector of rejected slots that have yet to be sent to the server + Vector *pendingTransactionQueue = NULL; + Vector *pendingSendArbitrationRounds = NULL; + Vector *pendingSendArbitrationEntriesToDelete = NULL; + Hashtable*> *transactionPartsSent = NULL; Hashtable *outstandingTransactionStatus = NULL; Hashtable *liveAbortsGeneratedByLocal = NULL; Hashset*> *offlineTransactionsCommittedAndAtServer = NULL; @@ -222,7 +222,7 @@ class Table { * Add a rejected message entry to the watch set to keep track of which clients have seen that * rejected message entry and which have not. */ - void addWatchList(int64_t machineId, RejectedMessage entry); + void addWatchVector(int64_t machineId, RejectedMessage entry); /** * Check if the HMAC chain is not violated diff --git a/version2/src/C/Transaction.cc b/version2/src/C/Transaction.cc index 532d6e5..d5abcc1 100644 --- a/version2/src/C/Transaction.cc +++ b/version2/src/C/Transaction.cc @@ -2,9 +2,9 @@ class Transaction { - Hashtable parts = NULL; - Set missingParts = NULL; - List partsPendingSend = NULL; + Hashtable parts = NULL; + Set missingParts = NULL; + Vector partsPendingSend = NULL; bool isComplete = false; bool hasLastPart = false; Set keyValueGuardSet = NULL; @@ -24,10 +24,10 @@ class Transaction { bool hadServerFailure = false; Transaction() { - parts = new Hashtable(); + parts = new Hashtable(); keyValueGuardSet = new HashSet(); keyValueUpdateSet = new HashSet(); - partsPendingSend = new ArrayList(); + partsPendingSend = new Vector(); } void addPartEncode(TransactionPart newPart) { @@ -63,7 +63,7 @@ class Transaction { // Set dead the old one since the new one is a rescued version of this part previoslySeenPart.setDead(); } else if (newPart.isLastPart()) { - missingParts = new HashSet(); + missingParts = new HashSet(); hasLastPart = true; for (int i = 0; i < newPart.getPartNumber(); i++) { @@ -106,7 +106,7 @@ class Transaction { void setSequenceNumber(int64_t _sequenceNumber) { sequenceNumber = _sequenceNumber; - for (Integer i : parts.keySet()) { + for (int32_t i : parts.keySet()) { parts.get(i).setSequenceNumber(sequenceNumber); } } @@ -115,7 +115,7 @@ class Transaction { return clientLocalSequenceNumber; } - Hashtable getParts() { + Hashtable getParts() { return parts; } @@ -159,7 +159,7 @@ class Transaction { return transactionStatus; } - void removeSentParts(List sentParts) { + void removeSentParts(Vector sentParts) { nextPartToSend = 0; if(partsPendingSend.removeAll(sentParts)) { @@ -206,7 +206,7 @@ class Transaction { isDead = true; // Make all the parts of this transaction dead - for (Integer partNumber : parts.keySet()) { + for (int32_t partNumber : parts.keySet()) { TransactionPart part = parts.get(partNumber); part.setDead(); } diff --git a/version2/src/C/Transaction.h b/version2/src/C/Transaction.h index d59f710..dab4949 100644 --- a/version2/src/C/Transaction.h +++ b/version2/src/C/Transaction.h @@ -6,7 +6,7 @@ class Transaction { private: Hashtable parts = NULL; Set missingParts = NULL; - List partsPendingSend = NULL; + Vector partsPendingSend = NULL; bool isComplete = false; bool hasLastPart = false; Hashset * keyValueGuardSet = NULL; @@ -26,10 +26,10 @@ class Transaction { bool hadServerFailure = false; public Transaction() { - parts = new Hashtable(); + parts = new Hashtable(); keyValueGuardSet = new HashSet(); keyValueUpdateSet = new HashSet(); - partsPendingSend = new ArrayList(); + partsPendingSend = new Vector(); } public void addPartEncode(TransactionPart newPart) { @@ -65,7 +65,7 @@ class Transaction { // Set dead the old one since the new one is a rescued version of this part previoslySeenPart.setDead(); } else if (newPart.isLastPart()) { - missingParts = new HashSet(); + missingParts = new HashSet(); hasLastPart = true; for (int i = 0; i < newPart.getPartNumber(); i++) { @@ -108,7 +108,7 @@ class Transaction { public void setSequenceNumber(int64_t _sequenceNumber) { sequenceNumber = _sequenceNumber; - for (Integer i : parts.keySet()) { + for (int32_t i : parts.keySet()) { parts.get(i).setSequenceNumber(sequenceNumber); } } @@ -117,7 +117,7 @@ class Transaction { return clientLocalSequenceNumber; } - public Hashtable getParts() { + public Hashtable getParts() { return parts; } @@ -161,7 +161,7 @@ class Transaction { return transactionStatus; } - public void removeSentParts(List sentParts) { + public void removeSentParts(Vector sentParts) { nextPartToSend = 0; if(partsPendingSend.removeAll(sentParts)) { @@ -208,7 +208,7 @@ class Transaction { isDead = true; // Make all the parts of this transaction dead - for (Integer partNumber : parts.keySet()) { + for (int32_t partNumber : parts.keySet()) { TransactionPart part = parts.get(partNumber); part.setDead(); } diff --git a/version2/src/C/TransactionPart.cc b/version2/src/C/TransactionPart.cc index 139b3d2..6e0528f 100644 --- a/version2/src/C/TransactionPart.cc +++ b/version2/src/C/TransactionPart.cc @@ -13,7 +13,7 @@ class TransactionPart extends Entry { Boolean isLastPart = false; Pair transactionId = NULL; - Pair partId = NULL; + Pair partId = NULL; char[] data = NULL; @@ -27,7 +27,7 @@ class TransactionPart extends Entry { isLastPart = _isLastPart; transactionId = new Pair(machineId, clientLocalSequenceNumber); - partId = new Pair(clientLocalSequenceNumber, partNumber); + partId = new Pair(clientLocalSequenceNumber, partNumber); } @@ -50,7 +50,7 @@ class TransactionPart extends Entry { return arbitratorId; } - Pair getPartId() { + Pair getPartId() { return partId; } diff --git a/version2/src/C/TransactionPart.h b/version2/src/C/TransactionPart.h index 806cb31..4b35977 100644 --- a/version2/src/C/TransactionPart.h +++ b/version2/src/C/TransactionPart.h @@ -13,7 +13,7 @@ class TransactionPart extends Entry { private Boolean isLastPart = false; private Pair transactionId = NULL; - private Pair partId = NULL; + private Pair partId = NULL; private char[] data = NULL; @@ -27,7 +27,7 @@ class TransactionPart extends Entry { isLastPart = _isLastPart; transactionId = new Pair(machineId, clientLocalSequenceNumber); - partId = new Pair(clientLocalSequenceNumber, partNumber); + partId = new Pair(clientLocalSequenceNumber, partNumber); } @@ -50,7 +50,7 @@ class TransactionPart extends Entry { return arbitratorId; } - public Pair getPartId() { + public Pair getPartId() { return partId; } diff --git a/version2/src/C/hashtable.h b/version2/src/C/hashtable.h index 648377e..b27dde2 100644 --- a/version2/src/C/hashtable.h +++ b/version2/src/C/hashtable.h @@ -53,7 +53,7 @@ inline bool defaultEquals(_Key key1, _Key key2) { * * @tparam _Key Type name for the key * @tparam _Val Type name for the values to be stored - * @tparam _KeyInt Integer type that is at least as large as _Key. Used for key + * @tparam _KeyInt int32_t type that is at least as large as _Key. Used for key * manipulation and storage. * @tparam _Shift Logical shift to apply to all keys. Default 0. */