summaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
Diffstat (limited to 'Remote')
-rw-r--r--Remote/External.hs7
-rw-r--r--Remote/External/Types.hs4
2 files changed, 11 insertions, 0 deletions
diff --git a/Remote/External.hs b/Remote/External.hs
index f682d242d..a0c3ef2d6 100644
--- a/Remote/External.hs
+++ b/Remote/External.hs
@@ -19,6 +19,7 @@ import Crypto
import Utility.Metered
import Logs.Transfer
import Logs.PreferredContent.Raw
+import Logs.RemoteState
import Config.Cost
import Annex.Content
import Annex.UUID
@@ -235,6 +236,12 @@ handleRequest' lck external req mp responsehandler
expr <- fromMaybe "" . M.lookup (externalUUID external)
<$> preferredContentMapRaw
send $ VALUE expr
+ handleRemoteRequest (SETSTATE key state) =
+ setRemoteState (externalUUID external) key state
+ handleRemoteRequest (GETSTATE key) = do
+ state <- fromMaybe ""
+ <$> getRemoteState (externalUUID external) key
+ send $ VALUE state
handleRemoteRequest (VERSION _) =
sendMessage lck external $ ERROR "too late to send VERSION"
diff --git a/Remote/External/Types.hs b/Remote/External/Types.hs
index e925f0e91..88c2126d7 100644
--- a/Remote/External/Types.hs
+++ b/Remote/External/Types.hs
@@ -170,6 +170,8 @@ data RemoteRequest
| GETUUID
| SETWANTED PreferredContentExpression
| GETWANTED
+ | SETSTATE Key String
+ | GETSTATE Key
deriving (Show)
instance Receivable RemoteRequest where
@@ -183,6 +185,8 @@ instance Receivable RemoteRequest where
parseCommand "GETUUID" = parse0 GETUUID
parseCommand "SETWANTED" = parse1 SETWANTED
parseCommand "GETWANTED" = parse0 GETWANTED
+ parseCommand "SETSTATE" = parse2 SETSTATE
+ parseCommand "GETSTATE" = parse1 GETSTATE
parseCommand _ = parseFail
-- Responses to RemoteRequest.