summaryrefslogtreecommitdiff
path: root/Assistant/DaemonStatus.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-26 15:39:02 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-26 15:39:02 -0400
commit271ea499789410e7c5c1352abe835af0a5001c38 (patch)
tree1672342ee6f1d0c83e98d75562b96e18de96c10a /Assistant/DaemonStatus.hs
parent4d269db5208dca3ce043e716d05a1c7bcc7a6755 (diff)
add support for readonly remotes
Currently only the web special remote is readonly, but it'd be possible to also have readonly drives, or other remotes. These are handled in the assistant by only downloading from them, and never trying to upload to them.
Diffstat (limited to 'Assistant/DaemonStatus.hs')
-rw-r--r--Assistant/DaemonStatus.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/Assistant/DaemonStatus.hs b/Assistant/DaemonStatus.hs
index 4077eec88..8e3b48777 100644
--- a/Assistant/DaemonStatus.hs
+++ b/Assistant/DaemonStatus.hs
@@ -14,6 +14,7 @@ import Utility.ThreadScheduler
import Utility.TempFile
import Utility.NotificationBroadcaster
import Logs.Transfer
+import Logs.Trust
import qualified Remote
import Control.Concurrent.STM
@@ -81,8 +82,13 @@ modifyDaemonStatus dstatus a = do
sendNotification $ changeNotifier s
return b
+{- Remotes ordered by cost, with dead ones thrown out. -}
calcKnownRemotes :: Annex [Remote]
-calcKnownRemotes = concat . Remote.byCost <$> Remote.enabledRemoteList
+calcKnownRemotes = do
+ rs <- concat . Remote.byCost <$> Remote.enabledRemoteList
+ alive <- snd <$> trustPartition DeadTrusted (map Remote.uuid rs)
+ let good r = Remote.uuid r `elem` alive
+ return $ filter good rs
{- Updates the cached ordered list of remotes from the list in Annex
- state. -}