summaryrefslogtreecommitdiff
path: root/Assistant/Commits.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-06-22 13:39:44 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-06-22 14:10:25 -0400
commit28e28bc0436cb0a33e570b1a1f678e80a770a21a (patch)
treed9acb7b66a19a64d6108f980c081f2537c9af353 /Assistant/Commits.hs
parent3ee44cf8feb11fc439c02eb0eb8f12d290b01120 (diff)
stub syncer thread and commit channel
Diffstat (limited to 'Assistant/Commits.hs')
-rw-r--r--Assistant/Commits.hs32
1 files changed, 32 insertions, 0 deletions
diff --git a/Assistant/Commits.hs b/Assistant/Commits.hs
new file mode 100644
index 000000000..152544e7c
--- /dev/null
+++ b/Assistant/Commits.hs
@@ -0,0 +1,32 @@
+{- git-annex assistant commit tracking
+ -
+ - Copyright 2012 Joey Hess <joey@kitenet.net>
+ -}
+
+module Assistant.Commits where
+
+import Utility.TSet
+
+import Data.Time.Clock
+
+type CommitChan = TSet Commit
+
+data Commit = Commit UTCTime
+ deriving (Show)
+
+newCommitChan :: IO CommitChan
+newCommitChan = newTSet
+
+{- Gets all unhandled commits.
+ - Blocks until at least one commit is made. -}
+getCommits :: CommitChan -> IO [Commit]
+getCommits = getTSet
+
+{- Puts unhandled commits back into the channel.
+ - Note: Original order is not preserved. -}
+refillCommits :: CommitChan -> [Commit] -> IO ()
+refillCommits = putTSet
+
+{- Records a commit in the channel. -}
+recordCommit :: CommitChan -> Commit -> IO ()
+recordCommit = putTSet1