summaryrefslogtreecommitdiff
path: root/Assistant/TransferQueue.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-05 10:44:03 -0600
committerGravatar Joey Hess <joey@kitenet.net>2012-07-05 10:44:07 -0600
commitc8135ea0a8aa2b374e45a8bb8c447c5287862838 (patch)
treec6415855534193981ddc2f03430a3eb07eaf2c1d /Assistant/TransferQueue.hs
parentb7c3cc27454181dabd14a90560a5e613048314e8 (diff)
split logic for uploads and downloads
Diffstat (limited to 'Assistant/TransferQueue.hs')
-rw-r--r--Assistant/TransferQueue.hs19
1 files changed, 16 insertions, 3 deletions
diff --git a/Assistant/TransferQueue.hs b/Assistant/TransferQueue.hs
index fc25b057d..f1f4882be 100644
--- a/Assistant/TransferQueue.hs
+++ b/Assistant/TransferQueue.hs
@@ -30,13 +30,26 @@ stubInfo f = TransferInfo
}
{- Adds pending transfers to the end of the queue for some of the known
- - remotes. (TBD: a smaller set of remotes that are sufficient to transfer to,
- - rather than transferring to all.) -}
+ - remotes. -}
queueTransfers :: TransferQueue -> DaemonStatusHandle -> Key -> AssociatedFile -> Direction -> Annex ()
queueTransfers q daemonstatus k f direction =
mapM_ (liftIO . queueTransfer q f . gentransfer)
- =<< knownRemotes <$> getDaemonStatus daemonstatus
+ =<< sufficientremotes . knownRemotes
+ <$> getDaemonStatus daemonstatus
where
+ sufficientremotes l
+ -- Queue downloads from all remotes, with the
+ -- cheapest ones first. More expensive ones will
+ -- only be tried if downloading from a cheap one
+ -- fails.
+ -- TODO: avoid downloading from remotes that don't
+ -- have the key.
+ | direction == Download = l
+ -- TODO: Determine a smaller set of remotes that
+ -- can be uploaded to, in order to ensure all
+ -- remotes can access the content. Currently,
+ -- send to every remote we can.
+ | otherwise = l
gentransfer r = Transfer
{ transferDirection = direction
, transferKey = k