change retrieveExportWithContentIdentifier to take a list of ContentIdentifier

This partly fixes an issue where there are duplicate files in the
special remote, and the first file gets swapped with another duplicate,
or deleted. The swap case is fixed by this, the deleted case will need
other changes.

This makes retrieveExportWithContentIdentifier take a list of allowed
ContentIdentifier, same as storeExportWithContentIdentifier,
removeExportWithContentIdentifier, and
checkPresentExportWithContentIdentifier.

Of the special remotes that support importtree, borg is a special case
and does not use content identifiers, S3 I assume can't get mixed up
like this, directory certainly has the problem, and adb also appears to
have had the problem.

Sponsored-by: Graham Spencer on Patreon
This commit is contained in:
Joey Hess 2022-09-20 13:15:31 -04:00
parent 3adf1f24e2
commit 0ffc59d341
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 32 additions and 29 deletions

View file

@ -334,7 +334,7 @@ data ImportActions a = ImportActions
-- Throws exception on failure to access the remote.
, importKey :: Maybe (ImportLocation -> ContentIdentifier -> ByteSize -> MeterUpdate -> a (Maybe Key))
-- Retrieves a file from the remote. Ensures that the file
-- it retrieves has the requested ContentIdentifier.
-- it retrieves has one of the requested ContentIdentifiers.
--
-- This has to be used rather than retrieveExport
-- when a special remote supports imports, since files on such a
@ -343,7 +343,7 @@ data ImportActions a = ImportActions
-- Throws exception on failure.
, retrieveExportWithContentIdentifier
:: ExportLocation
-> ContentIdentifier
-> [ContentIdentifier]
-- file to write content to
-> FilePath
-- Either the key, or when it's not yet known, a callback