summaryrefslogtreecommitdiff
path: root/RemoteDaemon/Types.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-04-08 13:41:36 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-04-08 13:42:57 -0400
commit6e47a1412175cbc00f44ea8dc663ad83331cfb6d (patch)
treeecd8cec02d1a56ea38513cfb893b86504c606a3c /RemoteDaemon/Types.hs
parent4772321f6a7359f282270c48be0e73563f8d7ae6 (diff)
cleaned up AnnexState handling in transports
Diffstat (limited to 'RemoteDaemon/Types.hs')
-rw-r--r--RemoteDaemon/Types.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/RemoteDaemon/Types.hs b/RemoteDaemon/Types.hs
index 5cb0ef758..025c602df 100644
--- a/RemoteDaemon/Types.hs
+++ b/RemoteDaemon/Types.hs
@@ -18,14 +18,20 @@ import Control.Concurrent
-- A Transport for a particular git remote consumes some messages
-- from a Chan, and emits others to another Chan.
-type Transport = Git.Repo -> RemoteName -> Annex.AnnexState -> Chan Consumed -> Chan Emitted -> IO ()
+type Transport = RemoteRepo -> RemoteName -> TransportHandle -> Chan Consumed -> Chan Emitted -> IO ()
+
+type RemoteRepo = Git.Repo
+type LocalRepo = Git.Repo
+
+-- All Transports share a single AnnexState MVar
+data TransportHandle = TransportHandle LocalRepo (MVar Annex.AnnexState)
-- Messages that the daemon emits.
data Emitted
= CONNECTED RemoteName
| DISCONNECTED RemoteName
| SYNCING RemoteName
- | DONESYNCING RemoteName Bool
+ | DONESYNCING Bool RemoteName
-- Messages that the deamon consumes.
data Consumed
@@ -45,8 +51,8 @@ instance Proto.Sendable Emitted where
["DISCONNECTED", Proto.serialize remote]
formatMessage (SYNCING remote) =
["SYNCING", Proto.serialize remote]
- formatMessage (DONESYNCING remote status) =
- ["DONESYNCING", Proto.serialize remote, Proto.serialize status]
+ formatMessage (DONESYNCING status remote) =
+ ["DONESYNCING", Proto.serialize status, Proto.serialize remote]
instance Proto.Sendable Consumed where
formatMessage PAUSE = ["PAUSE"]