Adding more error messages for slots range
authorrtrimana <rtrimana@uci.edu>
Tue, 9 Aug 2016 16:43:42 +0000 (09:43 -0700)
committerrtrimana <rtrimana@uci.edu>
Tue, 9 Aug 2016 16:43:42 +0000 (09:43 -0700)
doc/iotcloud.tex

index 9e213b3d75bd09322cccdd0e25ecb0139edb8694..b96f391f4179b97e4b457c3338814242a642d969 100644 (file)
@@ -200,6 +200,7 @@ $Dat_s = \tuple{s,id,hmac_p,DE,hmac_c}$ \\
 $slot_s = \tuple{s, E(Dat_s)} = \r
 \tuple{s, E(\tuple{s,id,hmac_p,DE,hmac_c})}$ \\ \\\r
 \textbf{States} \\\r
 $slot_s = \tuple{s, E(Dat_s)} = \r
 \tuple{s, E(\tuple{s,id,hmac_p,DE,hmac_c})}$ \\ \\\r
 \textbf{States} \\\r
+\textit{$d$ = delta between the last $s$ recorded and the first $s$ received} \\\r
 \textit{$id_{self}$ = machine Id of this client} \\\r
 \textit{$max_g$ = maximum number of slots (initially $max_g > 0$)} \\\r
 \textit{m = number of slots stored on client (initially $m = 0$)} \\\r
 \textit{$id_{self}$ = machine Id of this client} \\\r
 \textit{$max_g$ = maximum number of slots (initially $max_g > 0$)} \\\r
 \textit{m = number of slots stored on client (initially $m = 0$)} \\\r
@@ -258,6 +259,8 @@ $MinLastSeqN(MS_s)= s_{last}$ \textit{such that} $\tuple{id, s_{last}} \in MS_s
        \wedge \forall \tuple{id_s, s_{s_{last}}} \in MS_s, s_{last} \leq s_{s_{last}}$ \\\r
 $MinCRSeqN(CR_s)= s$ \textit{such that} $\tuple{s, id} \in CR_s \r
        \wedge \forall \tuple{s_s, id_s} \in CR_s, s \leq s_s$ \\\r
        \wedge \forall \tuple{id_s, s_{s_{last}}} \in MS_s, s_{last} \leq s_{s_{last}}$ \\\r
 $MinCRSeqN(CR_s)= s$ \textit{such that} $\tuple{s, id} \in CR_s \r
        \wedge \forall \tuple{s_s, id_s} \in CR_s, s \leq s_s$ \\\r
+$MaxSMSeqN(SM_s)= s$ \textit{such that} $\tuple{s, id} \in SM_s \r
+       \wedge \forall \tuple{s_s, id_s} \in SM_s, s \geq s_s$ \\\r
 \r
 \begin{algorithmic}[1]\r
 \Procedure{Error}{$msg$}\r
 \r
 \begin{algorithmic}[1]\r
 \Procedure{Error}{$msg$}\r
@@ -394,13 +397,13 @@ $MinCRSeqN(CR_s)= s$ \textit{such that} $\tuple{s, id} \in CR_s
 \end{algorithmic}\r
 \r
 \begin{algorithmic}[1]\r
 \end{algorithmic}\r
 \r
 \begin{algorithmic}[1]\r
-\Procedure{CheckLastSeqN}{$MS_s,MS_t$}\r
+\Procedure{CheckLastSeqN}{$MS_s,MS_t,d$}\r
 \For {$\tuple{id, s_t}$ in $MS_t$}\Comment{Check $MS_t$ based on the newer $MS_s$}\r
        \State $s_s \gets MS_s[id]$\r
 \For {$\tuple{id, s_t}$ in $MS_t$}\Comment{Check $MS_t$ based on the newer $MS_s$}\r
        \State $s_s \gets MS_s[id]$\r
-       \If{$s_s = \emptyset$}\r
-       \Call{Error}{'No $s$ for machine $id$'}\r
+       \If{$d \land s_s = \emptyset$}\r
+       \State \Call{Error}{'Missing $s$ for machine $id$'}\r
        \ElsIf{$id = id_{self}$ and $s_s \neq s_t$}\r
        \ElsIf{$id = id_{self}$ and $s_s \neq s_t$}\r
-                       \State \Call{Error}{'Invalid last $s$ for this machine'}\r
+               \State \Call{Error}{'Invalid last $s$ for this machine'}\r
        \ElsIf{$id \neq id_{self}$ and $s_{s_{last}} < s_{t_{last}}$}\r
        \State \Call{Error}{'Invalid last $s$ for machine $id$'}\r
     \Else\r
        \ElsIf{$id \neq id_{self}$ and $s_{s_{last}} < s_{t_{last}}$}\r
        \State \Call{Error}{'Invalid last $s$ for machine $id$'}\r
     \Else\r
@@ -427,22 +430,25 @@ $MinCRSeqN(CR_s)= s$ \textit{such that} $\tuple{s, id} \in CR_s
 \end{algorithmic}\r
 \r
 \begin{algorithmic}[1]\r
 \end{algorithmic}\r
 \r
 \begin{algorithmic}[1]\r
