diff options
author | 2014-07-29 14:53:17 -0400 | |
---|---|---|
committer | 2014-07-29 15:16:12 -0400 | |
commit | 48674a62c7d1fb9932c2bd234e6f851ec75478ac (patch) | |
tree | 42e85e57863731f46373052c3d2f6ba269121491 /Remote/Directory.hs | |
parent | 51a3747830e9c3a966185977b50652a928b3ee84 (diff) |
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.
Diffstat (limited to 'Remote/Directory.hs')
-rw-r--r-- | Remote/Directory.hs | 7 |
1 files changed, 4 insertions, 3 deletions
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 |