summaryrefslogtreecommitdiff
path: root/Remote/S3.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-08-03 01:12:24 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-08-03 01:12:24 -0400
commit237cceb715438809f9ddf7b45695f000f65f82b8 (patch)
treec6db0a6b1b79258fe0b85572640a69f6da837245 /Remote/S3.hs
parenta4a09a104747501f80ef93c4814e8dcf8bf51cb9 (diff)
better byteRetriever
Make the byteRetriever be passed the callback that consumes the bytestring. This way, there's no worries about the lazy bytestring not all being read when the resource that's creating it is closed. Which in turn lets bup, ddar, and S3 each switch from using an unncessary fileRetriver to a byteRetriever. So, more efficient on chunks and encrypted files. The only remaining fileRetrievers are hook and external, which really do retrieve to files.
Diffstat (limited to 'Remote/S3.hs')
-rw-r--r--Remote/S3.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Remote/S3.hs b/Remote/S3.hs
index ed9122cab..68d8ee4bf 100644
--- a/Remote/S3.hs
+++ b/Remote/S3.hs
@@ -147,9 +147,9 @@ store (conn, bucket) r k p file = do
prepareRetrieve :: Remote -> Preparer Retriever
prepareRetrieve r = resourcePrepare (const $ s3Action r False) $ \(conn, bucket) ->
- byteRetriever $ \k ->
+ byteRetriever $ \k sink ->
liftIO (getObject conn $ bucketKey r bucket k)
- >>= either s3Error (return . obj_data)
+ >>= either s3Error (sink . obj_data)
retrieveCheap :: Remote -> Key -> FilePath -> Annex Bool
retrieveCheap _ _ _ = return False