From 48674a62c7d1fb9932c2bd234e6f851ec75478ac Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 29 Jul 2014 14:53:17 -0400 Subject: add ContentSource type, for remotes that act on files rather than ByteStrings Note that currently nothing cleans up a ContentSource's file, when eg, retrieving chunks. --- Remote/Directory.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Remote/Directory.hs') diff --git a/Remote/Directory.hs b/Remote/Directory.hs index b107c18e9..5d8a040d4 100644 --- a/Remote/Directory.hs +++ b/Remote/Directory.hs @@ -110,9 +110,9 @@ tmpDir d k = addTrailingPathSeparator $ d "tmp" keyFile k prepareStore :: FilePath -> ChunkConfig -> Preparer Storer prepareStore d chunkconfig = checkPrepare (\k -> checkDiskSpace (Just d) k 0) - (store d chunkconfig) + (byteStorer $ store d chunkconfig) -store :: FilePath -> ChunkConfig -> Storer +store :: FilePath -> ChunkConfig -> Key -> L.ByteString -> MeterUpdate -> IO Bool store d chunkconfig k b p = do void $ tryIO $ createDirectoryIfMissing True tmpdir case chunkconfig of @@ -137,7 +137,8 @@ store d chunkconfig k b p = do retrieve :: FilePath -> ChunkConfig -> Preparer Retriever retrieve d (LegacyChunks _) = Legacy.retrieve locations d -retrieve d _ = simplyPrepare $ \k -> L.readFile =<< getLocation d k +retrieve d _ = simplyPrepare $ byteRetriever $ + \k -> L.readFile =<< getLocation d k retrieveCheap :: FilePath -> ChunkConfig -> Key -> FilePath -> Annex Bool -- no cheap retrieval possible for chunks -- cgit v1.2.3