update Annex.reposizes when changing location logs
The live update is only needed when Annex.reposizes has already been populated.
This commit is contained in:
parent
c376b1bd7e
commit
06064f897c
8 changed files with 69 additions and 28 deletions
|
@ -32,7 +32,7 @@ recordContentIdentifier :: RemoteStateHandle -> ContentIdentifier -> Key -> Anne
|
|||
recordContentIdentifier (RemoteStateHandle u) cid k = do
|
||||
c <- currentVectorClock
|
||||
config <- Annex.getGitConfig
|
||||
Annex.Branch.maybeChange
|
||||
void $ Annex.Branch.maybeChange
|
||||
(Annex.Branch.RegardingUUID [u])
|
||||
(remoteContentIdentifierLogFile config k)
|
||||
(addcid c . parseLog)
|
||||
|
|
|
@ -40,6 +40,7 @@ module Logs.Location (
|
|||
import Annex.Common
|
||||
import qualified Annex.Branch
|
||||
import Annex.Branch (FileContents)
|
||||
import Annex.RepoSize.LiveUpdate
|
||||
import Logs
|
||||
import Logs.Presence
|
||||
import Types.Cluster
|
||||
|
@ -81,11 +82,13 @@ logChange key u@(UUID _) s
|
|||
| isClusterUUID u = noop
|
||||
| otherwise = do
|
||||
config <- Annex.getGitConfig
|
||||
maybeAddLog
|
||||
changed <- maybeAddLog
|
||||
(Annex.Branch.RegardingUUID [u])
|
||||
(locationLogFile config key)
|
||||
s
|
||||
(LogInfo (fromUUID u))
|
||||
when changed $
|
||||
updateRepoSize u key s
|
||||
logChange _ NoUUID _ = noop
|
||||
|
||||
{- Returns a list of repository UUIDs that, according to the log, have
|
||||
|
@ -162,14 +165,15 @@ setDead key = do
|
|||
ls <- compactLog <$> readLog logfile
|
||||
mapM_ (go logfile) (filter (\l -> status l == InfoMissing) ls)
|
||||
where
|
||||
go logfile l =
|
||||
go logfile l = do
|
||||
let u = toUUID (fromLogInfo (info l))
|
||||
c = case date l of
|
||||
VectorClock v -> CandidateVectorClock $
|
||||
v + realToFrac (picosecondsToDiffTime 1)
|
||||
Unknown -> CandidateVectorClock 0
|
||||
in addLog' (Annex.Branch.RegardingUUID [u]) logfile InfoDead
|
||||
addLog' (Annex.Branch.RegardingUUID [u]) logfile InfoDead
|
||||
(info l) c
|
||||
updateRepoSize u key InfoDead
|
||||
|
||||
data Unchecked a = Unchecked (Annex (Maybe a))
|
||||
|
||||
|
|
|
@ -49,8 +49,10 @@ addLog' ru file logstatus loginfo c =
|
|||
{- When a LogLine already exists with the same status and info, but an
|
||||
- older timestamp, that LogLine is preserved, rather than updating the log
|
||||
- with a newer timestamp.
|
||||
-
|
||||
- Returns True when the log was changed.
|
||||
-}
|
||||
maybeAddLog :: Annex.Branch.RegardingUUID -> RawFilePath -> LogStatus -> LogInfo -> Annex ()
|
||||
maybeAddLog :: Annex.Branch.RegardingUUID -> RawFilePath -> LogStatus -> LogInfo -> Annex Bool
|
||||
maybeAddLog ru file logstatus loginfo = do
|
||||
c <- currentVectorClock
|
||||
Annex.Branch.maybeChange ru file $ \b ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue