aboutsummaryrefslogtreecommitdiff
path: root/Remote/External
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-12-29 13:39:25 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-12-29 13:39:25 -0400
commitefcba8f9fc8b9322f3c652f4d84ca4f345d45116 (patch)
treeb877703221b4704cd09eae59a6a927b745c2714a /Remote/External
parenta451dcfb3f44a635027b666c5e8757050dc5b123 (diff)
implement PREPARE-FAILURE for Tobias
Diffstat (limited to 'Remote/External')
-rw-r--r--Remote/External/Types.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/Remote/External/Types.hs b/Remote/External/Types.hs
index fbd050fe1..0525cdfee 100644
--- a/Remote/External/Types.hs
+++ b/Remote/External/Types.hs
@@ -14,6 +14,7 @@ module Remote.External.Types (
ExternalLock,
withExternalLock,
ExternalState(..),
+ PrepareStatus(..),
parseMessage,
Sendable(..),
Receivable(..),
@@ -67,9 +68,11 @@ data ExternalState = ExternalState
{ externalSend :: Handle
, externalReceive :: Handle
, externalPid :: ProcessHandle
- , externalPrepared :: Bool
+ , externalPrepared :: PrepareStatus
}
+data PrepareStatus = Unprepared | Prepared | FailedPrepare ErrorMsg
+
-- Constructor is not exported, and only created by newExternal.
data ExternalLock = ExternalLock
@@ -124,6 +127,7 @@ instance Sendable Request where
-- Responses the external remote can make to requests.
data Response
= PREPARE_SUCCESS
+ | PREPARE_FAILURE ErrorMsg
| TRANSFER_SUCCESS Direction Key
| TRANSFER_FAILURE Direction Key ErrorMsg
| CHECKPRESENT_SUCCESS Key
@@ -139,6 +143,7 @@ data Response
instance Receivable Response where
parseCommand "PREPARE-SUCCESS" = parse0 PREPARE_SUCCESS
+ parseCommand "PREPARE-FAILURE" = parse1 PREPARE_FAILURE
parseCommand "TRANSFER-SUCCESS" = parse2 TRANSFER_SUCCESS
parseCommand "TRANSFER-FAILURE" = parse3 TRANSFER_FAILURE
parseCommand "CHECKPRESENT-SUCCESS" = parse1 CHECKPRESENT_SUCCESS