git-annex/Assistant/Pushes.hs
Joey Hess f2bce89055 better data type for push records
Not yet plumbed thru
2012-06-26 12:36:42 -04:00

37 lines
1,017 B
Haskell

{- git-annex assistant push tracking
-
- Copyright 2012 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Assistant.Pushes where
import Common.Annex
import Control.Concurrent.SampleVar
import Data.Time.Clock
import qualified Data.Map as M
{- Track the most recent push failure for each remote. -}
type PushMap = M.Map Remote UTCTime
type FailedPushes = SampleVar PushMap
newFailedPushChan :: IO FailedPushChan
newFailedPushChan = newEmptySampleVar
{- Gets all failed pushes. Blocks until set. -}
getFailedPushes :: FailedPushChan -> IO PushMap
getFailedPushes = readSampleVar
{- Sets all failed pushes to passed PushMap -}
setFailedPushes :: FailedPushChan -> PushMap -> IO ()
setFailedPushes = writeSampleVar
{- Indicates a failure to push to a single remote. -}
failedPush :: FailedPushChan -> Remote -> IO ()
failedPush c r =
{- Indicates that a remote was pushed to successfully. -}
successfulPush :: FailedPushChan -> Remote -> IO ()
successfulPush c r =