edits
authorbdemsky <bdemsky@uci.edu>
Thu, 15 Feb 2018 23:59:57 +0000 (15:59 -0800)
committerbdemsky <bdemsky@uci.edu>
Thu, 15 Feb 2018 23:59:57 +0000 (15:59 -0800)
version2/src/C/Commit.cc
version2/src/C/PendingTransaction.cc
version2/src/C/Table.cc
version2/src/C/Table.h
version2/src/C/Transaction.cc
version2/src/C/Transaction.h
version2/src/C/vector.h
version2/src/java/iotcloud/Table.java

index ec4b39aefdf2885c275224e1ea66e8cb0c335734..f159f71608c59bf74f427234cab8af797fee8ddc 100644 (file)
@@ -198,7 +198,7 @@ void Commit::decodeCommitData() {
 Array<char> *Commit::convertDataToBytes() {
        // Calculate the size of the data
        int sizeOfData = sizeof(int32_t);       // Number of Update KV's
-       SetIterator<KeyValue *, uintptr_t, 0, hashKeyValue, equalsKeyValue> *kvit = keyValueUpdateSet->iterator();
+       SetIterator<KeyValue *, KeyValue *, uintptr_t, 0, hashKeyValue, equalsKeyValue> *kvit = keyValueUpdateSet->iterator();
        while (kvit->hasNext()) {
                KeyValue *kv = kvit->next();
                sizeOfData += kv->getSize();
@@ -227,7 +227,7 @@ void Commit::setKVsMap(Hashset<KeyValue *, uintptr_t, 0, hashKeyValue, equalsKey
        keyValueUpdateSet->clear();
        keyValueUpdateSet->addAll(newKVs);
        liveKeys->clear();
-       SetIterator<KeyValue *, uintptr_t, 0, hashKeyValue, equalsKeyValue> *kvit = newKVs->iterator();
+       SetIterator<KeyValue *, KeyValue *, uintptr_t, 0, hashKeyValue, equalsKeyValue> *kvit = newKVs->iterator();
        while (kvit->hasNext()) {
                liveKeys->add(kvit->next()->getKey());
        }
@@ -241,7 +241,7 @@ Commit *Commit_merge(Commit *newer, Commit *older, int64_t newSequenceNumber) {
                return older;
        }
        Hashset<KeyValue *, uintptr_t, 0, hashKeyValue, equalsKeyValue> *kvSet = new Hashset<KeyValue *, uintptr_t, 0, hashKeyValue, equalsKeyValue>();
-       SetIterator<KeyValue *, uintptr_t, 0, hashKeyValue, equalsKeyValue> *kvit = older->getKeyValueUpdateSet()->iterator();
+       SetIterator<KeyValue *, KeyValue *, uintptr_t, 0, hashKeyValue, equalsKeyValue> *kvit = older->getKeyValueUpdateSet()->iterator();
        while (kvit->hasNext()) {
                KeyValue *kv = kvit->next();
                kvSet->add(kv);
index b1f6db3b2a21b44d2a339d0a889cb0886f2cf60b..f4532190bca1e43d490cc4717c200f1827c1a98d 100644 (file)
@@ -27,7 +27,7 @@ void PendingTransaction::addKV(KeyValue *newKV) {
        KeyValue *rmKV = NULL;
 
        // Make sure there are no duplicates
-       SetIterator<KeyValue *> *kvit = keyValueUpdateSet->iterator();
+       SetIterator<KeyValue *, KeyValue *> *kvit = keyValueUpdateSet->iterator();
        while (kvit->hasNext()) {
                KeyValue *kv = kvit->next();
                if (kv->getKey()->equals(newKV->getKey())) {
@@ -71,7 +71,7 @@ bool PendingTransaction::checkArbitrator(int64_t arb) {
 }
 
 bool PendingTransaction::evaluateGuard(Hashtable<IoTString *, KeyValue *> *keyValTableCommitted, Hashtable<IoTString *, KeyValue *> *keyValTableSpeculative, Hashtable<IoTString *, KeyValue *> *keyValTablePendingTransSpeculative) {
-       SetIterator<KeyValue *> *kvit = keyValueGuardSet->iterator();
+       SetIterator<KeyValue *, KeyValue *> *kvit = keyValueGuardSet->iterator();
        while (kvit->hasNext()) {
                KeyValue *kvGuard = kvit->next();
                // First check if the key is in the speculative table, this is the
@@ -139,7 +139,7 @@ Transaction *PendingTransaction::createTransaction() {
        }
 
        // Add the Guard Conditions
-       SetIterator<KeyValue *> *kvit = keyValueGuardSet->iterator();
+       SetIterator<KeyValue *, KeyValue *> *kvit = keyValueGuardSet->iterator();
        while (kvit->hasNext()) {
                KeyValue *kv = kvit->next();
                newTransaction->addGuardKV(kv);
@@ -170,7 +170,7 @@ Array<char> *PendingTransaction::convertDataToBytes() {
        bbEncode->putInt(keyValueUpdateSet->size());
 
        // Encode all the guard conditions
-       SetIterator<KeyValue *> *kvit = keyValueGuardSet->iterator();
+       SetIterator<KeyValue *, KeyValue *> *kvit = keyValueGuardSet->iterator();
        while (kvit->hasNext()) {
                KeyValue *kv = kvit->next();
                kv->encode(bbEncode);
index 424e105690043f40fa83beae1b5d67b39863c2e3..1bdc259945f940e1ec05bd43c9a482c597de0816 100644 (file)
 #include "Commit.h"
 #include "RejectedMessage.h"
 #include "SlotIndexer.h"
+#include <stdlib.h>
+
+int compareInt64(const void * a, const void *b) {
+       const int64_t * pa = (const int64_t *) a;
+       const int64_t * pb = (const int64_t *) b;
+       if (*pa < *pb)
+               return -1;
+       else if (*pa > *pb)
+               return 1;
+       else
+               return 0;
+}
 
 Table::Table(IoTString *baseurl, IoTString *password, int64_t _localMachineId, int listeningPort) :
        buffer(NULL),
@@ -166,7 +178,7 @@ void Table::init() {
        lastArbitratedTransactionNumberByArbitratorTable = new Hashtable<int64_t, int64_t>();
        liveTransactionBySequenceNumberTable = new Hashtable<int64_t, Transaction *>();
        liveTransactionByTransactionIdTable = new Hashtable<Pair<int64_t, int64_t> *, Transaction *, uintptr_t, 0, pairHashFunction, pairEquals>();
-       liveCommitsTable = new Hashtable<int64_t, Hashtable<int64_t, Commit *> >();
+       liveCommitsTable = new Hashtable<int64_t, Hashtable<int64_t, Commit *> >();
        liveCommitsByKeyTable = new Hashtable<IoTString *, Commit *>();
        lastCommitSeenSequenceNumberByArbitratorTable = new Hashtable<int64_t, int64_t>();
        rejectedSlotVector = new Vector<int64_t>();
@@ -974,7 +986,6 @@ Pair<bool, bool> Table::sendTransactionToLocal(Transaction *transaction) {
 }
 
 Array<char> *Table::acceptDataFromLocal(Array<char> *data) {
-
        // Decode the data
        ByteBuffer *bbDecode = ByteBuffer_wrap(data);
        int64_t lastArbitratedSequenceNumberSeen = bbDecode->getLong();
@@ -1012,8 +1023,16 @@ Array<char> *Table::acceptDataFromLocal(Array<char> *data) {
        Vector<Entry *> *unseenArbitrations = new Vector<Entry *>();
 
        // Get the aborts to send back
-       Vector<int64_t> *abortLocalSequenceNumbers = new Vector<int64_t>(liveAbortsGeneratedByLocal->keySet());
-       Collections->sort(abortLocalSequenceNumbers);
+       Vector<int64_t> *abortLocalSequenceNumbers = new Vector<int64_t>();
+       {
+               SetIterator<int64_t, Abort *> *abortit = getKeyIterator(liveAbortsGeneratedByLocal);
+               while(abortit->hasNext())
+                       abortLocalSequenceNumbers->add(abortit->next());
+               delete abortit;
+       }
+       
+       qsort(abortLocalSequenceNumbers->expose(), abortLocalSequenceNumbers->size(), sizeof(int64_t), compareInt64);
+
        uint asize = abortLocalSequenceNumbers->size();
        for(uint i=0; i<asize; i++) {
                int64_t localSequenceNumber = abortLocalSequenceNumbers->get(i);
@@ -1029,8 +1048,14 @@ Array<char> *Table::acceptDataFromLocal(Array<char> *data) {
        // Get the commits to send back
        Hashtable<int64_t, Commit *> *commitForClientTable = liveCommitsTable->get(localMachineId);
        if (commitForClientTable != NULL) {
-               Vector<int64_t> *commitLocalSequenceNumbers = new Vector<int64_t>(commitForClientTable->keySet());
-               Collections->sort(commitLocalSequenceNumbers);
+               Vector<int64_t> *commitLocalSequenceNumbers = new Vector<int64_t>();
+               {
+                       SetIterator<int64_t, Commit *> *commitit = getKeyIterator(commitForClientTable);
+                       while(commitit->hasNext())
+                               commitLocalSequenceNumbers->add(commitit->next());
+                       delete commitit;
+               }
+               qsort(commitLocalSequenceNumbers->expose(), commitLocalSequenceNumbers->size(), sizeof(int64_t), compareInt64);
 
                uint clsSize = commitLocalSequenceNumbers->size();
                for(uint clsi = 0; clsi < clsSize; clsi++) {
@@ -1041,10 +1066,14 @@ Array<char> *Table::acceptDataFromLocal(Array<char> *data) {
                                continue;
                        }
 
-                       unseenArbitrations->addAll(commit->getParts()->values());
-
-                       for (CommitPart *commitPart : commit->getParts()->values()) {
-                               returnDataSize += commitPart->getSize();
+                       {
+                               Vector<CommitPart *> * parts = commit->getParts();
+                               uint nParts = parts->size();
+                               for(uint i=0; i<nParts; i++) {
+                                       CommitPart * commitPart = parts->get(i);
+                                       unseenArbitrations->add(commitPart);
+                                       returnDataSize += commitPart->getSize();
+                               }
                        }
                }
        }
@@ -1336,7 +1365,9 @@ ThreeTuple<bool, bool, int64_t> Table::doMandatoryResuce(Slot *slot, bool resize
                Vector<Entry *> *liveEntries = previousSlot->getLiveEntries(resize);
 
                // Iterate over all the live entries and try to rescue them
-               for (Entry *liveEntry : liveEntries) {
+               uint lESize = liveEntries->size();
+               for (uint i=0; i< lESize; i++) {
+                       Entry * liveEntry = liveEntries->get(i);
                        if (slot->hasSpace(liveEntry)) {
                                // Enough space to rescue the entry
                                slot->addEntry(liveEntry);
@@ -1368,7 +1399,9 @@ search:
                        continue;
                seenliveslot = true;
                Vector<Entry *> *liveentries = prevslot->getLiveEntries(resize);
-               for (Entry *liveentry : liveentries) {
+               uint lESize = liveentries->size();
+               for (uint i=0; i< lESize; i++) {
+                       Entry * liveentry = liveentries->get(i);
                        if (s->hasSpace(liveentry))
                                s->addEntry(liveentry);
                        else {
@@ -1407,13 +1440,22 @@ void Table::validateAndUpdate(Array<Slot *> *newSlots, bool acceptUpdatesToLocal
        checkHMACChain(indexer, newSlots);
 
        // Set to keep track of messages from clients
-       Hashset<int64_t> *machineSet = new Hashset<int64_t>(lastMessageTable->keySet());
+       Hashset<int64_t> *machineSet = new Hashset<int64_t>();
+       {
+               SetIterator<int64_t, Pair<int64_t, Liveness *> *> * lmit=getKeyIterator(lastMessageTable);
+               while(lmit->hasNext())
+                       machineSet->add(lmit->next());
+               delete lmit;
+       }
 
        // Process each slots data
-       for (Slot *slot : newSlots) {
-               processSlot(indexer, slot, acceptUpdatesToLocal, machineSet);
-
-               updateExpectedSize();
+       {
+               uint numSlots = newSlots->length();
+               for(uint i=0; i<numSlots; i++) {
+                       Slot *slot = newSlots->get(i);
+                       processSlot(indexer, slot, acceptUpdatesToLocal, machineSet);
+                       updateExpectedSize();
+               }
        }
 
        // If there is a gap, check to see if the server sent us
@@ -1422,7 +1464,7 @@ void Table::validateAndUpdate(Array<Slot *> *newSlots, bool acceptUpdatesToLocal
 
                // Check the size of the slots that were sent down by the server->
                // Can only check the size if there was a gap
-               checkNumSlots(newSlots->length);
+               checkNumSlots(newSlots->length());
 
                // Since there was a gap every machine must have pushed a slot or
                // must have a last message message-> If not then the server is
@@ -1436,16 +1478,19 @@ void Table::validateAndUpdate(Array<Slot *> *newSlots, bool acceptUpdatesToLocal
        commitNewMaxSize();
 
        // Commit new to slots to the local block chain->
-       for (Slot *slot : newSlots) {
-
-               // Insert this slot into our local block chain copy->
-               buffer->putSlot(slot);
-
-               // Keep track of how many slots are currently live (have live data
-               // in them)->
-               liveSlotCount++;
+       {
+               uint numSlots = newSlots->length();
+               for(uint i=0; i<numSlots; i++) {
+                       Slot *slot = newSlots->get(i);
+                       
+                       // Insert this slot into our local block chain copy->
+                       buffer->putSlot(slot);
+                       
+                       // Keep track of how many slots are currently live (have live data
+                       // in them)->
+                       liveSlotCount++;
+               }
        }
-
        // Get the sequence number of the latest slot in the system
        sequenceNumber = newSlots->get(newSlots->length() - 1)->getSequenceNumber();
        updateLiveStateFromServer();
@@ -1521,11 +1566,6 @@ void Table::checkNumSlots(int numberOfSlots) {
        }
 }
 
-void Table::updateCurrMaxSize(int newmaxsize) {
-       currMaxSize = newmaxsize;
-}
-
-
 /**
  * Update the size of of the local buffer if it is needed->
  */
@@ -1558,20 +1598,26 @@ void Table::processNewTransactionParts() {
 
        // Iterate through all the machine Ids that we received new parts
        // for
-       for (int64_t machineId : newTransactionParts->keySet()) {
+       SetIterator<int64_t, Hashtable<Pair<int64_t, int32_t> *, TransactionPart *, uintptr_t, 0, pairHashFunction, pairEquals> *> * tpit= getKeyIterator(newTransactionParts);
+       while(tpit->hasNext()) {
+               int64_t machineId = tpit->next();
                Hashtable<Pair<int64_t, int32_t> *, TransactionPart *, uintptr_t, 0, pairHashFunction, pairEquals> *parts = newTransactionParts->get(machineId);
 
+               SetIterator<Pair<int64_t, int32_t> *, TransactionPart *, uintptr_t, 0, pairHashFunction, pairEquals> *ptit = getKeyIterator(parts);
                // Iterate through all the parts for that machine Id
-               for (Pair<int64_t, int32_t> partId : parts->keySet()) {
+               while(ptit->hasNext()) {
+                       Pair<int64_t, int32_t> * partId = ptit->next();
                        TransactionPart *part = parts->get(partId);
 
-                       int64_t lastTransactionNumber = lastArbitratedTransactionNumberByArbitratorTable->get(part->getArbitratorId());
-                       if ((lastTransactionNumber != NULL) && (lastTransactionNumber >= part->getSequenceNumber())) {
-                               // Set dead the transaction part
-                               part->setDead();
-                               continue;
+                       if (lastArbitratedTransactionNumberByArbitratorTable->contains(part->getArbitratorId())) {
+                               int64_t lastTransactionNumber = lastArbitratedTransactionNumberByArbitratorTable->get(part->getArbitratorId());
+                               if (lastTransactionNumber >= part->getSequenceNumber()) {
+                                       // Set dead the transaction part
+                                       part->setDead();
+                                       continue;
+                               }
                        }
-
+                       
                        // Get the transaction object for that sequence number
                        Transaction *transaction = liveTransactionBySequenceNumberTable->get(part->getSequenceNumber());
 
@@ -1581,14 +1627,15 @@ void Table::processNewTransactionParts() {
 
                                // Insert this new transaction into the live tables
                                liveTransactionBySequenceNumberTable->put(part->getSequenceNumber(), transaction);
-                               liveTransactionByTransactionIdTable->put(part->getTransactionId(), transaction);
+                               liveTransactionByTransactionIdTable->put(new Pair<int64_t, int64_t>(part->getTransactionId()), transaction);
                        }
 
                        // Add that part to the transaction
                        transaction->addPartDecode(part);
                }
+               delete ptit;
        }
-
+       delete tpit;
        // Clear all the new transaction parts in preparation for the next
        // time the server sends slots
        newTransactionParts->clear();
@@ -1603,7 +1650,7 @@ void Table::arbitrateFromServer() {
 
        // Get the transaction sequence numbers and sort from oldest to newest
        Vector<int64_t> *transactionSequenceNumbers = new Vector<int64_t>(liveTransactionBySequenceNumberTable->keySet());
-       Collections->sort(transactionSequenceNumbers);
+       qsort(transactionSequenceNumbers->expose(), transactionSequenceNumbers->size(), sizeof(int64_t), compareInt64);
 
        // Collection of key value pairs that are
        Hashtable<IoTString *, KeyValue *> * speculativeTableTmp = new Hashtable<IoTString *, KeyValue *>();
@@ -1848,7 +1895,7 @@ bool Table::compactArbitrationData() {
 
        int numberToDelete = 1;
        while (numberToDelete < pendingSendArbitrationRounds->size()) {
-               ArbitrationRound *xs round = pendingSendArbitrationRounds->get(pendingSendArbitrationRounds->size() - numberToDelete - 1);
+               ArbitrationRound *round = pendingSendArbitrationRounds->get(pendingSendArbitrationRounds->size() - numberToDelete - 1);
 
                if (round->isFull() || round->getDidSendPart()) {
                        // Stop since there is a part that cannot be compacted and we
@@ -1859,14 +1906,14 @@ bool Table::compactArbitrationData() {
                if (round->getCommit() == NULL) {
                        // Try compacting aborts only
                        int newSize = round->getCurrentSize() + lastRound->getAbortsCount();
-                       if (newSize > ArbitrationRound->MAX_PARTS) {
+                       if (newSize > ArbitrationRound_MAX_PARTS) {
                                // Cant compact since it would be too large
                                break;
                        }
                        lastRound->addAborts(round->getAborts());
                } else {
                        // Create a new larger commit
-                       Commit newCommit = Commit->merge(lastRound->getCommit(), round->getCommit(), localArbitrationSequenceNumber);
+                       Commit * newCommit = Commit_merge(lastRound->getCommit(), round->getCommit(), localArbitrationSequenceNumber);
                        localArbitrationSequenceNumber++;
 
                        // Create the commit parts so that we can count them
@@ -1877,7 +1924,7 @@ bool Table::compactArbitrationData() {
                        newSize += lastRound->getAbortsCount();
                        newSize += round->getAbortsCount();
 
-                       if (newSize > ArbitrationRound->MAX_PARTS) {
+                       if (newSize > ArbitrationRound_MAX_PARTS) {
                                // Cant compact since it would be too large
                                break;
                        }
@@ -1898,7 +1945,7 @@ bool Table::compactArbitrationData() {
                        pendingSendArbitrationRounds->clear();
                } else {
                        for (int i = 0; i < numberToDelete; i++) {
-                               pendingSendArbitrationRounds->remove(pendingSendArbitrationRounds->size() - 1);
+                               pendingSendArbitrationRounds->removeIndex(pendingSendArbitrationRounds->size() - 1);
                        }
                }
 
@@ -1972,7 +2019,7 @@ bool Table::updateCommittedTable() {
 
                // Sort the commits in order
                Vector<int64_t> *commitSequenceNumbers = new Vector<int64_t>(commitForClientTable->keySet());
-               Collections->sort(commitSequenceNumbers);
+               qsort(commitSequenceNumbers->expose(), commitSequenceNumbers->size(), sizeof(int64_t), compareInt64);
 
                // Get the last commit seen from this arbitrator
                int64_t lastCommitSeenSequenceNumber = -1;
@@ -2120,7 +2167,7 @@ bool Table::updateSpeculativeTable(bool didProcessNewCommits) {
        // Create a list of the transaction sequence numbers and sort them
        // from oldest to newest
        Vector<int64_t> *transactionSequenceNumbersSorted = new Vector<int64_t>(liveTransactionBySequenceNumberTable->keySet());
-       Collections->sort(transactionSequenceNumbersSorted);
+       qsort(transactionSequenceNumberSorted->expose(), transactionSequenceNumbersSorted->size(), sizeof(int64_t), compareInt64);
 
        bool hasGapInTransactionSequenceNumbers = transactionSequenceNumbersSorted->get(0) != oldestTransactionSequenceNumberSpeculatedOn;
 
@@ -2347,7 +2394,7 @@ void Table::processEntry(NewKey *entry) {
  * seen in this current round of updating the local copy of the block
  * chain
  */
-void Table::processEntry(TableStatus entry, int64_t seq) {
+void Table::processEntry(TableStatus entry, int64_t seq) {
        int newNumSlots = entry->getMaxSlots();
        updateCurrMaxSize(newNumSlots);
        initExpectedSize(seq, newNumSlots);
index eb9facab8cbc66b8f451c4f33f8a0d874298bf70..394e6d63e3053ede1658005fbb10e5b2a22c7900 100644 (file)
@@ -71,7 +71,7 @@ private:
        Hashtable<int64_t, int64_t> *lastArbitratedTransactionNumberByArbitratorTable;  // Last transaction sequence number that an arbitrator arbitrated on
        Hashtable<int64_t, Transaction *> *liveTransactionBySequenceNumberTable;        // live transaction grouped by the sequence number
        Hashtable<Pair<int64_t, int64_t> *, Transaction *, uintptr_t, 0, pairHashFunction, pairEquals> *liveTransactionByTransactionIdTable;    // live transaction grouped by the transaction ID
-       Hashtable<int64_t, Hashtable<int64_t, Commit *> > *liveCommitsTable;
+       Hashtable<int64_t, Hashtable<int64_t, Commit *> *> *liveCommitsTable;
        Hashtable<IoTString *, Commit *> *liveCommitsByKeyTable;
        Hashtable<int64_t, int64_t> *lastCommitSeenSequenceNumberByArbitratorTable;
        Vector<int64_t> *rejectedSlotVector;    // Vector of rejected slots that have yet to be sent to the server
index 77c3590f5689bd1e467cbe5d165c8191ba768157..d9dbf916156bcff2c151c7f48da9160515470f93 100644 (file)
@@ -205,8 +205,8 @@ bool Transaction::isComplete() {
        return fldisComplete;
 }
 
-Pair<int64_t, int64_t> Transaction::getId() {
-       return transactionId;
+Pair<int64_t, int64_t> Transaction::getId() {
+       return transactionId;
 }
 
 void Transaction::setDead() {
@@ -265,7 +265,7 @@ void Transaction::decodeTransactionData() {
 }
 
 bool Transaction::evaluateGuard(Hashtable<IoTString *, KeyValue *> *committedKeyValueTable, Hashtable<IoTString *, KeyValue *> *speculatedKeyValueTable, Hashtable<IoTString *, KeyValue *> *pendingTransactionSpeculatedKeyValueTable) {
-       SetIterator<KeyValue *> *kvit = keyValueGuardSet->iterator();
+       SetIterator<KeyValue *, KeyValue *> *kvit = keyValueGuardSet->iterator();
        while (kvit->hasNext()) {
                KeyValue *kvGuard = kvit->next();
                // First check if the key is in the speculative table, this is the value of the latest assumption
index f635a7a2821f70852e2896064e92d2d22a0d16c7..240c535251c8221df99989e72106e273bef76727 100644 (file)
@@ -50,7 +50,7 @@ public:
        int64_t getMachineId();
        int64_t getArbitrator();
        bool isComplete();
-       Pair<int64_t, int64_t> getId();
+       Pair<int64_t, int64_t> getId();
        void setDead();
        TransactionPart *getPart(int32_t index);
        bool evaluateGuard(Hashtable<IoTString *, KeyValue *> *committedKeyValueTable, Hashtable<IoTString *, KeyValue *> *speculatedKeyValueTable, Hashtable<IoTString *, KeyValue *> *pendingTransactionSpeculatedKeyValueTable);
index ccd86498cc635f9943aa6d3ae5a185bbb6488850..1d468a7fc835e723f403fe73d91ec9f841e0be3b 100644 (file)
@@ -42,6 +42,13 @@ public:
                }
        }
        
+       void removeIndex(uint i) {
+               for (i++; i<fldsize; i++) {
+                       array[i - 1] = array[i];
+               }
+               fldsize--;
+       }
+       
        type last() const {
                return array[fldsize - 1];
        }
@@ -73,6 +80,14 @@ public:
                array[fldsize++] = item;
        }
 
+       type lastElement() {
+               return get(size()-1);
+       }
+
+       type firstElement() {
+               return get(0);
+       }
+
        type get(uint index) const {
                return array[index];
        }
index e4461523c02bf3d5d9f82827a00fdd648c032af7..25b677565f89d8db56c69e4ed30c4d52e1ba6e9c 100644 (file)
@@ -1982,7 +1982,7 @@ final public class Table {
                                pendingSendArbitrationRounds.clear();
                        } else {
                                for (int i = 0; i < numberToDelete; i++) {
-                                       pendingSendArbitrationRounds.remove(pendingSendArbitrationRounds.size() - 1);
+                                       pendingSendArbitrationRounds.removeIndex(pendingSendArbitrationRounds.size() - 1);
                                }
                        }
 
@@ -2745,4 +2745,4 @@ final public class Table {
                                throw new Error("Server Error: Invalid HMAC Chain" + currSlot + " " + prevSlot);
                }
        }
-}
\ No newline at end of file
+}