aboutsummaryrefslogtreecommitdiff
path: root/Logs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-03-30 19:32:58 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-03-30 19:35:30 -0400
commitf1a6e00a3107317d551c27459194aff3317919f4 (patch)
tree7ec2a98fd4a4ad0308792c8bb4c52ece424c43d0 /Logs
parent0862a7f3a3823a925f86bf2c33d67db05a2781e8 (diff)
multicast: New command, uses uftp to multicast annexed files, for eg a classroom setting.
This commit was supported by the NSF-funded DataLad project.
Diffstat (limited to 'Logs')
-rw-r--r--Logs/Multicast.hs33
1 files changed, 33 insertions, 0 deletions
diff --git a/Logs/Multicast.hs b/Logs/Multicast.hs
new file mode 100644
index 000000000..386899fdf
--- /dev/null
+++ b/Logs/Multicast.hs
@@ -0,0 +1,33 @@
+{- 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 Data.Time.Clock.POSIX
+
+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
+ ts <- liftIO getPOSIXTime
+ Annex.Branch.change multicastLog $
+ showLog show . changeLog ts uuid fp . parseLog readish
+
+knownFingerPrints :: Annex (M.Map UUID Fingerprint)
+knownFingerPrints = simpleMap . parseLog readish <$> Annex.Branch.get activityLog