support incremental verification when retrieving from export/import remotes

None of the special remotes do it yet, but this lays the groundwork.

Added MustFinishIncompleteVerify so that, when an incremental verify is
started but not complete, it can be forced to finish it. Otherwise, it
would have skipped doing it when verification is disabled, but
verification must always be done when retrievin from export remotes
since files can be modified during retrieval.

Note that retrieveExportWithContentIdentifier doesn't support incremental
verification yet. And I'm not sure if it can -- it doesn't know the Key
before it downloads the content. It seems a new API call would need to
be split out of that, which is provided with the key.

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2022-05-09 12:25:04 -04:00
parent 52b768db45
commit 90950a37e5
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
11 changed files with 42 additions and 22 deletions

View file

@ -349,8 +349,10 @@ adjustExportImport' isexport isimport r rs = do
retrieveKeyFileFromExport dbv k _af dest p = ifM (isVerifiable k)
( do
l <- getfirstexportloc dbv k
retrieveExport (exportActions r) k l dest p
return MustVerify
retrieveExport (exportActions r) k l dest p >>= return . \case
UnVerified -> MustVerify
IncompleteVerify iv -> MustFinishIncompleteVerify iv
v -> v
, giveup $ "exported content cannot be verified due to using the " ++ decodeBS (formatKeyVariety (fromKey keyVariety k)) ++ " backend"
)