diff options
Diffstat (limited to 'RemoteDaemon/EndPoint/GitAnnexShell')
-rw-r--r-- | RemoteDaemon/EndPoint/GitAnnexShell/Types.hs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/RemoteDaemon/EndPoint/GitAnnexShell/Types.hs b/RemoteDaemon/EndPoint/GitAnnexShell/Types.hs new file mode 100644 index 000000000..996c4237c --- /dev/null +++ b/RemoteDaemon/EndPoint/GitAnnexShell/Types.hs @@ -0,0 +1,32 @@ +{- git-remote-daemon, git-annex-shell endpoint, datatypes + - + - Copyright 2014 Joey Hess <joey@kitenet.net> + - + - Licensed under the GNU GPL version 3 or higher. + -} + +{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} + +module RemoteDaemon.EndPoint.GitAnnexShell.Types ( + Notification(..), + Proto.serialize, + Proto.deserialize, + Proto.formatMessage, +) where + +import qualified Utility.SimpleProtocol as Proto +import RemoteDaemon.Types (ShaList) + +data Notification + = READY + | CHANGED ShaList + +instance Proto.Sendable Notification where + formatMessage READY = ["READY"] + formatMessage (CHANGED shas) = ["CHANGED", Proto.serialize shas] + +instance Proto.Receivable Notification where + parseCommand "READY" = Proto.parse0 READY + parseCommand "CHANGED" = Proto.parse1 CHANGED + parseCommand _ = Proto.parseFail |