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 | |
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')
-rw-r--r-- | Remote/Directory/LegacyChunked.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Remote/Directory/LegacyChunked.hs b/Remote/Directory/LegacyChunked.hs index 5c200570c..a19868802 100644 --- a/Remote/Directory/LegacyChunked.hs +++ b/Remote/Directory/LegacyChunked.hs @@ -94,14 +94,14 @@ retrieve locations d basek a = do tmpdir <- fromRepo $ gitAnnexTmpMiscDir createAnnexDirectory tmpdir let tmp = tmpdir </> keyFile basek ++ ".directorylegacy.tmp" - a $ Just $ byteRetriever $ \k -> liftIO $ do - void $ withStoredFiles d locations k $ \fs -> do + a $ Just $ byteRetriever $ \k sink -> do + liftIO $ void $ withStoredFiles d locations k $ \fs -> do forM_ fs $ S.appendFile tmp <=< S.readFile return True - b <- L.readFile tmp - nukeFile tmp - return b + b <- liftIO $ L.readFile tmp + liftIO $ nukeFile tmp + sink b checkPresent :: FilePath -> (FilePath -> Key -> [FilePath]) -> Key -> Annex (Either String Bool) checkPresent d locations k = liftIO $ catchMsgIO $ |