wireproto: add frame flag to denote payloads as CBOR
authorGregory Szorc <gregory.szorc@gmail.com>
Wed, 28 Mar 2018 13:30:24 -0700
changeset 37299 e9aadee698cf
parent 37298 5ef2da00e935
child 37300 2f859ad7ed8c
wireproto: add frame flag to denote payloads as CBOR We may eventually want a separate frame type for this. But for now this is the easiest to implement. Differential Revision: https://phab.mercurial-scm.org/D2986
mercurial/help/internals/wireprotocol.txt
mercurial/wireprotoframing.py
--- a/mercurial/help/internals/wireprotocol.txt	Wed Mar 28 13:01:28 2018 -0700
+++ b/mercurial/help/internals/wireprotocol.txt	Wed Mar 28 13:30:24 2018 -0700
@@ -631,19 +631,21 @@
    server. The command has been fully issued and no new data for this
    command will be sent. The next frame will belong to a new command.
 
-Bytes Response Data (``0x04``)
-------------------------------
+Response Data (``0x04``)
+------------------------
 
-This frame contains raw bytes response data to an issued command.
+This frame contains raw response data to an issued command.
 
 The following flag values are defined for this type:
 
 0x01
-   Data continuation. When set, an additional frame containing raw
-   response data will follow.
+   Data continuation. When set, an additional frame containing response data
+   will follow.
 0x02
-   End of data. When sent, the response data has been fully sent and
+   End of data. When set, the response data has been fully sent and
    no additional frames for this response will be sent.
+0x04
+   CBOR data. When set, the frame payload consists of CBOR data.
 
 The ``0x01`` flag is mutually exclusive with the ``0x02`` flag.
 
--- a/mercurial/wireprotoframing.py	Wed Mar 28 13:01:28 2018 -0700
+++ b/mercurial/wireprotoframing.py	Wed Mar 28 13:30:24 2018 -0700
@@ -79,10 +79,12 @@
 
 FLAG_BYTES_RESPONSE_CONTINUATION = 0x01
 FLAG_BYTES_RESPONSE_EOS = 0x02
+FLAG_BYTES_RESPONSE_CBOR = 0x04
 
 FLAGS_BYTES_RESPONSE = {
     b'continuation': FLAG_BYTES_RESPONSE_CONTINUATION,
     b'eos': FLAG_BYTES_RESPONSE_EOS,
+    b'cbor': FLAG_BYTES_RESPONSE_CBOR,
 }
 
 FLAG_ERROR_RESPONSE_PROTOCOL = 0x01