summaryrefslogtreecommitdiffhomepage
path: root/debug-me.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-04-18 22:56:41 -0400
committerJoey Hess <joeyh@joeyh.name>2017-04-18 22:56:41 -0400
commitb42e68bd90286c5216336edec0165d6f3437976a (patch)
tree6b4f20c4fa03ab630600da05acd6e088812cbdb4 /debug-me.hs
parent6efff1628776b89922ea04c3a68bf760b6e5afb9 (diff)
downloaddebug-me-b42e68bd90286c5216336edec0165d6f3437976a.tar.gz
clarify content
backlog is not only Seen activities now
Diffstat (limited to 'debug-me.hs')
-rw-r--r--debug-me.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/debug-me.hs b/debug-me.hs
index 7a51613..cb353d9 100644
--- a/debug-me.hs
+++ b/debug-me.hs
@@ -308,21 +308,21 @@ reduceBacklog (Backlog (b :| l)) = Backlog (b :| go 0 (take 1000 l))
| n > 16777216 = []
| otherwise = x : go (n + dataSize x) xs
--- | Entered activity is legal when it points to the last Seen activvity,
+-- | Entered activity is legal when it points to the last logged activity,
-- because this guarantees that the person who entered it saw
-- the current state of the system before manipulating it.
--
-- To support typeahead on slow links, some echoData may be provided
-- in the Entered activity. If the Entered activity points
--- to an older Seen activity, then the echoData must match the
+-- to an older activity, then the echoData must match the
-- concatenation of all Seen activities after that one, up to the
--- most recent Seen activity.
+-- last logged activity.
isLegalEntered :: Activity Entered -> Backlog -> Bool
-isLegalEntered (Activity (Proto entered) hp sig) (Backlog (lastseen :| bl))
- | Just (loggedHash lastseen) == hp = True
+isLegalEntered (Activity (Proto entered) hp sig) (Backlog (lastact :| bl))
+ | Just (loggedHash lastact) == hp = True
| B.null (val (echoData entered)) = False -- optimisation
| any (== hp) (map (Just . loggedHash) bl) =
- let sincehp = reverse (lastseen : takeWhile (\l -> Just (loggedHash l) /= hp) bl)
+ let sincehp = reverse (lastact : takeWhile (\l -> Just (loggedHash l) /= hp) bl)
in echoData entered == mconcat (map (getseen . loggedActivity) sincehp)
| otherwise = False
where