diff options
author | 2017-09-12 16:59:04 -0400 | |
---|---|---|
committer | 2017-09-12 16:59:04 -0400 | |
commit | b2fcdcc0a97add0ba0a518fb991f57431937c2a9 (patch) | |
tree | fddebae7627ee9c9b03cc4f8aff736c05dadaec1 /Remote/Helper | |
parent | 9bb67ce329578be45b598c98b17283c3bb9dfd43 (diff) |
export: cache connections for S3 and webdav
Diffstat (limited to 'Remote/Helper')
-rw-r--r-- | Remote/Helper/Export.hs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Remote/Helper/Export.hs b/Remote/Helper/Export.hs index 517b4333f..4616d4bb1 100644 --- a/Remote/Helper/Export.hs +++ b/Remote/Helper/Export.hs @@ -26,8 +26,8 @@ class HasExportUnsupported a where instance HasExportUnsupported (RemoteConfig -> RemoteGitConfig -> Annex Bool) where exportUnsupported = \_ _ -> return False -instance HasExportUnsupported (ExportActions Annex) where - exportUnsupported = ExportActions +instance HasExportUnsupported (Annex (ExportActions Annex)) where + exportUnsupported = return $ ExportActions { storeExport = \_ _ _ _ -> do warning "store export is unsupported" return False @@ -103,7 +103,9 @@ adjustExportable r = case M.lookup "exporttree" (config r) of [] -> do warning "unknown export location" return False - (l:_) -> retrieveExport (exportActions r) k l dest p + (l:_) -> do + ea <- exportActions r + retrieveExport ea k l dest p else do warning $ "exported content cannot be verified due to using the " ++ formatKeyVariety (keyVariety k) ++ " backend" return False @@ -111,8 +113,9 @@ adjustExportable r = case M.lookup "exporttree" (config r) of -- Remove all files a key was exported to. , removeKey = \k -> do locs <- liftIO $ getExportLocation db k + ea <- exportActions r oks <- forM locs $ \loc -> do - ok <- removeExport (exportActions r) k loc + ok <- removeExport ea k loc when ok $ liftIO $ removeExportLocation db k loc return ok @@ -125,8 +128,9 @@ adjustExportable r = case M.lookup "exporttree" (config r) of -- Check if any of the files a key was exported -- to are present. This doesn't guarantee the -- export contains the right content. - , checkPresent = \k -> - anyM (checkPresentExport (exportActions r) k) + , checkPresent = \k -> do + ea <- exportActions r + anyM (checkPresentExport ea k) =<< liftIO (getExportLocation db k) , mkUnavailable = return Nothing , getInfo = do |