diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-06-09 13:28:30 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-06-09 13:28:30 -0400 |
commit | 6cc01e97fff6fcb933c3dba8fb008df9909bc390 (patch) | |
tree | 6b3df8f2be3e8b63f9d60926d01ca9fd77433d66 | |
parent | 9eb26116e50bac830b0d944935fc471a5e501449 (diff) |
parse X in location log file as indicating a dead key
A dead key is both not present at the location that thinks it has a copy,
and also is assumed to probably not be present anywhere else. Although
there may be lurking disconnected repos that somehow still have a copy.
Suprisingly few changes needed for this! This is because the presence log
code only really concerns itself with keys that are present, and dead keys
are not present.
Note that both the location and web log can be parsed as having a dead key.
I don't see any value to having keys listed as dead in the web log, but
since it doesn't change any behavior, there was no point in not parsing it.
-rw-r--r-- | Logs/Presence/Pure.hs | 4 | ||||
-rw-r--r-- | doc/internals.mdwn | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/Logs/Presence/Pure.hs b/Logs/Presence/Pure.hs index ec4415aad..b1fc212fd 100644 --- a/Logs/Presence/Pure.hs +++ b/Logs/Presence/Pure.hs @@ -20,7 +20,7 @@ data LogLine = LogLine { info :: String } deriving (Eq, Show) -data LogStatus = InfoPresent | InfoMissing +data LogStatus = InfoPresent | InfoMissing | InfoDead deriving (Eq, Show, Bounded, Enum) {- Parses a log file. Unparseable lines are ignored. -} @@ -38,6 +38,7 @@ parseLog = mapMaybe parseline . lines parseStatus :: String -> Maybe LogStatus parseStatus "1" = Just InfoPresent parseStatus "0" = Just InfoMissing +parseStatus "X" = Just InfoDead parseStatus _ = Nothing {- Generates a log file. -} @@ -47,6 +48,7 @@ showLog = unlines . map genline genline (LogLine d s i) = unwords [show d, genstatus s, i] genstatus InfoPresent = "1" genstatus InfoMissing = "0" + genstatus InfoDead = "X" {- Given a log, returns only the info that is are still in effect. -} getLog :: String -> [String] diff --git a/doc/internals.mdwn b/doc/internals.mdwn index 7e8f4b19a..c6dcb9621 100644 --- a/doc/internals.mdwn +++ b/doc/internals.mdwn @@ -171,8 +171,8 @@ for file contents. These are placed in two levels of subdirectories for hashing. See [[hashing]] for details. The name of the key is the filename, and the content -consists of a timestamp, either 1 (present) or 0 (not present), and -the UUID of the repository that has or lacks the file content. +consists of a timestamp, either 1 (present) or 0 (not present) or X (dead), +and the UUID of the repository that has or lacks the file content. Example: |