migrate: Support migrating v1 SHA keys to v2 SHA keys with size information that can be used for free space checking.

This commit is contained in:
Joey Hess 2011-03-23 17:57:10 -04:00
parent ad08273ac5
commit 6246b807f7
9 changed files with 54 additions and 10 deletions

View file

@ -24,6 +24,7 @@ module Backend (
removeKey,
hasKey,
fsckKey,
upgradableKey,
lookupFile,
chooseBackends,
keyBackend,
@ -130,6 +131,10 @@ fsckKey backend key file numcopies = do
backend_ok <-(B.fsckKey backend) key file numcopies
return $ size_ok && backend_ok
{- Checks if a key is upgradable to a newer representation. -}
upgradableKey :: Backend Annex -> Key -> Annex Bool
upgradableKey backend key = (B.upgradableKey backend) key
{- Looks up the key and backend corresponding to an annexed file,
- by examining what the file symlinks to. -}
lookupFile :: FilePath -> Annex (Maybe (Key, Backend Annex))