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.
This commit is contained in:
parent
0ad7e36dc1
commit
55809081d0
1 changed files with 7 additions and 8 deletions
|
@ -90,12 +90,11 @@ adjustExportable r = case M.lookup "exporttree" (config r) of
|
||||||
isexport = do
|
isexport = do
|
||||||
db <- openDb (uuid r)
|
db <- openDb (uuid r)
|
||||||
return $ r
|
return $ r
|
||||||
-- Storing a key on an export would need a way to
|
-- Storing a key on an export could be implemented,
|
||||||
-- look up the file(s) that the currently exported
|
-- but it would perform unncessary work
|
||||||
-- tree uses for a key; there's not currently an
|
-- when another repository has already stored the
|
||||||
-- inexpensive way to do that (getExportedLocation
|
-- key, and the local repository does not know
|
||||||
-- only finds files that have been stored on the
|
-- about it. To avoid unnecessary costs, don't do it.
|
||||||
-- export already).
|
|
||||||
{ storeKey = \_ _ _ -> do
|
{ storeKey = \_ _ _ -> do
|
||||||
warning "remote is configured with exporttree=yes; use `git-annex export` to store content on it"
|
warning "remote is configured with exporttree=yes; use `git-annex export` to store content on it"
|
||||||
return False
|
return False
|
||||||
|
@ -105,7 +104,7 @@ adjustExportable r = case M.lookup "exporttree" (config r) of
|
||||||
, retrieveKeyFile = \k _af dest p -> unVerified $
|
, retrieveKeyFile = \k _af dest p -> unVerified $
|
||||||
if maybe False (isJust . verifyKeyContent) (maybeLookupBackendVariety (keyVariety k))
|
if maybe False (isJust . verifyKeyContent) (maybeLookupBackendVariety (keyVariety k))
|
||||||
then do
|
then do
|
||||||
locs <- liftIO $ getExportedLocation db k
|
locs <- liftIO $ getExportTree db k
|
||||||
case locs of
|
case locs of
|
||||||
[] -> do
|
[] -> do
|
||||||
warning "unknown export location"
|
warning "unknown export location"
|
||||||
|
@ -136,7 +135,7 @@ adjustExportable r = case M.lookup "exporttree" (config r) of
|
||||||
, checkPresent = \k -> do
|
, checkPresent = \k -> do
|
||||||
ea <- exportActions r
|
ea <- exportActions r
|
||||||
anyM (checkPresentExport ea k)
|
anyM (checkPresentExport ea k)
|
||||||
=<< liftIO (getExportedLocation db k)
|
=<< liftIO (getExportTree db k)
|
||||||
, mkUnavailable = return Nothing
|
, mkUnavailable = return Nothing
|
||||||
, getInfo = do
|
, getInfo = do
|
||||||
is <- getInfo r
|
is <- getInfo r
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue