balanced preferred content and --rebalance

This all works fine. But it doesn't check repository sizes yet, and
without repository size checking, once a repository gets full, there
will be no other repository that will want its files.

Use of sha2 seems unncessary, probably alder2 or md5 or crc would have
been enough. Possibly just summing up the bytes of the key mod the number
of repositories would have sufficed. But sha2 is there, and probably
hardware accellerated. I doubt very much there is any security benefit
to using it though. If someone wants to construct a key that will be
balanced onto a given repository, sha2 is certianly not going to stop
them.
This commit is contained in:
Joey Hess 2024-08-09 14:16:09 -04:00
parent 152c87140b
commit 3ce2e95a5f
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
11 changed files with 169 additions and 17 deletions

View file

@ -56,6 +56,11 @@ gitAnnexCommonOptions = commonOptions ++
<> help "override minimum number of copies"
<> hidden
)
, annexFlag (setrebalance True)
( long "rebalance"
<> help "move content as needed to improve balance"
<> hidden
)
, annexOption (setAnnexState . Remote.forceTrust Trusted) $ strOption
( long "trust" <> metavar paramRemote
<> help "deprecated, does not override trust setting"
@ -103,6 +108,7 @@ gitAnnexCommonOptions = commonOptions ++
where
setnumcopies n = setAnnexRead $ \rd -> rd { Annex.forcenumcopies = Just $ configuredNumCopies n }
setmincopies n = setAnnexRead $ \rd -> rd { Annex.forcemincopies = Just $ configuredMinCopies n }
setrebalance v = setAnnexRead $ \rd -> rd { Annex.rebalance = v }
setuseragent v = setAnnexRead $ \rd -> rd { Annex.useragent = Just v }
setdesktopnotify v = setAnnexRead $ \rd -> rd { Annex.desktopnotify = Annex.desktopnotify rd <> v }
setgitconfig v = Annex.addGitConfigOverride v