summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-09-18 14:40:08 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-09-18 14:45:00 -0400
commit6f4a0b8b5ad281cc29184cd87a323aec309ffef1 (patch)
tree67d0c0e81f1ad47dc39c007a0ee81e486a0c1921
parent2980ca009586c4373b127ce688694bd84674625a (diff)
update for ExportTree
Use ExportTree rather than ExportedLocation for retrieveKeyFile and checkPresent. When another remote exported the content, ExportTree will be populated, but ExportedLocation will not be. It would be possible to implement storeKey to exports as well, but it risks performing a lot of unncessary work when another repository already stored the key on the export and the local repository doesn't know about it. The only way to avoid that work would be for storeKey to use checkPresentExport before uploading. But, the other repository could have changed the exported tree as well, so that can't be trusted, and if it were used in storeKey, could result in bad information getting into the location log. This commit was sponsored by Bruno BEAUFILS on Patreon.
-rw-r--r--Remote/Helper/Export.hs15
1 files changed, 7 insertions, 8 deletions
diff --git a/Remote/Helper/Export.hs b/Remote/Helper/Export.hs
index 6f4811285..9b31baca3 100644
--- a/Remote/Helper/Export.hs
+++ b/Remote/Helper/Export.hs
@@ -90,12 +90,11 @@ adjustExportable r = case M.lookup "exporttree" (config r) of
isexport = do
db <- openDb (uuid r)
return $ r
- -- Storing a key on an export would need a way to
- -- look up the file(s) that the currently exported
- -- tree uses for a key; there's not currently an
- -- inexpensive way to do that (getExportedLocation
- -- only finds files that have been stored on the
- -- export already).
+ -- Storing a key on an export could be implemented,
+ -- but it would perform unncessary work
+ -- when another repository has already stored the
+ -- key, and the local repository does not know
+ -- about it. To avoid unnecessary costs, don't do it.
{ storeKey = \_ _ _ -> do
warning "remote is configured with exporttree=yes; use `git-annex export` to store content on it"
return False
@@ -105,7 +104,7 @@ adjustExportable r = case M.lookup "exporttree" (config r) of
, retrieveKeyFile = \k _af dest p -> unVerified $
if maybe False (isJust . verifyKeyContent) (maybeLookupBackendVariety (keyVariety k))
then do
- locs <- liftIO $ getExportedLocation db k
+ locs <- liftIO $ getExportTree db k
case locs of
[] -> do
warning "unknown export location"
@@ -136,7 +135,7 @@ adjustExportable r = case M.lookup "exporttree" (config r) of
, checkPresent = \k -> do
ea <- exportActions r
anyM (checkPresentExport ea k)
- =<< liftIO (getExportedLocation db k)
+ =<< liftIO (getExportTree db k)
, mkUnavailable = return Nothing
, getInfo = do
is <- getInfo r