Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/lib-dict/dict-client.c @ 9174:eed86bcc33aa HEAD
dict proxy: Use base_dir as the default dict-server location.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 27 Jun 2009 22:08:33 -0400 |
parents | a68ed51b681d |
children | a1b92a251bb9 |
rev | line source |
---|---|
8590
b9faf4db2a9f
Updated copyright notices to include year 2009.
Timo Sirainen <tss@iki.fi>
parents:
8105
diff
changeset
|
1 /* Copyright (c) 2005-2009 Dovecot authors, see the included COPYING file */ |
3793 | 2 |
3 #include "lib.h" | |
4 #include "str.h" | |
5 #include "network.h" | |
6 #include "istream.h" | |
7 #include "ostream.h" | |
8 #include "dict-private.h" | |
9 #include "dict-client.h" | |
10 | |
11 #include <unistd.h> | |
12 #include <fcntl.h> | |
13 | |
14 struct client_dict { | |
15 struct dict dict; | |
16 | |
17 pool_t pool; | |
18 int fd; | |
19 const char *uri; | |
20 const char *username; | |
21 const char *path; | |
4516
aa2f73a4df26
Dictionary changes: Added support for defining value's type. Key is still always a string. Added support for sorting the iteration replies. Added dict_unset(). Added Berkeley DB support. Most of the code written by Tianyan Liu.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4512
diff
changeset
|
22 enum dict_data_type value_type; |
3793 | 23 |
7008
6950bb5e7921
Don't try to reconnect more often than once/sec.
Timo Sirainen <tss@iki.fi>
parents:
7007
diff
changeset
|
24 time_t last_connect_try; |
3793 | 25 struct istream *input; |
26 struct ostream *output; | |
27 | |
28 unsigned int connect_counter; | |
29 unsigned int transaction_id_counter; | |
30 | |
31 unsigned int in_iteration:1; | |
32 unsigned int handshaked:1; | |
33 }; | |
34 | |
35 struct client_dict_iterate_context { | |
36 struct dict_iterate_context ctx; | |
37 | |
38 pool_t pool; | |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
3858
diff
changeset
|
39 bool failed; |
3793 | 40 }; |
41 | |
42 struct client_dict_transaction_context { | |
43 struct dict_transaction_context ctx; | |
44 | |
45 unsigned int id; | |
46 unsigned int connect_counter; | |
47 | |
4512
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
48 unsigned int failed:1; |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
49 unsigned int sent_begin:1; |
3793 | 50 }; |
51 | |
52 static int client_dict_connect(struct client_dict *dict); | |
53 static void client_dict_disconnect(struct client_dict *dict); | |
54 | |
55 const char *dict_client_escape(const char *src) | |
56 { | |
57 const char *p; | |
58 string_t *dest; | |
59 | |
60 /* first do a quick lookup to see if there's anything to escape. | |
61 probably not. */ | |
62 for (p = src; *p != '\0'; p++) { | |
63 if (*p == '\t' || *p == '\n' || *p == '\001') | |
64 break; | |
65 } | |
66 | |
67 if (*p == '\0') | |
68 return src; | |
69 | |
70 dest = t_str_new(256); | |
71 str_append_n(dest, src, p - src); | |
72 | |
3858 | 73 for (; *p != '\0'; p++) { |
3793 | 74 switch (*p) { |
75 case '\t': | |
76 str_append_c(dest, '\001'); | |
77 str_append_c(dest, 't'); | |
78 break; | |
79 case '\n': | |
80 str_append_c(dest, '\001'); | |
81 str_append_c(dest, 'n'); | |
82 break; | |
83 case '\001': | |
84 str_append_c(dest, '\001'); | |
85 str_append_c(dest, '1'); | |
86 break; | |
87 default: | |
88 str_append_c(dest, *p); | |
89 break; | |
90 } | |
91 } | |
92 return str_c(dest); | |
93 } | |
94 | |
95 const char *dict_client_unescape(const char *src) | |
96 { | |
97 const char *p; | |
98 string_t *dest; | |
99 | |
100 /* first do a quick lookup to see if there's anything to unescape. | |
101 probably not. */ | |
102 for (p = src; *p != '\0'; p++) { | |
103 if (*p == '\001') | |
104 break; | |
105 } | |
106 | |
107 if (*p == '\0') | |
108 return src; | |
109 | |
110 dest = t_str_new(256); | |
111 str_append_n(dest, src, p - src); | |
112 for (; *p != '\0'; p++) { | |
113 if (*p != '\001') | |
114 str_append_c(dest, *p); | |
115 else if (p[1] != '\0') { | |
116 p++; | |
117 switch (*p) { | |
118 case '1': | |
119 str_append_c(dest, '\001'); | |
120 break; | |
121 case 't': | |
122 str_append_c(dest, '\t'); | |
123 break; | |
124 case 'n': | |
125 str_append_c(dest, '\n'); | |
126 break; | |
127 } | |
128 } | |
129 } | |
130 return str_c(dest); | |
131 } | |
132 | |
133 static int client_dict_send_query(struct client_dict *dict, const char *query) | |
134 { | |
4368 | 135 if (dict->output == NULL) { |
136 /* not connected currently */ | |
137 if (client_dict_connect(dict) < 0) | |
138 return -1; | |
139 } | |
140 | |
3793 | 141 if (o_stream_send_str(dict->output, query) < 0 || |
142 o_stream_flush(dict->output) < 0) { | |
143 /* Send failed */ | |
144 if (!dict->handshaked) { | |
145 /* we're trying to send hello, don't try to reconnect */ | |
146 return -1; | |
147 } | |
148 | |
149 /* Reconnect and try again. */ | |
150 client_dict_disconnect(dict); | |
151 if (client_dict_connect(dict) < 0) | |
152 return -1; | |
153 | |
154 if (o_stream_send_str(dict->output, query) < 0 || | |
155 o_stream_flush(dict->output) < 0) { | |
156 i_error("write(%s) failed: %m", dict->path); | |
157 return -1; | |
158 } | |
159 } | |
160 return 0; | |
161 } | |
162 | |
4368 | 163 static int |
4512
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
164 client_dict_transaction_send_begin(struct client_dict_transaction_context *ctx) |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
165 { |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
166 struct client_dict *dict = (struct client_dict *)ctx->ctx.dict; |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
167 |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
168 if (ctx->failed) |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
169 return -1; |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
170 |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
171 T_BEGIN { |
6940
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
172 const char *query; |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
173 |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
174 query = t_strdup_printf("%c%u\n", DICT_PROTOCOL_CMD_BEGIN, |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
175 ctx->id); |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
176 if (client_dict_send_query(dict, query) < 0) |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
177 ctx->failed = TRUE; |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
178 else |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
179 ctx->connect_counter = dict->connect_counter; |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
180 } T_END; |
4512
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
181 |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
182 return ctx->failed ? -1 : 0; |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
183 } |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
184 |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
185 static int |
4368 | 186 client_dict_send_transaction_query(struct client_dict_transaction_context *ctx, |
187 const char *query) | |
188 { | |
189 struct client_dict *dict = (struct client_dict *)ctx->ctx.dict; | |
190 | |
4512
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
191 if (!ctx->sent_begin) { |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
192 if (client_dict_transaction_send_begin(ctx) < 0) |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
193 return -1; |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
194 ctx->sent_begin = TRUE; |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
195 } |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
196 |
4385 | 197 if (ctx->connect_counter != dict->connect_counter || ctx->failed) |
198 return -1; | |
199 | |
200 if (dict->output == NULL) { | |
4512
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
201 /* not connected, this'll fail */ |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
202 return -1; |
4385 | 203 } |
204 | |
4368 | 205 if (o_stream_send_str(dict->output, query) < 0 || |
206 o_stream_flush(dict->output) < 0) { | |
207 /* Send failed. Our transactions have died, so don't even try | |
208 to re-send the command */ | |
209 ctx->failed = TRUE; | |
210 client_dict_disconnect(dict); | |
211 return -1; | |
212 } | |
213 return 0; | |
214 } | |
215 | |
3793 | 216 static char *client_dict_read_line(struct client_dict *dict) |
217 { | |
218 char *line; | |
219 int ret; | |
220 | |
4519
4be4c887deb7
dict proxy: Dictionary iteration was broken.
Timo Sirainen <tss@iki.fi>
parents:
4517
diff
changeset
|
221 line = i_stream_next_line(dict->input); |
4be4c887deb7
dict proxy: Dictionary iteration was broken.
Timo Sirainen <tss@iki.fi>
parents:
4517
diff
changeset
|
222 if (line != NULL) |
4be4c887deb7
dict proxy: Dictionary iteration was broken.
Timo Sirainen <tss@iki.fi>
parents:
4517
diff
changeset
|
223 return line; |
4be4c887deb7
dict proxy: Dictionary iteration was broken.
Timo Sirainen <tss@iki.fi>
parents:
4517
diff
changeset
|
224 |
3793 | 225 while ((ret = i_stream_read(dict->input)) > 0) { |
226 line = i_stream_next_line(dict->input); | |
8664
446775a31754
dict proxy: Handle async commits better.
Timo Sirainen <tss@iki.fi>
parents:
8660
diff
changeset
|
227 if (line != NULL) |
446775a31754
dict proxy: Handle async commits better.
Timo Sirainen <tss@iki.fi>
parents:
8660
diff
changeset
|
228 return line; |
3793 | 229 } |
6525 | 230 i_assert(ret < 0); |
3793 | 231 |
6525 | 232 if (ret == -2) |
233 i_error("read(%s) returned too much data", dict->path); | |
7988
e069e4c221e1
dict-proxy: Fix error message if remote disconnects.
Timo Sirainen <tss@iki.fi>
parents:
7969
diff
changeset
|
234 else if (dict->input->stream_errno == 0) |
e069e4c221e1
dict-proxy: Fix error message if remote disconnects.
Timo Sirainen <tss@iki.fi>
parents:
7969
diff
changeset
|
235 i_error("read(%s) failed: Remote disconnected", dict->path); |
7418
a18f7f0dcff5
Reverted last error handling change, it can't happen after all.
Timo Sirainen <tss@iki.fi>
parents:
7417
diff
changeset
|
236 else |
7417 | 237 i_error("read(%s) failed: %m", dict->path); |
3793 | 238 return NULL; |
239 } | |
240 | |
241 static int client_dict_connect(struct client_dict *dict) | |
242 { | |
243 const char *query; | |
244 | |
245 i_assert(dict->fd == -1); | |
246 | |
7008
6950bb5e7921
Don't try to reconnect more often than once/sec.
Timo Sirainen <tss@iki.fi>
parents:
7007
diff
changeset
|
247 if (dict->last_connect_try == ioloop_time) { |
6950bb5e7921
Don't try to reconnect more often than once/sec.
Timo Sirainen <tss@iki.fi>
parents:
7007
diff
changeset
|
248 /* Try again later */ |
6950bb5e7921
Don't try to reconnect more often than once/sec.
Timo Sirainen <tss@iki.fi>
parents:
7007
diff
changeset
|
249 return -1; |
6950bb5e7921
Don't try to reconnect more often than once/sec.
Timo Sirainen <tss@iki.fi>
parents:
7007
diff
changeset
|
250 } |
6950bb5e7921
Don't try to reconnect more often than once/sec.
Timo Sirainen <tss@iki.fi>
parents:
7007
diff
changeset
|
251 dict->last_connect_try = ioloop_time; |
6950bb5e7921
Don't try to reconnect more often than once/sec.
Timo Sirainen <tss@iki.fi>
parents:
7007
diff
changeset
|
252 |
3793 | 253 dict->fd = net_connect_unix(dict->path); |
254 if (dict->fd == -1) { | |
255 i_error("net_connect_unix(%s) failed: %m", dict->path); | |
256 return -1; | |
257 } | |
258 | |
259 /* Dictionary lookups are blocking */ | |
260 net_set_nonblock(dict->fd, FALSE); | |
261 | |
6162
896cc473c1f0
Renamed i_stream_create_file() to i_stream_create_fd().
Timo Sirainen <tss@iki.fi>
parents:
6161
diff
changeset
|
262 dict->input = i_stream_create_fd(dict->fd, (size_t)-1, FALSE); |
7969
2cd775b45b0c
Set dict proxy istream nonblocking so EINTR (^C) won't crash.
Timo Sirainen <tss@iki.fi>
parents:
7418
diff
changeset
|
263 dict->input->blocking = TRUE; |
6161
c62f7ee79446
Split o_stream_create_file() to _create_fd() and _create_fd_file().
Timo Sirainen <tss@iki.fi>
parents:
6142
diff
changeset
|
264 dict->output = o_stream_create_fd(dict->fd, 4096, FALSE); |
3793 | 265 dict->transaction_id_counter = 0; |
266 | |
4516
aa2f73a4df26
Dictionary changes: Added support for defining value's type. Key is still always a string. Added support for sorting the iteration replies. Added dict_unset(). Added Berkeley DB support. Most of the code written by Tianyan Liu.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4512
diff
changeset
|
267 query = t_strdup_printf("%c%u\t%u\t%d\t%s\t%s\n", |
aa2f73a4df26
Dictionary changes: Added support for defining value's type. Key is still always a string. Added support for sorting the iteration replies. Added dict_unset(). Added Berkeley DB support. Most of the code written by Tianyan Liu.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4512
diff
changeset
|
268 DICT_PROTOCOL_CMD_HELLO, |
3793 | 269 DICT_CLIENT_PROTOCOL_MAJOR_VERSION, |
270 DICT_CLIENT_PROTOCOL_MINOR_VERSION, | |
4516
aa2f73a4df26
Dictionary changes: Added support for defining value's type. Key is still always a string. Added support for sorting the iteration replies. Added dict_unset(). Added Berkeley DB support. Most of the code written by Tianyan Liu.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4512
diff
changeset
|
271 dict->value_type, dict->username, dict->uri); |
3793 | 272 if (client_dict_send_query(dict, query) < 0) { |
273 client_dict_disconnect(dict); | |
274 return -1; | |
275 } | |
276 | |
277 dict->handshaked = TRUE; | |
278 return 0; | |
279 } | |
280 | |
281 static void client_dict_disconnect(struct client_dict *dict) | |
282 { | |
283 dict->connect_counter++; | |
284 dict->handshaked = FALSE; | |
285 | |
3879
928229f8b3e6
deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents:
3863
diff
changeset
|
286 if (dict->input != NULL) |
4070
71b8faa84ec6
Added i_stream_destroy() and o_stream_destroy() and used them instead of
Timo Sirainen <tss@iki.fi>
parents:
3990
diff
changeset
|
287 i_stream_destroy(&dict->input); |
3879
928229f8b3e6
deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents:
3863
diff
changeset
|
288 if (dict->output != NULL) |
4070
71b8faa84ec6
Added i_stream_destroy() and o_stream_destroy() and used them instead of
Timo Sirainen <tss@iki.fi>
parents:
3990
diff
changeset
|
289 o_stream_destroy(&dict->output); |
3793 | 290 |
291 if (dict->fd != -1) { | |
292 if (close(dict->fd) < 0) | |
293 i_error("close(%s) failed: %m", dict->path); | |
294 dict->fd = -1; | |
295 } | |
296 } | |
297 | |
4516
aa2f73a4df26
Dictionary changes: Added support for defining value's type. Key is still always a string. Added support for sorting the iteration replies. Added dict_unset(). Added Berkeley DB support. Most of the code written by Tianyan Liu.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4512
diff
changeset
|
298 static struct dict * |
4517
e661182eab75
Berkeley DB dict support is now enabled only when using --with-db configure option.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4516
diff
changeset
|
299 client_dict_init(struct dict *driver, const char *uri, |
9174
eed86bcc33aa
dict proxy: Use base_dir as the default dict-server location.
Timo Sirainen <tss@iki.fi>
parents:
8683
diff
changeset
|
300 enum dict_data_type value_type, const char *username, |
eed86bcc33aa
dict proxy: Use base_dir as the default dict-server location.
Timo Sirainen <tss@iki.fi>
parents:
8683
diff
changeset
|
301 const char *base_dir) |
3793 | 302 { |
303 struct client_dict *dict; | |
3967
6fabe878c46d
Dictionary takes now a username parameter, which is used for private
Timo Sirainen <tss@iki.fi>
parents:
3879
diff
changeset
|
304 const char *dest_uri; |
3793 | 305 pool_t pool; |
306 | |
3967
6fabe878c46d
Dictionary takes now a username parameter, which is used for private
Timo Sirainen <tss@iki.fi>
parents:
3879
diff
changeset
|
307 /* uri = [<path>] ":" <uri> */ |
3793 | 308 dest_uri = strchr(uri, ':'); |
309 if (dest_uri == NULL) { | |
310 i_error("dict-client: Invalid URI: %s", uri); | |
311 return NULL; | |
312 } | |
313 | |
314 pool = pool_alloconly_create("client dict", 1024); | |
315 dict = p_new(pool, struct client_dict, 1); | |
316 dict->pool = pool; | |
4517
e661182eab75
Berkeley DB dict support is now enabled only when using --with-db configure option.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4516
diff
changeset
|
317 dict->dict = *driver; |
4516
aa2f73a4df26
Dictionary changes: Added support for defining value's type. Key is still always a string. Added support for sorting the iteration replies. Added dict_unset(). Added Berkeley DB support. Most of the code written by Tianyan Liu.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4512
diff
changeset
|
318 dict->value_type = value_type; |
3967
6fabe878c46d
Dictionary takes now a username parameter, which is used for private
Timo Sirainen <tss@iki.fi>
parents:
3879
diff
changeset
|
319 dict->username = p_strdup(pool, username); |
3793 | 320 |
321 dict->fd = -1; | |
322 | |
3967
6fabe878c46d
Dictionary takes now a username parameter, which is used for private
Timo Sirainen <tss@iki.fi>
parents:
3879
diff
changeset
|
323 if (*uri != ':') { |
3793 | 324 /* path given */ |
3967
6fabe878c46d
Dictionary takes now a username parameter, which is used for private
Timo Sirainen <tss@iki.fi>
parents:
3879
diff
changeset
|
325 dict->path = p_strdup_until(pool, uri, dest_uri); |
3793 | 326 } else { |
9174
eed86bcc33aa
dict proxy: Use base_dir as the default dict-server location.
Timo Sirainen <tss@iki.fi>
parents:
8683
diff
changeset
|
327 dict->path = p_strconcat(pool, base_dir, |
eed86bcc33aa
dict proxy: Use base_dir as the default dict-server location.
Timo Sirainen <tss@iki.fi>
parents:
8683
diff
changeset
|
328 "/"DEFAULT_DICT_SERVER_SOCKET_FNAME, NULL); |
3793 | 329 } |
330 dict->uri = p_strdup(pool, dest_uri + 1); | |
331 return &dict->dict; | |
332 } | |
333 | |
334 static void client_dict_deinit(struct dict *_dict) | |
335 { | |
336 struct client_dict *dict = (struct client_dict *)_dict; | |
337 | |
338 client_dict_disconnect(dict); | |
6428
7cad076906eb
pool_unref() now takes ** pointer.
Timo Sirainen <tss@iki.fi>
parents:
6162
diff
changeset
|
339 pool_unref(&dict->pool); |
3793 | 340 } |
341 | |
342 static int client_dict_lookup(struct dict *_dict, pool_t pool, | |
343 const char *key, const char **value_r) | |
344 { | |
345 struct client_dict *dict = (struct client_dict *)_dict; | |
346 const char *line; | |
6940
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
347 int ret; |
3793 | 348 |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
349 T_BEGIN { |
6940
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
350 const char *query; |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
351 |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
352 query = t_strdup_printf("%c%s\n", DICT_PROTOCOL_CMD_LOOKUP, |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
353 dict_client_escape(key)); |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
354 ret = client_dict_send_query(dict, query); |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
355 } T_END; |
6940
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
356 if (ret < 0) |
3793 | 357 return -1; |
358 | |
359 /* read reply */ | |
360 line = client_dict_read_line(dict); | |
361 if (line == NULL) | |
362 return -1; | |
363 | |
364 if (*line == DICT_PROTOCOL_REPLY_OK) { | |
365 *value_r = p_strdup(pool, dict_client_unescape(line + 1)); | |
366 return 1; | |
367 } else { | |
368 *value_r = NULL; | |
369 return *line == DICT_PROTOCOL_REPLY_NOTFOUND ? 0 : -1; | |
370 } | |
371 } | |
372 | |
373 static struct dict_iterate_context * | |
4516
aa2f73a4df26
Dictionary changes: Added support for defining value's type. Key is still always a string. Added support for sorting the iteration replies. Added dict_unset(). Added Berkeley DB support. Most of the code written by Tianyan Liu.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4512
diff
changeset
|
374 client_dict_iterate_init(struct dict *_dict, const char *path, |
aa2f73a4df26
Dictionary changes: Added support for defining value's type. Key is still always a string. Added support for sorting the iteration replies. Added dict_unset(). Added Berkeley DB support. Most of the code written by Tianyan Liu.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4512
diff
changeset
|
375 enum dict_iterate_flags flags) |
3793 | 376 { |
377 struct client_dict *dict = (struct client_dict *)_dict; | |
378 struct client_dict_iterate_context *ctx; | |
379 | |
380 if (dict->in_iteration) | |
381 i_panic("dict-client: Only one iteration supported"); | |
382 dict->in_iteration = TRUE; | |
383 | |
384 ctx = i_new(struct client_dict_iterate_context, 1); | |
385 ctx->ctx.dict = _dict; | |
386 ctx->pool = pool_alloconly_create("client dict iteration", 512); | |
387 | |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
388 T_BEGIN { |
6940
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
389 const char *query; |
3793 | 390 |
6940
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
391 query = t_strdup_printf("%c%d\t%s\n", DICT_PROTOCOL_CMD_ITERATE, |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
392 flags, dict_client_escape(path)); |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
393 if (client_dict_send_query(dict, query) < 0) |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
394 ctx->failed = TRUE; |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
395 } T_END; |
3793 | 396 return &ctx->ctx; |
397 } | |
398 | |
399 static int client_dict_iterate(struct dict_iterate_context *_ctx, | |
400 const char **key_r, const char **value_r) | |
401 { | |
402 struct client_dict_iterate_context *ctx = | |
403 (struct client_dict_iterate_context *)_ctx; | |
404 struct client_dict *dict = (struct client_dict *)_ctx->dict; | |
405 char *line, *value; | |
406 | |
407 if (ctx->failed) | |
408 return -1; | |
409 | |
410 /* read next reply */ | |
411 line = client_dict_read_line(dict); | |
412 if (line == NULL) | |
413 return -1; | |
414 | |
415 if (*line == '\0') { | |
416 /* end of iteration */ | |
417 return 0; | |
418 } | |
419 | |
420 /* line contains key \t value */ | |
421 p_clear(ctx->pool); | |
422 | |
423 value = strchr(line, '\t'); | |
424 if (value == NULL) { | |
425 /* broken protocol */ | |
426 i_error("dict client (%s) sent broken reply", dict->path); | |
427 return -1; | |
428 } | |
429 *value++ = '\0'; | |
430 | |
431 *key_r = p_strdup(ctx->pool, dict_client_unescape(line)); | |
432 *value_r = p_strdup(ctx->pool, dict_client_unescape(value)); | |
433 return 1; | |
434 } | |
435 | |
436 static void client_dict_iterate_deinit(struct dict_iterate_context *_ctx) | |
437 { | |
438 struct client_dict *dict = (struct client_dict *)_ctx->dict; | |
439 struct client_dict_iterate_context *ctx = | |
440 (struct client_dict_iterate_context *)_ctx; | |
441 | |
6428
7cad076906eb
pool_unref() now takes ** pointer.
Timo Sirainen <tss@iki.fi>
parents:
6162
diff
changeset
|
442 pool_unref(&ctx->pool); |
3793 | 443 i_free(ctx); |
8105
ad9ad222729c
Calling dict_iterate_init() multiple times for a dict assert-crashed.
Timo Sirainen <tss@iki.fi>
parents:
7988
diff
changeset
|
444 dict->in_iteration = FALSE; |
3793 | 445 } |
446 | |
447 static struct dict_transaction_context * | |
448 client_dict_transaction_init(struct dict *_dict) | |
449 { | |
450 struct client_dict *dict = (struct client_dict *)_dict; | |
451 struct client_dict_transaction_context *ctx; | |
452 | |
453 ctx = i_new(struct client_dict_transaction_context, 1); | |
454 ctx->ctx.dict = _dict; | |
455 ctx->id = ++dict->transaction_id_counter; | |
4368 | 456 |
3793 | 457 return &ctx->ctx; |
458 } | |
459 | |
8660
d8a56ea9f408
Added dict_transaction_commit_async().
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
460 static int client_dict_transaction_commit(struct dict_transaction_context *_ctx, |
d8a56ea9f408
Added dict_transaction_commit_async().
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
461 bool async) |
3793 | 462 { |
463 struct client_dict_transaction_context *ctx = | |
464 (struct client_dict_transaction_context *)_ctx; | |
465 struct client_dict *dict = (struct client_dict *)_ctx->dict; | |
466 int ret = ctx->failed ? -1 : 0; | |
467 | |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
468 if (ctx->sent_begin) T_BEGIN { |
6940
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
469 const char *query, *line; |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
470 |
8664
446775a31754
dict proxy: Handle async commits better.
Timo Sirainen <tss@iki.fi>
parents:
8660
diff
changeset
|
471 query = t_strdup_printf("%c%u\n", ctx->failed ? |
446775a31754
dict proxy: Handle async commits better.
Timo Sirainen <tss@iki.fi>
parents:
8660
diff
changeset
|
472 DICT_PROTOCOL_CMD_ROLLBACK : |
446775a31754
dict proxy: Handle async commits better.
Timo Sirainen <tss@iki.fi>
parents:
8660
diff
changeset
|
473 (!async ? DICT_PROTOCOL_CMD_COMMIT : |
446775a31754
dict proxy: Handle async commits better.
Timo Sirainen <tss@iki.fi>
parents:
8660
diff
changeset
|
474 DICT_PROTOCOL_CMD_COMMIT_ASYNC), |
446775a31754
dict proxy: Handle async commits better.
Timo Sirainen <tss@iki.fi>
parents:
8660
diff
changeset
|
475 ctx->id); |
4512
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
476 if (client_dict_send_transaction_query(ctx, query) < 0) |
3793 | 477 ret = -1; |
8683
a68ed51b681d
dict proxy client: Don't hang when doing an async commit.
Timo Sirainen <tss@iki.fi>
parents:
8664
diff
changeset
|
478 else if (ret < 0 || async) { |
a68ed51b681d
dict proxy client: Don't hang when doing an async commit.
Timo Sirainen <tss@iki.fi>
parents:
8664
diff
changeset
|
479 /* no reply */ |
8660
d8a56ea9f408
Added dict_transaction_commit_async().
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
480 } else { |
8683
a68ed51b681d
dict proxy client: Don't hang when doing an async commit.
Timo Sirainen <tss@iki.fi>
parents:
8664
diff
changeset
|
481 /* sync commit, read reply */ |
4512
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
482 line = client_dict_read_line(dict); |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
483 if (line == NULL || *line != DICT_PROTOCOL_REPLY_OK) |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
484 ret = -1; |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
485 } |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
486 } T_END; |
3793 | 487 |
488 i_free(ctx); | |
489 return ret; | |
490 } | |
491 | |
492 static void | |
493 client_dict_transaction_rollback(struct dict_transaction_context *_ctx) | |
494 { | |
495 struct client_dict_transaction_context *ctx = | |
496 (struct client_dict_transaction_context *)_ctx; | |
497 | |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
498 if (ctx->sent_begin) T_BEGIN { |
6940
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
499 const char *query; |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
500 |
4512
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
501 query = t_strdup_printf("%c%u\n", DICT_PROTOCOL_CMD_ROLLBACK, |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
502 ctx->id); |
b5d4c1e9a492
Delay sending the transaction begin command to server until the first
Timo Sirainen <tss@iki.fi>
parents:
4385
diff
changeset
|
503 (void)client_dict_send_transaction_query(ctx, query); |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
504 } T_END; |
4385 | 505 |
3793 | 506 i_free(ctx); |
507 } | |
508 | |
509 static void client_dict_set(struct dict_transaction_context *_ctx, | |
510 const char *key, const char *value) | |
511 { | |
512 struct client_dict_transaction_context *ctx = | |
513 (struct client_dict_transaction_context *)_ctx; | |
6940
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
514 |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
515 T_BEGIN { |
6940
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
516 const char *query; |
3793 | 517 |
6940
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
518 query = t_strdup_printf("%c%u\t%s\t%s\n", |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
519 DICT_PROTOCOL_CMD_SET, ctx->id, |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
520 dict_client_escape(key), |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
521 dict_client_escape(value)); |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
522 (void)client_dict_send_transaction_query(ctx, query); |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
523 } T_END; |
3793 | 524 } |
525 | |
4516
aa2f73a4df26
Dictionary changes: Added support for defining value's type. Key is still always a string. Added support for sorting the iteration replies. Added dict_unset(). Added Berkeley DB support. Most of the code written by Tianyan Liu.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4512
diff
changeset
|
526 static void client_dict_unset(struct dict_transaction_context *_ctx, |
aa2f73a4df26
Dictionary changes: Added support for defining value's type. Key is still always a string. Added support for sorting the iteration replies. Added dict_unset(). Added Berkeley DB support. Most of the code written by Tianyan Liu.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4512
diff
changeset
|
527 const char *key) |
aa2f73a4df26
Dictionary changes: Added support for defining value's type. Key is still always a string. Added support for sorting the iteration replies. Added dict_unset(). Added Berkeley DB support. Most of the code written by Tianyan Liu.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4512
diff
changeset
|
528 { |
aa2f73a4df26
Dictionary changes: Added support for defining value's type. Key is still always a string. Added support for sorting the iteration replies. Added dict_unset(). Added Berkeley DB support. Most of the code written by Tianyan Liu.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4512
diff
changeset
|
529 struct client_dict_transaction_context *ctx = |
aa2f73a4df26
Dictionary changes: Added support for defining value's type. Key is still always a string. Added support for sorting the iteration replies. Added dict_unset(). Added Berkeley DB support. Most of the code written by Tianyan Liu.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4512
diff
changeset
|
530 (struct client_dict_transaction_context *)_ctx; |
6940
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
531 |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
532 T_BEGIN { |
6940
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
533 const char *query; |
4516
aa2f73a4df26
Dictionary changes: Added support for defining value's type. Key is still always a string. Added support for sorting the iteration replies. Added dict_unset(). Added Berkeley DB support. Most of the code written by Tianyan Liu.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4512
diff
changeset
|
534 |
6940
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
535 query = t_strdup_printf("%c%u\t%s\n", |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
536 DICT_PROTOCOL_CMD_UNSET, ctx->id, |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
537 dict_client_escape(key)); |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
538 (void)client_dict_send_transaction_query(ctx, query); |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
539 } T_END; |
4516
aa2f73a4df26
Dictionary changes: Added support for defining value's type. Key is still always a string. Added support for sorting the iteration replies. Added dict_unset(). Added Berkeley DB support. Most of the code written by Tianyan Liu.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4512
diff
changeset
|
540 } |
aa2f73a4df26
Dictionary changes: Added support for defining value's type. Key is still always a string. Added support for sorting the iteration replies. Added dict_unset(). Added Berkeley DB support. Most of the code written by Tianyan Liu.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4512
diff
changeset
|
541 |
3793 | 542 static void client_dict_atomic_inc(struct dict_transaction_context *_ctx, |
3990
e2e6919c6c4d
LF wasn't sent at the end of all commands.
Timo Sirainen <tss@iki.fi>
parents:
3967
diff
changeset
|
543 const char *key, long long diff) |
3793 | 544 { |
545 struct client_dict_transaction_context *ctx = | |
546 (struct client_dict_transaction_context *)_ctx; | |
547 | |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
548 T_BEGIN { |
6940
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
549 const char *query; |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
550 query = t_strdup_printf("%c%u\t%s\t%lld\n", |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
551 DICT_PROTOCOL_CMD_ATOMIC_INC, |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
552 ctx->id, dict_client_escape(key), diff); |
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6525
diff
changeset
|
553 (void)client_dict_send_transaction_query(ctx, query); |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
554 } T_END; |
3793 | 555 } |
556 | |
4517
e661182eab75
Berkeley DB dict support is now enabled only when using --with-db configure option.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4516
diff
changeset
|
557 struct dict dict_driver_client = { |
3793 | 558 MEMBER(name) "proxy", |
559 | |
560 { | |
561 client_dict_init, | |
562 client_dict_deinit, | |
563 client_dict_lookup, | |
564 client_dict_iterate_init, | |
565 client_dict_iterate, | |
566 client_dict_iterate_deinit, | |
567 client_dict_transaction_init, | |
568 client_dict_transaction_commit, | |
569 client_dict_transaction_rollback, | |
570 client_dict_set, | |
4516
aa2f73a4df26
Dictionary changes: Added support for defining value's type. Key is still always a string. Added support for sorting the iteration replies. Added dict_unset(). Added Berkeley DB support. Most of the code written by Tianyan Liu.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4512
diff
changeset
|
571 client_dict_unset, |
3793 | 572 client_dict_atomic_inc |
573 } | |
574 }; |