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.
This commit is contained in:
Joey Hess 2012-08-26 15:39:02 -04:00
parent 4d269db520
commit 271ea49978
13 changed files with 33 additions and 9 deletions

View file

@ -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. -}