From c46eba94f69151ded37988efd7e3375d327faef3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 27 Jul 2014 00:30:04 -0400 Subject: better Preparer interface This will allow things like WebDAV to opean a single persistent connection and reuse it for all the chunked data. The crazy types allow for some nice code reuse. --- Remote/Directory/LegacyChunked.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Remote/Directory') diff --git a/Remote/Directory/LegacyChunked.hs b/Remote/Directory/LegacyChunked.hs index df6d94d04..c7b8ad52c 100644 --- a/Remote/Directory/LegacyChunked.hs +++ b/Remote/Directory/LegacyChunked.hs @@ -7,6 +7,8 @@ - Licensed under the GNU GPL version 3 or higher. -} +{-# LANGUAGE Rank2Types #-} + module Remote.Directory.LegacyChunked where import qualified Data.ByteString.Lazy as L @@ -88,13 +90,13 @@ store chunksize finalizer k b p = storeHelper finalizer k $ \dests -> - Done very innefficiently, by writing to a temp file. - :/ This is legacy code.. -} -retrieve :: (FilePath -> Key -> [FilePath]) -> FilePath -> PrepareRetriever -retrieve locations d basek = do +retrieve :: (FilePath -> Key -> [FilePath]) -> FilePath -> Preparer Retriever +retrieve locations d basek a = do showLongNote "This remote uses the deprecated chunksize setting. So this will be quite slow." tmpdir <- fromRepo $ gitAnnexTmpMiscDir createAnnexDirectory tmpdir let tmp = tmpdir keyFile basek ++ ".directorylegacy.tmp" - return $ Just $ \k -> do + a $ Just $ \k -> do void $ withStoredFiles d locations k $ \fs -> do forM_ fs $ S.appendFile tmp <=< S.readFile -- cgit v1.2.3