aboutsummaryrefslogtreecommitdiff
path: root/RemoteDaemon/Types.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-12-09 14:52:38 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-12-09 15:01:09 -0400
commitb3b800bb6140543306ec65751506ae2862ca345f (patch)
tree6357ef2d4ea6a6f302b9b00f45d25e4c997b5ec2 /RemoteDaemon/Types.hs
parent94e91f857e9ae3522c31c3d2268475aeae45fdb3 (diff)
refactor ref change watching
Added to change notification to P2P protocol. Switched to a TBChan so that a single long-running thread can be started, and serve perhaps intermittent requests for change notifications, without buffering all changes in memory. The P2P runner currently starts up a new thread each times it waits for a change, but that should allow later reusing a thread. Although each connection from a peer will still need a new watcher thread to run. The dependency on stm-chans is more or less free; some stuff in yesod uses it, so it was already indirectly pulled in when building with the webapp. This commit was sponsored by Francois Marier on Patreon.
Diffstat (limited to 'RemoteDaemon/Types.hs')
-rw-r--r--RemoteDaemon/Types.hs10
1 files changed, 2 insertions, 8 deletions
diff --git a/RemoteDaemon/Types.hs b/RemoteDaemon/Types.hs
index ba88aa685..c0d74e038 100644
--- a/RemoteDaemon/Types.hs
+++ b/RemoteDaemon/Types.hs
@@ -5,7 +5,6 @@
- Licensed under the GNU GPL version 3 or higher.
-}
-{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module RemoteDaemon.Types where
@@ -15,6 +14,7 @@ import qualified Annex
import qualified Git.Types as Git
import qualified Utility.SimpleProtocol as Proto
import Types.GitConfig
+import Annex.ChangedRefs (ChangedRefs)
import Network.URI
import Control.Concurrent
@@ -52,13 +52,11 @@ data Consumed
= PAUSE
| LOSTNET
| RESUME
- | CHANGED RefList
+ | CHANGED ChangedRefs
| RELOAD
| STOP
deriving (Show)
-type RefList = [Git.Ref]
-
instance Proto.Sendable Emitted where
formatMessage (CONNECTED remote) =
["CONNECTED", Proto.serialize remote]
@@ -100,10 +98,6 @@ instance Proto.Serializable RemoteURI where
serialize (RemoteURI u) = show u
deserialize = RemoteURI <$$> parseURI
-instance Proto.Serializable RefList where
- serialize = unwords . map Git.fromRef
- deserialize = Just . map Git.Ref . words
-
instance Proto.Serializable Bool where
serialize False = "0"
serialize True = "1"