diff options
author | Joey Hess <joeyh@joeyh.name> | 2022-05-09 15:38:21 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2022-05-09 15:39:43 -0400 |
commit | e8a601aa24a0d90abb6421bb043650f99172189a (patch) | |
tree | f04f3c8d30c11ed77b931ca8b9d3fba15351687a /Remote/Adb.hs | |
parent | 2f2701137d1617fec075965d652c156ff02b85e3 (diff) |
incremental verification for retrieval from import remotes
Sponsored-by: Dartmouth College's Datalad project
Diffstat (limited to 'Remote/Adb.hs')
-rw-r--r-- | Remote/Adb.hs | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/Remote/Adb.hs b/Remote/Adb.hs index 477d9ea589..081b69cfe8 100644 --- a/Remote/Adb.hs +++ b/Remote/Adb.hs @@ -338,15 +338,23 @@ listImportableContentsM serial adir c = adbfind >>= \case -- connection is resonably fast, it's probably as good as -- git's handling of similar situations with files being modified while -- it's updating the working tree for a merge. -retrieveExportWithContentIdentifierM :: AndroidSerial -> AndroidPath -> ExportLocation -> ContentIdentifier -> FilePath -> Annex Key -> MeterUpdate -> Annex Key -retrieveExportWithContentIdentifierM serial adir loc cid dest mkkey _p = do - retrieve' serial src dest - k <- mkkey - currcid <- getExportContentIdentifier serial adir loc - if currcid == Right (Just cid) - then return k - else giveup "the file on the android device has changed" +retrieveExportWithContentIdentifierM :: AndroidSerial -> AndroidPath -> ExportLocation -> ContentIdentifier -> FilePath -> Either Key (Annex Key) -> MeterUpdate -> Annex (Key, Verification) +retrieveExportWithContentIdentifierM serial adir loc cid dest gk _p = do + case gk of + Right mkkey -> do + go + k <- mkkey + return (k, UnVerified) + Left k -> do + v <- verifyKeyContentIncrementally DefaultVerify k + (\iv -> tailVerify iv (toRawFilePath dest) go) + return (k, v) where + go = do + retrieve' serial src dest + currcid <- getExportContentIdentifier serial adir loc + when (currcid /= Right (Just cid)) $ + giveup "the file on the android device has changed" src = androidExportLocation adir loc storeExportWithContentIdentifierM :: AndroidSerial -> AndroidPath -> FilePath -> Key -> ExportLocation -> [ContentIdentifier] -> MeterUpdate -> Annex ContentIdentifier |