summaryrefslogtreecommitdiff
path: root/Remote/Directory/LegacyChunked.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-07-27 00:30:04 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-07-27 00:30:04 -0400
commitc46eba94f69151ded37988efd7e3375d327faef3 (patch)
tree90d69a2eecde684e1010e99604055df1741e5acf /Remote/Directory/LegacyChunked.hs
parent07eb1e676829a20cb7bcc73a219f51b76daa4b3f (diff)
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.
Diffstat (limited to 'Remote/Directory/LegacyChunked.hs')
-rw-r--r--Remote/Directory/LegacyChunked.hs8
1 files changed, 5 insertions, 3 deletions
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