clean up url removal presence update

* rmurl: Fix a case where removing the last url left git-annex thinking
  content was still present in the web special remote.
* SETURLPRESENT, SETURIPRESENT, SETURLMISSING, and SETURIMISSING
  used to update the presence information of the external special remote
  that called them; this was not documented behavior and is no longer done.

Done by making setUrlPresent and setUrlMissing only update presence info
for the web, and only when the url is a web url. See the comment for
reasoning about why that's the right thing to do.

In AddUrl, had to make it update location tracking, to handle the
non-web-url case.

This commit was sponsored by Ewen McNeill on Patreon.
This commit is contained in:
Joey Hess 2018-10-04 17:33:25 -04:00
parent ca66e7b66a
commit 451171b7c1
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
14 changed files with 77 additions and 26 deletions

View file

@ -112,7 +112,7 @@ uploadKey _ _ _ = do
dropKey :: Key -> Annex Bool
dropKey k = do
mapM_ (setUrlMissing bitTorrentUUID k) =<< getBitTorrentUrls k
mapM_ (setUrlMissing k) =<< getBitTorrentUrls k
return True
{- We punt and don't try to check if a torrent has enough seeders

View file

@ -416,9 +416,9 @@ handleRequest' st external req mp responsehandler
<$> getRemoteState (externalUUID external) key
send $ VALUE state
handleRemoteRequest (SETURLPRESENT key url) =
setUrlPresent (externalUUID external) key url
setUrlPresent key url
handleRemoteRequest (SETURLMISSING key url) =
setUrlMissing (externalUUID external) key url
setUrlMissing key url
handleRemoteRequest (SETURIPRESENT key uri) =
withurl (SETURLPRESENT key) uri
handleRemoteRequest (SETURIMISSING key uri) =

View file

@ -195,7 +195,7 @@ store _r info h = fileStorer $ \k f p -> do
void $ storeHelper info h f (T.pack $ bucketObject info k) p
-- Store public URL to item in Internet Archive.
when (isIA info && not (isChunkKey k)) $
setUrlPresent webUUID k (iaPublicUrl info (bucketObject info k))
setUrlPresent k (iaPublicUrl info (bucketObject info k))
return True
storeHelper :: S3Info -> S3Handle -> FilePath -> S3.Object -> MeterUpdate -> Annex (Maybe S3VersionID)

View file

@ -100,7 +100,7 @@ uploadKey _ _ _ = do
dropKey :: Key -> Annex Bool
dropKey k = do
mapM_ (setUrlMissing webUUID k) =<< getWebUrls k
mapM_ (setUrlMissing k) =<< getWebUrls k
return True
checkKey :: Key -> Annex Bool