eb6fca108e8d8819a20d66a56bb33a7d06359803
[iotcloud.git] / doc / iotcloud.tex
1 \documentclass[11pt]{article}\r
2 \newcommand{\tuple}[1]{\ensuremath \langle #1 \rangle}\r
3 \usepackage{color}\r
4 \usepackage{amsthm}\r
5 \usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx\r
6 \newtheorem{theorem}{Theorem}\r
7 \newtheorem{defn}{Definition}\r
8 \newcommand{\note}[1]{{\color{red} \bf [[#1]]}}\r
9 \newcommand{\push}[1][1]{\hskip\dimexpr #1\algorithmicindent\relax}\r
10 \begin{document}\r
11 \section{Approach}\r
12 \r
13 \subsection{Keys}\r
14 \r
15 Each device has: user id + password\r
16 \r
17 Server login is:\r
18 hash1(user id), hash1(password)\r
19 \r
20 Symmetric Crypto keys is:\r
21 hash2(user id | password)\r
22 \r
23 Server has finite length queue of entries + max\_entry\_identifier +\r
24 server login key\r
25 \r
26 \subsection{Entry layout}\r
27 Each entry has:\r
28 \begin{enumerate}\r
29 \item Sequence identifier\r
30 \item Random IV (if needed by crypto algorithm)\r
31 \item Encrypted payload\r
32 \end{enumerate}\r
33 \r
34 Payload has:\r
35 \begin{enumerate}\r
36 \item Sequence identifier\r
37 \item Machine id (most probably something like a 64-bit random number \r
38 that is self-generated by client)\r
39 \item HMAC of previous slot\r
40 \item Data entries\r
41 \item HMAC of current slot\r
42 \end{enumerate}\r
43 \r
44 A data entry can be one of these:\r
45 \begin{enumerate}\r
46 \item All or part of a Key-value entry\r
47 \item Slot sequence entry: Machine id + last message identifier \r
48 \newline {The purpose of this is to keep the record of the last slot \r
49 from a certain client if a client's update has to expunge that other \r
50 client's last entry from the queue. This is kept in the slot until \r
51 the entry owner inserts a newer update into the queue.}\r
52 \item Queue state entry: Includes queue size \newline {The purpose \r
53 of this is for the client to tell if the server lies about the number \r
54 of slots in the queue, e.g. if there are 2 queue state entry in the queue, \r
55 e.g. 50 and 70, the client knows that when it sees 50, it should expect \r
56 at most 50 slots in the queue and after it sees 70, it should expect \r
57 50 slots before that queue state entry slot 50 and at most 70 slots. \r
58 The queue state entry slot 70 is counted as slot number 51 in the queue.}\r
59 \item Collision resolution entry: Machine id + message identifier of\r
60 collision winner\r
61 \newline {The purpose of this is to keep keep track of the winner of \r
62 all the collisions until all clients have seen the particular entry.}\r
63 \end{enumerate}\r
64 \r
65 \subsection{Live status}\r
66 \r
67 Live status of entries:\r
68 \begin{enumerate}\r
69 \item Key-Value Entry is dead if either (a) there is a newer key-value pair or (b) it is incomplete.\r
70         \r
71 \item Slot sequence number (of either a message version data\r
72 or user-level data) is dead if there is a newer slot from the same machine.\r
73 \r
74 \item Queue state entry is dead if there is a newer queue state entry.\r
75 {In the case of queue state entries 50 and 70, this means that queue state \r
76 entry 50 is dead and 70 is live. However, not until the number of slots reaches \r
77 70 that queue state entry 50 will be expunged from the queue.}\r
78 \r
79 \item Collision resolution entry is dead if there this entry has been seen\r
80 by all clients after a collision happens.\r
81 \end{enumerate}\r
82 \r
83 When data is at the end of the queue ready to expunge, if:\r
84 \begin{enumerate}\r
85 \item The key-value entry is not dead, it must be reinserted at the\r
86 beginning of the queue.\r
87 \r
88 \item If the slot sequence number is not dead, then a message sequence\r
89 entry must be inserted.\r
90 \r
91 \item If the queue state entry is not dead, it must be reinserted at the\r
92 beginning of the queue.\r
93 \end{enumerate}\r
94 \r
95 \r
96 \paragraph{Reads:}\r
97 Client sends a sequence number.  Server replies with either: all data\r
98 entries or all newer data entries.\r
99 \r
100 \paragraph{Writes:}\r
101 Client sends slot, server verifies that sequence number is valid,\r
102 checks entry hash, and replies with an accept message if all checks\r
103 pass.  On success, client updates its sequence number.  On failure,\r
104 server sends updates slots to client and client validates those slots.\r
105 \r
106 \paragraph{Local state on each client:}\r
107 A list of machines and the corresponding latest sequence numbers.\r
108 \r
109 \paragraph{Validation procedure on client:}\r
110 \begin{enumerate}\r
111 \item Decrypt each new slot in order.\r
112 \item For each slot:\r
113     (a) check its HMAC, and\r
114     (b) check that the previous entry HMAC field matches the previous\r
115     entry.\r
116 \item Check that the last message version for our machine matches our\r
117 last message sent.\r
118 \item For all other machines, check that the latest sequence number is\r
119 at least as large (never goes backwards).\r
120 \item That the queue has a current queue state entry.\r
121 \item That the number of entries received is consistent with the size\r
122 specified in the queue state entry.\r
123 \end{enumerate}\r
124 \r
125 Key-value entries can span multiple slots.  They aren't valid until\r
126 they are complete.\r
127 \r
128 \subsection{Resizing Queue}\r
129 Client can make a request to resize the queue. This is done as a write that combines:\r
130   (a) a slot with the message, and\r
131         (b) a request to the server\r
132 \r
133 \subsection{Server Algorithm}\r
134 $s \in SN$ is a sequence number set\\\r
135 $sv \in SV$ is a slot's value\\\r
136 $slot_s = \tuple{s, sv} \in SL \subseteq SN \times SV$ \\\r
137 \r
138 \textbf{State} \\\r
139 \textit{SL = set of live slots on server} \\\r
140 \textit{max = maximum number of slots (input only for resize message)} \\\r
141 \textit{n = number of slots} \\ \\\r
142 \textbf{Helper Function} \\\r
143 $MaxSlot(SL_s)= \tuple{s, sv} \mid \tuple{s, sv}\r
144 \in SL_s \wedge \forall \tuple{s_s, sv_s} \in SL_s, s \geq s_s$ \\\r
145 $MinSlot(SL_s)= \tuple{s, sv} \mid \tuple{s, sv} \r
146 \in SL_s \wedge \forall \tuple{s_s, sv_s} \in SL_s, s \leq s_s$ \\\r
147 $SeqN(\tuple{s, sv})=s$ \\\r
148 $SlotVal(\tuple{s, sv})=sv$ \\\r
149 \r
150 \begin{algorithmic}[1]\r
151 \Function{GetSlot}{$s_g$}\r
152 \State \Return{$\{\tuple{s, sv} \in SL \mid s \geq s_g\}$}\r
153 \EndFunction\r
154 \end{algorithmic}\r
155 \r
156 \begin{algorithmic}[1]\r
157 \Function{PutSlot}{$s_p,sv_p,max'$}\r
158 \If{$(max' \neq \emptyset)$}\Comment{Resize}\r
159 \State $max \gets max'$\r
160 \EndIf\r
161 \State $\tuple{s_n,sv_n} \gets MaxSlot(SL)$\Comment{Last sv}\r
162 \State $s_n \gets SeqN(\tuple{s_n,sv_n})$\r
163 \If{$(s_p = s_n + 1)$}\r
164         \If{$n = max$}\r
165         \State $\tuple{s_m,sv_m} \gets MinSlot(SL)$\Comment{First sv}\r
166                 \State $SL \gets SL - \{\tuple{s_m,sv_m}\}$\r
167         \Else \Comment{$n < max$}\r
168                 \State $n \gets n + 1$\r
169         \EndIf\r
170     \State $SL \gets SL \cup \{\tuple{s_p,sv_p}\}$\r
171         \State \Return{$(true,\emptyset)$}\r
172 \Else\r
173         \State \Return{$(false,\{\tuple{s,sv}\in SL \mid \r
174     s \geq s_p\})$}\r
175 \EndIf\r
176 \EndFunction\r
177 \end{algorithmic}\r
178 \r
179 \subsection{Client Algorithm}\r
180 \textbf{Data Entry} \\\r
181 $de$ is a data entry \\\r
182 $k$ is key of entry \\\r
183 $v$ is value of entry \\\r
184 $kv$ is a key-value entry $\tuple{k,v}$, $kv \in D$ \\\r
185 $ss$ is a slot sequence entry $\tuple{id,s_{last}}$, \r
186 id + last s of a machine, $ss \in D$ \\\r
187 $qs$ is a queue state entry, $qs \in D$ \\\r
188 $D = \{kv,ss,qs\}$ \\\r
189 $DE = \{de \mid de \in D\}$ \\ \\\r
190 $s \in SN$ is a sequence number set\\\r
191 $id$ is a machine ID\\\r
192 $hmac_p$ is the HMAC value of the previous slot \\\r
193 $hmac_c$ is the HMAC value of the current slot \\\r
194 $Dat_s = \tuple{s,id,hmac_p,DE,hmac_c}$ \\\r
195 $sv_s = \tuple{s, E(Dat_s)} = \r
196 \tuple{s, E(\tuple{s,id,hmac_p,DE,hmac_c})}$ \\ \\\r
197 \r
198 \textbf{States} \\\r
199 \textit{DT = set of $\tuple{k,v}$ on client} \\\r
200 \textit{MS = set of $\tuple{id, s_{last}}$ of all clients on client \r
201 (initially empty)} \\\r
202 \textit{$MS_c$ = set MS to save all $\tuple{id, s_{last}}$ pairs while\r
203 traversing DT after a request to server (initially empty)} \\\r
204 \textit{$max_c$ = maximum number of slots (initially $max_c > 0$)} \\\r
205 \textit{m = number of slots on client (initially $m = 0 \mid m \leq n$)} \\\r
206 \textit{$hmac_p$ = the HMAC value of the previous slot ($hmac_p = \emptyset$ \r
207 for the first slot)} \\\r
208 \textit{$id_{self}$ = machine Id of this client} \\\r
209 \textit{SK = Secret Key} \\ \\\r
210 \textbf{Helper Functions} \\\r
211 $MaxSlot(SL_s)= \tuple{s, sv} \mid \tuple{s, sv}\r
212 \in SL_s \wedge \forall \tuple{s_s, sv_s} \in SL_s, s \geq s_s$ \\\r
213 $MinSlot(SL_s)= \tuple{s, sv} \mid \tuple{s, sv} \r
214 \in SL_s \wedge \forall \tuple{s_s, sv_s} \in SL_s, s \leq s_s$ \\\r
215 $SeqN(\tuple{s, sv})=s$ \\\r
216 $SlotVal(\tuple{s, sv})=sv$ \\\r
217 $Decrypt(SK_s,sv_s)=Dat_s=\tuple{s,id,hmac_p,DE,hmac_c}$ \\\r
218 $ComputeHash(bit_s)$ is a hash function that generates hash value on $bit_s$ \\\r
219 $ComputeHmac(bit_s,SK_s)$ is a HMAC function that generates HMAC value on $bit_s$ \r
220 based on key $SK_s$\\\r
221 $GetSeqN(Dat_s = \tuple{s,id,hmac_p,DE,hmac_c})=s$ \\\r
222 $GetMacId(Dat_s = \tuple{s,id,hmac_p,DE,hmac_c})=id$ \\\r
223 $GetPrevHmac(Dat_s = \tuple{s,id,hmac_p,DE,hmac_c})=hmac_p$ \\\r
224 $GetCurrHmac(Dat_s = \tuple{s,id,hmac_p,DE,hmac_c})=hmac_c$ \\\r
225 $GetDatEnt(Dat_s = \tuple{s,id,hmac_p,DE,hmac_c})=DE$ \\\r
226 $GetQS(de_s \mid de_s \in D \land de_s = qs)=qs$ \\\r
227 $GetSS(de_s \mid de_s \in D \land de_s = ss)=ss$ \\\r
228 $GetKV(de_s \mid de_s \in D \land de_s = kv)=kv=\tuple{k,v}$ \\\r
229 $GetLastSeqN(MS_s,id_s)= s_{last} \mid \tuple{id, s_{last}}\r
230 \in MS_s \wedge \forall \tuple{id_s, s_{s_{last}}} \in MS_s, \r
231 id = id_s$ \\\r
232 $GetKey(\tuple{k, v})=k$ \\\r
233 $GetVal(\tuple{k, v})=v$ \\\r
234 $GetKeyVal(DT_s,k_s)= \tuple{k, v} \mid \tuple{k, v} \r
235 \in DT_s \wedge \forall \tuple{k_s, v_s} \in DT_s, k = k_s$ \\\r
236 \r
237 \begin{algorithmic}[1]\r
238 \Function{CreateSK}{$uid,pw$}\r
239 \State $SK = ComputeHash(uid + pw)$\r
240 \State \Return{$SK$}\r
241 \EndFunction\r
242 \end{algorithmic}\r
243 \r
244 \begin{algorithmic}[1]\r
245 \Function{Hmac}{$Dat_s,SK_s$}\r
246 \State \Return{$ComputeHmac(Dat_s,SK_s)$}\r
247 \EndFunction\r
248 \end{algorithmic}\r
249 \r
250 \begin{algorithmic}[1]\r
251 \Function{ValidHmac}{$Dat_s,SK_s$}\r
252 \State $hmac_{stored} \gets GetCurrHmac(Dat_s)$\r
253 \State $hmac_{computed} \gets \Call{Hmac}{Dat_s,SK_s}$\r
254 \If{$hmac_{stored} = hmac_{computed}$}\r
255         \State \Return{$true$}\r
256 \Else\r
257         \State \Return{$false$}\r
258 \EndIf\r
259 \EndFunction\r
260 \end{algorithmic}\r
261 \r
262 \begin{algorithmic}[1]\r
263 \Function{ValidPrevHmac}{$Dat_s,hmac_{p_s}$}\r
264 \If{$hmac_{p_s} = \emptyset$}\Comment{First slot - no previous HMAC}\r
265         \State \Return{$true$}\r
266 \EndIf\r
267 \State $hmac_{stored} \gets GetPrevHmac(Dat_s)$\r
268 \If{$hmac_{stored} = hmac_{p_s}$}\r
269         \State \Return{$true$}\r
270 \Else\r
271         \State \Return{$false$}\r
272 \EndIf\r
273 \EndFunction\r
274 \end{algorithmic}\r
275 \r
276 \begin{algorithmic}[1]\r
277 \Function{GetQueSta}{$Dat_s$}\r
278 \State $DE_s \gets GetDatEnt(Dat_s)$\r
279 %\State $qs_{ret} \gets max_s$\r
280 %\ForAll{$de_i \in DE_s$}\r
281 %       \If{$de_i \mid de_i \in D \land de_i = qs$}\r
282 %       \State $qs_i \gets GetQS(de_i)$\r
283 %        \If{$qs_i > qs_{ret}$}\r
284 %               \State $qs_{ret} \gets qs_i$\r
285 %        \EndIf\r
286 %    \EndIf\r
287 %\EndFor\r
288 \State $de_{qs} \gets de_s \mid de_s \in DE_s, de_s \in D \land de_s = qs$\r
289 \State $qs_{ret} \gets GetQS(de_{qs})$\r
290 %\If{$qs_{ret} > max_s$}\r
291 %\State $qs_{ret} \gets qs_i$\r
292 %\EndIf\r
293 \State \Return{$qs_{ret}$}\r
294 \EndFunction\r
295 \end{algorithmic}\r
296 \r
297 \begin{algorithmic}[1]\r
298 \Function{GetSlotSeq}{$Dat_s$}\r
299 \State $DE_s \gets GetDatEnt(Dat_s)$\r
300 %\ForAll{$de_i \in DE_s$}\r
301         %\If{$de_i \mid de_i \in D \land de_i = ss$}\r
302         %\State $\tuple{id_{ret},s_{last_{ret}}} \gets GetSS(de_i)$\r
303     %\EndIf\r
304 %\EndFor\r
305 \State $de_{ss} \gets de_s \mid de_s \in DE_s, de_s \in D \land de_s = ss$\r
306 \State $\tuple{id_{ret},s_{last_{ret}}} \gets GetSS(de_{ss})$\r
307 \State \Return{$\tuple{id_{ret},s_{last_{ret}}}$}\r
308 \EndFunction\r
309 \end{algorithmic}\r
310 \r
311 \begin{algorithmic}[1]\r
312 \Function{UpdateLastSeqN}{$id_s,s_s,MS_s$}\r
313 \State $s_t \gets GetLastSeqN(MS_s,id_s)$\r
314 \If{$s_t = \emptyset$}\r
315         \State $MS_s \gets MS_s \cup \{\tuple{id_s,s_s}\}$\Comment{First occurrence}\r
316 \Else\r
317         \If{$s_s > s_t$}\Comment{Update entry with a later s}\r
318         \State $MS_s \gets (MS_s - \{\tuple{id_s,s_t}\}) \cup \r
319                 \{\tuple{id_s,s_s}\}$\r
320     \EndIf\r
321 \EndIf\r
322 \State \Return{$MS_s$}\r
323 \EndFunction\r
324 \end{algorithmic}\r
325 \r
326 \begin{algorithmic}[1]\r
327 \Function{CheckLastSeqN}{$MS_s,MS_t$}\Comment{Check $MS_t$ based on $MS_s$}\r
328 \ForAll{$\tuple{id_t,s_{t_{last}}} \in MS_t$}\r
329         \State $s_{s_{last}} \gets GetLastSeqN(MS_s,id_t)$\r
330         \If{$s_{s_{last}} \neq \emptyset$}\r
331                 \If{$id_t = id_{self}$}\r
332                 \If{$s_{s_{last}} \neq s_{t_{last}}$}\r
333                                 \State $error \gets$ 'Invalid last $s$ for this machine'\r
334                                 \State \Return{error}\r
335                         \EndIf\r
336                 \Else\r
337                         \If{$s_{s_{last}} \geq s_{t_{last}}$}\r
338                                 \State $MS_s \gets (MS_s - \{\tuple{id_t,s_{t_{last}}}\}) \cup \r
339                                 \{\tuple{id_t,s_{s_{last}}}\}$\r
340                         \Else\r
341                                 \State $error \gets$ 'Invalid last $s$ for machine $id_t$'\r
342                                 \State \Return{error}\r
343                         \EndIf\r
344                 \EndIf\r
345         \EndIf\r
346 \EndFor\r
347 \State \Return{$\emptyset$}\r
348 \EndFunction\r
349 \end{algorithmic}\r
350 \r
351 \begin{algorithmic}[1]\r
352 \Function{UpdateDT}{$DT_s,Dat_s$}\r
353 \State $DE_s \gets GetDatEnt(Dat_s)$\r
354 \ForAll{$de_i \in DE_s$}\r
355         \If{$de_i \mid de_i \in D \land de_i = kv$}\r
356                 \State $\tuple{k_s,v_s} \gets GetKV(de_i)$\r
357                 \State $k_s \gets GetKey(\tuple{k_s,v_s})$\r
358                 \State $\tuple{k_s,v_t} \gets GetKeyVal(DT_s,k_s)$\r
359                 \If{$\tuple{k_s,v_t} = \emptyset$}\r
360                         \State $DT_s \gets DT_s \cup \{\tuple{k_s,v_s}\}$\r
361                 \Else\r
362                 \State $DT_s \gets (DT_s - \{\tuple{k_s,v_t}\}) \cup \r
363                         \{\tuple{k_s,v_s}\}$\r
364                 \EndIf\r
365     \EndIf\r
366 \EndFor\r
367 \State \Return{$DT_s$}\r
368 \EndFunction\r
369 \end{algorithmic}\r
370 \r
371 \begin{algorithmic}[1]\r
372 \Function{GetKVPairs}{$s$}\r
373 \State $SL_c \gets \Call{GetSlot}{s}$\r
374 \State $MS_c \gets \emptyset$\r
375 \ForAll{$\tuple{s_i,sv_i} \in SL_c$}\r
376         \State $s_i \gets SeqN(\tuple{s_i,sv_i})$\r
377         \State $sv_i \gets SlotVal(\tuple{s,sv_i})$\r
378         \State $Dat_i \gets Decrypt(SK,sv_i)$\r
379         \State $s_s \gets GetSeqN(Dat_s)$\r
380     \If{$s_i \neq s_s$}\r
381                 \State $error \gets$ 'Invalid sequence number'\r
382         \EndIf\r
383         \If{$\Call{ValidPrevHmac}{Dat_i,hmac_p} = false$}\r
384                 \State $error \gets$ 'Invalid previous HMAC value'\r
385         \EndIf\r
386         \If{$\Call{ValidHmac}{Dat_i,SK} = false$}\r
387                 \State $error \gets$ 'Invalid current HMAC value'\r
388         \EndIf\r
389         \State $hmac_p \gets \Call{Hmac}{Dat_i,SK}$\Comment{Update $hmac_p$ for next slot check}\r
390         %\State $max_c \gets \Call{GetQueSta}{Dat_i,max_c}$\Comment{Handle qs}\r
391         \State $qs_c \gets \Call{GetQueSta}{Dat_i}$\Comment{Handle qs}\r
392         \If{$qs_c > max_c$}\r
393                 \State $max_c \gets qs_c$\r
394         \EndIf\r
395     %Check for last s in Dat\r
396         \State $id_i \gets GetMacId(Dat_i)$\Comment{Handle last s}\r
397         \State $MS_c \gets \Call{UpdateLastSeqN}{id_i,s_i,MS_c}$\r
398     %Check for last s in DE in Dat\r
399     \State $\tuple{id_j,s_{j_{last}}} \gets \Call{GetSlotSeq}{Dat_i}$\Comment{Handle ss}\r
400     \State $MS_c \gets \Call{UpdateLastSeqN}{id_j,s_{j_{last}},MS_c}$\r
401         \State $DT \gets \Call{UpdateDT}{DT,Dat_i}$\r
402 \EndFor\r
403 \If{$m + |SL_c| \leq max_c$}\Comment{Check actual size against $max_c$}\r
404         \State $m \gets m + |SL_c|$\r
405 \Else\r
406         \State $error \gets$ 'Actual queue size exceeds $max_c$'\r
407 \EndIf\r
408         \State $error \gets \Call{CheckLastSeqN}{MS_c,MS}$\r
409 \State \Return{$DT$}\r
410 \EndFunction\r
411 \end{algorithmic}\r
412 \r
413 \begin{algorithmic}[1]\r
414 \Function{GetValFromKey}{$k_g$}\r
415 \State $\tuple{k_s,v_s} \gets \tuple{k,v} \mid \tuple{k,v} \in DT \land k = k_g$\r
416 \State $v_s \gets GetVal(\tuple{k_s,v_s})$\r
417 \State \Return{$v_s$}\r
418 \EndFunction\r
419 \end{algorithmic}\r
420 \r
421 \subsection{Formal Guarantees}\r
422 \r
423 \textit{To be completed ...}\r
424 \r
425 \begin{defn}[System Execution]\r
426 Let \\\r
427 \begin{center}\r
428 $Q = \{slot_{sn_1}, slot_{sn_2}, \dots, Slot_{sn_n}\}$, \\\r
429 $SN = \{sn_1, sn_2, \dots, sn_n\}$ \\\r
430 \end{center}\r
431 denote a queue $Q$ of $n$ slots, with each slot entry being denoted by a\r
432 valid sequence number $sn_i \in SN$. $Q$ represents a total order of all \r
433 slot updates from all corresponding machines.\r
434 %\textit{Formalize a system execution as a sequence of slot updates...\r
435 %There is a total order of all slot updates.}\r
436 \end{defn}\r
437 \r
438 \begin{defn}[Transitive Closure]\r
439 A transitive closure $\tau : \tau = \epsilon_{update(slot_i)} R $\r
440 $\epsilon_{receive(slot_i)}$ is a relation from slot update event\r
441 $\epsilon$ to a slot receive event $\epsilon$ for $slot_i$.\r
442 %Define transitive closure relation for slot updates...  There is an\r
443 %edge from a slot update to a slot receive event if the receive event\r
444 %reads from the update event.\r
445 \end{defn}\r
446 \r
447 \begin{defn}[Suborder]\r
448 Let \\\r
449 \begin{center}\r
450 $q = \{slot_{i}, slot_{i+1}, \dots, slot_{j}\}, \r
451 sn_1 \leq i \leq j \leq sn_n \Longrightarrow q \subseteq Q$\r
452 \end{center}\r
453 denote a suborder of the total order. Set q is a sequence of contiguous\r
454 slot updates that is a subset of a total order of all slot updates in Q.\r
455 %Define suborder of total order.  It is a sequence of contiguous slots\r
456 %updates (as observed by a given device).\r
457 \end{defn}\r
458 \r
459 \begin{defn}[Prefix of a suborder]\r
460 Given a suborder \\ \r
461 \begin{center}\r
462 $q' = \{slot_{i}, slot_{i+1}, \dots, slot_{j}, \dots\}, \r
463 sn_1 \leq i \leq j \leq sn_n \Longrightarrow \r
464 q' \subseteq Q$\r
465 \end{center}\r
466 with $slot_{j}$ as a slot update in $q'$, the prefix of $q'$ is a sequence \r
467 of all slot updates $\{slot_{i}, slot_{i+1}, \dots, slot_{j-1}\} \cup\r
468 slot_{j}$.\r
469 %Given a sub order $o=u_{i},u_{i+1},...,u_j, u_{j+i},..., u', ...$ and\r
470 %a slot update $u'$ in $o$, the prefix of $o$ is a sequence of all\r
471 %updates that occur before $u'$ and $u'$.\r
472 \end{defn}\r
473 \r
474 \begin{defn}[Consistency between a suborder and a total order]\r
475 A suborder $q'$ is consistent with a total order $T$ of $Q$, if all\r
476 updates in $q'$ appear in $T$ and they appear in the same order, as \r
477 the following:\r
478 \begin{center}\r
479 $q' = \{slot_{i}, slot_{i+1}, \dots, slot_{j}\},$\r
480 $T = \{slot_{sn_1}, \dots, slot_{i}, slot_{i+1}, \dots, slot_{j}, \dots,\r
481 slot_{sn_n}\},$ \\ $sn_1 \leq i \leq j \leq sn_n \Longrightarrow\r
482 q' \subseteq T$\r
483 \end{center}\r
484 %A suborder $o$ is consistent with a total order $t$, if all updates in $o$ %appear in $t$ and they appear in the same order.\r
485 \end{defn}\r
486 \r
487 \begin{defn}[Consistency between suborders]\r
488 Two suborders U and V are consistent if there exist a total order T \r
489 such that both U and V are suborders of T.\r
490 \begin{center}\r
491 $U = \{slot_{i}, slot_{i+1}, \dots, slot_{j}\},$ \\\r
492 $V = \{slot_{k}, slot_{k+1}, \dots, slot_{l}\},$ \\\r
493 $sn_1 \leq i \leq j \leq k \leq l \leq sn_n,$ \\\r
494 $U \subset T \land V \subset T$ \\\r
495 $T = \{slot_{sn_1}, \dots, slot_{i}, slot_{i+1}, \dots, slot_{j}, $\\\r
496 $\dots, slot_{k}, slot_{k+1}, \dots, slot_{l}, \dots, slot_{sn_n}\}$\r
497 \end{center}\r
498 %Define notion of consistency between suborders...  Two suborders U,V\r
499 %are consistent if there exist a total order T such that both U and V\r
500 %are suborders of T.\r
501 \end{defn}\r
502 \r
503 \begin{defn}[Error-free execution]\r
504 An error-free execution, for which the client does not flag any errors\r
505 is defined by the following criteria:\r
506 \begin{enumerate}\r
507 \item Item 1\r
508 \item Item 2\r
509 \end{enumerate}\r
510 %not flag any errors...\r
511 %Define error-free execution --- execution for which the client does\r
512 %not flag any errors...\r
513 \end{defn}\r
514 \r
515 \begin{theorem} Error-free execution of algorithm ensures that the suborder\r
516 for node n is consistent with the prefix suborder for all other nodes\r
517 that are in the transitive closure.\r
518 \end{theorem}\r
519 \begin{proof}\r
520 \textit{TODO}\r
521 \end{proof}\r
522 \r
523 \begin{defn}[State of Data Structure]\r
524 Define in terms of playing all updates sequentially onto local data\r
525 structure.\r
526 \end{defn}\r
527 \r
528 \begin{theorem}\r
529 Algorithm gives consistent view of data structure.\r
530 \end{theorem}\r
531 \begin{proof}\r
532 \textit{TODO}\r
533 \end{proof}\r
534 \r
535 \subsection{Future Work}\r
536 \paragraph{Support Messages}\r
537   A message is dead once receiving machine sends an entry with a newer\r
538   sequence identifier\r
539 \r
540 \paragraph{Persistent data structures}\r
541         Root object w/ fields\r
542         Other objects can be reachable from root\r
543         Each object has its own entries\r
544         Dead objects correspond to dead \r
545 \r
546 \paragraph{Multiple App Sharing}\r
547 \r
548 Idea is to separate subspace of entries...  Shared with other cloud...\r
549 \end{document}\r
550 \r