\textit{max = maximum number of slots (input only for resize message)} \\\r
\textit{n = number of slots} \\ \\\r
\textbf{Helper Function} \\\r
-$MaxSlot(SL')= \langle s, sv \rangle \mid \langle s, sv \rangle \r
-\in SL' \wedge \forall \langle s', sv' \rangle \in SL', s \geq s'$ \\\r
-$MinSlot(SL')= \langle s, sv \rangle \mid \langle s, sv \rangle \r
-\in SL' \wedge \forall \langle s', sv' \rangle \in SL', s \leq s'$ \\\r
-$SeqN(\langle s, sv \rangle)=s$ \\\r
-$SlotVal(\langle s, sv \rangle)=sv$ \\\r
+$MaxSlot(SL')= \tuple{s, sv} \mid \tuple{s, sv}\r
+\in SL' \wedge \forall \tuple{s', sv'} \in SL', s \geq s'$ \\\r
+$MinSlot(SL')= \tuple{s, sv} \mid \tuple{s, sv} \r
+\in SL' \wedge \forall \tuple{s', sv'} \in SL', s \leq s'$ \\\r
+$SeqN(\tuple{s, sv})=s$ \\\r
+$SlotVal(\tuple{s, sv})=sv$ \\\r
\r
\begin{algorithmic}[1]\r
\Function{GetSlot}{$s_g$}\r
\If{$(max' \neq \emptyset)$}\Comment{Resize}\r
\State $max \gets max'$\r
\EndIf\r
-\State $\langle s_n,sv_n \rangle \gets MaxSlot(SL)$\Comment{Last sv}\r
-\State $s_n \gets SeqN(\langle s_n,sv_n \rangle)$\r
+\State $\tuple{s_n,sv_n} \gets MaxSlot(SL)$\Comment{Last sv}\r
+\State $s_n \gets SeqN(\tuple{s_n,sv_n})$\r
\If{$(s_p = s_n + 1)$}\r
\If{$n = max$}\r
- \State $\langle s_m,sv_m \rangle \gets MinSlot(SL)$\Comment{First sv}\r
- \State $SL \gets SL - \{\langle s_m,sv_m \rangle\}$\r
+ \State $\tuple{s_m,sv_m} \gets MinSlot(SL)$\Comment{First sv}\r
+ \State $SL \gets SL - \{\tuple{s_m,sv_m}\}$\r
\Else \Comment{$n < max$}\r
\State $n \gets n + 1$\r
\EndIf\r
- \State $SL \gets SL \cup \{\langle s_p,sv_p \rangle\}$\r
+ \State $SL \gets SL \cup \{\tuple{s_p,sv_p}\}$\r
\State \Return{$true$}\r
\Else\r
- \State \Return{$(false,\{\langle s,sv \rangle \in SL \mid \r
+ \State \Return{$(false,\{\tuple{s,sv}\in SL \mid \r
s \geq s_p\})$}\r
\EndIf\r
\EndFunction\r