converting more log files to use Builder

Probably not any particular speedup in this, since most of these logs
are not written to often. Possibly chunk log writing is sped up, but
writes to chunk logs are interleaved with expensive data transfers to
remotes, so unlikely to be a noticiable speedup.
This commit is contained in:
Joey Hess 2019-01-09 13:06:37 -04:00
parent 5500cbbc30
commit 2d46038754
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
12 changed files with 91 additions and 56 deletions

View file

@ -9,7 +9,7 @@
-
- New uuid based logs instead use the form: "timestamp UUID INFO"
-
- Copyright 2011-2013 Joey Hess <id@joeyh.name>
- Copyright 2011-2019 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@ -23,7 +23,7 @@ module Logs.UUIDBased (
parseLogNew,
parseLogWithUUID,
showLog,
showLogNew,
buildLogNew,
changeLog,
addLog,
simpleMap,
@ -37,6 +37,8 @@ import Annex.VectorClock
import Logs.MapLog
import Logs.Line
import Data.ByteString.Builder
type Log v = MapLog UUID v
showLog :: (v -> String) -> Log v -> String
@ -74,8 +76,8 @@ parseLogWithUUID parser = M.fromListWith best . mapMaybe parse . splitLines
| ts == Unknown = drop 1 ws
| otherwise = drop 1 $ beginning ws
showLogNew :: (v -> String) -> Log v -> String
showLogNew = showMapLog fromUUID
buildLogNew :: (v -> Builder) -> Log v -> Builder
buildLogNew = buildMapLog (byteString . fromUUID)
parseLogNew :: (String -> Maybe v) -> String -> Log v
parseLogNew = parseMapLog (Just . toUUID)