summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-04-11 17:15:45 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-04-11 17:32:31 -0400
commit67524c3a41a2c0b5e8c34bcbfde737ca50fc191b (patch)
tree2d6e8c0fcf36efe7274c9bc1f83c85635412be59 /Command
parent90f10c58ba491a17d1b59e91d8c730f80cd25bce (diff)
connect existing meters to the transfer log for downloads
Most remotes have meters in their implementations of retrieveKeyFile already. Simply hooking these up to the transfer log makes that information available. Easy peasy. This is particularly valuable information for encrypted remotes, which otherwise bypass the assistant's polling of temp files, and so don't have good progress bars yet. Still some work to do here (see progressbars.mdwn changes), but this is entirely an improvement from the lack of progress bars for encrypted downloads.
Diffstat (limited to 'Command')
-rw-r--r--Command/AddUrl.hs2
-rw-r--r--Command/Fsck.hs3
-rw-r--r--Command/Get.hs4
-rw-r--r--Command/Move.hs4
-rw-r--r--Command/TransferKey.hs4
-rw-r--r--Command/TransferKeys.hs4
6 files changed, 11 insertions, 10 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs
index 12142fb93..db003d4ef 100644
--- a/Command/AddUrl.hs
+++ b/Command/AddUrl.hs
@@ -114,7 +114,7 @@ download url file = do
)
return $ Backend.URL.fromUrl url size
runtransfer dummykey tmp =
- Transfer.download webUUID dummykey (Just file) Transfer.forwardRetry $ do
+ Transfer.download webUUID dummykey (Just file) Transfer.forwardRetry $ const $ do
liftIO $ createDirectoryIfMissing True (parentDir tmp)
downloadUrl [url] tmp
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index 0d70f697b..9a81f986b 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -150,9 +150,10 @@ performRemote key file backend numcopies remote =
( return True
, ifM (Annex.getState Annex.fast)
( return False
- , Remote.retrieveKeyFile remote key Nothing tmp
+ , Remote.retrieveKeyFile remote key Nothing tmp dummymeter
)
)
+ dummymeter _ = noop
{- To fsck a bare repository, fsck each key in the location log. -}
withBarePresentKeys :: (Key -> CommandStart) -> CommandSeek
diff --git a/Command/Get.hs b/Command/Get.hs
index 432be31e3..5b6fdecfa 100644
--- a/Command/Get.hs
+++ b/Command/Get.hs
@@ -69,7 +69,7 @@ getKeyFile key file dest = dispatch =<< Remote.keyPossibilities key
either (const False) id <$> Remote.hasKey r key
| otherwise = return True
docopy r continue = do
- ok <- download (Remote.uuid r) key (Just file) noRetry $ do
+ ok <- download (Remote.uuid r) key (Just file) noRetry $ \p -> do
showAction $ "from " ++ Remote.name r
- Remote.retrieveKeyFile r key (Just file) dest
+ Remote.retrieveKeyFile r key (Just file) dest p
if ok then return ok else continue
diff --git a/Command/Move.hs b/Command/Move.hs
index 31daf5529..ec0e68bb7 100644
--- a/Command/Move.hs
+++ b/Command/Move.hs
@@ -144,9 +144,9 @@ fromPerform src move key file = moveLock move key $
, handle move =<< go
)
where
- go = download (Remote.uuid src) key (Just file) noRetry $ do
+ go = download (Remote.uuid src) key (Just file) noRetry $ \p -> do
showAction $ "from " ++ Remote.name src
- getViaTmp key $ Remote.retrieveKeyFile src key (Just file)
+ getViaTmp key $ \t -> Remote.retrieveKeyFile src key (Just file) t p
handle _ False = stop -- failed
handle False True = next $ return True -- copy complete
handle True True = do -- finish moving
diff --git a/Command/TransferKey.hs b/Command/TransferKey.hs
index eb657d738..13790dd50 100644
--- a/Command/TransferKey.hs
+++ b/Command/TransferKey.hs
@@ -52,8 +52,8 @@ toPerform remote key file = go $
fromPerform :: Remote -> Key -> AssociatedFile -> CommandPerform
fromPerform remote key file = go $
- download (uuid remote) key file forwardRetry $
- getViaTmp key $ Remote.retrieveKeyFile remote key file
+ download (uuid remote) key file forwardRetry $ \p ->
+ getViaTmp key $ \t -> Remote.retrieveKeyFile remote key file t p
go :: Annex Bool -> CommandPerform
go a = ifM a ( liftIO exitSuccess, liftIO exitFailure)
diff --git a/Command/TransferKeys.hs b/Command/TransferKeys.hs
index 458fb31c1..9334fd08f 100644
--- a/Command/TransferKeys.hs
+++ b/Command/TransferKeys.hs
@@ -59,8 +59,8 @@ start readh writeh = do
when ok $
Remote.logStatus remote key InfoPresent
return ok
- | otherwise = download (Remote.uuid remote) key file forwardRetry $
- getViaTmp key $ Remote.retrieveKeyFile remote key file
+ | otherwise = download (Remote.uuid remote) key file forwardRetry $ \p ->
+ getViaTmp key $ \t -> Remote.retrieveKeyFile remote key file t p
runRequests
:: Handle