formatting
[iotcloud.git] / src / java / iotcloud / Table.java
index 6cd2b323d9cf6a07789f2b8dcd9da318ad7da73e..dcb74e29d7b8aa47708fa67175ee76940d64a26d 100644 (file)
@@ -7,13 +7,13 @@ import javax.crypto.*;
 public class Table {
        int numslots;
        HashMap<IoTString, KeyValue> table=new HashMap<IoTString, KeyValue>();
-       HashMap<Long, Pair<Long, Liveness>> lastmessagetable=new HashMap<Long, Pair<Long, Liveness>>();
+       HashMap<Long, Pair<Long, Liveness> > lastmessagetable=new HashMap<Long, Pair<Long, Liveness> >();
        SlotBuffer buffer;
        CloudComm cloud;
        private Mac hmac;
        long sequencenumber;
        long localmachineid;
-       
+
        public Table(String baseurl, String password, long _localmachineid) {
                localmachineid=_localmachineid;
                buffer = new SlotBuffer();
@@ -63,7 +63,7 @@ public class Table {
        public IoTString put(IoTString key, IoTString value) {
                return null;
        }
-       
+
        void validateandupdate(Slot[] newslots) {
                //The cloud communication layer has checked slot HMACs already
                //before decoding
@@ -79,7 +79,7 @@ public class Table {
                for(Slot slot: newslots) {
                        processSlot(indexer, slot);
                }
-               
+
        }
 
        void processEntry(KeyValue entry, SlotIndexer indexer) {
@@ -100,7 +100,7 @@ public class Table {
                long newseqnum=entry.getNewSeqNum();
                boolean isequal=entry.getEqual();
                long machineid=entry.getMachineID();
-               for(long seqnum=oldseqnum;seqnum<=newseqnum;seqnum++) {
+               for(long seqnum=oldseqnum; seqnum<=newseqnum; seqnum++) {
                        Slot slot=indexer.getSlot(seqnum);
                        if (slot != null) {
                                long slotmachineid=slot.getMachineID();
@@ -110,9 +110,9 @@ public class Table {
                        }
                }
        }
-       
+
        void processEntry(TableStatus entry, SlotIndexer indexer, Slot slot) {
-               
+
        }
 
        void updateLastMessage(long machineid, long seqnum, Liveness liveness) {
@@ -129,7 +129,7 @@ public class Table {
                } else {
                        throw new Error("Unrecognized type");
                }
-               
+
                //Check that nothing funny happened
                if (machineid == localmachineid) {
                        if (lastmsgseqnum != seqnum)
@@ -139,7 +139,7 @@ public class Table {
                                throw new Error("Server Error: Rolback on remote machine sequence number");
                }
        }
-       
+
        void processSlot(SlotIndexer indexer, Slot slot) {
                updateLastMessage(slot.getMachineID(), slot.getSequenceNumber(), slot);
 
@@ -148,21 +148,25 @@ public class Table {
                        case Entry.TypeKeyValue:
                                processEntry((KeyValue)entry, indexer);
                                break;
+
                        case Entry.TypeLastMessage:
                                processEntry((LastMessage)entry, indexer);
                                break;
+
                        case Entry.TypeRejectedMessage:
                                processEntry((RejectedMessage)entry, indexer);
                                break;
+
                        case Entry.TypeTableStatus:
                                processEntry((TableStatus)entry, indexer, slot);
                                break;
+
                        default:
                                throw new Error("Unrecognized type: "+entry.getType());
                        }
                }
        }
-       
+
        void checkHMACChain(SlotIndexer indexer, Slot[] newslots) {
                for(int i=0; i < newslots.length; i++) {
                        Slot currslot=newslots[i];