diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-12-07 14:25:01 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-12-07 14:25:01 -0400 |
commit | 51b648ac6e11d0d5a9e617e45d236bd850894285 (patch) | |
tree | 15a28ce8095bba46d704ac2ac68448c5e1bf81eb /Remote/P2P.hs | |
parent | 84023bbceb672c757a0cbd93571b303f154f8001 (diff) |
more p2p progress meters
Display progress meter on send and receive from remote.
Added a new hGetMetered that can read an exact number of bytes (or
less), updating a meter as it goes.
This commit was sponsored by Andreas on Patreon.
Diffstat (limited to 'Remote/P2P.hs')
-rw-r--r-- | Remote/P2P.hs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Remote/P2P.hs b/Remote/P2P.hs index 8286a9a18..1d7ede30f 100644 --- a/Remote/P2P.hs +++ b/Remote/P2P.hs @@ -24,6 +24,7 @@ import Annex.UUID import Config import Config.Cost import Remote.Helper.Git +import Messages.Progress import Utility.Metered import Utility.AuthToken import Types.NumCopies @@ -74,12 +75,14 @@ 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 = fromMaybe False - <$> runProto u addr connpool (P2P.put k af p) +store u addr connpool k af p = + metered (Just p) k $ \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 $ fromMaybe False - <$> runProto u addr connpool (P2P.get dest k af) +retrieve u addr connpool k af dest p = unVerified $ + metered (Just p) k $ \p' -> fromMaybe False + <$> runProto u addr connpool (P2P.get dest k af p') remove :: UUID -> P2PAddress -> ConnectionPool -> Key -> Annex Bool remove u addr connpool k = fromMaybe False |