aboutsummaryrefslogtreecommitdiff
path: root/Remote/P2P.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-11-14 16:27:39 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-11-14 16:40:49 -0400
commita38d1ae1fb3b3d1b42ee5b8ed878d574180c544f (patch)
tree29923061b31bf0a715af34c38cf304dc714f4d5a /Remote/P2P.hs
parent0298701d0018b0baa933761657751e0c26dc39d1 (diff)
Display progress meter when uploading a key without size information
Getting the size by statting the content file. This commit was supported by the NSF-funded DataLad project.
Diffstat (limited to 'Remote/P2P.hs')
-rw-r--r--Remote/P2P.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/Remote/P2P.hs b/Remote/P2P.hs
index be0d4589f..83ce258de 100644
--- a/Remote/P2P.hs
+++ b/Remote/P2P.hs
@@ -21,6 +21,7 @@ import Types.Remote
import Types.GitConfig
import qualified Git
import Annex.UUID
+import Annex.Content
import Config
import Config.Cost
import Remote.Helper.Git
@@ -78,13 +79,15 @@ chainGen addr r u c gc = do
return (Just this)
store :: UUID -> P2PAddress -> ConnectionPool -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
-store u addr connpool k af p =
- metered (Just p) k $ \p' -> fromMaybe False
- <$> runProto u addr connpool (P2P.put k af p')
+store u addr connpool k af p = do
+ let getsrcfile = fmap fst <$> prepSendAnnex k
+ metered (Just p) k getsrcfile $ \p' ->
+ fromMaybe False
+ <$> runProto u addr connpool (P2P.put k af p')
retrieve :: UUID -> P2PAddress -> ConnectionPool -> Key -> AssociatedFile -> FilePath -> MeterUpdate -> Annex (Bool, Verification)
retrieve u addr connpool k af dest p = unVerified $
- metered (Just p) k $ \p' -> fromMaybe False
+ metered (Just p) k (return Nothing) $ \p' -> fromMaybe False
<$> runProto u addr connpool (P2P.get dest k af p')
remove :: UUID -> P2PAddress -> ConnectionPool -> Key -> Annex Bool