typo
[iotcloud.git] / doc / iotcloud.tex
1 \documentclass[11pt]{article}\r
2 \newcommand{\tuple}[1]{\ensuremath \langle #1 \rangle}\r
3 \usepackage{amsthm}\r
4 \newtheorem{theorem}{Theorem}\r
5 \newtheorem{defn}{Definition}\r
6 \r
7 \begin{document}\r
8 \section{Approach}\r
9 \r
10 \subsection{Keys}\r
11 \r
12 Each device has: user id + password\r
13 \r
14 Server login is:\r
15 hash1(user id), hash1(password)...\r
16 \r
17 Symmetric Crypto keys is:\r
18 hash2(user id | password)\r
19 \r
20 Server has finite length queue of entries + max\_entry\_identifier +\r
21 server login key\r
22 \r
23 \subsection{Entry layout}\r
24 Each entry has:\r
25 \begin{enumerate}\r
26 \item Sequence identifier\r
27 \item Random IV (if needed by crypto algorithm)\r
28 \item Encrypted payload\r
29 \end{enumerate}\r
30 \r
31 Payload has:\r
32 \begin{enumerate}\r
33 \item Sequence identifier\r
34 \item Machine id\r
35 \item Hash of previous slot\r
36 \item Data entries\r
37 \item HMAC of current slot\r
38 \end{enumerate}\r
39 \r
40 Data entry can be:\r
41 \begin{enumerate}\r
42 \item All or part of a Key-value entry,\r
43 \item Slot sequence entry: Machine id + last message identifier, or\r
44 \item Queue state entry: Includes queue size\r
45 \end{enumerate}\r
46 \r
47 \subsection{Live status}\r
48 \r
49 Live status of entries:\r
50 \begin{enumerate}\r
51 \item Key-Value Entry is dead if either (a) there is a newer key-value pair or (b) it is incomplete.\r
52         \r
53 \item Slot sequence number (of either a message version data\r
54 or user-level data) is dead if there is a newer slot from the same machine\r
55 \r
56 \item Queue state entry is dead if there is a newer queue state entry\r
57 \end{enumerate}\r
58 \r
59 When data is at the end of the queue ready to expunge, if:\r
60 \begin{enumerate}\r
61 \item The key-value entry is not dead, it must be reinserted at the\r
62 beginning of the queue.\r
63 \r
64 \item If the slot sequence number is not dead, then a message sequence\r
65 entry must be inserted\r
66 \r
67 \item If the queue state entry is not dead, it must be reinserted at the\r
68 beginning of the queue\r
69 \end{enumerate}\r
70 \r
71 \r
72 \paragraph{Reads:}\r
73 Client sends a sequence number.  Server replies with either: all data\r
74 entries or all newer data entries.\r
75 \r
76 \paragraph{Writes:}\r
77 Client sends slot, server verifies that sequence number is valid,\r
78 checks entry hash, and replies with an accept message if all checks\r
79 pass.  On success, client updates its sequence number.\r
80 \r
81 \paragraph{Local state on each client:}\r
82 A list of machines and the corresponding latest sequence numbers\r
83 \r
84 \paragraph{Validation procedure on client:}\r
85 \begin{enumerate}\r
86 \item Decrypt each new slot in order\r
87 \item For each slot:\r
88     (a) check its HMAC\r
89     (b) check that the previous entry HMAC field matches the previous\r
90     entry\r
91 \item Check that the last message version for our machine matches our\r
92 last message sent\r
93 \item For all other machines, check that the latest sequence number is\r
94 at least as large (never goes backwards)\r
95 \item That the queue has a current queue state entry\r
96 \item That the number of entries received is consistent with the size\r
97 specified in the queue state entry\r
98 \end{enumerate}\r
99 \r
100 Key-value entries can span multiple slots.  They aren't valid until\r
101 they are complete.\r
102 \r
103 \subsection{Resizing Queue}\r
104 Client can make a request to resize the queue...  This is done as a write that combines:\r
105   (a) a slot with the message\r
106         (b) a request to the server\r
107 \r
108 \subsection{Formal Guarantees}\r
109 \r
110 Rahmadi should clean this section up.\r
111 \r
112 \begin{defn}[System Execution]\r
113 Formalize a system execution as a sequence of slot updates...  There\r
114 is a total order of all slot updates.\r
115 \end{defn}\r
116 \r
117 \begin{defn}[Transitive Closure]\r
118 Define transitive closure relation for slot updates...  There is an\r
119 edge from a slot update to a slot receive event if the receive event\r
120 reads from the update event.\r
121 \end{defn}\r
122 \r
123 \r
124 \begin{defn}[Suborder]\r
125 Define suborder of total order.  It is a sequence of contiguous slots\r
126 updates (as observed by a given device).\r
127 \end{defn}\r
128 \r
129 \begin{defn}[Prefix of a suborder]\r
130 Given a sub order $o=u_{i},u_{i+1},...,u_j, u_{j+i},..., u', ...$ and\r
131 a slot update $u'$ in $o$, the prefix of $o$ is a sequence of all\r
132 updates that occur before $u'$ and $u'$.\r
133 \end{defn}\r
134 \r
135 \begin{defn}[Consistency between a suborder and a total order]\r
136 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
137 \end{defn}\r
138 \r
139 \begin{defn}[Consistency between suborders]\r
140 Define notion of consistency between suborders...  Two suborders U,V\r
141 are consistent if there exist a total order T such that both U and V\r
142 are suborders of T.\r
143 \end{defn}\r
144 \r
145 \begin{defn}[Error-free execution]\r
146 Define error-free execution --- execution for which the client does\r
147 not flag any errors...\r
148 \end{defn}\r
149 \r
150 \begin{theorem} Error-free execution of algorithm ensures that the suborder\r
151 for node n is consistent with the prefix suborder for all other nodes\r
152 that are in the transitive closure.\r
153 \end{theorem}\r
154 \begin{proof}\r
155 Exercise for Rahmadi.\r
156 \end{proof}\r
157 \r
158 \begin{defn}[State of Data Structure]\r
159 Define in terms of playing all updates sequentially onto local data\r
160 structure.\r
161 \end{defn}\r
162 \r
163 \begin{theorem}\r
164 Algorithm gives consistent view of data structure.\r
165 \end{theorem}\r
166 \begin{proof}\r
167 Exercise for Rahmadi.\r
168 \end{proof}\r
169 \r
170 \subsection{Future Work}\r
171 \paragraph{Support Messages}\r
172   A message is dead once receiving machine sends an entry with a newer\r
173   sequence identifier\r
174 \r
175 \paragraph{Persistent data structures}\r
176         Root object w/ fields\r
177         Other objects can be reachable from root\r
178         Each object has its own entries\r
179         Dead objects correspond to dead \r
180 \r
181 \paragraph{Multiple App Sharing}\r
182 \r
183 Idea is to separate subspace of entries...  Shared with other cloud...\r
184 \end{document}\r