-\Procedure{CheckSlotsRange}{$|SL_s|,s_{s_{min}},s_{s_{max}}$}\r
+\Function{ValidSlotsRange}{$|SL_s|,s_{s_{min}},s_{s_{max}}$}\r
 \State $sz_{SL} \gets s_{s_{max}} - s_{s_{min}} + 1$\r
 \If{$sz_{SL} \neq |SL_s|$}\r
 \State $sz_{SL} \gets s_{s_{max}} - s_{s_{min}} + 1$\r
 \If{$sz_{SL} \neq |SL_s|$}\r
-       \State \Call{Error}{'Sequence numbers range does not match slots set'}\r
+       \State \Call{Error}{'Sequence numbers range does not match actual set'}\r
 \EndIf\r
 \EndIf\r
-\State $s_{min} \gets MinLastSeqN(MS)$\r
-\State $s_{max} \gets MaxLastSeqN(MS)$\r
-\If{$s_{s_{min}} \leq s_{min}$}\r
-       \State \Call{Error}{'Server sent old slot'}\r
+\State $s_{s_{last}} \gets MaxSMSeqN(SM)$\r
+\If{$s_{s_{min}} \leq s_{s_{last}}$}\r
+       \State \Call{Error}{'Server sent old slots'}\r
 \EndIf\r
 \EndIf\r
-\If{$s_{s_{max}} > s_{max}$}\r
-       \State \Call{Error}{'Server sent out-of-range slot'}\r
-\EndIf\r
-\State $s_{self} \gets MS_s[id_{self}]$\r
-\State $sz_{expected} \gets s_{max} - s_{self} + 1$\r
-\If{$sz_{SL} \neq sz_{expected}$}\r
+\State \Return{$s_{s_{min}} > s_{s_{last}} + 1$}\r
+\EndFunction\r
+\end{algorithmic}\r
+\r
+\begin{algorithmic}[1]\r
+\Procedure{CheckSlotsRange}{$|SL_s|$}\r
+\State $s_{s_{max}} \gets MaxLastSeqN(MS)$\r
+\State $s_{self} \gets MS[id_{self}]$\r
+\State $sz_{expected} \gets s_{s_{max}} - s_{self} + 1$\r
+\If{$|SL_s| \neq sz_{expected}$}\r
        \State \Call{Error}{'Actual number of slots does not match expected'}\r
 \EndIf\r
 \EndProcedure\r
        \State \Call{Error}{'Actual number of slots does not match expected'}\r
 \EndIf\r
 \EndProcedure\r
@@ -482,6 +488,7 @@ $MinCRSeqN(CR_s)= s$ \textit{such that} $\tuple{s, id} \in CR_s
 \State $MS_g \gets \emptyset$\r
 \State $\tuple{s_{g_{min}},sv_{g_{min}}} \gets MinSlot(SL_g)$\r
 \State $\tuple{s_{g_{max}},sv_{g_{max}}} \gets MaxSlot(SL_g)$\r
 \State $MS_g \gets \emptyset$\r
 \State $\tuple{s_{g_{min}},sv_{g_{min}}} \gets MinSlot(SL_g)$\r
 \State $\tuple{s_{g_{max}},sv_{g_{max}}} \gets MaxSlot(SL_g)$\r
+\State $d \gets \Call{ValidSlotsRange}{|SL_g|,s_{g_{min}},s_{g_{max}}}$\r
 \For{$s_g \gets s_{g_{min}}$ \textbf{to} $s_{g_{max}}$}\Comment{Process slots \r
        in $SL_g$ in order}\r
        \State $\tuple{s_g,sv_g} \gets Slot(SL_g,s_g)$\r
 \For{$s_g \gets s_{g_{min}}$ \textbf{to} $s_{g_{max}}$}\Comment{Process slots \r
        in $SL_g$ in order}\r
        \State $\tuple{s_g,sv_g} \gets Slot(SL_g,s_g)$\r
@@ -534,8 +541,8 @@ $MinCRSeqN(CR_s)= s$ \textit{such that} $\tuple{s, id} \in CR_s
 \Else\r
        \State \Call{Error}{'Actual $SL$ size on server exceeds $max_g$'}\r
 \EndIf\r
 \Else\r
        \State \Call{Error}{'Actual $SL$ size on server exceeds $max_g$'}\r
 \EndIf\r
-\State $\Call{CheckSlotsRange}{|SL_g|,s_{g_{min}},s_{g_{max}}}$\r
-\State $\Call{CheckLastSeqN}{MS_g,MS}$\r
+\State $\Call{CheckLastSeqN}{MS_g,MS,d}$\r
+\State $\Call{CheckSlotsRange}{|SL_g|}$\r
 \State $\Call{UpdateSSLivEnt}{SS_{live},MS}$\r
 \State $\Call{UpdateCRLivEnt}{CR_{live},MS}$\r
 \State $\Call{UpdateSM}{SM,CR_{live}}$\r
 \State $\Call{UpdateSSLivEnt}{SS_{live},MS}$\r
 \State $\Call{UpdateCRLivEnt}{CR_{live},MS}$\r
 \State $\Call{UpdateSM}{SM,CR_{live}}$\r