diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-06-16 22:08:40 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-06-16 22:08:40 +0000 |
commit | 55fe7180de4f26582646418073bd52bf13bb5697 (patch) | |
tree | 30296a970be4a650f1f82644ead9f9be305f5a9d /src/datastore/plugin_datastore_sqlite.c | |
parent | a69e21076e7a4d6e5b6d66078cae83c0626c94aa (diff) | |
download | gnunet-55fe7180de4f26582646418073bd52bf13bb5697.tar.gz gnunet-55fe7180de4f26582646418073bd52bf13bb5697.zip |
further datastore API improvements:
Diffstat (limited to 'src/datastore/plugin_datastore_sqlite.c')
-rw-r--r-- | src/datastore/plugin_datastore_sqlite.c | 65 |
1 files changed, 43 insertions, 22 deletions
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index 234519079..6bee1a0c9 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c | |||
@@ -51,6 +51,26 @@ static unsigned long long sqlite_plugin_get_size (void *cls) | |||
51 | } | 51 | } |
52 | 52 | ||
53 | 53 | ||
54 | |||
55 | /** | ||
56 | * Function invoked on behalf of a "PluginIterator" | ||
57 | * asking the database plugin to call the iterator | ||
58 | * with the next item. | ||
59 | * | ||
60 | * @param next_cls whatever argument was given | ||
61 | * to the PluginIterator as "next_cls". | ||
62 | * @param end_it set to GNUNET_YES if we | ||
63 | * should terminate the iteration early | ||
64 | * (iterator should be still called once more | ||
65 | * to signal the end of the iteration). | ||
66 | */ | ||
67 | static void | ||
68 | sqlite_next_request (void *next_cls, | ||
69 | int end_it) | ||
70 | { | ||
71 | } | ||
72 | |||
73 | |||
54 | /** | 74 | /** |
55 | * Store an item in the datastore. | 75 | * Store an item in the datastore. |
56 | * | 76 | * |
@@ -103,10 +123,10 @@ sqlite_plugin_get (void *cls, | |||
103 | const GNUNET_HashCode * key, | 123 | const GNUNET_HashCode * key, |
104 | const GNUNET_HashCode * vhash, | 124 | const GNUNET_HashCode * vhash, |
105 | uint32_t type, | 125 | uint32_t type, |
106 | GNUNET_DATASTORE_Iterator iter, void *iter_cls) | 126 | PluginIterator iter, void *iter_cls) |
107 | { | 127 | { |
108 | static struct GNUNET_TIME_Absolute zero; | 128 | static struct GNUNET_TIME_Absolute zero; |
109 | iter (iter_cls, NULL, 0, NULL, 0, 0, 0, zero, 0); | 129 | iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, zero, 0); |
110 | } | 130 | } |
111 | 131 | ||
112 | 132 | ||
@@ -155,12 +175,12 @@ sqlite_plugin_update (void *cls, | |||
155 | */ | 175 | */ |
156 | static void | 176 | static void |
157 | sqlite_plugin_iter_low_priority (void *cls, | 177 | sqlite_plugin_iter_low_priority (void *cls, |
158 | uint32_t type, | 178 | uint32_t type, |
159 | GNUNET_DATASTORE_Iterator iter, | 179 | PluginIterator iter, |
160 | void *iter_cls) | 180 | void *iter_cls) |
161 | { | 181 | { |
162 | static struct GNUNET_TIME_Absolute zero; | 182 | static struct GNUNET_TIME_Absolute zero; |
163 | iter (iter_cls, NULL, 0, NULL, 0, 0, 0, zero, 0); | 183 | iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, zero, 0); |
164 | } | 184 | } |
165 | 185 | ||
166 | 186 | ||
@@ -176,12 +196,12 @@ sqlite_plugin_iter_low_priority (void *cls, | |||
176 | */ | 196 | */ |
177 | static void | 197 | static void |
178 | sqlite_plugin_iter_zero_anonymity (void *cls, | 198 | sqlite_plugin_iter_zero_anonymity (void *cls, |
179 | uint32_t type, | 199 | uint32_t type, |
180 | GNUNET_DATASTORE_Iterator iter, | 200 | PluginIterator iter, |
181 | void *iter_cls) | 201 | void *iter_cls) |
182 | { | 202 | { |
183 | static struct GNUNET_TIME_Absolute zero; | 203 | static struct GNUNET_TIME_Absolute zero; |
184 | iter (iter_cls, NULL, 0, NULL, 0, 0, 0, zero, 0); | 204 | iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, zero, 0); |
185 | } | 205 | } |
186 | 206 | ||
187 | 207 | ||
@@ -198,12 +218,12 @@ sqlite_plugin_iter_zero_anonymity (void *cls, | |||
198 | */ | 218 | */ |
199 | static void | 219 | static void |
200 | sqlite_plugin_iter_ascending_expiration (void *cls, | 220 | sqlite_plugin_iter_ascending_expiration (void *cls, |
201 | uint32_t type, | 221 | uint32_t type, |
202 | GNUNET_DATASTORE_Iterator iter, | 222 | PluginIterator iter, |
203 | void *iter_cls) | 223 | void *iter_cls) |
204 | { | 224 | { |
205 | static struct GNUNET_TIME_Absolute zero; | 225 | static struct GNUNET_TIME_Absolute zero; |
206 | iter (iter_cls, NULL, 0, NULL, 0, 0, 0, zero, 0); | 226 | iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, zero, 0); |
207 | } | 227 | } |
208 | 228 | ||
209 | 229 | ||
@@ -220,12 +240,12 @@ sqlite_plugin_iter_ascending_expiration (void *cls, | |||
220 | */ | 240 | */ |
221 | static void | 241 | static void |
222 | sqlite_plugin_iter_migration_order (void *cls, | 242 | sqlite_plugin_iter_migration_order (void *cls, |
223 | uint32_t type, | 243 | uint32_t type, |
224 | GNUNET_DATASTORE_Iterator iter, | 244 | PluginIterator iter, |
225 | void *iter_cls) | 245 | void *iter_cls) |
226 | { | 246 | { |
227 | static struct GNUNET_TIME_Absolute zero; | 247 | static struct GNUNET_TIME_Absolute zero; |
228 | iter (iter_cls, NULL, 0, NULL, 0, 0, 0, zero, 0); | 248 | iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, zero, 0); |
229 | } | 249 | } |
230 | 250 | ||
231 | 251 | ||
@@ -242,12 +262,12 @@ sqlite_plugin_iter_migration_order (void *cls, | |||
242 | */ | 262 | */ |
243 | static void | 263 | static void |
244 | sqlite_plugin_iter_all_now (void *cls, | 264 | sqlite_plugin_iter_all_now (void *cls, |
245 | uint32_t type, | 265 | uint32_t type, |
246 | GNUNET_DATASTORE_Iterator iter, | 266 | PluginIterator iter, |
247 | void *iter_cls) | 267 | void *iter_cls) |
248 | { | 268 | { |
249 | static struct GNUNET_TIME_Absolute zero; | 269 | static struct GNUNET_TIME_Absolute zero; |
250 | iter (iter_cls, NULL, 0, NULL, 0, 0, 0, zero, 0); | 270 | iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, zero, 0); |
251 | } | 271 | } |
252 | 272 | ||
253 | 273 | ||
@@ -276,6 +296,7 @@ libgnunet_plugin_datastore_sqlite_init (void *cls) | |||
276 | api->cls = plugin; | 296 | api->cls = plugin; |
277 | api->get_size = &sqlite_plugin_get_size; | 297 | api->get_size = &sqlite_plugin_get_size; |
278 | api->put = &sqlite_plugin_put; | 298 | api->put = &sqlite_plugin_put; |
299 | api->next_request = &sqlite_next_request; | ||
279 | api->get = &sqlite_plugin_get; | 300 | api->get = &sqlite_plugin_get; |
280 | api->update = &sqlite_plugin_update; | 301 | api->update = &sqlite_plugin_update; |
281 | api->iter_low_priority = &sqlite_plugin_iter_low_priority; | 302 | api->iter_low_priority = &sqlite_plugin_iter_low_priority; |