incremental checksum on download from ssh or p2p
Checksum as content is received from a remote git-annex repository, rather than doing it in a second pass. Not tested at all yet, but I imagine it will work! Not implemented for any special remotes, and also not implemented for copies from local remotes. It may be that, for local remotes, it will suffice to use rsync, rely on its checksumming, and simply return Verified. (It would still make a checksumming pass when cp is used for COW, I guess.)
This commit is contained in:
parent
ed684f651e
commit
62e152f210
17 changed files with 118 additions and 52 deletions
15
Backend.hs
15
Backend.hs
|
@ -1,6 +1,6 @@
|
|||
{- git-annex key/value backends
|
||||
-
|
||||
- Copyright 2010-2020 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2010-2021 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
@ -17,11 +17,13 @@ module Backend (
|
|||
isStableKey,
|
||||
isCryptographicallySecure,
|
||||
isVerifiable,
|
||||
startVerifyKeyContentIncrementally,
|
||||
) where
|
||||
|
||||
import Annex.Common
|
||||
import qualified Annex
|
||||
import Annex.CheckAttr
|
||||
import Annex.Verify
|
||||
import Types.Key
|
||||
import Types.KeySource
|
||||
import qualified Types.Backend as B
|
||||
|
@ -127,3 +129,14 @@ isCryptographicallySecure k = maybe False (`B.isCryptographicallySecure` k)
|
|||
isVerifiable :: Key -> Annex Bool
|
||||
isVerifiable k = maybe False (isJust . B.verifyKeyContent)
|
||||
<$> maybeLookupBackendVariety (fromKey keyVariety k)
|
||||
|
||||
startVerifyKeyContentIncrementally :: VerifyConfig -> Key -> Annex (Maybe B.IncrementalVerifier)
|
||||
startVerifyKeyContentIncrementally verifyconfig k =
|
||||
ifM (shouldVerify verifyconfig)
|
||||
( maybeLookupBackendVariety (fromKey keyVariety k) >>= \case
|
||||
Just b -> case B.verifyKeyContentIncrementally b of
|
||||
Just v -> Just <$> v k
|
||||
Nothing -> return Nothing
|
||||
Nothing -> return Nothing
|
||||
, return Nothing
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue