Skip to content

Commit b513b85

Browse files
committed
Apply suggestions from code review
1 parent 86dd9a3 commit b513b85

File tree

16 files changed

+66
-68
lines changed

16 files changed

+66
-68
lines changed

doc/dev_guide/internals/iproto/requests.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Overview
4040

4141
* - :ref:`IPROTO_UNKNOWN <internals-iproto-unknown>`
4242
- -1 |br| MP_UINT
43-
- Unknown request type
43+
- An unknown request type
4444

4545
* - :ref:`IPROTO_SELECT <box_protocol-select>`
4646
- 0x01
@@ -139,7 +139,7 @@ Since :doc:`2.11.0 </release/2.11.0>`.
139139

140140
Code: -1.
141141

142-
Unknown request type. The constant is used to override the handler of unknown IPROTO request types.
142+
An unknown request type. The constant is used to override the handler of unknown IPROTO request types.
143143
Learn more: :ref:`box.iproto.override() <reference_lua-box_iproto_override>` and :ref:`box_iproto_override <box_box_iproto_override>`.
144144

145145
.. _box_protocol-select:

doc/dev_guide/reference_capi/box.rst

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
:return: -1 on error (check :ref:`box_error_last()<c_api-error-box_error_last>`)
106106
:return: 0 otherwise
107107
108-
See also :ref:`space_object.insert()<box_space-insert>`
108+
See also: :ref:`space_object.insert()<box_space-insert>`
109109
110110
.. _box-box_replace:
111111
@@ -122,7 +122,7 @@
122122
:return: -1 on error (check :ref:`box_error_last()<c_api-error-box_error_last>`)
123123
:return: 0 otherwise
124124
125-
See also :ref:`space_object.replace()<box_space-replace>`
125+
See also: :ref:`space_object.replace()<box_space-replace>`
126126
127127
.. c:function:: int box_delete(uint32_t space_id, uint32_t index_id, const char *key, const char *key_end, box_tuple_t **result)
128128
@@ -138,7 +138,7 @@
138138
:return: -1 on error (check :ref:`box_error_last()<c_api-error-box_error_last>`)
139139
:return: 0 otherwise
140140
141-
See also :ref:`space_object.delete()<box_space-delete>`
141+
See also: :ref:`space_object.delete()<box_space-delete>`
142142
143143
.. c:function:: int box_update(uint32_t space_id, uint32_t index_id, const char *key, const char *key_end, const char *ops, const char *ops_end, int index_base, box_tuple_t **result)
144144
@@ -159,7 +159,7 @@
159159
:return: -1 on error (check :ref:`box_error_last()<c_api-error-box_error_last>`)
160160
:return: 0 otherwise
161161
162-
See also :ref:`space_object.update()<box_space-update>`
162+
See also: :ref:`space_object.update()<box_space-update>`
163163
164164
.. c:function:: int box_upsert(uint32_t space_id, uint32_t index_id, const char *tuple, const char *tuple_end, const char *ops, const char *ops_end, int index_base, box_tuple_t **result)
165165
@@ -180,7 +180,7 @@
180180
:return: -1 on error (check :ref:`box_error_last()<c_api-error-box_error_last>`)
181181
:return: 0 otherwise
182182
183-
See also :ref:`space_object.upsert()<box_space-upsert>`
183+
See also: :ref:`space_object.upsert()<box_space-upsert>`
184184
185185
.. c:function:: int box_truncate(uint32_t space_id)
186186
@@ -230,7 +230,7 @@
230230
:return: the database schema version
231231
:rtype: number
232232
233-
See also :ref:`box.info.schema_version <box_info_schema_version>` and :ref:`IPROTO_SCHEMA_VERSION <internals-iproto-keys-schema_version>`
233+
See also: :ref:`box.info.schema_version <box_info_schema_version>` and :ref:`IPROTO_SCHEMA_VERSION <internals-iproto-keys-schema_version>`
234234
235235
.. _box_box_session_id:
236236
@@ -239,11 +239,10 @@
239239
Since version :doc:`2.11.0 </release/2.11.0>`.
240240
Return the unique identifier (ID) for the current session.
241241
242-
:return: the unique identifier (ID) for the current session
243-
:return: 0 or -1 if there is no session
242+
:return: the session identifier; 0 or -1 if there is no session
244243
:rtype: number
245244
246-
See also :ref:`box.session.id() <box_session-id>`
245+
See also: :ref:`box.session.id() <box_session-id>`
247246
248247
.. _box_box_iproto_send:
249248
@@ -255,24 +254,23 @@
255254
The function yields.
256255
The function works for binary sessions only. For details, see :ref:`box.session.type() <box_session-type>`.
257256
258-
:param uint32_t sid: IPROTO session identifier (see :ref:`box_session_id() <box_box_session_id>`)
257+
:param uint32_t sid: the IPROTO session identifier (see :ref:`box_session_id() <box_box_session_id>`)
259258
:param char* header: a MsgPack-encoded header
260259
:param char* header_end: end of a header encoded as MsgPack
261260
:param char* body: a MsgPack-encoded body. If the ``body`` and ``body_end`` parameters are omitted, the packet
262261
consists of the header only.
263262
:param char* body_end: end of a body encoded as MsgPack
264263
265-
:return: 0 on success
266-
:return: -1 on error (check :ref:`box_error_last() <c_api-error-box_error_last>`)
264+
:return: 0 on success; -1 on error (check :ref:`box_error_last() <c_api-error-box_error_last>`)
267265
:rtype: number
268266
269-
See also :ref:`box.iproto.send() <reference_lua-box_iproto_send>`
267+
See also: :ref:`box.iproto.send() <reference_lua-box_iproto_send>`
270268
271269
**Possible errors:**
272270
273271
* :errcode:`ER_SESSION_CLOSED` -- the session is closed.
274272
* :errcode:`ER_NO_SUCH_SESSION` -- the session does not exist.
275-
* :errcode:`ER_MEMORY_ISSUE` -- out of memory limit has been reached.
273+
* :errcode:`ER_MEMORY_ISSUE` -- out-of-memory limit has been reached.
276274
* :errcode:`ER_WRONG_SESSION_TYPE` -- the session type is not binary.
277275
278276
For details, see `src/box/errcode.h <https://github.com/tarantool/tarantool/blob/master/src/box/errcode.h>`__.
@@ -335,11 +333,10 @@
335333
336334
:param void* ctx: a context passed to the ``handler`` and ``destroy`` callbacks
337335
338-
:return: 0 on success
339-
:return: -1 on error (check :ref:`box_error_last() <c_api-error-box_error_last>`)
336+
:return: 0 on success; -1 on error (check :ref:`box_error_last() <c_api-error-box_error_last>`)
340337
:rtype: number
341338
342-
See also :ref:`box.iproto.override() <reference_lua-box_iproto_override>`
339+
See also: :ref:`box.iproto.override() <reference_lua-box_iproto_override>`
343340
344341
**Possible errors:**
345342

