Added the annex.fullybalancedthreshhold git config.

This commit is contained in:
Joey Hess 2024-08-22 07:15:55 -04:00
parent 3fe67744b1
commit 70e2fca257
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 6 additions and 3 deletions

View file

@ -23,6 +23,7 @@ git-annex (10.20240831) UNRELEASED; urgency=medium
* Added --rebalance option. * Added --rebalance option.
* maxsize: New command to tell git-annex how large the expected maximum * maxsize: New command to tell git-annex how large the expected maximum
size of a repository is, and to display repository sizes. size of a repository is, and to display repository sizes.
* Added the annex.fullybalancedthreshhold git config.
* vicfg: Include maxsize configuration. * vicfg: Include maxsize configuration.
* info: Improved speed. * info: Improved speed.

View file

@ -602,7 +602,7 @@ limitFullyBalanced' :: String -> Maybe UUID -> Annex GroupMap -> MkLimit Annex
limitFullyBalanced' = limitFullyBalanced'' $ \n key candidates -> do limitFullyBalanced' = limitFullyBalanced'' $ \n key candidates -> do
maxsizes <- getMaxSizes maxsizes <- getMaxSizes
sizemap <- getRepoSizes False sizemap <- getRepoSizes False
let threshhold = 0.9 :: Double threshhold <- annexFullyBalancedThreshhold <$> Annex.getGitConfig
let toofull u = let toofull u =
case (M.lookup u maxsizes, M.lookup u sizemap) of case (M.lookup u maxsizes, M.lookup u sizemap) of
(Just (MaxSize maxsize), Just (RepoSize reposize)) -> (Just (MaxSize maxsize), Just (RepoSize reposize)) ->

View file

@ -163,6 +163,7 @@ data GitConfig = GitConfig
, annexAdviceNoSshCaching :: Bool , annexAdviceNoSshCaching :: Bool
, annexViewUnsetDirectory :: ViewUnset , annexViewUnsetDirectory :: ViewUnset
, annexClusters :: M.Map RemoteName ClusterUUID , annexClusters :: M.Map RemoteName ClusterUUID
, annexFullyBalancedThreshhold :: Double
} }
extractGitConfig :: ConfigSource -> Git.Repo -> GitConfig extractGitConfig :: ConfigSource -> Git.Repo -> GitConfig
@ -296,6 +297,9 @@ extractGitConfig configsource r = GitConfig
M.mapMaybe (mkClusterUUID . toUUID) $ M.mapMaybe (mkClusterUUID . toUUID) $
M.mapKeys removeclusterprefix $ M.mapKeys removeclusterprefix $
M.filterWithKey isclusternamekey (config r) M.filterWithKey isclusternamekey (config r)
, annexFullyBalancedThreshhold =
fromMaybe 0.9 $ (/ 100) <$> getmayberead
(annexConfig "fullybalancedthreshhold")
} }
where where
getbool k d = fromMaybe d $ getmaybebool k getbool k d = fromMaybe d $ getmaybebool k

View file

@ -30,8 +30,6 @@ Planned schedule of work:
## work notes ## work notes
* Implement annex.fullybalancedthreshhold
* `git-annex assist --rebalance` of `balanced=foo:2` * `git-annex assist --rebalance` of `balanced=foo:2`
sometimes needs several runs to stabalize. sometimes needs several runs to stabalize.