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

@ -1,6 +1,6 @@
{- Remote state logs.
-
- Copyright 2014 Joey Hess <id@joeyh.name>
- Copyright 2014, 2019 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@ -17,6 +17,7 @@ import qualified Annex.Branch
import qualified Annex
import qualified Data.Map as M
import Data.ByteString.Builder
type RemoteState = String
@ -25,7 +26,10 @@ setRemoteState u k s = do
c <- liftIO currentVectorClock
config <- Annex.getGitConfig
Annex.Branch.change (remoteStateLogFile config k) $
encodeBL . showLogNew id . changeLog c u s . parseLogNew Just . decodeBL
buildRemoteState . changeLog c u s . parseLogNew Just . decodeBL
buildRemoteState :: Log RemoteState -> Builder
buildRemoteState = buildLogNew (byteString . encodeBS)
getRemoteState :: UUID -> Key -> Annex (Maybe RemoteState)
getRemoteState u k = do