summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Remote/External.hs2
-rw-r--r--doc/design/external_special_remote_protocol.mdwn18
2 files changed, 13 insertions, 7 deletions
diff --git a/Remote/External.hs b/Remote/External.hs
index c3297c7ea..1520acea3 100644
--- a/Remote/External.hs
+++ b/Remote/External.hs
@@ -129,6 +129,7 @@ data Response
| COST_UNKNOWN
| INITREMOTE_SUCCESS
| INITREMOTE_FAILURE ErrorMsg
+ | UNKNOWN_REQUEST
deriving (Show)
instance Receivable Response where
@@ -144,6 +145,7 @@ instance Receivable Response where
parseCommand "COST_UNKNOWN" = parse0 COST_UNKNOWN
parseCommand "INITREMOTE-SUCCESS" = parse0 INITREMOTE_SUCCESS
parseCommand "INITREMOTE-FAILURE" = parse1 INITREMOTE_FAILURE
+ parseCommand "UNKNOWN-REQUEST" = parse0 UNKNOWN_REQUEST
parseCommand _ = parseFail
-- Requests that the external remote can send at any time it's in control.
diff --git a/doc/design/external_special_remote_protocol.mdwn b/doc/design/external_special_remote_protocol.mdwn
index a17ce96fc..cfd94f3aa 100644
--- a/doc/design/external_special_remote_protocol.mdwn
+++ b/doc/design/external_special_remote_protocol.mdwn
@@ -79,6 +79,10 @@ remote can send any messages it likes while handling the requests.
Once the special remote has finished performing the request, it should
send one of the corresponding replies listed in the next section.
+More requests may be added over time, so if the special remote sees a
+request it does not understand, it should respond with UNKNOWN-REQUEST
+and continue running.
+
* `PREPARE`
Tells the special remote it's time to prepare itself to be used.
Only run once, at startup, always immediately after the special remote
@@ -141,6 +145,8 @@ while it's handling a request.
Indicates the INITREMOTE succeeded and the remote is ready to use.
* `INITREMOTE-FAILURE ErrorMsg`
Indicates that INITREMOTE failed.
+* `UNKNOWN-REQUEST`
+ Indicates that the special remote does not know how to handle a request.
## special remote messages
@@ -188,12 +194,11 @@ These messages can be sent at any time by either git-annex or the special
remote.
* `ERROR ErrorMsg`
- Generic error. Can be sent at any time if things get messed up.
- When possible, use a more specific reply from the list above.
- It would be a good idea to send this if git-annex sends a command
- you do not support. The program should exit after sending this, as
+ Generic error. Can be sent at any time if things get too messed up
+ to continue. When possible, use a more specific reply from the list above.
+ The special remote program should exit after sending this, as
git-annex will not talk to it any further. If the program receives
- an ERROR, it can try to recover, or exit with its own ERROR.
+ an ERROR from git-annex, it can exit with its own ERROR.
## Simple shell example
@@ -249,8 +254,7 @@ while read line; do
echo REMOVE-SUCCESS "$key"
;;
*)
- echo ERROR "unknown command received: $line"
- exit 1
+ echo UNKNOWN-REQUEST
;;
esac
done