doc/reference/reference_lua/box_info/schema_version.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ box.info.schema_version
2323
- 84
2424
...
2525
26-
See also :ref:`IPROTO_SCHEMA_VERSION <internals-iproto-keys-schema_version>`
26+
See also: :ref:`IPROTO_SCHEMA_VERSION <internals-iproto-keys-schema_version>`

doc/reference/reference_lua/box_iproto.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The ``box.iproto`` submodule provides the ability to work with the network subsy
99
It allows you to extend the :ref:`IPROTO <box_protocol>` functionality from Lua.
1010
With this submodule, you can:
1111

12-
* :ref:`parse the unknown IPROTO requests types <reference_lua-box_iproto_override>`
12+
* :ref:`parse unknown IPROTO request types <reference_lua-box_iproto_override>`
1313
* :ref:`send arbitrary IPROTO packets <reference_lua-box_iproto_send>`
1414
* :ref:`override the behavior <reference_lua-box_iproto_override>` of the existing and unknown request types in the binary protocol
1515

@@ -24,11 +24,11 @@ IPROTO constants in the ``box.iproto`` namespace are written in uppercase letter
2424
The constants are divided into several groups:
2525

2626
* :ref:`key <reference_lua-box_iproto_key>` (:ref:`IPROTO_SYNC <internals-iproto-keys-sync>`, :ref:`IPROTO_REQUEST_TYPE <internals-iproto-keys-request_type>`)
27-
* :ref:`request type <reference_lua-box_iproto_type>` (:ref:`IPROTO_OK <internals-iproto-ok>`)
28-
* :ref:`flag <reference_lua-box_iproto_flag>` (:ref:`IPROTO_COMMIT <box_protocol-commit>`)
27+
* :ref:`request type <reference_lua-box_iproto_type>` (for example, :ref:`IPROTO_OK <internals-iproto-ok>`)
28+
* :ref:`flag <reference_lua-box_iproto_flag>` (for example, :ref:`IPROTO_COMMIT <box_protocol-commit>`)
2929
* :ref:`ballot key <reference_lua-box_iproto_ballot>` (:ref:`IPROTO_FLAG_COMMIT <box_protocol-flags>`)
30-
* :ref:`metadata key <reference_lua-box_iproto_metadata>` (:ref:`IPROTO_FIELD_IS_NULLABLE <internals-iproto-keys-sql-specific>`)
31-
* :ref:`RAFT key <reference_lua-box_iproto_raft>` (:ref:`IPROTO_TERM <internals-iproto-keys-term>`)
30+
* :ref:`metadata key <reference_lua-box_iproto_metadata>` (for example, :ref:`IPROTO_FIELD_IS_NULLABLE <internals-iproto-keys-sql-specific>`)
31+
* :ref:`RAFT key <reference_lua-box_iproto_raft>` (for example, :ref:`IPROTO_TERM <internals-iproto-keys-term>`)
3232

