add key stability checking interface

Needed for resuming from chunks.

Url keys are considered not stable. I considered treating url keys with a
known size as stable, but just don't feel that is enough information.
This commit is contained in:
Joey Hess 2014-07-27 12:33:46 -04:00
parent aad8cfe718
commit 13bbb61a51
5 changed files with 18 additions and 1 deletions

View file

@ -14,7 +14,8 @@ module Backend (
isAnnexLink,
chooseBackend,
lookupBackendName,
maybeLookupBackendName
maybeLookupBackendName,
checkStableKey,
) where
import Common.Annex
@ -124,3 +125,7 @@ maybeLookupBackendName s = M.lookup s nameMap
nameMap :: M.Map String Backend
nameMap = M.fromList $ zip (map B.name list) list
checkStableKey :: Key -> Bool
checkStableKey k = maybe False (`B.isStableKey` k)
(maybeLookupBackendName (keyBackendName k))