sim: fix get bug

When getting from a remote, have to check that the repo doing the
getting thinks the remote contains the key, but also that the remote
actually does. Before this bug fix, it would get from a repo that used
to have the key, but that had dropped it since the last git pull.
This commit is contained in:
Joey Hess 2024-09-17 14:29:49 -04:00
parent e568ac96b7
commit 6751f23978
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 21 additions and 6 deletions

View file

@ -535,12 +535,15 @@ overFilesRemote r u remote remotepred checkwant handlewanted st =
go remoteu (f, k) st' =
let af = AssociatedFile $ Just f
in liftIO $ runSimRepo u st' $ \rst ->
if checkremotepred remoteu rst k
then ifM (checkwant (Just k) af remoteu)
( return $ handlewanted remoteu f k r st'
, return st'
)
else return st'
case M.lookup remoteu (simRepoState st') of
Nothing -> return st'
Just rmtst
| not (checkremotepred remoteu rst k) -> return st'
| not (checkremotepred remoteu rmtst k) -> return st'
| otherwise -> ifM (checkwant (Just k) af remoteu)
( return $ handlewanted remoteu f k r st'
, return st'
)
checkremotepred remoteu rst k =
remotepred remoteu (getSimLocations rst k)

View file

@ -34,6 +34,18 @@ Planned schedule of work:
* sim: implement addtree
* sim: May need to use LiveUpdate to make size balanced preferred content
work
* sim: Can a cluster using size balanced preferred content be simulated?
May need the sim to get the concept of a cluster gateway, since the
gateway is what picks amoung the nodes on the basis of size. On the other
hand, it may suffice to connect the sending repo directly to each node of
the cluster, and let that repo pick which nodes to send to.
* sim: Add support for metadata, so preferred content that matches on it
will work
## items deferred until later for balanced preferred content and maxsize tracking
* `git-annex assist --rebalance` of `balanced=foo:2`