diff options
author | Joey Hess <joey@kitenet.net> | 2014-07-27 12:33:46 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-07-27 12:33:46 -0400 |
commit | 300935948503d671ad91b943787d71dc1f6e421e (patch) | |
tree | 9452b227b121f30e7c89fd87cc3756cd34769357 /Backend.hs | |
parent | c7f90efb8626573f2e2927195ce16cb609fac315 (diff) |
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.
Diffstat (limited to 'Backend.hs')
-rw-r--r-- | Backend.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Backend.hs b/Backend.hs index 245e79ec2..99752c66f 100644 --- a/Backend.hs +++ b/Backend.hs @@ -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)) |