~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to PROTOCOL

  • Committer: Vijay Samuel
  • Date: 2010-09-10 21:03:37 UTC
  • mto: (1757.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1758.
  • Revision ID: vijay@vijay-20100910210337-rf7c2ymawtqj6tkv
Merge added utf 8 tamil test case suite and test case for creating a database in tamil.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
.. Drizzle Client & Protocol Library
 
1
#
 
2
# Drizzle Client & Protocol Library
 
3
 
4
# Copyright (C) 2008 Eric Day (eday@oddments.org)
 
5
# All rights reserved.
 
6
 
7
# Use and distribution licensed under the BSD license.  See
 
8
# the COPYING file in this directory for full text.
 
9
#
2
10
 
3
 
.. Copyright (C) 2008 Eric Day (eday@oddments.org)
4
 
.. All rights reserved.
5
 
 
6
 
.. Use and distribution licensed under the BSD license.  See
7
 
.. the COPYING.BSD file in the root source directory for full text.
 
11
STATUS: This is currently a proposed draft as of November 29, 2008
8
12
 
9
13
Drizzle Protocol
10
 
================
11
 
 
12
 
`This is currently a proposed draft as of November 29, 2008`
 
14
----------------
13
15
 
14
16
The Drizzle protocol works over TCP, UDP, and Unix Domain Sockets
15
17
(UDS, also known as IPC sockets), although there are limitations when
127
129
to be aborted gracefully (without having to close the connection)
128
130
in the event of an error.
129
131
 
130
 
   +-------------------------------------------------------------------------+
131
 
   +                                  32 Bits                                +
132
 
   +-------------------------------------------------------------------------+
133
 
    
134
 
   +-----+----------------+----------------+---------------------------------+
135
 
   |   0 | Magic          | Protocol       | Command ID                      |
136
 
   +-----+----------------+----------------+---------------------------------+
137
 
 
138
 
   +-----+---------------------------------+---------------------------------+
139
 
   |  32 | Command / Result Code           | Client ID Length                |
140
 
   +-----+---------------------------------+---------------------------------+
141
 
 
142
 
   +-----+---------------------------------+---------------------------------+
143
 
   |  64 | Client ID (optional, variable length)                             |
144
 
   +-----+---------------------------------+---------------------------------+
145
 
 
146
 
   +-----+---------------------------------+---------------------------------+
147
 
   | 64+ | Chunk Length and Value Pairs (optional, variable length)          |
148
 
   +-----+---------------------------------+---------------------------------+
149
 
 
150
 
   +-----+---------------------------------+---------------------------------+
151
 
   + 64+ | Chunk Length = 0                |                                 |
152
 
   +-----+---------------------------------+---------------------------------+
153
 
 
154
 
   +-----+---------------------------------+---------------------------------+
155
 
   | 80+ | Checksum                                                          |
156
 
   +-----+---------------------------------+---------------------------------+
 
132
    |----------------------------- 32 Bits -----------------------------|
 
133
 
 
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
    |---------------------------------|---------------------------------|
 
145
80+ | Checksum                                                          |
 
146
    |-------------------------------------------------------------------|
157
147
 
158
148
The first part of a packet is:
159
149
 
170
160
 
171
161
2-byte Command/result code. For commands, this may be:
172
162
 
173
 
       1  ECHO
174
 
         The entire packet is simply echoed back to the caller.
175
 
       2  SET
176
 
         Set protocol options.
177
 
       3  QUERY
178
 
         Execute query.
179
 
       4  QUERY_RO
180
 
         Same as QUERY, but hints that this is a read-only
181
 
         query. This is only useful for routers/proxies who may want
182
 
         to redirect the request to a read slave.
 
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.
183
169
 
184
170
       Result codes may be:
185
171
 
186
 
       1  OK
187
 
         Single packet success response. No data associated
188
 
         with the result besides parameters.
189
 
       2  ERROR
190
 
         Single packet error response.
191
 
       3  DATA
192
 
         Start of a multi-packet result set.
193
 
       3  DATA_END
194
 
         Mark the end of a series of data packets. This is
195
 
         useful so a low level router or proxy can know when a
196
 
         response is complete without inspecting the contents of
197
 
         the packets.
 
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
 
179
          the packets.
198
180
 
199
181
2-byte Client ID length.
200
 
X-byte Client ID (length is value of client ID length).
201
 
The client ID is there for the client and routers/proxies to use. The server
202
 
treats this as opaque data, and will only preserve it to send
203
 
in responses. This can be used as a sharding key, to keep
204
 
state information in a proxy, or any other use.
 
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.
205
187
 
206
188
Next, zero or more chunks are given, terminated by a chunk length of
207
189
0. Each chunk consist of a length and then that amount of data.