diff options
author | Joey Hess <joey@kitenet.net> | 2011-06-23 21:25:39 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-06-23 21:25:39 -0400 |
commit | 69d3c1cec9f6be1dba1ffb391bf69464c52f5936 (patch) | |
tree | 25409afd87286b599c65bd61e403a597413a86b0 /Types | |
parent | a61154baf5e205af74766f44fe99cbbd63411f57 (diff) |
cache the trustmap
Doubles the speed of fsck, and speeds up drop as well.
Diffstat (limited to 'Types')
-rw-r--r-- | Types/TrustLevel.hs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Types/TrustLevel.hs b/Types/TrustLevel.hs new file mode 100644 index 000000000..058ce4595 --- /dev/null +++ b/Types/TrustLevel.hs @@ -0,0 +1,30 @@ +{- git-annex trust levels + - + - Copyright 2010 Joey Hess <joey@kitenet.net> + - + - Licensed under the GNU GPL version 3 or higher. + -} + +module Types.TrustLevel ( + TrustLevel(..), + TrustMap +) where + +import qualified Data.Map as M + +import Types.UUID + +data TrustLevel = SemiTrusted | UnTrusted | Trusted + deriving Eq + +instance Show TrustLevel where + show SemiTrusted = "?" + show UnTrusted = "0" + show Trusted = "1" + +instance Read TrustLevel where + readsPrec _ "1" = [(Trusted, "")] + readsPrec _ "0" = [(UnTrusted, "")] + readsPrec _ _ = [(SemiTrusted, "")] + +type TrustMap = M.Map UUID TrustLevel |