space hacks
[iotcloud.git] / version2 / src / C / Commit.cpp
index 766584175f86a82c00442dd0bb3adf119e1a7420..d7c9220d8e132da9bccda5e8c4dbd4cebb8f00b0 100644 (file)
@@ -6,7 +6,6 @@
 Commit::Commit() :
        parts(new Vector<CommitPart *>()),
        partCount(0),
-       missingParts(NULL),
        fldisComplete(false),
        hasLastPart(false),
        keyValueUpdateSet(new Hashset<KeyValue *, uintptr_t, 0>()),
@@ -21,7 +20,6 @@ Commit::Commit() :
 Commit::Commit(int64_t _sequenceNumber, int64_t _machineId, int64_t _transactionSequenceNumber) :
        parts(new Vector<CommitPart *>()),
        partCount(0),
-       missingParts(NULL),
        fldisComplete(true),
        hasLastPart(false),
        keyValueUpdateSet(new Hashset<KeyValue *, uintptr_t, 0>()),
@@ -49,8 +47,6 @@ Commit::~Commit() {
                delete keyValueUpdateSet;
        }
        delete liveKeys;
-       if (missingParts != NULL)
-               delete missingParts;
        if (dataBytes != NULL)
                delete dataBytes;
 }
@@ -72,27 +68,21 @@ void Commit::addPartDecode(CommitPart *newPart) {
                previouslySeenPart->setDead();
                previouslySeenPart->releaseRef();
        } else if (newPart->isLastPart()) {
-               missingParts = new Hashset<int32_t>();
                hasLastPart = true;
-
-               for (int i = 0; i < newPart->getPartNumber(); i++) {
-                       if (parts->get(i) == NULL) {
-                               missingParts->add(i);
-                       }
-               }
        }
 
        if (!fldisComplete && hasLastPart) {
-
                // We have seen this part so remove it from the set of missing parts
-               missingParts->remove(newPart->getPartNumber());
-
-               // Check if all the parts have been seen
-               if (missingParts->size() == 0) {
-
-                       // We have all the parts
-                       fldisComplete = true;
+               uint size = parts->size();
+               fldisComplete = true;
+               for(uint i=0; i < size; i++) {
+                       if (parts->get(i) == NULL) {
+                               fldisComplete = false;
+                               break;
+                       }
+               }
 
+               if (fldisComplete) {
                        // Decode all the parts and create the key value guard and update sets
                        decodeCommitData();