6280af2901
Especially from borg, where the content identifier logs all end up being the same identical file! But also, for other imports, the location tracking logs can, in some cases, be identical files. Bonus optimisation: Avoid looking up (and parsing when set) GIT_ANNEX_VECTOR_CLOCK env var every time a log is written to. Although the lookup does happen at startup even when no log will be written now.
23 lines
574 B
Haskell
23 lines
574 B
Haskell
{- git-annex vector clock utilities
|
|
-
|
|
- Copyright 2017-2020 Joey Hess <id@joeyh.name>
|
|
-
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
|
-}
|
|
|
|
module Annex.VectorClock.Utility where
|
|
|
|
import Data.Time.Clock.POSIX
|
|
|
|
import Types.VectorClock
|
|
import Utility.Env
|
|
import Utility.TimeStamp
|
|
|
|
startVectorClock :: IO (IO VectorClock)
|
|
startVectorClock = go =<< getEnv "GIT_ANNEX_VECTOR_CLOCK"
|
|
where
|
|
go Nothing = timebased
|
|
go (Just s) = case parsePOSIXTime s of
|
|
Just t -> return (pure (VectorClock t))
|
|
Nothing -> timebased
|
|
timebased = return (VectorClock <$> getPOSIXTime)
|