@@ -80,6 +80,7 @@ The IPROTO constants that identify requests that we will mention in this section
80
80
IPROTO_VOTE=0x44
81
81
IPROTO_FETCH_SNAPSHOT=0x45
82
82
IPROTO_REGISTER=0x46
83
+ IPROTO_ID=0x49
83
84
84
85
The IPROTO constants that appear within requests or responses that we will describe in this section are:
85
86
@@ -140,6 +141,8 @@ The IPROTO constants that appear within requests or responses that we will descr
140
141
IPROTO_RAFT_VOTE=0x01
141
142
IPROTO_RAFT_STATE=0x02
142
143
IPROTO_RAFT_VCLOCK=0x03
144
+ IPROTO_VERSION=0x54
145
+ IPROTO_FEATURES=0x55
143
146
144
147
145
148
To denote message descriptions we will say ``msgpack(...) `` and within it we will use modified
@@ -800,6 +803,53 @@ The body is a 2-item map:
800
803
IPROTO_LSN: :samp: `{ {MP_INT integer } } `
801
804
})
802
805
806
+ .. _box_protocol-id :
807
+
808
+ IPROTO_ID = 0x49
809
+ ~~~~~~~~~~~~~~~~~~~~~~
810
+
811
+ Clients send this message to inform the server about the protocol version and
812
+ features they support. Based on this information, the server can enable or
813
+ disable certain features in interacting with these clients.
814
+
815
+ The body is a 2-item map:
816
+
817
+ .. cssclass :: highlight
818
+ .. parsed-literal ::
819
+
820
+ # <size>
821
+ msgpack(:samp: `{ {MP_UINT unsigned integer = size(<header>) + size(<body>) } } `)
822
+ # <header>
823
+ msgpack({
824
+ IPROTO_REQUEST_TYPE: IPROTO_ID,
825
+ IPROTO_SYNC: :samp: `{ {MP_UINT unsigned integer } } `
826
+ })
827
+ # <body>
828
+ msgpack({
829
+ IPROTO_VERSION: :samp: `{ {MP_UINT unsigned integer } }} `,
830
+ IPROTO_FEATURES: :samp: `{ {MP_ARRAY array of unsigned integers } }} `
831
+ })
832
+
833
+ IPROTO_VERSION is an integer number reflecting the version of protocol that the
834
+ client supports. The latest IPROTO_VERSION is |iproto_version |.
835
+
836
+ Available IPROTO_FEATURES are the following:
837
+
838
+ - ``IPROTO_FEATURE_STREAMS = 0 `` -- streams support: :ref: `IPROTO_STREAM_ID <box_protocol-iproto_stream_id >`
839
+ in the request header.
840
+ - ``IPROTO_FEATURE_TRANSACTIONS = 1 `` -- transaction support: IPROTO_BEGIN,
841
+ IPROTO_COMMIT, and IPROTO_ROLLBACK commands (with :ref: `IPROTO_STREAM_ID <box_protocol-iproto_stream_id >`
842
+ in the request header). Learn more about :ref: `sending transaction commands <box_protocol-stream_transactions >`.
843
+ - ``IPROTO_FEATURE_ERROR_EXTENSION = 2 `` -- :ref: `MP_ERROR <msgpack_ext-error >`
844
+ MsgPack extension support. Clients that don't support this feature will receive
845
+ error responses for :ref: `IPROTO_EVAL <box_protocol-eval >` and
846
+ :ref: `IPROTO_CALL <box_protocol-call >` encoded to string error messages.
847
+ - ``IPROTO_FEATURE_WATCHERS = 3 `` -- remote watchers support: IPROTO_WATCH,
848
+ IPROTO_UNWATCH, and IPROTO_EVENT commands.
849
+ .. // TODO: document remote watchers commands
850
+
851
+ IPROTO_ID requests can be processed without authentication.
852
+
803
853
804
854
.. _box_protocol-responses :
805
855
@@ -832,12 +882,20 @@ For IPROTO_OK, the header Response-Code-Indicator will be 0 and the body is a 1-
832
882
IPROTO_DATA: :samp: `{ {any type } } `
833
883
})
834
884
835
- For :ref: `IPROTO_PING <box_protocol-ping >` the body will be an empty map.
836
- For most data-access requests (IPROTO_SELECT IPROTO_INSERT IPROTO_DELETE etc.)
837
- the body is an IPROTO_DATA map with an array of tuples that contain an array of fields.
838
- For :ref: `IPROTO_EVAL <box_protocol-eval >` and :ref: `IPROTO_CALL <box_protocol-call >`
839
- it will usually be an array but, since Lua requests can result in a wide variety
840
- of structures, bodies can have a wide variety of structures.
885
+ - For :ref: `IPROTO_PING <box_protocol-ping >` the body will be an empty map.
886
+
887
+ - For most data-access requests (:ref: `IPROTO_SELECT <box_protocol-select >`,
888
+ :ref: `IPROTO_INSERT <box_protocol-insert >`, :ref: `IPROTO_DELETE <box_protocol-delete >`
889
+ , etc.) the body is an IPROTO_DATA map with an array of tuples that contain
890
+ an array of fields.
891
+
892
+ - For :ref: `IPROTO_EVAL <box_protocol-eval >` and :ref: `IPROTO_CALL <box_protocol-call >`
893
+ it will usually be an array but, since Lua requests can result in a wide variety
894
+ of structures, bodies can have a wide variety of structures.
895
+
896
+ - For :ref: `IPROTO_ID <box_protocol-id >`, the response body has the same structure as
897
+ the request body. It informs the client about the protocol version and features
898
+ that the server supports.
841
899
842
900
Example: if this is the fifth message and the request is
843
901
:codenormal: `box.space. `:codeitalic: `space-name `:codenormal: `:insert{6} `,
@@ -1171,9 +1229,8 @@ function ``netbox_encode_auth``.
1171
1229
1172
1230
.. _box_protocol-streams :
1173
1231
1174
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1175
1232
Binary protocol -- streams
1176
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1233
+ --------------------------
1177
1234
1178
1235
The :ref: `Streams and interactive transactions <box_stream >`
1179
1236
feature, which was added in Tarantool version
@@ -1221,6 +1278,8 @@ that the header will contain an additional item: IPROTO_STREAM_ID=0x0a
1221
1278
with MP_UINT=0x01. It happens to equal 1 for this example because
1222
1279
each call to conn:new_stream() assigns a new number, starting with 1.
1223
1280
1281
+ .. _box_protocol-stream_transactions :
1282
+
1224
1283
The client makes stream transactions by sending, in order:
1225
1284
IPROTO_BEGIN, the transaction data-change and query requests,
1226
1285
IPROTO_COMMIT or IPROTO_ROLLBACK.
0 commit comments