aboutsummaryrefslogtreecommitdiff
path: root/Remote/Directory.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-07-29 16:22:19 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-07-29 16:28:44 -0400
commit99e69a42d1afc02c381657e82547dfcc9f2a6ae2 (patch)
treee38a15038aa62dfdad0873bc3b4b874d5e0f254e /Remote/Directory.hs
parent48674a62c7d1fb9932c2bd234e6f851ec75478ac (diff)
lift types from IO to Annex
Some remotes like External need to run store and retrieve actions in Annex, not IO. In order to do that lift, I had to dive pretty deep into the utilities, making Utility.Gpg and Utility.Tmp be partly converted to using MonadIO, and Control.Monad.Catch for exception handling. There should be no behavior changes in this commit. This commit was sponsored by Michael Barabanov.
Diffstat (limited to 'Remote/Directory.hs')
-rw-r--r--Remote/Directory.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/Remote/Directory.hs b/Remote/Directory.hs
index 5d8a040d4..9f2775965 100644
--- a/Remote/Directory.hs
+++ b/Remote/Directory.hs
@@ -112,8 +112,8 @@ prepareStore d chunkconfig = checkPrepare
(\k -> checkDiskSpace (Just d) k 0)
(byteStorer $ store d chunkconfig)
-store :: FilePath -> ChunkConfig -> Key -> L.ByteString -> MeterUpdate -> IO Bool
-store d chunkconfig k b p = do
+store :: FilePath -> ChunkConfig -> Key -> L.ByteString -> MeterUpdate -> Annex Bool
+store d chunkconfig k b p = liftIO $ do
void $ tryIO $ createDirectoryIfMissing True tmpdir
case chunkconfig of
LegacyChunks chunksize -> Legacy.store chunksize finalizer k b p tmpdir destdir
@@ -138,7 +138,7 @@ store d chunkconfig k b p = do
retrieve :: FilePath -> ChunkConfig -> Preparer Retriever
retrieve d (LegacyChunks _) = Legacy.retrieve locations d
retrieve d _ = simplyPrepare $ byteRetriever $
- \k -> L.readFile =<< getLocation d k
+ \k -> liftIO $ L.readFile =<< getLocation d k
retrieveCheap :: FilePath -> ChunkConfig -> Key -> FilePath -> Annex Bool
-- no cheap retrieval possible for chunks