summaryrefslogtreecommitdiff
path: root/Remote/Helper/ChunkedEncryptable.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-07-29 17:17:41 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-07-29 17:18:49 -0400
commite55bc5640997362f1f77a5423f7556b307377f61 (patch)
tree84971796a95bfad3f2867e70ae83eb856d1bdaad /Remote/Helper/ChunkedEncryptable.hs
parent99e69a42d1afc02c381657e82547dfcc9f2a6ae2 (diff)
allow Retriever action to update the progress meter
Needed for eg, Remote.External. Generally, any Retriever that stores content in a file is responsible for updating the meter, while ones that procude a lazy bytestring cannot update the meter, so are not asked to.
Diffstat (limited to 'Remote/Helper/ChunkedEncryptable.hs')
-rw-r--r--Remote/Helper/ChunkedEncryptable.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/Remote/Helper/ChunkedEncryptable.hs b/Remote/Helper/ChunkedEncryptable.hs
index b851ecd94..024a53309 100644
--- a/Remote/Helper/ChunkedEncryptable.hs
+++ b/Remote/Helper/ChunkedEncryptable.hs
@@ -14,6 +14,7 @@ module Remote.Helper.ChunkedEncryptable (
Storer,
Retriever,
simplyPrepare,
+ ContentSource,
checkPrepare,
fileStorer,
byteStorer,
@@ -36,6 +37,8 @@ import Remote.Helper.Encryptable as X
import Annex.Content
import Annex.Exception
+import qualified Data.ByteString.Lazy as L
+
simplyPrepare :: helper -> Preparer helper
simplyPrepare helper _ a = a $ Just helper
@@ -101,8 +104,10 @@ chunkedEncryptableRemote c preparestorer prepareretriever baser = encr
retrieveChunks retriever (uuid baser) chunkconfig
enck k dest p' sink
go Nothing = return False
- sink h p' b = do
- let write = meteredWrite p' h
+ sink h mp b = do
+ let write = case mp of
+ Just p' -> meteredWrite p' h
+ Nothing -> L.hPut h
case enc of
Nothing -> write b
Just (cipher, _) ->