8
8
# the COPYING file in this directory for full text.
11
STATUS: This is currently a proposed draft as of November 29, 2008
14
`This is currently a proposed draft as of November 29, 2008`
16
16
The Drizzle protocol works over TCP, UDP, and Unix Domain Sockets
17
17
(UDS, also known as IPC sockets), although there are limitations when
129
129
to be aborted gracefully (without having to close the connection)
130
130
in the event of an error.
132
|----------------------------- 32 Bits -----------------------------|
134
|----------------|----------------|---------------------------------|
135
0 | Magic | Protocol | Command ID |
136
|----------------|----------------|---------------------------------|
137
32 | Command / Result Code | Client ID Length |
138
|---------------------------------|---------------------------------|
139
64 | Client ID (optional, variable length) |
140
|---------------------------------|---------------------------------|
141
64+ | Chunk Length and Value Pairs (optional, variable length) |
142
|---------------------------------|---------------------------------|
143
64+ | Chunk Length = 0 |
144
|---------------------------------|---------------------------------|
146
|-------------------------------------------------------------------|
132
+-------------------------------------------------------------------------+
134
+-------------------------------------------------------------------------+
136
+-----+----------------+----------------+---------------------------------+
137
| 0 | Magic | Protocol | Command ID |
138
+-----+----------------+----------------+---------------------------------+
140
+-----+---------------------------------+---------------------------------+
141
| 32 | Command / Result Code | Client ID Length |
142
+-----+---------------------------------+---------------------------------+
144
+-----+---------------------------------+---------------------------------+
145
| 64 | Client ID (optional, variable length) |
146
+-----+---------------------------------+---------------------------------+
148
+-----+---------------------------------+---------------------------------+
149
| 64+ | Chunk Length and Value Pairs (optional, variable length) |
150
+-----+---------------------------------+---------------------------------+
152
+-----+---------------------------------+---------------------------------+
153
+ 64+ | Chunk Length = 0 | |
154
+-----+---------------------------------+---------------------------------+
156
+-----+---------------------------------+---------------------------------+
158
+-----+---------------------------------+---------------------------------+
148
160
The first part of a packet is:
161
173
2-byte Command/result code. For commands, this may be:
163
1 ECHO - The entire packet is simply echoed back to the caller.
164
2 SET - Set protocol options.
165
3 QUERY - Execute query.
166
4 QUERY_RO - Same as QUERY, but hints that this is a read-only
167
query. This is only useful for routers/proxies who may want
168
to redirect the request to a read slave.
176
The entire packet is simply echoed back to the caller.
178
Set protocol options.
182
Same as QUERY, but hints that this is a read-only
183
query. This is only useful for routers/proxies who may want
184
to redirect the request to a read slave.
170
186
Result codes may be:
172
1 OK - Single packet success response. No data associated
173
with the result besides parameters.
174
2 ERROR - Single packet error response.
175
3 DATA - Start of a multi-packet result set.
176
3 DATA_END - Mark the end of a series of data packets. This is
177
useful so a low level router or proxy can know when a
178
response is complete without inspecting the contents of
189
Single packet success response. No data associated
190
with the result besides parameters.
192
Single packet error response.
194
Start of a multi-packet result set.
196
Mark the end of a series of data packets. This is
197
useful so a low level router or proxy can know when a
198
response is complete without inspecting the contents of
181
201
2-byte Client ID length.
182
X-byte Client ID (length is value of client ID length). The client ID is
183
there for the client and routers/proxies to use. The server
184
treats this as opaque data, and will only preserve it to send
185
in responses. This can be used as a sharding key, to keep
186
state information in a proxy, or any other use.
202
X-byte Client ID (length is value of client ID length).
203
The client ID is there for the client and routers/proxies to use. The server
204
treats this as opaque data, and will only preserve it to send
205
in responses. This can be used as a sharding key, to keep
206
state information in a proxy, or any other use.
188
208
Next, zero or more chunks are given, terminated by a chunk length of
189
209
0. Each chunk consist of a length and then that amount of data.