From e0b04f2e37bc8989c24ec4799beb8d0f0f25b4b6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 5 Apr 2014 14:44:48 -0400 Subject: [PATCH] tiny little protocol between git-remote-daemon and git-annex-shell Subset of the git-remote-daemon protocol. --- RemoteDaemon/Endpoint/GitAnnexShell/Types.hs | 29 ++++++++++++++++++++ RemoteDaemon/Types.hs | 2 -- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 RemoteDaemon/Endpoint/GitAnnexShell/Types.hs diff --git a/RemoteDaemon/Endpoint/GitAnnexShell/Types.hs b/RemoteDaemon/Endpoint/GitAnnexShell/Types.hs new file mode 100644 index 0000000000..dd8b59d1db --- /dev/null +++ b/RemoteDaemon/Endpoint/GitAnnexShell/Types.hs @@ -0,0 +1,29 @@ +{- git-remote-daemon, git-annex-shell endpoint, datatypes + - + - Copyright 2014 Joey Hess + - + - Licensed under the GNU GPL version 3 or higher. + -} + +{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} + +module RemoteDaemon.EndPoint.GitAnnexShell.Types where + +import Common.Annex +import qualified Git.Types as Git +import qualified Utility.SimpleProtocol as Proto +import RemoteDaemon.Types (RemoteName, RefList) + +data Notifications + = CHANGED RemoteName RefList + +instance Proto.Sendable Notifications where + formatMessage (CHANGED remote refs) = + ["CHANGED" + , Proto.serialize remote + , Proto.serialize refs + ] + +instance Proto.Receivable Notifications where + parseCommand "CHANGED" = Proto.parse2 CHANGED diff --git a/RemoteDaemon/Types.hs b/RemoteDaemon/Types.hs index 49813fc89c..746b895f61 100644 --- a/RemoteDaemon/Types.hs +++ b/RemoteDaemon/Types.hs @@ -14,8 +14,6 @@ import Common.Annex import qualified Git.Types as Git import qualified Utility.SimpleProtocol as Proto -import Control.Concurrent.STM - -- Messages that the daemon emits. data Emitted = CHANGED RemoteName RefList