GQTP is the acronym of Groonga Query Transfer Protocol. GQTP is the original protocol for groonga.
GQTP is stateful client server model protocol. The following sequence is one processing unit:
You can do zero or more processing units in a session.
Both request and response consist of GQTP header and body. GQTP header is fixed size data. Body is variable size data and its size is stored in GQTP header. The content of body isn't defined in GQTP.
GQTP header consists of the following unsigned integer values:
Name | Size | Description |
---|---|---|
protocol | 1byte | Protocol type. |
query_type | 1byte | Content type of body. |
key_length | 2byte | Not used. |
level | 1byte | Not used. |
flags | 1byte | Flags. |
status | 2byte | Return code. |
size | 4byte | Body size. |
opaque | 4byte | Not used. |
cas | 8byte | Not used. |
All header values are encoded by network byte order.
The following sections describes available values of each header value.
The total size of GQTP header is 24byte.
The value is always 0xc7 in both request and response GQTP header.
The value is one of the following values:
Name | Value | Description |
---|---|---|
NONE | 0 | Free format. |
TSV | 1 | Tab Separated Values. |
JSON | 2 | JSON. |
XML | 3 | XML. |
MSGPACK | 4 | MessagePack. |
This is not used in request GQTP header.
This is used in response GQTP header. Body is formatted as specified type.
The value is bitwise OR of the following values:
Name | Value | Description |
---|---|---|
MORE | 0x01 | There are more data. |
TAIL | 0x02 | There are no more data. |
HEAD | 0x04 | Not used. |
QUIET | 0x08 | Be quiet. |
QUIT | 0x10 | Quit. |
You must specify MORE or TAIL flag.
If you use MORE flag, you should also use QUIET flag. Because you don't need to show a response for your partial request.
Use QUIT flag to quit this session.
Here are available values. The new statuses will be added in the future.
The size of body. The maximum body size is 4GiB because size is 4byte unsigned integer. If you want to send 4GiB or more larger data, use MORE flag.
TODO
TODO