invalidate caches after log changes
authorJoey Hess <joeyh@joeyh.name>
Fri, 20 Sep 2024 20:52:17 +0000 (16:52 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 20 Sep 2024 20:52:17 +0000 (16:52 -0400)
This seems like something Annex.Sim would need to happen. And generally
a really good idea.

Logs/MaxSize.hs
Logs/NumCopies.hs
Logs/PreferredContent/Raw.hs
Logs/UUID.hs

index 0f69e202e722505fd3aba3d881744b7a5a7a4a12..dbd69928ea43bb0c0a1bcd115c9214555a2cf2de 100644 (file)
@@ -39,6 +39,7 @@ recordMaxSize uuid maxsize = do
                (buildLogNew buildMaxSize)
                        . changeLog c uuid maxsize
                        . parseLogNew parseMaxSize
+       Annex.changeState $ \s -> s { Annex.maxsizes = Nothing }
 
 buildMaxSize :: MaxSize -> Builder
 buildMaxSize (MaxSize n) = byteString (encodeBS (show n))
index 7579baf3f385403a48c7d6339d82233ff4c9ce6b..263aed5f5f95eb5d5606235a0c0700e5f9141626 100644 (file)
@@ -36,12 +36,14 @@ setGlobalNumCopies new = do
        curr <- getGlobalNumCopies
        when (curr /= Just new) $
                setLog (Annex.Branch.RegardingUUID []) numcopiesLog new
+       Annex.changeState $ \s -> s { Annex.globalnumcopies = Nothing }
 
 setGlobalMinCopies :: MinCopies -> Annex ()
 setGlobalMinCopies new = do
        curr <- getGlobalMinCopies
        when (curr /= Just new) $
                setLog (Annex.Branch.RegardingUUID []) mincopiesLog new
+       Annex.changeState $ \s -> s { Annex.globalmincopies = Nothing }
 
 {- Value configured in the numcopies log. Cached for speed. -}
 getGlobalNumCopies :: Annex (Maybe NumCopies)
index b5a1b3932c129fb3da63ccd2974e6635449960a0..e86347d37554b484786d86c561d9462b277aefdf 100644 (file)
@@ -23,10 +23,14 @@ import Data.ByteString.Builder
 
 {- Changes the preferred content configuration of a remote. -}
 preferredContentSet :: UUID -> PreferredContentExpression -> Annex ()
-preferredContentSet = setLog preferredContentLog
+preferredContentSet u expr = do
+       setLog preferredContentLog u expr
+       Annex.changeState $ \st -> st { Annex.preferredcontentmap = Nothing }
 
 requiredContentSet :: UUID -> PreferredContentExpression -> Annex ()
-requiredContentSet = setLog requiredContentLog
+requiredContentSet u expr = do
+       setLog requiredContentLog u expr
+       Annex.changeState $ \st -> st { Annex.requiredcontentmap = Nothing }
 
 setLog :: RawFilePath -> UUID -> PreferredContentExpression -> Annex ()
 setLog logfile uuid@(UUID _) val = do
index 1a3142e198d04de9f1e17e5a841fa70e83eca98b..17df43bdf434767faa26981b24a24e4babbcdc4b 100644 (file)
@@ -39,6 +39,7 @@ describeUUID uuid desc = do
        c <- currentVectorClock
        Annex.Branch.change (Annex.Branch.RegardingUUID [uuid]) uuidLog $
                buildLogOld builder . changeLog c uuid desc . parseUUIDLog
+       Annex.changeState $ \s -> s { Annex.uuiddescmap = Nothing }
   where
        builder (UUIDDesc b) = byteString (escnewline b)
        -- Escape any newline in the description, since newlines cannot