2012-07-05 14:34:20 -06:00
|
|
|
{- git-annex assistant data transferrer thread
|
|
|
|
-
|
2015-01-21 12:50:09 -04:00
|
|
|
- Copyright 2012 Joey Hess <id@joeyh.name>
|
2012-07-05 14:34:20 -06:00
|
|
|
-
|
2019-03-13 15:48:14 -04:00
|
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
2012-07-05 14:34:20 -06:00
|
|
|
-}
|
|
|
|
|
|
|
|
module Assistant.Threads.Transferrer where
|
|
|
|
|
2012-07-20 19:29:59 -04:00
|
|
|
import Assistant.Common
|
2012-07-05 14:34:20 -06:00
|
|
|
import Assistant.TransferQueue
|
2012-07-06 16:39:07 -04:00
|
|
|
import Assistant.TransferSlots
|
2016-08-03 12:37:12 -04:00
|
|
|
import Types.Transfer
|
2015-02-28 17:23:13 -04:00
|
|
|
import Annex.Path
|
2013-12-01 15:37:51 -04:00
|
|
|
import Utility.Batch
|
2012-07-05 14:34:20 -06:00
|
|
|
|
2012-07-05 18:57:06 -06:00
|
|
|
{- Dispatches transfers from the queue. -}
|
2012-10-29 14:07:12 -04:00
|
|
|
transfererThread :: NamedThread
|
2013-01-26 17:09:33 +11:00
|
|
|
transfererThread = namedThread "Transferrer" $ do
|
2015-02-28 17:23:13 -04:00
|
|
|
program <- liftIO programPath
|
2013-12-01 15:37:51 -04:00
|
|
|
batchmaker <- liftIO getBatchCommandMaker
|
|
|
|
forever $ inTransferSlot program batchmaker $
|
2013-10-02 22:59:07 -04:00
|
|
|
maybe (return Nothing) (uncurry genTransfer)
|
2012-10-30 17:14:26 -04:00
|
|
|
=<< getNextTransfer notrunning
|
2012-10-29 14:07:12 -04:00
|
|
|
where
|
|
|
|
{- Skip transfers that are already running. -}
|
|
|
|
notrunning = isNothing . startedTime
|