git-annex/Assistant/Threads/Transferrer.hs

39 lines
1 KiB
Haskell
Raw Normal View History

2012-07-05 14:34:20 -06:00
{- git-annex assistant data transferrer thread
-
- Copyright 2012 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Assistant.Threads.Transferrer where
import Assistant.Common
2012-07-05 14:34:20 -06:00
import Assistant.DaemonStatus
import Assistant.TransferQueue
import Assistant.TransferSlots
2012-08-06 17:09:23 -04:00
import Assistant.Alert
2013-04-04 01:48:26 -04:00
import Assistant.Alert.Utility
import Assistant.Commits
2012-11-24 16:30:15 -04:00
import Assistant.Drop
import Assistant.TransferrerPool
2012-07-05 14:34:20 -06:00
import Logs.Transfer
import Logs.Location
2012-07-05 14:34:20 -06:00
import Annex.Content
import qualified Remote
import qualified Types.Remote as Remote
import qualified Git
2013-04-23 11:38:52 -04:00
import Config.Files
import Assistant.Threads.TransferWatcher
import Annex.Wanted
2012-07-05 14:34:20 -06:00
{- Dispatches transfers from the queue. -}
transfererThread :: NamedThread
transfererThread = namedThread "Transferrer" $ do
program <- liftIO readProgramFile
forever $ inTransferSlot program $
2013-10-02 22:59:07 -04:00
maybe (return Nothing) (uncurry genTransfer)
=<< getNextTransfer notrunning
where
{- Skip transfers that are already running. -}
notrunning = isNothing . startedTime