diff options
Diffstat (limited to 'src/datastore')
-rw-r--r-- | src/datastore/datastore_api.c | 8 | ||||
-rw-r--r-- | src/datastore/gnunet-datastore.c | 18 | ||||
-rw-r--r-- | src/datastore/gnunet-service-datastore.c | 8 | ||||
-rw-r--r-- | src/datastore/perf_datastore_api.c | 2 | ||||
-rw-r--r-- | src/datastore/perf_plugin_datastore.c | 6 | ||||
-rw-r--r-- | src/datastore/plugin_datastore_heap.c | 56 | ||||
-rw-r--r-- | src/datastore/plugin_datastore_mysql.c | 10 | ||||
-rw-r--r-- | src/datastore/plugin_datastore_postgres.c | 8 | ||||
-rw-r--r-- | src/datastore/test_datastore_api.c | 4 | ||||
-rw-r--r-- | src/datastore/test_datastore_api_management.c | 2 | ||||
-rw-r--r-- | src/datastore/test_plugin_datastore.c | 2 |
11 files changed, 62 insertions, 62 deletions
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index 2fb250b96..461440c85 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c | |||
@@ -475,7 +475,7 @@ make_queue_entry (struct GNUNET_DATASTORE_Handle *h, size_t msize, | |||
475 | GNUNET_assert (pos->response_proc != NULL); | 475 | GNUNET_assert (pos->response_proc != NULL); |
476 | /* move 'pos' element to head so that it will be | 476 | /* move 'pos' element to head so that it will be |
477 | * killed on 'NULL' call below */ | 477 | * killed on 'NULL' call below */ |
478 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Dropping request from datastore queue\n"); | 478 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Dropping request from datastore queue\n"); |
479 | GNUNET_CONTAINER_DLL_remove (h->queue_head, h->queue_tail, pos); | 479 | GNUNET_CONTAINER_DLL_remove (h->queue_head, h->queue_tail, pos); |
480 | GNUNET_CONTAINER_DLL_insert (h->queue_head, h->queue_tail, pos); | 480 | GNUNET_CONTAINER_DLL_insert (h->queue_head, h->queue_tail, pos); |
481 | GNUNET_STATISTICS_update (h->stats, | 481 | GNUNET_STATISTICS_update (h->stats, |
@@ -691,7 +691,7 @@ process_queue (struct GNUNET_DATASTORE_Handle *h) | |||
691 | * @param emsg error message | 691 | * @param emsg error message |
692 | */ | 692 | */ |
693 | static void | 693 | static void |
694 | drop_status_cont (void *cls, int32_t result, | 694 | drop_status_cont (void *cls, int32_t result, |
695 | struct GNUNET_TIME_Absolute min_expiration, | 695 | struct GNUNET_TIME_Absolute min_expiration, |
696 | const char *emsg) | 696 | const char *emsg) |
697 | { | 697 | { |
@@ -800,7 +800,7 @@ process_status_message (void *cls, const struct GNUNET_MessageHeader *msg) | |||
800 | h->retry_time = GNUNET_TIME_UNIT_ZERO; | 800 | h->retry_time = GNUNET_TIME_UNIT_ZERO; |
801 | process_queue (h); | 801 | process_queue (h); |
802 | if (rc.cont != NULL) | 802 | if (rc.cont != NULL) |
803 | rc.cont (rc.cont_cls, status, | 803 | rc.cont (rc.cont_cls, status, |
804 | GNUNET_TIME_absolute_ntoh (sm->min_expiration), | 804 | GNUNET_TIME_absolute_ntoh (sm->min_expiration), |
805 | emsg); | 805 | emsg); |
806 | } | 806 | } |
@@ -1039,7 +1039,7 @@ GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, uint64_t uid, | |||
1039 | cont = &drop_status_cont; | 1039 | cont = &drop_status_cont; |
1040 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1040 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1041 | "Asked to update entry %llu raising priority by %u and expiration to %s\n", | 1041 | "Asked to update entry %llu raising priority by %u and expiration to %s\n", |
1042 | uid, | 1042 | uid, |
1043 | (unsigned int) priority, | 1043 | (unsigned int) priority, |
1044 | GNUNET_STRINGS_absolute_time_to_string (expiration)); | 1044 | GNUNET_STRINGS_absolute_time_to_string (expiration)); |
1045 | qc.sc.cont = cont; | 1045 | qc.sc.cont = cont; |
diff --git a/src/datastore/gnunet-datastore.c b/src/datastore/gnunet-datastore.c index 4388818d7..9daad04c7 100644 --- a/src/datastore/gnunet-datastore.c +++ b/src/datastore/gnunet-datastore.c | |||
@@ -84,7 +84,7 @@ do_shutdown (void *cls, | |||
84 | /** | 84 | /** |
85 | * Perform next GET operation. | 85 | * Perform next GET operation. |
86 | */ | 86 | */ |
87 | static void | 87 | static void |
88 | do_get (void); | 88 | do_get (void); |
89 | 89 | ||
90 | 90 | ||
@@ -101,7 +101,7 @@ do_get (void); | |||
101 | * space for 0-priority content | 101 | * space for 0-priority content |
102 | * @param msg NULL on success, otherwise an error message | 102 | * @param msg NULL on success, otherwise an error message |
103 | */ | 103 | */ |
104 | static void | 104 | static void |
105 | do_finish (void *cls, | 105 | do_finish (void *cls, |
106 | int32_t success, | 106 | int32_t success, |
107 | struct GNUNET_TIME_Absolute min_expiration, | 107 | struct GNUNET_TIME_Absolute min_expiration, |
@@ -135,7 +135,7 @@ do_finish (void *cls, | |||
135 | * @param uid unique identifier for the datum; | 135 | * @param uid unique identifier for the datum; |
136 | * maybe 0 if no unique identifier is available | 136 | * maybe 0 if no unique identifier is available |
137 | */ | 137 | */ |
138 | static void | 138 | static void |
139 | do_put (void *cls, | 139 | do_put (void *cls, |
140 | const struct GNUNET_HashCode *key, | 140 | const struct GNUNET_HashCode *key, |
141 | size_t size, const void *data, | 141 | size_t size, const void *data, |
@@ -156,8 +156,8 @@ do_put (void *cls, | |||
156 | first_uid = uid; | 156 | first_uid = uid; |
157 | qe = GNUNET_DATASTORE_put (db_dst, 0, | 157 | qe = GNUNET_DATASTORE_put (db_dst, 0, |
158 | key, size, data, type, | 158 | key, size, data, type, |
159 | priority, anonymity, | 159 | priority, anonymity, |
160 | 0 /* FIXME: replication is lost... */, | 160 | 0 /* FIXME: replication is lost... */, |
161 | expiration, | 161 | expiration, |
162 | 0, 1, GNUNET_TIME_UNIT_FOREVER_REL, | 162 | 0, 1, GNUNET_TIME_UNIT_FOREVER_REL, |
163 | &do_finish, NULL); | 163 | &do_finish, NULL); |
@@ -167,7 +167,7 @@ do_put (void *cls, | |||
167 | /** | 167 | /** |
168 | * Perform next GET operation. | 168 | * Perform next GET operation. |
169 | */ | 169 | */ |
170 | static void | 170 | static void |
171 | do_get () | 171 | do_get () |
172 | { | 172 | { |
173 | qe = GNUNET_DATASTORE_get_key (db_src, | 173 | qe = GNUNET_DATASTORE_get_key (db_src, |
@@ -185,7 +185,7 @@ do_get () | |||
185 | * | 185 | * |
186 | * @param cls closure | 186 | * @param cls closure |
187 | * @param args remaining command-line arguments | 187 | * @param args remaining command-line arguments |
188 | * @param cfgfile name of the configuration file used | 188 | * @param cfgfile name of the configuration file used |
189 | * @param cfg configuration -- for destination datastore | 189 | * @param cfg configuration -- for destination datastore |
190 | */ | 190 | */ |
191 | static void | 191 | static void |
@@ -196,7 +196,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
196 | return; /* nothing to be done */ | 196 | return; /* nothing to be done */ |
197 | if (0 == strcmp (cfgfile, alternative_cfg)) | 197 | if (0 == strcmp (cfgfile, alternative_cfg)) |
198 | { | 198 | { |
199 | fprintf (stderr, | 199 | fprintf (stderr, |
200 | _("Cannot use the same configuration for source and destination\n")); | 200 | _("Cannot use the same configuration for source and destination\n")); |
201 | ret = 1; | 201 | ret = 1; |
202 | return; | 202 | return; |
@@ -253,7 +253,7 @@ main (int argc, char *const *argv) | |||
253 | if (GNUNET_OK != | 253 | if (GNUNET_OK != |
254 | GNUNET_PROGRAM_run (argc, argv, "gnunet-datastore", | 254 | GNUNET_PROGRAM_run (argc, argv, "gnunet-datastore", |
255 | gettext_noop ("Manipulate GNUnet datastore"), | 255 | gettext_noop ("Manipulate GNUnet datastore"), |
256 | options, &run, NULL)) | 256 | options, &run, NULL)) |
257 | ret = 1; | 257 | ret = 1; |
258 | GNUNET_free ((void*) argv); | 258 | GNUNET_free ((void*) argv); |
259 | return ret; | 259 | return ret; |
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c index e605da8fc..7c4c47e90 100644 --- a/src/datastore/gnunet-service-datastore.c +++ b/src/datastore/gnunet-service-datastore.c | |||
@@ -409,7 +409,7 @@ quota_processor (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
409 | "Deleting %llu bytes of low-priority (%u) content `%s' of type %u at %s prior to expiration (still trying to free another %llu bytes)\n", | 409 | "Deleting %llu bytes of low-priority (%u) content `%s' of type %u at %s prior to expiration (still trying to free another %llu bytes)\n", |
410 | (unsigned long long) (size + GNUNET_DATASTORE_ENTRY_OVERHEAD), | 410 | (unsigned long long) (size + GNUNET_DATASTORE_ENTRY_OVERHEAD), |
411 | (unsigned int) priority, | 411 | (unsigned int) priority, |
412 | GNUNET_h2s (key), type, | 412 | GNUNET_h2s (key), type, |
413 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (expiration), | 413 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (expiration), |
414 | GNUNET_YES), | 414 | GNUNET_YES), |
415 | *need); | 415 | *need); |
@@ -1473,7 +1473,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1473 | sizeof (struct GNUNET_MessageHeader)}, | 1473 | sizeof (struct GNUNET_MessageHeader)}, |
1474 | {NULL, NULL, 0, 0} | 1474 | {NULL, NULL, 0, 0} |
1475 | }; | 1475 | }; |
1476 | char *fn; | 1476 | char *fn; |
1477 | char *pfn; | 1477 | char *pfn; |
1478 | unsigned int bf_size; | 1478 | unsigned int bf_size; |
1479 | int refresh_bf; | 1479 | int refresh_bf; |
@@ -1504,7 +1504,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1504 | cache_size = quota / 8; /* Or should we make this an option? */ | 1504 | cache_size = quota / 8; /* Or should we make this an option? */ |
1505 | GNUNET_STATISTICS_set (stats, gettext_noop ("# cache size"), cache_size, | 1505 | GNUNET_STATISTICS_set (stats, gettext_noop ("# cache size"), cache_size, |
1506 | GNUNET_NO); | 1506 | GNUNET_NO); |
1507 | if (quota / (32 * 1024LL) > (1 << 31)) | 1507 | if (quota / (32 * 1024LL) > (1 << 31)) |
1508 | bf_size = (1 << 31); /* absolute limit: ~2 GB, beyond that BF just won't help anyway */ | 1508 | bf_size = (1 << 31); /* absolute limit: ~2 GB, beyond that BF just won't help anyway */ |
1509 | else | 1509 | else |
1510 | bf_size = quota / (32 * 1024LL); /* 8 bit per entry, 1 bit per 32 kb in DB */ | 1510 | bf_size = quota / (32 * 1024LL); /* 8 bit per entry, 1 bit per 32 kb in DB */ |
@@ -1610,7 +1610,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
1610 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1610 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1611 | _("Rebuilding bloomfilter. Please be patient.\n")); | 1611 | _("Rebuilding bloomfilter. Please be patient.\n")); |
1612 | if (NULL != plugin->api->get_keys) | 1612 | if (NULL != plugin->api->get_keys) |
1613 | plugin->api->get_keys (plugin->api->cls, &add_key_to_bloomfilter, filter); | 1613 | plugin->api->get_keys (plugin->api->cls, &add_key_to_bloomfilter, filter); |
1614 | else | 1614 | else |
1615 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1615 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1616 | _("Plugin does not support get_keys function. Please fix!\n")); | 1616 | _("Plugin does not support get_keys function. Please fix!\n")); |
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c index 83be3ad5f..c51502cc6 100644 --- a/src/datastore/perf_datastore_api.c +++ b/src/datastore/perf_datastore_api.c | |||
@@ -294,7 +294,7 @@ run_tests (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, c | |||
294 | 294 | ||
295 | 295 | ||
296 | static void | 296 | static void |
297 | run (void *cls, | 297 | run (void *cls, |
298 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 298 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
299 | struct GNUNET_TESTING_Peer *peer) | 299 | struct GNUNET_TESTING_Peer *peer) |
300 | { | 300 | { |
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c index 657acc66b..908a7ee55 100644 --- a/src/datastore/perf_plugin_datastore.c +++ b/src/datastore/perf_plugin_datastore.c | |||
@@ -163,10 +163,10 @@ iterate_zeros (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
163 | memcpy (&i, &cdata[4], sizeof (i)); | 163 | memcpy (&i, &cdata[4], sizeof (i)); |
164 | hits[i / 8] |= (1 << (i % 8)); | 164 | hits[i / 8] |= (1 << (i % 8)); |
165 | 165 | ||
166 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 166 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
167 | "Found result %d type=%u, priority=%u, size=%u, expire=%s\n", | 167 | "Found result %d type=%u, priority=%u, size=%u, expire=%s\n", |
168 | i, | 168 | i, |
169 | type, priority, size, | 169 | type, priority, size, |
170 | GNUNET_STRINGS_absolute_time_to_string (expiration)); | 170 | GNUNET_STRINGS_absolute_time_to_string (expiration)); |
171 | crc->cnt++; | 171 | crc->cnt++; |
172 | if (crc->cnt == PUT_10 / 4 - 1) | 172 | if (crc->cnt == PUT_10 / 4 - 1) |
@@ -349,7 +349,7 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
349 | GNUNET_break (0); | 349 | GNUNET_break (0); |
350 | crc->phase = RP_ERROR; | 350 | crc->phase = RP_ERROR; |
351 | } | 351 | } |
352 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 352 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
353 | "In phase %d, iteration %u\n", crc->phase, crc->cnt); | 353 | "In phase %d, iteration %u\n", crc->phase, crc->cnt); |
354 | switch (crc->phase) | 354 | switch (crc->phase) |
355 | { | 355 | { |
diff --git a/src/datastore/plugin_datastore_heap.c b/src/datastore/plugin_datastore_heap.c index 79dcb9043..1f756a95c 100644 --- a/src/datastore/plugin_datastore_heap.c +++ b/src/datastore/plugin_datastore_heap.c | |||
@@ -33,7 +33,7 @@ | |||
33 | 33 | ||
34 | /** | 34 | /** |
35 | * A value that we are storing. | 35 | * A value that we are storing. |
36 | */ | 36 | */ |
37 | struct Value | 37 | struct Value |
38 | { | 38 | { |
39 | 39 | ||
@@ -67,11 +67,11 @@ struct Value | |||
67 | * only used if anonymity is zero. | 67 | * only used if anonymity is zero. |
68 | */ | 68 | */ |
69 | unsigned int zero_anon_offset; | 69 | unsigned int zero_anon_offset; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Number of bytes in 'data'. | 72 | * Number of bytes in 'data'. |
73 | */ | 73 | */ |
74 | uint32_t size; | 74 | uint32_t size; |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * Priority of the value. | 77 | * Priority of the value. |
@@ -82,7 +82,7 @@ struct Value | |||
82 | * Anonymity level for the value. | 82 | * Anonymity level for the value. |
83 | */ | 83 | */ |
84 | uint32_t anonymity; | 84 | uint32_t anonymity; |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Replication level for the value. | 87 | * Replication level for the value. |
88 | */ | 88 | */ |
@@ -209,10 +209,10 @@ heap_plugin_estimate_size (void *cls) | |||
209 | * @return GNUNET_OK on success | 209 | * @return GNUNET_OK on success |
210 | */ | 210 | */ |
211 | static int | 211 | static int |
212 | heap_plugin_put (void *cls, | 212 | heap_plugin_put (void *cls, |
213 | const struct GNUNET_HashCode * key, | 213 | const struct GNUNET_HashCode * key, |
214 | uint32_t size, | 214 | uint32_t size, |
215 | const void *data, | 215 | const void *data, |
216 | enum GNUNET_BLOCK_Type type, | 216 | enum GNUNET_BLOCK_Type type, |
217 | uint32_t priority, uint32_t anonymity, | 217 | uint32_t priority, uint32_t anonymity, |
218 | uint32_t replication, | 218 | uint32_t replication, |
@@ -328,7 +328,7 @@ struct GetContext | |||
328 | * The plugin. | 328 | * The plugin. |
329 | */ | 329 | */ |
330 | struct Plugin *plugin; | 330 | struct Plugin *plugin; |
331 | 331 | ||
332 | /** | 332 | /** |
333 | * Requested value hash. | 333 | * Requested value hash. |
334 | */ | 334 | */ |
@@ -343,7 +343,7 @@ struct GetContext | |||
343 | * Function to call with the result. | 343 | * Function to call with the result. |
344 | */ | 344 | */ |
345 | PluginDatumProcessor proc; | 345 | PluginDatumProcessor proc; |
346 | 346 | ||
347 | /** | 347 | /** |
348 | * Closure for 'proc'. | 348 | * Closure for 'proc'. |
349 | */ | 349 | */ |
@@ -358,7 +358,7 @@ struct GetContext | |||
358 | * @param value the value to check against the query | 358 | * @param value the value to check against the query |
359 | * @return GNUNET_YES if the value matches | 359 | * @return GNUNET_YES if the value matches |
360 | */ | 360 | */ |
361 | static int | 361 | static int |
362 | match (const struct GetContext *gc, | 362 | match (const struct GetContext *gc, |
363 | struct Value *value) | 363 | struct Value *value) |
364 | { | 364 | { |
@@ -421,7 +421,7 @@ get_iterator (void *cls, | |||
421 | if (0 != gc->offset--) | 421 | if (0 != gc->offset--) |
422 | return GNUNET_OK; | 422 | return GNUNET_OK; |
423 | if (GNUNET_NO == | 423 | if (GNUNET_NO == |
424 | gc->proc (gc->proc_cls, | 424 | gc->proc (gc->proc_cls, |
425 | key, | 425 | key, |
426 | value->size, | 426 | value->size, |
427 | &value[1], | 427 | &value[1], |
@@ -476,7 +476,7 @@ heap_plugin_get_key (void *cls, uint64_t offset, | |||
476 | &gc); | 476 | &gc); |
477 | if (0 == gc.offset) | 477 | if (0 == gc.offset) |
478 | { | 478 | { |
479 | proc (proc_cls, | 479 | proc (proc_cls, |
480 | NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); | 480 | NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); |
481 | return; | 481 | return; |
482 | } | 482 | } |
@@ -489,11 +489,11 @@ heap_plugin_get_key (void *cls, uint64_t offset, | |||
489 | { | 489 | { |
490 | GNUNET_CONTAINER_multihashmap_get_multiple (plugin->keyvalue, | 490 | GNUNET_CONTAINER_multihashmap_get_multiple (plugin->keyvalue, |
491 | key, | 491 | key, |
492 | &count_iterator, | 492 | &count_iterator, |
493 | &gc); | 493 | &gc); |
494 | if (0 == gc.offset) | 494 | if (0 == gc.offset) |
495 | { | 495 | { |
496 | proc (proc_cls, | 496 | proc (proc_cls, |
497 | NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); | 497 | NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); |
498 | return; | 498 | return; |
499 | } | 499 | } |
@@ -518,7 +518,7 @@ heap_plugin_get_key (void *cls, uint64_t offset, | |||
518 | * @param proc_cls closure for proc | 518 | * @param proc_cls closure for proc |
519 | */ | 519 | */ |
520 | static void | 520 | static void |
521 | heap_plugin_get_replication (void *cls, | 521 | heap_plugin_get_replication (void *cls, |
522 | PluginDatumProcessor proc, | 522 | PluginDatumProcessor proc, |
523 | void *proc_cls) | 523 | void *proc_cls) |
524 | { | 524 | { |
@@ -528,7 +528,7 @@ heap_plugin_get_replication (void *cls, | |||
528 | value = GNUNET_CONTAINER_heap_remove_root (plugin->by_replication); | 528 | value = GNUNET_CONTAINER_heap_remove_root (plugin->by_replication); |
529 | if (NULL == value) | 529 | if (NULL == value) |
530 | { | 530 | { |
531 | proc (proc_cls, | 531 | proc (proc_cls, |
532 | NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); | 532 | NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); |
533 | return; | 533 | return; |
534 | } | 534 | } |
@@ -537,18 +537,18 @@ heap_plugin_get_replication (void *cls, | |||
537 | value->replication--; | 537 | value->replication--; |
538 | value->replication_heap = GNUNET_CONTAINER_heap_insert (plugin->by_replication, | 538 | value->replication_heap = GNUNET_CONTAINER_heap_insert (plugin->by_replication, |
539 | value, | 539 | value, |
540 | value->replication); | 540 | value->replication); |
541 | } | 541 | } |
542 | else | 542 | else |
543 | { | 543 | { |
544 | /* need a better way to pick a random item, replication level is always 0 */ | 544 | /* need a better way to pick a random item, replication level is always 0 */ |
545 | value->replication_heap = GNUNET_CONTAINER_heap_insert (plugin->by_replication, | 545 | value->replication_heap = GNUNET_CONTAINER_heap_insert (plugin->by_replication, |
546 | value, | 546 | value, |
547 | value->replication); | 547 | value->replication); |
548 | value = GNUNET_CONTAINER_heap_walk_get_next (plugin->by_replication); | 548 | value = GNUNET_CONTAINER_heap_walk_get_next (plugin->by_replication); |
549 | } | 549 | } |
550 | if (GNUNET_NO == | 550 | if (GNUNET_NO == |
551 | proc (proc_cls, | 551 | proc (proc_cls, |
552 | &value->key, | 552 | &value->key, |
553 | value->size, | 553 | value->size, |
554 | &value[1], | 554 | &value[1], |
@@ -579,12 +579,12 @@ heap_plugin_get_expiration (void *cls, PluginDatumProcessor proc, | |||
579 | value = GNUNET_CONTAINER_heap_peek (plugin->by_expiration); | 579 | value = GNUNET_CONTAINER_heap_peek (plugin->by_expiration); |
580 | if (NULL == value) | 580 | if (NULL == value) |
581 | { | 581 | { |
582 | proc (proc_cls, | 582 | proc (proc_cls, |
583 | NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); | 583 | NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); |
584 | return; | 584 | return; |
585 | } | 585 | } |
586 | if (GNUNET_NO == | 586 | if (GNUNET_NO == |
587 | proc (proc_cls, | 587 | proc (proc_cls, |
588 | &value->key, | 588 | &value->key, |
589 | value->size, | 589 | value->size, |
590 | &value[1], | 590 | &value[1], |
@@ -618,8 +618,8 @@ heap_plugin_get_expiration (void *cls, PluginDatumProcessor proc, | |||
618 | * @return GNUNET_OK on success | 618 | * @return GNUNET_OK on success |
619 | */ | 619 | */ |
620 | static int | 620 | static int |
621 | heap_plugin_update (void *cls, | 621 | heap_plugin_update (void *cls, |
622 | uint64_t uid, | 622 | uint64_t uid, |
623 | int delta, | 623 | int delta, |
624 | struct GNUNET_TIME_Absolute expire, char **msg) | 624 | struct GNUNET_TIME_Absolute expire, char **msg) |
625 | { | 625 | { |
@@ -675,10 +675,10 @@ heap_plugin_get_zero_anonymity (void *cls, uint64_t offset, | |||
675 | } | 675 | } |
676 | if (0 == count) | 676 | if (0 == count) |
677 | { | 677 | { |
678 | proc (proc_cls, | 678 | proc (proc_cls, |
679 | NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); | 679 | NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); |
680 | return; | 680 | return; |
681 | } | 681 | } |
682 | offset = offset % count; | 682 | offset = offset % count; |
683 | for (zabt = plugin->zero_head; NULL != zabt; zabt = zabt->next) | 683 | for (zabt = plugin->zero_head; NULL != zabt; zabt = zabt->next) |
684 | { | 684 | { |
@@ -695,7 +695,7 @@ heap_plugin_get_zero_anonymity (void *cls, uint64_t offset, | |||
695 | GNUNET_assert (NULL != zabt); | 695 | GNUNET_assert (NULL != zabt); |
696 | value = zabt->array[offset]; | 696 | value = zabt->array[offset]; |
697 | if (GNUNET_NO == | 697 | if (GNUNET_NO == |
698 | proc (proc_cls, | 698 | proc (proc_cls, |
699 | &value->key, | 699 | &value->key, |
700 | value->size, | 700 | value->size, |
701 | &value[1], | 701 | &value[1], |
@@ -749,8 +749,8 @@ return_value (void *cls, | |||
749 | void *val) | 749 | void *val) |
750 | { | 750 | { |
751 | struct GetAllContext *gac = cls; | 751 | struct GetAllContext *gac = cls; |
752 | 752 | ||
753 | gac->proc (gac->proc_cls, | 753 | gac->proc (gac->proc_cls, |
754 | key, | 754 | key, |
755 | 1); | 755 | 1); |
756 | return GNUNET_OK; | 756 | return GNUNET_OK; |
diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c index 40f25deee..923660dc2 100644 --- a/src/datastore/plugin_datastore_mysql.c +++ b/src/datastore/plugin_datastore_mysql.c | |||
@@ -363,7 +363,7 @@ mysql_plugin_update (void *cls, uint64_t uid, int delta, | |||
363 | 363 | ||
364 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 364 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
365 | "Updating value %llu adding %d to priority and maxing exp at %s\n", | 365 | "Updating value %llu adding %d to priority and maxing exp at %s\n", |
366 | vkey, delta, | 366 | vkey, delta, |
367 | GNUNET_STRINGS_absolute_time_to_string (expire)); | 367 | GNUNET_STRINGS_absolute_time_to_string (expire)); |
368 | ret = | 368 | ret = |
369 | GNUNET_MYSQL_statement_run_prepared (plugin->mc, plugin->update_entry, NULL, | 369 | GNUNET_MYSQL_statement_run_prepared (plugin->mc, plugin->update_entry, NULL, |
@@ -454,7 +454,7 @@ execute_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt | |||
454 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 454 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
455 | "Found %u-byte value under key `%s' with prio %u, anon %u, expire %s selecting from gn090 table\n", | 455 | "Found %u-byte value under key `%s' with prio %u, anon %u, expire %s selecting from gn090 table\n", |
456 | (unsigned int) size, GNUNET_h2s (&key), | 456 | (unsigned int) size, GNUNET_h2s (&key), |
457 | priority, anonymity, | 457 | priority, anonymity, |
458 | GNUNET_STRINGS_absolute_time_to_string (expiration)); | 458 | GNUNET_STRINGS_absolute_time_to_string (expiration)); |
459 | GNUNET_assert (size < MAX_DATUM_SIZE); | 459 | GNUNET_assert (size < MAX_DATUM_SIZE); |
460 | ret = | 460 | ret = |
@@ -769,7 +769,7 @@ mysql_plugin_get_keys (void *cls, | |||
769 | struct GNUNET_HashCode key; | 769 | struct GNUNET_HashCode key; |
770 | MYSQL_BIND cbind[1]; | 770 | MYSQL_BIND cbind[1]; |
771 | unsigned long length; | 771 | unsigned long length; |
772 | 772 | ||
773 | statement = GNUNET_MYSQL_statement_get_stmt (plugin->mc, | 773 | statement = GNUNET_MYSQL_statement_get_stmt (plugin->mc, |
774 | plugin->get_all_keys); | 774 | plugin->get_all_keys); |
775 | if (statement == NULL) | 775 | if (statement == NULL) |
@@ -812,14 +812,14 @@ mysql_plugin_get_keys (void *cls, | |||
812 | while (0 == (ret = mysql_stmt_fetch (statement))) | 812 | while (0 == (ret = mysql_stmt_fetch (statement))) |
813 | { | 813 | { |
814 | if (sizeof (struct GNUNET_HashCode) == length) | 814 | if (sizeof (struct GNUNET_HashCode) == length) |
815 | proc (proc_cls, &key, 1); | 815 | proc (proc_cls, &key, 1); |
816 | } | 816 | } |
817 | if (ret != MYSQL_NO_DATA) | 817 | if (ret != MYSQL_NO_DATA) |
818 | { | 818 | { |
819 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 819 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
820 | _("`%s' failed at %s:%d with error: %s\n"), | 820 | _("`%s' failed at %s:%d with error: %s\n"), |
821 | "mysql_stmt_fetch", __FILE__, __LINE__, | 821 | "mysql_stmt_fetch", __FILE__, __LINE__, |
822 | mysql_stmt_error (statement)); | 822 | mysql_stmt_error (statement)); |
823 | GNUNET_MYSQL_statements_invalidate (plugin->mc); | 823 | GNUNET_MYSQL_statements_invalidate (plugin->mc); |
824 | return; | 824 | return; |
825 | } | 825 | } |
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c index 98109d4da..6a96ad5d3 100644 --- a/src/datastore/plugin_datastore_postgres.c +++ b/src/datastore/plugin_datastore_postgres.c | |||
@@ -257,7 +257,7 @@ postgres_plugin_estimate_size (void *cls) | |||
257 | /** | 257 | /** |
258 | * Store an item in the datastore. | 258 | * Store an item in the datastore. |
259 | * | 259 | * |
260 | * @param cls closure with the 'struct Plugin' | 260 | * @param cls closure with the 'struct Plugin' |
261 | * @param key key for the item | 261 | * @param key key for the item |
262 | * @param size number of bytes in data | 262 | * @param size number of bytes in data |
263 | * @param data content stored | 263 | * @param data content stored |
@@ -335,7 +335,7 @@ postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t siz | |||
335 | */ | 335 | */ |
336 | static void | 336 | static void |
337 | process_result (struct Plugin *plugin, PluginDatumProcessor proc, | 337 | process_result (struct Plugin *plugin, PluginDatumProcessor proc, |
338 | void *proc_cls, PGresult * res, | 338 | void *proc_cls, PGresult * res, |
339 | const char *filename, int line) | 339 | const char *filename, int line) |
340 | { | 340 | { |
341 | int iret; | 341 | int iret; |
@@ -802,7 +802,7 @@ postgres_plugin_get_keys (void *cls, | |||
802 | if (sizeof (struct GNUNET_HashCode) != PQgetlength (res, i, 0)) | 802 | if (sizeof (struct GNUNET_HashCode) != PQgetlength (res, i, 0)) |
803 | { | 803 | { |
804 | memcpy (&key, PQgetvalue (res, i, 0), sizeof (struct GNUNET_HashCode)); | 804 | memcpy (&key, PQgetvalue (res, i, 0), sizeof (struct GNUNET_HashCode)); |
805 | proc (proc_cls, &key, 1); | 805 | proc (proc_cls, &key, 1); |
806 | } | 806 | } |
807 | } | 807 | } |
808 | PQclear (res); | 808 | PQclear (res); |
@@ -819,7 +819,7 @@ static void | |||
819 | postgres_plugin_drop (void *cls) | 819 | postgres_plugin_drop (void *cls) |
820 | { | 820 | { |
821 | struct Plugin *plugin = cls; | 821 | struct Plugin *plugin = cls; |
822 | 822 | ||
823 | if (GNUNET_OK != GNUNET_POSTGRES_exec (plugin->dbh, "DROP TABLE gn090")) | 823 | if (GNUNET_OK != GNUNET_POSTGRES_exec (plugin->dbh, "DROP TABLE gn090")) |
824 | GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "postgres", _("Failed to drop table from database.\n")); | 824 | GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "postgres", _("Failed to drop table from database.\n")); |
825 | } | 825 | } |
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c index a88dd0c20..03939cee3 100644 --- a/src/datastore/test_datastore_api.c +++ b/src/datastore/test_datastore_api.c | |||
@@ -191,7 +191,7 @@ check_value (void *cls, const struct GNUNET_HashCode * key, size_t size, | |||
191 | return; | 191 | return; |
192 | } | 192 | } |
193 | #if 0 | 193 | #if 0 |
194 | FPRINTF (stderr, | 194 | FPRINTF (stderr, |
195 | "Check value got `%s' of size %u, type %d, expire %s\n", | 195 | "Check value got `%s' of size %u, type %d, expire %s\n", |
196 | GNUNET_h2s (key), (unsigned int) size, type, | 196 | GNUNET_h2s (key), (unsigned int) size, type, |
197 | GNUNET_STRINGS_absolute_time_to_string (expiration)); | 197 | GNUNET_STRINGS_absolute_time_to_string (expiration)); |
@@ -464,7 +464,7 @@ run_tests (void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiratio | |||
464 | 464 | ||
465 | 465 | ||
466 | static void | 466 | static void |
467 | run (void *cls, | 467 | run (void *cls, |
468 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 468 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
469 | struct GNUNET_TESTING_Peer *peer) | 469 | struct GNUNET_TESTING_Peer *peer) |
470 | { | 470 | { |
diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c index 8baeeede8..7f330031a 100644 --- a/src/datastore/test_datastore_api_management.c +++ b/src/datastore/test_datastore_api_management.c | |||
@@ -258,7 +258,7 @@ run_tests (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, c | |||
258 | 258 | ||
259 | 259 | ||
260 | static void | 260 | static void |
261 | run (void *cls, | 261 | run (void *cls, |
262 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 262 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
263 | struct GNUNET_TESTING_Peer *peer) | 263 | struct GNUNET_TESTING_Peer *peer) |
264 | { | 264 | { |
diff --git a/src/datastore/test_plugin_datastore.c b/src/datastore/test_plugin_datastore.c index 3efd7b4ce..844d32a7b 100644 --- a/src/datastore/test_plugin_datastore.c +++ b/src/datastore/test_plugin_datastore.c | |||
@@ -226,7 +226,7 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
226 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test aborted.\n"); | 226 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Test aborted.\n"); |
227 | crc->phase = RP_ERROR; | 227 | crc->phase = RP_ERROR; |
228 | } | 228 | } |
229 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 229 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
230 | "In phase %d, iteration %u\n", crc->phase, crc->cnt); | 230 | "In phase %d, iteration %u\n", crc->phase, crc->cnt); |
231 | switch (crc->phase) | 231 | switch (crc->phase) |
232 | { | 232 | { |