avoid reloading trust log
This commit is contained in:
parent
70cb93a66b
commit
b158e067c0
3 changed files with 22 additions and 6 deletions
|
@ -20,7 +20,6 @@ module Logs.Trust (
|
||||||
|
|
||||||
import Annex.Common
|
import Annex.Common
|
||||||
import Types.TrustLevel
|
import Types.TrustLevel
|
||||||
import qualified Annex
|
|
||||||
import Logs
|
import Logs
|
||||||
import Remote.List
|
import Remote.List
|
||||||
import Logs.Trust.Basic as X
|
import Logs.Trust.Basic as X
|
||||||
|
@ -61,7 +60,7 @@ trustExclude level ls = snd <$> trustPartition level ls
|
||||||
{- trustLog in a map, overridden with any values from forcetrust or
|
{- trustLog in a map, overridden with any values from forcetrust or
|
||||||
- the git config. The map is cached for speed. -}
|
- the git config. The map is cached for speed. -}
|
||||||
trustMap :: Annex TrustMap
|
trustMap :: Annex TrustMap
|
||||||
trustMap = maybe trustMapLoad return =<< Annex.getState Annex.trustmap
|
trustMap = trustMap' =<< remoteList
|
||||||
|
|
||||||
{- Loads the map, updating the cache, -}
|
{- Loads the map, updating the cache, -}
|
||||||
trustMapLoad :: Annex TrustMap
|
trustMapLoad :: Annex TrustMap
|
||||||
|
|
|
@ -9,6 +9,7 @@ module Logs.Trust.Basic (
|
||||||
module X,
|
module X,
|
||||||
trustSet,
|
trustSet,
|
||||||
trustMapRaw,
|
trustMapRaw,
|
||||||
|
trustMap',
|
||||||
trustMapLoad',
|
trustMapLoad',
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
@ -39,6 +40,9 @@ trustSet NoUUID _ = error "unknown UUID; cannot modify"
|
||||||
trustMapRaw :: Annex TrustMap
|
trustMapRaw :: Annex TrustMap
|
||||||
trustMapRaw = calcTrustMap <$> Annex.Branch.get trustLog
|
trustMapRaw = calcTrustMap <$> Annex.Branch.get trustLog
|
||||||
|
|
||||||
|
trustMap' :: [Remote] -> Annex TrustMap
|
||||||
|
trustMap' l = maybe (trustMapLoad' l) return =<< Annex.getState Annex.trustmap
|
||||||
|
|
||||||
trustMapLoad' :: [Remote] -> Annex TrustMap
|
trustMapLoad' :: [Remote] -> Annex TrustMap
|
||||||
trustMapLoad' l = do
|
trustMapLoad' l = do
|
||||||
forceoverrides <- Annex.getState Annex.forcetrust
|
forceoverrides <- Annex.getState Annex.forcetrust
|
||||||
|
|
|
@ -755,6 +755,8 @@ computeKey rs (ComputeProgram program) k _af dest meterupdate vc =
|
||||||
|
|
||||||
keyPossibilities :: Key -> Annex [Remote]
|
keyPossibilities :: Key -> Annex [Remote]
|
||||||
keyPossibilities key = do
|
keyPossibilities key = do
|
||||||
|
-- This gets populated with a list of all remotes before this
|
||||||
|
-- remote is used.
|
||||||
remotelist <- Annex.getState Annex.remotes
|
remotelist <- Annex.getState Annex.remotes
|
||||||
locs <- loggedLocations key
|
locs <- loggedLocations key
|
||||||
keyPossibilities' (IncludeIgnored False) key locs remotelist
|
keyPossibilities' (IncludeIgnored False) key locs remotelist
|
||||||
|
@ -804,12 +806,23 @@ avoidCycles outputkeys inputkey = filterM go
|
||||||
-- its inputs are also still available.
|
-- its inputs are also still available.
|
||||||
checkKey :: RemoteStateHandle -> Key -> Annex Bool
|
checkKey :: RemoteStateHandle -> Key -> Annex Bool
|
||||||
checkKey rs k = do
|
checkKey rs k = do
|
||||||
deadset <- S.fromList . M.keys . M.filter (== DeadTrusted)
|
deadset <- getdeadset
|
||||||
<$> (trustMapLoad' =<< Annex.getState Annex.remotes)
|
computeset <- getcomputeset
|
||||||
computeset <- S.fromList . M.keys . M.filter isComputeRemote'
|
|
||||||
<$> remoteConfigMap
|
|
||||||
availablecompute [] deadset computeset k rs
|
availablecompute [] deadset computeset k rs
|
||||||
where
|
where
|
||||||
|
getdeadset = do
|
||||||
|
-- Usually this will already be populated with all remotes,
|
||||||
|
-- otherwise this compute remote would not be used. Check
|
||||||
|
-- just in case, to avoid trustMap' caching bad inputs.
|
||||||
|
rs <- Annex.getState Annex.remotes
|
||||||
|
if null rs
|
||||||
|
then error "internal"
|
||||||
|
else S.fromList . M.keys . M.filter (== DeadTrusted)
|
||||||
|
<$> trustMap' rs
|
||||||
|
|
||||||
|
getcomputeset = S.fromList . M.keys . M.filter isComputeRemote'
|
||||||
|
<$> remoteConfigMap
|
||||||
|
|
||||||
availablecompute inputkeys deadset computeset k' rs'
|
availablecompute inputkeys deadset computeset k' rs'
|
||||||
| k' `elem` inputkeys = return False -- avoid cycles
|
| k' `elem` inputkeys = return False -- avoid cycles
|
||||||
| otherwise =
|
| otherwise =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue