diff options
author | Joey Hess <joey@kitenet.net> | 2014-08-03 01:12:24 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-08-03 01:12:24 -0400 |
commit | 237cceb715438809f9ddf7b45695f000f65f82b8 (patch) | |
tree | c6db0a6b1b79258fe0b85572640a69f6da837245 /Remote/Directory.hs | |
parent | a4a09a104747501f80ef93c4814e8dcf8bf51cb9 (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/Directory.hs')
-rw-r--r-- | Remote/Directory.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Remote/Directory.hs b/Remote/Directory.hs index a87987529..78d30b1a1 100644 --- a/Remote/Directory.hs +++ b/Remote/Directory.hs @@ -136,8 +136,8 @@ store d chunkconfig k b p = liftIO $ do retrieve :: FilePath -> ChunkConfig -> Preparer Retriever retrieve d (LegacyChunks _) = Legacy.retrieve locations d -retrieve d _ = simplyPrepare $ byteRetriever $ \k -> - liftIO $ L.readFile =<< getLocation d k +retrieve d _ = simplyPrepare $ byteRetriever $ \k sink -> + sink =<< liftIO (L.readFile =<< getLocation d k) retrieveCheap :: FilePath -> ChunkConfig -> Key -> FilePath -> Annex Bool -- no cheap retrieval possible for chunks |