sofa-bolt-python icon indicating copy to clipboard operation
sofa-bolt-python copied to clipboard

[feature request]bolt v2 support

Open wanderxjtu opened this issue 4 years ago • 1 comments

Support bolt v2 codec.

the mainly change in bolt v2 is to support optional crc32 verification.

Spec:

Request command protocol for v2 ** request definition **

 0     1     2           4           6           8          10     11     12          14         16
 +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+------+-----+-----+-----+-----+
 |proto| ver1|type | cmdcode   |ver2 |   requestId           |codec|switch|   timeout             |
 +-----------+-----------+-----------+-----------+-----------+------------+-----------+-----------+
 |classLen   |headerLen  |contentLen             |           ...                                  |
 +-----------+-----------+-----------+-----------+                                                +
 |               className + header  + content  bytes                                             |
 +                                                                                                +
 |                               ... ...                                  | CRC32(optional)       |
 +------------------------------------------------------------------------------------------------+

Response command protocol for v2 ** response definition **

 0     1     2     3     4           6           8          10     11    12          14          16
 +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+------+-----+-----+-----+-----+
 |proto| ver1| type| cmdcode   |ver2 |   requestId           |codec|switch|respstatus |  classLen |
 +-----------+-----------+-----------+-----------+-----------+------------+-----------+-----------+
 |headerLen  | contentLen            |                      ...                                   |
 +-----------------------------------+                                                            +
 |               className + header  + content  bytes                                             |
 +                                                                                                +
 |                               ... ...                                  | CRC32(optional)       |
 +------------------------------------------------------------------------------------------------+

respstatus: response status

wanderxjtu avatar Aug 13 '21 06:08 wanderxjtu

What is need to be done:

  • Subclasses for v2 bolt headers
  • Server decoder needs to read proto first, than deside which bolt header class were to use.
  • Server should use same codecs to build response package.
  • Allow a optional arguments in Client to choose proto.

wanderxjtu avatar Aug 13 '21 06:08 wanderxjtu