cache remote.log
Unlikely to speed up any of the existing uses much, but I want to use it in a message that might be displayed many times.
This commit is contained in:
parent
ebdce707da
commit
5cfcf1f05f
19 changed files with 62 additions and 29 deletions
|
@ -1,12 +1,13 @@
|
|||
{- git-annex remote log
|
||||
-
|
||||
- Copyright 2011-2019 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2011-2020 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module Logs.Remote (
|
||||
remoteLog,
|
||||
remoteConfigMap,
|
||||
readRemoteLog,
|
||||
configSet,
|
||||
keyValToConfig,
|
||||
|
@ -18,6 +19,7 @@ module Logs.Remote (
|
|||
) where
|
||||
|
||||
import Annex.Common
|
||||
import qualified Annex
|
||||
import qualified Annex.Branch
|
||||
import Types.Remote
|
||||
import Logs
|
||||
|
@ -35,8 +37,20 @@ configSet u cfg = do
|
|||
buildRemoteConfigLog
|
||||
. changeLog c u (removeSameasInherited cfg)
|
||||
. parseRemoteConfigLog
|
||||
Annex.changeState $ \s -> s { Annex.remoteconfigmap = Nothing }
|
||||
|
||||
{- Map of remotes by uuid containing key/value config maps.
|
||||
- Cached for speed. -}
|
||||
remoteConfigMap :: Annex (M.Map UUID RemoteConfig)
|
||||
remoteConfigMap = maybe remoteConfigMapLoad return
|
||||
=<< Annex.getState Annex.remoteconfigmap
|
||||
|
||||
remoteConfigMapLoad :: Annex (M.Map UUID RemoteConfig)
|
||||
remoteConfigMapLoad = do
|
||||
m <- readRemoteLog
|
||||
Annex.changeState $ \s -> s { Annex.remoteconfigmap = Just m }
|
||||
return m
|
||||
|
||||
{- Map of remotes by uuid containing key/value config maps. -}
|
||||
readRemoteLog :: Annex (M.Map UUID RemoteConfig)
|
||||
readRemoteLog = calcRemoteConfigMap
|
||||
<$> Annex.Branch.get remoteLog
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue