summaryrefslogtreecommitdiff
path: root/RemoteClass.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-03-28 23:51:07 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-03-28 23:51:07 -0400
commita3b6586902d6689b07c050b1fc50e19f4115c42e (patch)
tree51d1658cd393c31435cda2b618e03f68563b645a /RemoteClass.hs
parentb1db436816b6b70ff0b9891bbc4a5468d9b895b3 (diff)
update
Diffstat (limited to 'RemoteClass.hs')
-rw-r--r--RemoteClass.hs17
1 files changed, 16 insertions, 1 deletions
diff --git a/RemoteClass.hs b/RemoteClass.hs
index eb4a01748..f3cc9379b 100644
--- a/RemoteClass.hs
+++ b/RemoteClass.hs
@@ -10,6 +10,7 @@
module RemoteClass where
import Control.Exception
+import Data.Map as M
import Key
@@ -18,6 +19,15 @@ import Key
- that are not cheap to set up. -}
type RemoteGenerator a = ([a (Remote a)], [String])
+{- There are different types of remotes. -}
+data RemoteType a = RemoteType {
+ -- human visible type name
+ typename :: String,
+ -- generates remotes of this type
+ generator :: a (RemoteGenerator a)
+}
+
+{- An individual remote. -}
data Remote a = Remote {
-- each Remote has a unique uuid
uuid :: String,
@@ -36,7 +46,12 @@ data Remote a = Remote {
hasKey :: Key -> a (Either IOException Bool),
-- Some remotes can check hasKey without an expensive network
-- operation.
- hasKeyCheap :: Bool
+ hasKeyCheap :: Bool,
+ -- a Remote may have a persistent configuration store
+ hasConfig :: Bool,
+ config :: Maybe (M.Map String String),
+ -- initializes or changes the config of a remote
+ setup :: M.Map String String -> a ()
}
instance Show (Remote a) where