diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-02-24 15:16:56 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-02-24 15:16:56 -0400 |
commit | 2f868db90c7ba16eee901b9b1472b1e1a889dd93 (patch) | |
tree | 8a366a36cc50cf1c3899aeaddf10e02d9cffc847 /Annex | |
parent | 13fb898fb2379a9ed9b7df2b645453059d296488 (diff) |
add KeyVariety type
Where before the "name" of a key and a backend was a string, this makes
it a concrete data type.
This is groundwork for allowing some varieties of keys to be disabled
in file2key, so git-annex won't use them at all.
Benchmarks ran in my big repo:
old git-annex info:
real 0m3.338s
user 0m3.124s
sys 0m0.244s
new git-annex info:
real 0m3.216s
user 0m3.024s
sys 0m0.220s
new git-annex find:
real 0m7.138s
user 0m6.924s
sys 0m0.252s
old git-annex find:
real 0m7.433s
user 0m7.240s
sys 0m0.232s
Surprising result; I'd have expected it to be slower since it now parses
all the key varieties. But, the parser is very simple and perhaps
sharing KeyVarieties uses less memory or something like that.
This commit was supported by the NSF-funded DataLad project.
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/Content.hs | 2 | ||||
-rw-r--r-- | Annex/Locations.hs | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs index e879e4eeb..8e225548f 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -341,7 +341,7 @@ verifyKeyContent v UnVerified k f = ifM (shouldVerify v) Just size -> do size' <- liftIO $ catchDefaultIO 0 $ getFileSize f return (size' == size) - verifycontent = case Types.Backend.verifyKeyContent =<< Backend.maybeLookupBackendName (keyBackendName k) of + verifycontent = case Types.Backend.verifyKeyContent =<< Backend.maybeLookupBackendVariety (keyVariety k) of Nothing -> return True Just verifier -> verifier k f diff --git a/Annex/Locations.hs b/Annex/Locations.hs index 3138b2322..6bc24c4a8 100644 --- a/Annex/Locations.hs +++ b/Annex/Locations.hs @@ -78,6 +78,7 @@ import Data.Default import Common import Key +import Types.Key import Types.UUID import Types.GitConfig import Types.Difference @@ -478,7 +479,7 @@ prop_isomorphic_fileKey s | null s = True -- it's not legal for a key to have no keyName | otherwise= Just k == fileKey (keyFile k) where - k = stubKey { keyName = s, keyBackendName = "test" } + k = stubKey { keyName = s, keyVariety = OtherKey "test" } {- A location to store a key on a special remote that uses a filesystem. - A directory hash is used, to protect against filesystems that dislike |