diff options
author | Joey Hess <joey@kitenet.net> | 2012-07-05 14:34:20 -0600 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-07-05 14:34:20 -0600 |
commit | 71b5ad8398c4d86d5e9b993e175b48f2c5f0861d (patch) | |
tree | 46bd1db5caa16256b948146ecd2d61057bed44fb /Assistant/DaemonStatus.hs | |
parent | e8df726d07657c82c012a02697282c2bc642e742 (diff) |
wrote transfer thread
finally!
Diffstat (limited to 'Assistant/DaemonStatus.hs')
-rw-r--r-- | Assistant/DaemonStatus.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Assistant/DaemonStatus.hs b/Assistant/DaemonStatus.hs index a3e909904..40816bb1a 100644 --- a/Assistant/DaemonStatus.hs +++ b/Assistant/DaemonStatus.hs @@ -31,12 +31,14 @@ data DaemonStatus = DaemonStatus -- Last time the sanity checker ran , lastSanityCheck :: Maybe POSIXTime -- Currently running file content transfers - , currentTransfers :: M.Map Transfer TransferInfo + , currentTransfers :: TransferMap -- Ordered list of remotes to talk to. , knownRemotes :: [Remote] } deriving (Show) +type TransferMap = M.Map Transfer TransferInfo + type DaemonStatusHandle = MVar DaemonStatus newDaemonStatus :: DaemonStatus @@ -132,3 +134,8 @@ afterLastDaemonRun timestamp status = maybe False (< t) (lastRunning status) tenMinutes :: Int tenMinutes = 10 * 60 + +{- Mutates the transfer map. -} +adjustTransfers :: DaemonStatusHandle -> (TransferMap -> TransferMap) -> Annex () +adjustTransfers dstatus a = modifyDaemonStatus dstatus $ + \s -> s { currentTransfers = a (currentTransfers s) } |