Skip to content

Commit 8cee461

Browse files
code-health: update request type constant name
Modern Tarantool documentation uses IPROTO_REQUEST_TYPE name for request type instead of IPROTO_CODE [1]. 1. https://www.tarantool.io/en/doc/latest/dev_guide/internals/box_protocol/ Part of #206
1 parent a94f97c commit 8cee461

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Diff for: tarantool/const.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pylint: disable=C0301,W0105,W0401,W0614
22

3-
IPROTO_CODE = 0x00
3+
IPROTO_REQUEST_TYPE = 0x00
44
IPROTO_SYNC = 0x01
55
# replication keys (header)
66
IPROTO_SERVER_ID = 0x02

Diff for: tarantool/request.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from tarantool.error import DatabaseError
1515
from tarantool.const import (
16-
IPROTO_CODE,
16+
IPROTO_REQUEST_TYPE,
1717
IPROTO_SYNC,
1818
IPROTO_SPACE_ID,
1919
IPROTO_INDEX_ID,
@@ -161,7 +161,7 @@ def header(self, length):
161161
"""
162162

163163
self._sync = self.conn.generate_sync()
164-
header = self._dumps({IPROTO_CODE: self.request_type,
164+
header = self._dumps({IPROTO_REQUEST_TYPE: self.request_type,
165165
IPROTO_SYNC: self._sync,
166166
IPROTO_SCHEMA_ID: self.conn.schema_version})
167167

@@ -259,7 +259,7 @@ def header(self, length):
259259
self._sync = self.conn.generate_sync()
260260
# Set IPROTO_SCHEMA_ID: 0 to avoid SchemaReloadException
261261
# It is ok to use 0 in auth every time.
262-
header = self._dumps({IPROTO_CODE: self.request_type,
262+
header = self._dumps({IPROTO_REQUEST_TYPE: self.request_type,
263263
IPROTO_SYNC: self._sync,
264264
IPROTO_SCHEMA_ID: 0})
265265

@@ -618,7 +618,7 @@ def __init__(self, conn, sync):
618618
"""
619619

620620
super(RequestOK, self).__init__(conn)
621-
request_body = self._dumps({IPROTO_CODE: self.request_type,
621+
request_body = self._dumps({IPROTO_REQUEST_TYPE: self.request_type,
622622
IPROTO_SYNC: sync})
623623
self._body = request_body
624624

Diff for: tarantool/response.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import msgpack
1010

1111
from tarantool.const import (
12-
IPROTO_CODE,
12+
IPROTO_REQUEST_TYPE,
1313
IPROTO_DATA,
1414
IPROTO_ERROR,
1515
IPROTO_SYNC,
@@ -93,7 +93,7 @@ def __init__(self, conn, response):
9393

9494
self.conn = conn
9595
self._sync = header.get(IPROTO_SYNC, 0)
96-
self._code = header[IPROTO_CODE]
96+
self._code = header[IPROTO_REQUEST_TYPE]
9797
self._body = {}
9898
self._schema_version = header.get(IPROTO_SCHEMA_ID, None)
9999
try:

0 commit comments

Comments
 (0)