From 70e2fca2575821f4ede26138454064e464209229 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 22 Aug 2024 07:15:55 -0400 Subject: [PATCH] Added the annex.fullybalancedthreshhold git config. --- CHANGELOG | 1 + Limit.hs | 2 +- Types/GitConfig.hs | 4 ++++ doc/todo/git-annex_proxies.mdwn | 2 -- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d5c63b3a45..95b7579d5e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -23,6 +23,7 @@ git-annex (10.20240831) UNRELEASED; urgency=medium * Added --rebalance option. * maxsize: New command to tell git-annex how large the expected maximum size of a repository is, and to display repository sizes. + * Added the annex.fullybalancedthreshhold git config. * vicfg: Include maxsize configuration. * info: Improved speed. diff --git a/Limit.hs b/Limit.hs index 4ed4853f78..72175d8a44 100644 --- a/Limit.hs +++ b/Limit.hs @@ -602,7 +602,7 @@ limitFullyBalanced' :: String -> Maybe UUID -> Annex GroupMap -> MkLimit Annex limitFullyBalanced' = limitFullyBalanced'' $ \n key candidates -> do maxsizes <- getMaxSizes sizemap <- getRepoSizes False - let threshhold = 0.9 :: Double + threshhold <- annexFullyBalancedThreshhold <$> Annex.getGitConfig let toofull u = case (M.lookup u maxsizes, M.lookup u sizemap) of (Just (MaxSize maxsize), Just (RepoSize reposize)) -> diff --git a/Types/GitConfig.hs b/Types/GitConfig.hs index 68ce298d02..4b9c546e86 100644 --- a/Types/GitConfig.hs +++ b/Types/GitConfig.hs @@ -163,6 +163,7 @@ data GitConfig = GitConfig , annexAdviceNoSshCaching :: Bool , annexViewUnsetDirectory :: ViewUnset , annexClusters :: M.Map RemoteName ClusterUUID + , annexFullyBalancedThreshhold :: Double } extractGitConfig :: ConfigSource -> Git.Repo -> GitConfig @@ -296,6 +297,9 @@ extractGitConfig configsource r = GitConfig M.mapMaybe (mkClusterUUID . toUUID) $ M.mapKeys removeclusterprefix $ M.filterWithKey isclusternamekey (config r) + , annexFullyBalancedThreshhold = + fromMaybe 0.9 $ (/ 100) <$> getmayberead + (annexConfig "fullybalancedthreshhold") } where getbool k d = fromMaybe d $ getmaybebool k diff --git a/doc/todo/git-annex_proxies.mdwn b/doc/todo/git-annex_proxies.mdwn index 14520d0a03..f8606e5aba 100644 --- a/doc/todo/git-annex_proxies.mdwn +++ b/doc/todo/git-annex_proxies.mdwn @@ -30,8 +30,6 @@ Planned schedule of work: ## work notes -* Implement annex.fullybalancedthreshhold - * `git-annex assist --rebalance` of `balanced=foo:2` sometimes needs several runs to stabalize.