3333
Each group is located in the corresponding subnamespace without the prefix.
3434
For example:
@@ -67,11 +67,11 @@ The example converts the feature names from ``box.iproto.protocol_features`` set
6767
6868
-- Features supported by the server
6969
box.iproto.protocol_features = {
70-
streams = true,
71-
transactions = true,
72-
error_extension = true,
73-
watchers = true,
74-
pagination = true,
70+
streams = true,
71+
transactions = true,
72+
error_extension = true,
73+
watchers = true,
74+
pagination = true,
7575
}
7676
7777
-- Convert the feature names into codes
@@ -130,7 +130,7 @@ The table lists all available functions and data of the submodule:
130130
- Keys from the ``IPROTO_RAFT_`` requests
131131

132132
* - :doc:`./box_iproto/protocol_version`
133-
- Current IPROTO protocol version
133+
- The current IPROTO protocol version
134134

135135
* - :doc:`./box_iproto/protocol_features`
136136
- The set of supported IPROTO protocol features

doc/reference/reference_lua/box_iproto/ballot.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ box.iproto.ballot_key
77

88
.. data:: ballot_key
99

10-
The ``box.iproto.ballot_key`` namespace contains the keys from the :ref:`IPROTO_BALLOT <box_protocol-ballots>` requests.
10+
Contains the keys from the :ref:`IPROTO_BALLOT <box_protocol-ballots>` requests.
1111
Learn more: :ref:`IPROTO_BALLOT keys <internals-iproto-keys-ballot>`.
1212

1313
**Example**

doc/reference/reference_lua/box_iproto/feature.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ box.iproto.feature
77

88
.. data:: feature
99

10-
The ``box.iproto.feature`` namespace contains the IPROTO protocol features that are supported by the server.
10+
Contains the IPROTO protocol features that are supported by the server.
1111
Each feature is mapped to its corresponding code.
1212
Learn more: :ref:`IPROTO_FEATURES <internals-iproto-keys-features>`.
1313

doc/reference/reference_lua/box_iproto/flag.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ box.iproto.flag
77

88
.. data:: flag
99

