cache the trustmap

Doubles the speed of fsck, and speeds up drop as well.
This commit is contained in:
Joey Hess 2011-06-23 21:25:39 -04:00
parent a61154baf5
commit 69d3c1cec9
4 changed files with 24 additions and 10 deletions

30
Types/TrustLevel.hs Normal file
View file

@ -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