From b42e68bd90286c5216336edec0165d6f3437976a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 18 Apr 2017 22:56:41 -0400 Subject: clarify content backlog is not only Seen activities now --- debug-me.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'debug-me.hs') 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 -- cgit v1.2.3