Skip to content

Commit cbfc455

Browse files
committed
Add (Response Wait) in the CLI protocol for heartbeats
Signed-off-by: Zheng Li <[email protected]>
1 parent f465540 commit cbfc455

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

ocaml/xapi/cli_protocol.ml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
(** Used to ensure that we actually are talking to a thin CLI server *)
1919
let major = 0
20-
let minor = 1
20+
let minor = 2
2121

2222
(** A prefix string which should be unique, used to detect that we're talking to
2323
a totally different kind of server (eg a standard HTTP server) *)
@@ -42,9 +42,10 @@ type command =
4242
If the command was "Load" or "Prompt" then the client sends a list
4343
of data chunks. *)
4444
type response =
45-
| OK
46-
| Failed
47-
45+
| OK
46+
| Wait
47+
| Failed
48+
4849
(** When streaming binary data, send in chunks with a known length and a
4950
special End marker at the end. *)
5051
type blob_header =
@@ -72,8 +73,9 @@ let string_of_command = function
7273
| PrintStderr x -> "PrintStderr " ^ x
7374

7475
let string_of_response = function
75-
| OK -> "OK"
76-
| Failed -> "Failed"
76+
| OK -> "OK"
77+
| Wait -> "Wait"
78+
| Failed -> "Failed"
7779

7880
let string_of_blob_header = function
7981
| Chunk x -> "Chunk " ^ (Int32.to_string x)
@@ -182,12 +184,14 @@ let unmarshal_command pos =
182184
| n -> raise (Unknown_tag("command", n))
183185

184186
let marshal_response = function
185-
| OK -> marshal_int 5
187+
| OK -> marshal_int 5
188+
| Wait -> marshal_int 18
186189
| Failed -> marshal_int 6
187190

188191
let unmarshal_response pos =
189192
let tag, pos = unmarshal_int pos in match tag with
190-
| 5 -> OK, pos
193+
| 5 -> OK, pos
194+
| 18 -> Wait, pos
191195
| 6 -> Failed, pos
192196
| n -> raise (Unknown_tag("response", n))
193197

@@ -287,6 +291,7 @@ let examples =
287291
Command (Exit 5);
288292
Response OK;
289293
Response Failed;
294+
Response Wait;
290295
Blob (Chunk 1024l);
291296
Blob (Chunk 10240l);
292297
Blob (Chunk 102400l);

0 commit comments

Comments
 (0)