plumb in LiveUpdate (WIP)

Each command that first checks preferred content (and/or required
content) and then does something that can change the sizes of
repositories needs to call prepareLiveUpdate, and plumb it through the
preferred content check and the location log update.

So far, only Command.Drop is done. Many other commands that don't need
to do this have been updated to keep working.

There may be some calls to NoLiveUpdate in places where that should be
done. All will need to be double checked.

Not currently in a compilable state.
This commit is contained in:
Joey Hess 2024-08-23 16:35:12 -04:00
parent 4885073377
commit c3d40b9ec3
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
58 changed files with 363 additions and 247 deletions

View file

@ -80,7 +80,7 @@ runLocal runst runner a = case a of
iv <- startVerifyKeyContentIncrementally DefaultVerify k
let runtransfer ti =
Right <$> transfer download' k af Nothing (\p ->
logStatusAfter k $ getViaTmp rsp DefaultVerify k af Nothing $ \tmp ->
logStatusAfter NoLiveUpdate k $ getViaTmp rsp DefaultVerify k af Nothing $ \tmp ->
storefile (fromRawFilePath tmp) o l getb iv validitycheck p ti)
let fallback = return $ Left $
ProtoFailureMessage "transfer already in progress, or unable to take transfer lock"
@ -121,7 +121,8 @@ runLocal runst runner a = case a of
Right (Left e) -> return $ Left e
Right (Right ok) -> runner (next ok)
SetPresent k u next -> do
v <- tryNonAsync $ logChange k u InfoPresent
-- FIXME: Can a live update be done here?
v <- tryNonAsync $ logChange NoLiveUpdate k u InfoPresent
case v of
Left e -> return $ Left $ ProtoFailureException e
Right () -> runner next
@ -132,7 +133,8 @@ runLocal runst runner a = case a of
Right result -> runner (next result)
RemoveContent k mts next -> do
let cleanup = do
logStatus k InfoMissing
-- FIXME: Can a live update be done here?
logStatus NoLiveUpdate k InfoMissing
return True
let checkts = case mts of
Nothing -> return True