cleanup daemonStatus accessors

This commit is contained in:
Joey Hess 2012-10-30 14:44:18 -04:00
parent 68118b8986
commit ea8df8fe9f
15 changed files with 29 additions and 29 deletions

View file

@ -18,7 +18,7 @@ import Utility.NotificationBroadcaster
daemonStatusThread :: NamedThread
daemonStatusThread = NamedThread "DaemonStatus" $ do
notifier <- liftIO . newNotificationHandle
=<< changeNotifier <$> daemonStatus
=<< changeNotifier <$> getDaemonStatus
checkpoint
runEvery (Seconds tenMinutes) <~> do
liftIO $ waitNotification notifier
@ -26,4 +26,4 @@ daemonStatusThread = NamedThread "DaemonStatus" $ do
where
checkpoint = do
file <- liftAnnex $ fromRepo gitAnnexDaemonStatusFile
liftIO . writeDaemonStatusFile file =<< daemonStatus
liftIO . writeDaemonStatusFile file =<< getDaemonStatus

View file

@ -41,7 +41,7 @@ pairListenerThread urlrenderer = NamedThread "PairListener" $ do
Just m -> do
sane <- checkSane msg
(pip, verified) <- verificationCheck m
=<< (pairingInProgress <$> daemonStatus)
=<< (pairingInProgress <$> getDaemonStatus)
let wrongstage = maybe False (\p -> pairMsgStage m <= inProgressPairStage p) pip
case (wrongstage, sane, pairMsgStage m) of
-- ignore our own messages, and

View file

@ -89,7 +89,7 @@ xmppClient iowaitpush iodebug iopull = do
pull :: [UUID] -> Assistant ()
pull [] = noop
pull us = do
rs <- filter matching . syncRemotes <$> daemonStatus
rs <- filter matching . syncRemotes <$> getDaemonStatus
debug $ "push notification for" : map (fromUUID . Remote.uuid ) rs
pullone rs =<< liftAnnex (inRepo Git.Branch.current)
where

View file

@ -46,7 +46,7 @@ pushThread = NamedThread "Pusher" $ runEvery (Seconds 2) <~> do
-- Now see if now's a good time to push.
if shouldPush commits
then do
remotes <- filter pushable . syncRemotes <$> daemonStatus
remotes <- filter pushable . syncRemotes <$> getDaemonStatus
unless (null remotes) $
void $ alertWhile (pushAlert remotes) $ do
now <- liftIO $ getCurrentTime

View file

@ -49,7 +49,7 @@ sanityCheckerThread = NamedThread "SanityChecker" $ forever $ do
{- Only run one check per day, from the time of the last check. -}
waitForNextCheck :: Assistant ()
waitForNextCheck = do
v <- lastSanityCheck <$> daemonStatus
v <- lastSanityCheck <$> getDaemonStatus
now <- liftIO getPOSIXTime
liftIO $ threadDelaySeconds $ Seconds $ calcdelay now v
where

View file

@ -22,10 +22,10 @@ transferPollerThread :: NamedThread
transferPollerThread = NamedThread "TransferPoller" $ do
g <- liftAnnex gitRepo
tn <- liftIO . newNotificationHandle =<<
transferNotifier <$> daemonStatus
transferNotifier <$> getDaemonStatus
forever $ do
liftIO $ threadDelay 500000 -- 0.5 seconds
ts <- currentTransfers <$> daemonStatus
ts <- currentTransfers <$> getDaemonStatus
if M.null ts
-- block until transfers running
then liftIO $ waitNotification tn

View file

@ -57,7 +57,7 @@ transferScannerThread = NamedThread "TransferScanner" $ do
- and then the system (or us) crashed, and that info was
- lost.
-}
startupScan = addScanRemotes True =<< syncRemotes <$> daemonStatus
startupScan = addScanRemotes True =<< syncRemotes <$> getDaemonStatus
{- This is a cheap scan for failed transfers involving a remote. -}
failedTransferScan :: Remote -> Assistant ()
@ -122,7 +122,7 @@ expensiveScan rs = unless onlyweb $ do
locs <- loggedLocations key
{- The syncable remotes may have changed since this
- scan began. -}
syncrs <- liftIO $ syncRemotes <$> getDaemonStatus dstatus
syncrs <- liftIO $ syncRemotes <$> getDaemonStatusOld dstatus
present <- inAnnex key
handleDrops' locs syncrs present key (Just f)

View file

@ -133,18 +133,18 @@ onAddSymlink file filestatus = go =<< liftAnnex (Backend.lookupFile file)
link <- liftAnnex $ calcGitLink file key
ifM ((==) link <$> liftIO (readSymbolicLink file))
( do
s <- daemonStatus
s <- getDaemonStatus
checkcontent key s
ensurestaged link s
, do
liftIO $ removeFile file
liftIO $ createSymbolicLink link file
checkcontent key =<< daemonStatus
checkcontent key =<< getDaemonStatus
addlink link
)
go Nothing = do -- other symlink
link <- liftIO (readSymbolicLink file)
ensurestaged link =<< daemonStatus
ensurestaged link =<< getDaemonStatus
{- This is often called on symlinks that are already
- staged correctly. A symlink may have been deleted