bug fix ported
authorbdemsky <bdemsky@uci.edu>
Sat, 12 May 2018 20:35:16 +0000 (13:35 -0700)
committerbdemsky <bdemsky@uci.edu>
Sat, 12 May 2018 20:35:16 +0000 (13:35 -0700)
version2/src/java/iotcloud/Table.java

index e4461523c02bf3d5d9f82827a00fdd648c032af7..41b27318ab96f6388047501af38d468641f9829d 100644 (file)
@@ -41,17 +41,17 @@ final public class Table {
        private int numberOfSlots = 0;  // Number of slots stored in buffer
        private int bufferResizeThreshold = 0; // Threshold on the number of live slots before a resize is needed
        private long liveSlotCount = 0; // Number of currently live slots
-       private long oldestLiveSlotSequenceNumver = 0;  // Smallest sequence number of the slot with a live entry
+       private long oldestLiveSlotSequenceNumver = 1;  // Smallest sequence number of the slot with a live entry
        private long localMachineId = 0; // Machine ID of this client device
        private long sequenceNumber = 0; // Largest sequence number a client has received
        private long localSequenceNumber = 0;
 
        // private int smallestTableStatusSeen = -1; // Smallest Table Status that was seen in the latest slots sent from the server
        // private int largestTableStatusSeen = -1; // Largest Table Status that was seen in the latest slots sent from the server
-       private long localTransactionSequenceNumber = 0; // Local sequence number counter for transactions
-       private long lastTransactionSequenceNumberSpeculatedOn = -1; // the last transaction that was speculated on
-       private long oldestTransactionSequenceNumberSpeculatedOn = -1; // the oldest transaction that was speculated on
-       private long localArbitrationSequenceNumber = 0;
+       private long localTransactionSequenceNumber = 1; // Local sequence number counter for transactions
+       private long lastTransactionSequenceNumberSpeculatedOn = 0; // the last transaction that was speculated on
+       private long oldestTransactionSequenceNumberSpeculatedOn = 0; // the oldest transaction that was speculated on
+       private long localArbitrationSequenceNumber = 1;
        private boolean hadPartialSendToServer = false;
        private boolean attemptedToSendToServer = false;
        private long expectedsize;
@@ -299,6 +299,11 @@ final public class Table {
        public synchronized void close() {
                cloud.close();
        }
+       
+       // Return all keys in the table
+       public synchronized Set<IoTString> getKeys() {
+               return committedKeyValueTable.keySet();
+       }
 
        public synchronized IoTString getCommitted(IoTString key)  {
                KeyValue kv = committedKeyValueTable.get(key);
@@ -2745,4 +2750,4 @@ final public class Table {
                                throw new Error("Server Error: Invalid HMAC Chain" + currSlot + " " + prevSlot);
                }
        }
-}
\ No newline at end of file
+}