10-
The ``box.iproto.flag`` namespace contains the flags from the ``IPROTO_FLAGS`` key.
10+
Contains the flags from the ``IPROTO_FLAGS`` key.
1111
Learn more: :ref:`IPROTO_FLAGS key <box_protocol-flags>`.
1212

1313
**Example**

doc/reference/reference_lua/box_iproto/key.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ box.iproto.key
77

88
.. data:: key
99

10-
The ``box.iproto.key`` namespace contains all available request keys, except :ref:`raft <reference_lua-box_iproto_raft>`,
10+
Contains all available request keys, except :ref:`raft <reference_lua-box_iproto_raft>`,
1111
:ref:`metadata <reference_lua-box_iproto_metadata>`, and :ref:`ballot <reference_lua-box_iproto_ballot>` keys.
1212
Learn more: :ref:`Keys used in requests and responses <internals-iproto-keys>`.
1313

doc/reference/reference_lua/box_iproto/metadata.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ box.iproto.metadata_key
77

88
.. data:: metadata_key
99

10-
The ``box.iproto.metadata_key`` namespace contains the ``IPROTO_FIELD_*`` keys, which are nested in the
10+
Contains the ``IPROTO_FIELD_*`` keys, which are nested in the
1111
:ref:`IPROTO_METADATA <internals-iproto-keys-metadata>` key.
1212

1313
**Example**

doc/reference/reference_lua/box_iproto/override.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ box.iproto.override()
2020
:param function handler: IPROTO request handler.
2121
The signature of a handler function: ``function(sid, header, body)``, where
2222

23-
* ``sid`` (number): current IPROTO session identifier (see :ref:`box.session.id() <box_session-id>`)
23+
* ``sid`` (number): the current IPROTO session identifier (see :ref:`box.session.id() <box_session-id>`)
2424
* ``header`` (userdata): a request header encoded as a :ref:`msgpack_object <msgpack-object-methods>`
2525
* ``body`` (userdata): a request body encoded as a :ref:`msgpack_object <msgpack-object-methods>`
2626

2727
Returns ``true`` on success, otherwise ``false``. On ``false``, there is a fallback
2828
to the default handler. Also, you can indicate an error by throwing an exception.
29-
In this case, the return value is ``false``, but this does not always means a failure.
29+
In this case, the return value is ``false``, but this does not always mean a failure.
3030

3131
To reset the request handler, set the ``handler`` parameter to ``nil``.
3232

@@ -49,15 +49,15 @@ box.iproto.override()
4949
.. code-block:: lua
5050
5151
local function iproto_select_handler_lua(sid, header, body)
52-
if body.space_id == 512
53-
box.iproto.send(box.session.id(),
54-
{request_type = box.iproto.type.OK,
55-
sync = header.SYNC,
56-
schema_version = box.info.schema_version}),
57-
{data = {1, 2, 3}})
58-
return true
59-
end
60-
return false
52+
if body.space_id == 512 then
53+
box.iproto.send(box.session.id(),
54+
{ request_type = box.iproto.type.OK,
55+
sync = header.SYNC,
56+
schema_version = box.info.schema_version },
57+
{ data = { 1, 2, 3 } })
58+
return true
59+
end
60+
return false
6161
end
6262
6363
Override ``box.iproto.type.SELECT`` handler:

doc/reference/reference_lua/box_iproto/protocol_features.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. _reference_lua-box_iproto_protocol-features:
1+
.. _reference_lua-box_iproto_protocol-features:
22

33
box.iproto.protocol_features
44
============================

doc/reference/reference_lua/box_iproto/protocol_version.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. _reference_lua-box_iproto_version:
1+
.. _reference_lua-box_iproto_version:
22

33
box.iproto.protocol_version
44
===========================
@@ -7,7 +7,7 @@ box.iproto.protocol_version
77

88
.. data:: protocol_version
99

10-
Current IPROTO protocol version of the server.
10+
The current IPROTO protocol version of the server.
1111
Learn more: :ref:`IPROTO_ID <box_protocol-id>`.
1212

1313
**Example**

doc/reference/reference_lua/box_iproto/raft.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ box.iproto.raft
77

