diff options
author | Joey Hess <joey@kitenet.net> | 2014-07-24 16:23:36 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-07-24 16:23:36 -0400 |
commit | 2b414feaf2d20452794d0cdd608c6dd91feb1ec1 (patch) | |
tree | 16f4caafc5158227eda6b36462b93a9c3f35173f /Annex | |
parent | 35b31b00e4efbf84bcfb814acc477bbb89b50107 (diff) |
implement chunk logs
Slightly tricky as they are not normal UUIDBased logs, but are instead maps
from (uuid, chunksize) to chunkcount.
This commit was sponsored by Frank Thomas.
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/Branch/Transitions.hs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Annex/Branch/Transitions.hs b/Annex/Branch/Transitions.hs index 5c2c14548..4c39f198f 100644 --- a/Annex/Branch/Transitions.hs +++ b/Annex/Branch/Transitions.hs @@ -12,8 +12,9 @@ module Annex.Branch.Transitions ( import Logs import Logs.Transitions -import Logs.UUIDBased as UUIDBased -import Logs.Presence.Pure as Presence +import qualified Logs.UUIDBased as UUIDBased +import qualified Logs.Presence.Pure as Presence +import qualified Logs.Chunk.Pure as Chunk import Types.TrustLevel import Types.UUID @@ -37,9 +38,11 @@ dropDead f content trustmap = case getLogVariety f of -- because git remotes may still exist, and they need -- to still know it's dead. | f == trustLog -> PreserveFile - | otherwise -> ChangeFile $ UUIDBased.showLog id $ dropDeadFromUUIDBasedLog trustmap $ UUIDBased.parseLog Just content + | otherwise -> ChangeFile $ UUIDBased.showLog id $ dropDeadFromMapLog trustmap id $ UUIDBased.parseLog Just content Just NewUUIDBasedLog -> ChangeFile $ - UUIDBased.showLogNew id $ dropDeadFromUUIDBasedLog trustmap $ UUIDBased.parseLogNew Just content + UUIDBased.showLogNew id $ dropDeadFromMapLog trustmap id $ UUIDBased.parseLogNew Just content + Just (ChunkLog _) -> ChangeFile $ + Chunk.showLog $ dropDeadFromMapLog trustmap fst $ Chunk.parseLog content Just (PresenceLog _) -> let newlog = Presence.compactLog $ dropDeadFromPresenceLog trustmap $ Presence.parseLog content in if null newlog @@ -48,8 +51,8 @@ dropDead f content trustmap = case getLogVariety f of Just OtherLog -> PreserveFile Nothing -> PreserveFile -dropDeadFromUUIDBasedLog :: TrustMap -> UUIDBased.Log String -> UUIDBased.Log String -dropDeadFromUUIDBasedLog trustmap = M.filterWithKey $ notDead trustmap . const +dropDeadFromMapLog :: TrustMap -> (k -> UUID) -> M.Map k v -> M.Map k v +dropDeadFromMapLog trustmap getuuid = M.filterWithKey $ \k _v -> notDead trustmap getuuid k {- Presence logs can contain UUIDs or other values. Any line that matches - a dead uuid is dropped; any other values are passed through. -} |