diff options
author | Joey Hess <joey@kitenet.net> | 2012-06-25 16:38:12 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-06-25 16:38:12 -0400 |
commit | 5cfe91f06d5eaab217f1b289810d96fee0144c31 (patch) | |
tree | bf4bff9c2d25c73590f17eec3e92558193c19f9a /Assistant/Pushes.hs | |
parent | 0b146f9ecc36545478c4a2218981b376828c61db (diff) |
add a push retry thread
Diffstat (limited to 'Assistant/Pushes.hs')
-rw-r--r-- | Assistant/Pushes.hs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Assistant/Pushes.hs b/Assistant/Pushes.hs new file mode 100644 index 000000000..f3bffbf79 --- /dev/null +++ b/Assistant/Pushes.hs @@ -0,0 +1,36 @@ +{- 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 Utility.TSet + +import Data.Time.Clock + +type FailedPushChan = TSet FailedPush + +data FailedPush = FailedPush + { failedRemote :: Remote + , failedTimeStamp :: UTCTime + } + +newFailedPushChan :: IO FailedPushChan +newFailedPushChan = newTSet + +{- Gets all failed pushes. Blocks until there is at least one failed push. -} +getFailedPushes :: FailedPushChan -> IO [FailedPush] +getFailedPushes = getTSet + +{- Puts failed pushes back into the channel. + - Note: Original order is not preserved. -} +refillFailedPushes :: FailedPushChan -> [FailedPush] -> IO () +refillFailedPushes = putTSet + +{- Records a failed push in the channel. -} +recordFailedPush :: FailedPushChan -> FailedPush -> IO () +recordFailedPush = putTSet1 |