break module dependancy loop

A PITA but worth it to clean up the trust configuration code.
This commit is contained in:
Joey Hess 2012-01-10 13:11:16 -04:00
parent 0d5c402210
commit 07cacbeee9
10 changed files with 109 additions and 107 deletions

View file

@ -16,8 +16,7 @@
module Logs.Location (
LogStatus(..),
logChange,
readLog,
keyLocations,
loggedLocations,
loggedKeys,
loggedKeysFor,
logFile,
@ -27,7 +26,6 @@ module Logs.Location (
import Common.Annex
import qualified Annex.Branch
import Logs.Presence
import Logs.Trust
{- Log a change in the presence of a key's value in a repository. -}
logChange :: Key -> UUID -> LogStatus -> Annex ()
@ -36,13 +34,9 @@ logChange _ NoUUID _ = return ()
{- Returns a list of repository UUIDs that, according to the log, have
- the value of a key.
-
- Dead repositories are skipped.
-}
keyLocations :: Key -> Annex [UUID]
keyLocations key = do
l <- map toUUID <$> (currentLog . logFile) key
snd <$> trustPartition DeadTrusted l
loggedLocations :: Key -> Annex [UUID]
loggedLocations key = map toUUID <$> (currentLog . logFile) key
{- Finds all keys that have location log information.
- (There may be duplicate keys in the list.) -}
@ -57,7 +51,7 @@ loggedKeysFor u = filterM isthere =<< loggedKeys
{- This should run strictly to avoid the filterM
- building many thunks containing keyLocations data. -}
isthere k = do
us <- keyLocations k
us <- loggedLocations k
let !there = u `elem` us
return there