aboutsummaryrefslogtreecommitdiff
path: root/Assistant/Commits.hs
blob: 255648c94d70dea9d9765be382862346c7c4b992 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{- git-annex assistant commit tracking
 -
 - Copyright 2012 Joey Hess <id@joeyh.name>
 -
 - Licensed under the GNU GPL version 3 or higher.
 -}

module Assistant.Commits where

import Assistant.Common
import Assistant.Types.Commits
import Utility.TList

import Control.Concurrent.STM

{- Gets all unhandled commits.
 - Blocks until at least one commit is made. -}
getCommits :: Assistant [Commit]
getCommits = (atomically . getTList) <<~ commitChan

{- Records a commit in the channel. -}
recordCommit :: Assistant ()
recordCommit = (atomically . flip consTList Commit) <<~ commitChan

{- Gets all unhandled export commits.
 - Blocks until at least one export commit is made. -}
getExportCommits :: Assistant [Commit]
getExportCommits = (atomically . getTList) <<~ exportCommitChan

{- Records an export commit in the channel. -}
recordExportCommit :: Assistant ()
recordExportCommit = (atomically . flip consTList Commit) <<~ exportCommitChan