From a505cd515fd120bc3f489cf50ee541cd68307745 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Tue, 19 Jul 2016 13:42:37 -0700 Subject: [PATCH] some initial comments...haven't read most of the code --- doc/iotcloud.tex | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/doc/iotcloud.tex b/doc/iotcloud.tex index 49f0b2a..ad8f80a 100644 --- a/doc/iotcloud.tex +++ b/doc/iotcloud.tex @@ -254,33 +254,27 @@ $MinLastSeqN(MS_s)= s_{last}$ \textit{such that} $\tuple{id, s_{last}} \in MS_s \EndProcedure \end{algorithmic} +\note{Don't include ``such that'' in the argument of a function...} + \begin{algorithmic}[1] \Function{ValidHmac}{$DE_s,SK_s,hmac_{stored}$} \State $hmac_{computed} \gets Hmac(DE_s,SK_s)$ -\If{$hmac_{stored} = hmac_{computed}$} - \State $valid \gets true$ -\Else - \State $valid \gets false$ -\EndIf -\State \Return{$valid$} +\State \Return {$hmac_{stored} = hmac_{computed}$} \EndFunction \end{algorithmic} \begin{algorithmic}[1] \Function{ValidPrevHmac}{$DE_s,hmac_{p_s},hmac_{p_{sto}}$} \If{$hmac_{p_s} = \emptyset$}\Comment{First slot - no previous HMAC} - \State $valid \gets true$ + \State \Return $true$ \Else - \If{$hmac_{p_{sto}} = hmac_{p_s}$} - \State $valid \gets true$ - \Else - \State $valid \gets false$ - \EndIf + \State \Return {$hmac_{p_{sto}} = hmac_{p_s}$} \EndIf -\State \Return{$valid$} \EndFunction \end{algorithmic} +\note{So if a slot has a null previous hmac, everything is fine? What if it isn't the first slot?} + \begin{algorithmic}[1] \Function{GetQueSta}{$Dat_s$} \State $DE_s \gets GetDatEnt(DE_s)$ @@ -409,7 +403,6 @@ $MinLastSeqN(MS_s)= s_{last}$ \textit{such that} $\tuple{id, s_{last}} \in MS_s \ForAll{$de_s \in DE_s$} \If{$de_s$ \textit{such that} $de_s \in D \land de_s = kv$} \State $\tuple{k_s,v_s} \gets GetKV(de_s)$ - \State $k_s \gets GetKey(\tuple{k_s,v_s})$ \State $\tuple{k_s,v_t} \gets GetKeyVal(DT_s,k_s)$ \If{$\tuple{k_s,v_t} = \emptyset$} \State $DT_s \gets DT_s \cup \{\tuple{k_s,v_s}\}$ @@ -493,7 +486,6 @@ $MinLastSeqN(MS_s)= s_{last}$ \textit{such that} $\tuple{id, s_{last}} \in MS_s \Function{GetValFromKey}{$k_g$} \State $\tuple{k_s,v_s} \gets \tuple{k,v}$ \textit{such that} $\tuple{k,v} \in DT \land k = k_g$ -\State $v_s \gets GetVal(\tuple{k_s,v_s})$ \State \Return{$v_s$} \EndFunction \end{algorithmic} @@ -546,7 +538,6 @@ $\tuple{ck,\tuple{k, v}} \in KV_s \wedge \begin{algorithmic}[1] \Function{PutKVPair}{$KV_s,\tuple{k_s,v_s}$} -\State $k_s \gets GetKey(\tuple{k_s,v_s})$ \State $\tuple{ck_s,\tuple{k_s,v_t}} \gets GetKV(KV_s,k_s)$ \If{$\tuple{ck_s,\tuple{k_s,v_t}} = \emptyset$} \State $KV_s \gets KV_s \cup \{\tuple{ck_p, \tuple{k_s,v_s}}\}$ @@ -580,12 +571,7 @@ $\tuple{ck,\tuple{k, v}} \in KV_s \wedge \State $s_{last_{max}} \gets MaxLastSeqN(MS_s)$ \State $n_{live} \gets s_{last_{max}} - s_{last_{min}}$\Comment{Number of live slots} \State $n_{dead} \gets max'_t - n_{live}$ -\If{$n_{dead} = 0$} - \State $need \gets true$ -\Else - \State $need \gets false$ -\EndIf -\State \Return{$need$} +\State \Return {$n_{dead} = 0$} \EndFunction \end{algorithmic} @@ -620,6 +606,10 @@ $\tuple{ck,\tuple{k, v}} \in KV_s \wedge \State \Return{$cr_s$} \EndFunction \end{algorithmic} +\note{Shouldn't this function do something pretty sophisticated about seeing what data we actually need to keep from the last slot and not just insert the entire thing?} + +\note{Probably best to just not call this function is $need_s$ is false and not pass in such parameters. It makes it harder to read.} + \begin{algorithmic}[1] \Function{GetDEPairs}{$KV_s,max'_s,need_s,sl_s$} @@ -678,6 +668,13 @@ $\tuple{ck,\tuple{k, v}} \in KV_s \wedge \EndProcedure \end{algorithmic} +\note{Lots of problems with PutDataEntries: (1) What happens if lose network connectivity after adding the key value pair, but before reinserting the last slot? You probably need to create space first and then insert your data entry... (2) What if reinsertlastslot kicks something else important out? What if the server rejects our update because it is out of date? At the very least, any putdataentries function w/o a loop is wrong!} + +\note{General comments... Work on structuring things to improve + readability... This include names of functions/variables, how + things are partitioned into functions, adding useful comments,...} + + \subsection{Formal Guarantees} \textit{To be completed ...} -- 2.34.1