From 8c4bfe2f2141bce84ea22120da445c148b6f1168 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 6 Apr 2014 19:06:03 -0400 Subject: added git-annex remotedaemon So far, handling connecting to git-annex-shell notifychanges, and pulling immediately when a change is pushed to a remote. A little bit buggy (crashes after the first pull), but it already works! This commit was sponsored by Mark Sheppard. --- RemoteDaemon/Transport/Ssh/Types.hs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 RemoteDaemon/Transport/Ssh/Types.hs (limited to 'RemoteDaemon/Transport/Ssh') diff --git a/RemoteDaemon/Transport/Ssh/Types.hs b/RemoteDaemon/Transport/Ssh/Types.hs new file mode 100644 index 000000000..d3fd314b4 --- /dev/null +++ b/RemoteDaemon/Transport/Ssh/Types.hs @@ -0,0 +1,32 @@ +{- git-remote-daemon, git-annex-shell notifychanges protocol types + - + - Copyright 2014 Joey Hess + - + - Licensed under the GNU GPL version 3 or higher. + -} + +{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} + +module RemoteDaemon.Transport.Ssh.Types ( + Notification(..), + Proto.serialize, + Proto.deserialize, + Proto.formatMessage, +) where + +import qualified Utility.SimpleProtocol as Proto +import RemoteDaemon.Types (RefList) + +data Notification + = READY + | CHANGED RefList + +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 -- cgit v1.2.3