88
.. data:: raft_key
99

10-
The ``box.iproto.raft_key`` namespace contains the keys from the ``IPROTO_RAFT_*`` requests.
10+
Contains the keys from the ``IPROTO_RAFT_*`` requests.
1111
Learn more: :ref:`Synchronous replication keys <internals-iproto-keys-synchro-replication>`.
1212

1313
**Example**

doc/reference/reference_lua/box_iproto/request_type.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ box.iproto.type
77

88
.. data:: type
99

10-
The ``box.iproto.type`` namespace contains all available request types.
10+
Contains all available request types.
1111
Learn more about the requests: :ref:`Client-server requests and responses <internals-requests_responses>`.
1212

1313
**Example**

doc/reference/reference_lua/box_iproto/send.rst

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ box.iproto.send()
1818

1919
The function works for binary sessions only. For details, see :ref:`box.session.type() <box_session-type>`.
2020

21-
:param number sid: IPROTO session identifier (see :ref:`box.session.id() <box_session-id>`)
21+
:param number sid: the IPROTO session identifier (see :ref:`box.session.id() <box_session-id>`)
2222
:param table|string header: a request header encoded as MsgPack
2323
:param table|string|nil body: a request body encoded as MsgPack
2424

@@ -29,7 +29,7 @@ box.iproto.send()
2929

3030
* :errcode:`ER_SESSION_CLOSED` -- the session is closed.
3131
* :errcode:`ER_NO_SUCH_SESSION` -- the session does not exist.
32-
* :errcode:`ER_MEMORY_ISSUE` -- out of memory limit has been reached.
32+
* :errcode:`ER_MEMORY_ISSUE` -- out-of-memory limit has been reached.
3333
* :errcode:`ER_WRONG_SESSION_TYPE` -- the session type is not binary.
3434

3535
For details, see `src/box/errcode.h <https://github.com/tarantool/tarantool/blob/master/src/box/errcode.h>`__.
@@ -40,25 +40,27 @@ box.iproto.send()
4040

4141
.. code-block:: lua
4242
43-
box.iproto.send(box.session.id(), {request_type = box.iproto.type.OK,
44-
sync = 10,
45-
schema_version = box.info.schema_version}),
46-
{data = 1}))
43+
box.iproto.send(box.session.id(),
44+
{ request_type = box.iproto.type.OK,
45+
sync = 10,
46+
schema_version = box.info.schema_version },
47+
{ data = 1 })
4748
4849
Send a packet using Lua tables and numeric IPROTO constants:
4950

5051
.. code-block:: lua
5152
52-
box.iproto.send(box.session.id(), {[box.iproto.key.REQUEST_TYPE] = box.iproto.type.OK,
53-
[box.iproto.key.SYNC] = 10,
54-
[box.iproto.key.SCHEMA_VERSION] = box.info.schema_version}),
55-
{[box.iproto.key.DATA] = 1}))
53+
box.iproto.send(box.session.id(),
54+
{ [box.iproto.key.REQUEST_TYPE] = box.iproto.type.OK,
55+
[box.iproto.key.SYNC] = 10,
56+
[box.iproto.key.SCHEMA_VERSION] = box.info.schema_version },
57+
{ [box.iproto.key.DATA] = 1 })
5658
5759
Send a packet that contains only the header:
5860

5961
.. code-block:: lua
6062
61-
box.iproto.send(box.session.id(), {request_type = box.iproto.type.OK,
62-
sync = 10,
63-
schema_version = box.info.schema_version}))
64-
63+
box.iproto.send(box.session.id(),
64+
{ request_type = box.iproto.type.OK,
65+
sync = 10,
66+
schema_version = box.info.schema_version })

doc/reference/reference_lua/box_session/id.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ box.session.id()
1010

1111
Return the unique identifier (ID) for the current session.
1212

13-
:return: the unique identifier (ID) for the current session
14-
:return: 0 or -1 if there is no session
13+
:return: the session identifier; 0 or -1 if there is no session
1514
:rtype: number

0 commit comments

Comments
 (0)