2017-03-30 23:32:58 +00:00
|
|
|
{- git-annex multicast fingerprint log
|
|
|
|
-
|
|
|
|
- Copyright 2017 Joey Hess <id@joeyh.name>
|
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
|
|
|
module Logs.Multicast (
|
|
|
|
Fingerprint(..),
|
|
|
|
recordFingerprint,
|
|
|
|
knownFingerPrints,
|
|
|
|
) where
|
|
|
|
|
|
|
|
import Annex.Common
|
|
|
|
import qualified Annex.Branch
|
|
|
|
import Logs
|
|
|
|
import Logs.UUIDBased
|
|
|
|
|
|
|
|
import qualified Data.Map as M
|
|
|
|
|
|
|
|
newtype Fingerprint = Fingerprint String
|
|
|
|
deriving (Eq, Read, Show)
|
|
|
|
|
|
|
|
recordFingerprint :: Fingerprint -> UUID -> Annex ()
|
|
|
|
recordFingerprint fp uuid = do
|
2017-08-14 17:55:38 +00:00
|
|
|
c <- liftIO currentVectorClock
|
2017-03-30 23:32:58 +00:00
|
|
|
Annex.Branch.change multicastLog $
|
2017-08-14 17:55:38 +00:00
|
|
|
showLog show . changeLog c uuid fp . parseLog readish
|
2017-03-30 23:32:58 +00:00
|
|
|
|
|
|
|
knownFingerPrints :: Annex (M.Map UUID Fingerprint)
|
|
|
|
knownFingerPrints = simpleMap . parseLog readish <$> Annex.Branch.get activityLog
|