edits
[iotcloud.git] / version2 / src / C / Transaction.cc
index 00d0882c5da034996ffedb134410e1525500e6f1..d5abcc136dadad144542a2424f711c5a8101fba6 100644 (file)
@@ -2,9 +2,9 @@
 
 class Transaction {
 
-    Map<Integer, TransactionPart> parts = NULL;
-    Set<Integer> missingParts = NULL;
-    List<Integer> partsPendingSend = NULL;
+    Hashtable<int32_t, TransactionPart> parts = NULL;
+    Set<int32_t> missingParts = NULL;
+    Vector<int32_t> partsPendingSend = NULL;
     bool isComplete = false;
     bool hasLastPart = false;
     Set<KeyValue> keyValueGuardSet = NULL;
@@ -24,10 +24,10 @@ class Transaction {
     bool hadServerFailure = false;
 
     Transaction() {
-        parts = new HashMap<Integer, TransactionPart>();
+        parts = new Hashtable<int32_t, TransactionPart>();
         keyValueGuardSet = new HashSet<KeyValue>();
         keyValueUpdateSet = new HashSet<KeyValue>();
-        partsPendingSend = new ArrayList<Integer>();
+        partsPendingSend = new Vector<int32_t>();
     }
 
     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<Integer>();
+            missingParts = new HashSet<int32_t>();
             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;
     }
 
-    Map<Integer, TransactionPart> getParts() {
+    Hashtable<int32_t, TransactionPart> getParts() {
         return parts;
     }
 
@@ -159,7 +159,7 @@ class Transaction {
         return transactionStatus;
     }
 
-    void removeSentParts(List<Integer> sentParts) {
+    void removeSentParts(Vector<int32_t> 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();
         }
@@ -255,7 +255,7 @@ class Transaction {
         }
     }
 
-    bool evaluateGuard(Map<IoTString, KeyValue> committedKeyValueTable, Map<IoTString, KeyValue> speculatedKeyValueTable, Map<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable) {
+    bool evaluateGuard(Hashtable<IoTString, KeyValue> committedKeyValueTable, Hashtable<IoTString, KeyValue> speculatedKeyValueTable, Hashtable<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable) {
         for (KeyValue kvGuard : keyValueGuardSet) {
 
             // First check if the key is in the speculative table, this is the value of the latest assumption