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.
This commit is contained in:
parent
2c365b8b74
commit
9e11699c76
21 changed files with 103 additions and 69 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue