attoparsec parsers for all new-format uuid-based logs
There should be some speed gains here, especially for chunk and remote state logs, which are queried once per key. Now only old-format uuid-based logs still need to be converted to attoparsec.
This commit is contained in:
parent
7e54c215b4
commit
66603d6f75
10 changed files with 88 additions and 56 deletions
|
@ -39,6 +39,8 @@ import Annex.VectorClock
|
|||
import Logs.MapLog
|
||||
import Logs.Line
|
||||
|
||||
import qualified Data.ByteString.Lazy as L
|
||||
import qualified Data.Attoparsec.ByteString.Lazy as A
|
||||
import Data.ByteString.Builder
|
||||
|
||||
type Log v = MapLog UUID v
|
||||
|
@ -84,8 +86,8 @@ parseLogWithUUID parser = M.fromListWith best . mapMaybe parse . splitLines
|
|||
buildLogNew :: (v -> Builder) -> Log v -> Builder
|
||||
buildLogNew = buildMapLog buildUUID
|
||||
|
||||
parseLogNew :: (String -> Maybe v) -> String -> Log v
|
||||
parseLogNew = parseMapLog (Just . toUUID)
|
||||
parseLogNew :: A.Parser v -> L.ByteString -> Log v
|
||||
parseLogNew = parseMapLog (toUUID <$> A.takeByteString)
|
||||
|
||||
changeLog :: VectorClock -> UUID -> v -> Log v -> Log v
|
||||
changeLog = changeMapLog
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue