diff options
author | 2012-07-05 10:44:03 -0600 | |
---|---|---|
committer | 2012-07-05 10:44:07 -0600 | |
commit | c8135ea0a8aa2b374e45a8bb8c447c5287862838 (patch) | |
tree | c6415855534193981ddc2f03430a3eb07eaf2c1d | |
parent | b7c3cc27454181dabd14a90560a5e613048314e8 (diff) |
split logic for uploads and downloads
-rw-r--r-- | Assistant/TransferQueue.hs | 19 |
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 |