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

@ -214,7 +214,7 @@ onAddFile symlinkssupported f fs =
Database.Keys.removeAssociatedFile oldkey
=<< inRepo (toTopFilePath (toRawFilePath file))
unlessM (inAnnex oldkey) $
logStatus oldkey InfoMissing
logStatus NoLiveUpdate oldkey InfoMissing
addlink file key = do
mode <- liftIO $ catchMaybeIO $ fileMode <$> R.getFileStatus (toRawFilePath file)
liftAnnex $ stagePointerFile (toRawFilePath file) mode =<< hashPointerFile key

View file

@ -60,7 +60,7 @@ queueTransfers = queueTransfersMatching (const True)
- condition. Honors preferred content settings. -}
queueTransfersMatching :: (UUID -> Bool) -> Reason -> Schedule -> Key -> AssociatedFile -> Direction -> Assistant Bool
queueTransfersMatching matching reason schedule k f direction
| direction == Download = ifM (liftAnnex $ wantGet True (Just k) f)
| direction == Download = ifM (liftAnnex $ wantGet NoLiveUpdate True (Just k) f)
( go
, return False
)
@ -89,7 +89,7 @@ queueTransfersMatching matching reason schedule k f direction
- already have it. -}
| otherwise = do
s <- locs
filterM (wantGetBy True (Just k) f . Remote.uuid) $
filterM (wantGetBy NoLiveUpdate True (Just k) f . Remote.uuid) $
filter (\r -> not (inset s r || Remote.readonly r))
(syncDataRemotes st)
where

View file

@ -210,11 +210,11 @@ genTransfer t info = case transferRemote info of
shouldTransfer :: Transfer -> TransferInfo -> Annex Bool
shouldTransfer t info
| transferDirection t == Download =
(not <$> inAnnex key) <&&> wantGet True (Just key) file
(not <$> inAnnex key) <&&> wantGet NoLiveUpdate True (Just key) file
| transferDirection t == Upload = case transferRemote info of
Nothing -> return False
Just r -> notinremote r
<&&> wantGetBy True (Just key) file (Remote.uuid r)
<&&> wantGetBy NoLiveUpdate True (Just key) file (Remote.uuid r)
| otherwise = return False
where
key = transferKey t

View file

@ -77,7 +77,7 @@ expireUnused duration = do
debug ["removing old unused key", serializeKey k]
liftAnnex $ tryNonAsync $ do
lockContentForRemoval k noop removeAnnex
logStatus k InfoMissing
logStatus NoLiveUpdate k InfoMissing
where
boundary = durationToPOSIXTime <$> duration
tooold now (_, mt) = case boundary of

View file

@ -101,7 +101,7 @@ startDistributionDownload d = go =<< liftIO . newVersionLocation d =<< liftIO ol
cleanup = liftAnnex $ do
lockContentForRemoval k noop removeAnnex
setUrlMissing k u
logStatus k InfoMissing
logStatus NoLiveUpdate k InfoMissing
{- Called once the download is done.
- Passed an action that can be used to clean up the downloaded file.