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