diff options
author | David Barksdale <amatus@amat.us> | 2017-02-20 11:18:53 -0600 |
---|---|---|
committer | David Barksdale <amatus@amat.us> | 2017-02-20 11:21:29 -0600 |
commit | 4e96704538f882095eca84fed92a7811b299aca1 (patch) | |
tree | 2bcf0008f09aa3bc319bf2425f0f526b72fbc1ce /src/datastore | |
parent | f6f7fbbe98c110867febbcca647da8308be123c7 (diff) | |
download | gnunet-4e96704538f882095eca84fed92a7811b299aca1.tar.gz gnunet-4e96704538f882095eca84fed92a7811b299aca1.zip |
Remove unused GNUNET_DATASTORE_update() API call
Diffstat (limited to 'src/datastore')
-rw-r--r-- | src/datastore/datastore.h | 29 | ||||
-rw-r--r-- | src/datastore/datastore_api.c | 66 | ||||
-rw-r--r-- | src/datastore/gnunet-service-datastore.c | 53 | ||||
-rw-r--r-- | src/datastore/test_datastore_api.c | 48 |
4 files changed, 1 insertions, 195 deletions
diff --git a/src/datastore/datastore.h b/src/datastore/datastore.h index dc3d9d1f2..9de72f064 100644 --- a/src/datastore/datastore.h +++ b/src/datastore/datastore.h | |||
@@ -180,35 +180,6 @@ struct GetZeroAnonymityMessage | |||
180 | 180 | ||
181 | 181 | ||
182 | /** | 182 | /** |
183 | * Message to the datastore service requesting an update | ||
184 | * to the priority or expiration for some content. | ||
185 | */ | ||
186 | struct UpdateMessage | ||
187 | { | ||
188 | /** | ||
189 | * Type is GNUNET_MESSAGE_TYPE_DATASTORE_UPDATE. | ||
190 | */ | ||
191 | struct GNUNET_MessageHeader header; | ||
192 | |||
193 | /** | ||
194 | * Desired priority increase. | ||
195 | */ | ||
196 | int32_t priority GNUNET_PACKED; | ||
197 | |||
198 | /** | ||
199 | * Desired new expiration time. | ||
200 | */ | ||
201 | struct GNUNET_TIME_AbsoluteNBO expiration; | ||
202 | |||
203 | /** | ||
204 | * Unique ID for the content. | ||
205 | */ | ||
206 | uint64_t uid; | ||
207 | |||
208 | }; | ||
209 | |||
210 | |||
211 | /** | ||
212 | * Message transmitting content from or to the datastore | 183 | * Message transmitting content from or to the datastore |
213 | * service. | 184 | * service. |
214 | */ | 185 | */ |
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index db485364e..311a61283 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c | |||
@@ -1126,72 +1126,6 @@ GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, | |||
1126 | 1126 | ||
1127 | 1127 | ||
1128 | /** | 1128 | /** |
1129 | * Update a value in the datastore. | ||
1130 | * | ||
1131 | * @param h handle to the datastore | ||
1132 | * @param uid identifier for the value | ||
1133 | * @param priority how much to increase the priority of the value | ||
1134 | * @param expiration new expiration value should be MAX of existing and this argument | ||
1135 | * @param queue_priority ranking of this request in the priority queue | ||
1136 | * @param max_queue_size at what queue size should this request be dropped | ||
1137 | * (if other requests of higher priority are in the queue) | ||
1138 | * @param cont continuation to call when done | ||
1139 | * @param cont_cls closure for @a cont | ||
1140 | * @return NULL if the entry was not queued, otherwise a handle that can be used to | ||
1141 | * cancel; note that even if NULL is returned, the callback will be invoked | ||
1142 | * (or rather, will already have been invoked) | ||
1143 | */ | ||
1144 | struct GNUNET_DATASTORE_QueueEntry * | ||
1145 | GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, | ||
1146 | uint64_t uid, | ||
1147 | uint32_t priority, | ||
1148 | struct GNUNET_TIME_Absolute expiration, | ||
1149 | unsigned int queue_priority, | ||
1150 | unsigned int max_queue_size, | ||
1151 | GNUNET_DATASTORE_ContinuationWithStatus cont, | ||
1152 | void *cont_cls) | ||
1153 | { | ||
1154 | struct GNUNET_DATASTORE_QueueEntry *qe; | ||
1155 | struct GNUNET_MQ_Envelope *env; | ||
1156 | struct UpdateMessage *um; | ||
1157 | union QueueContext qc; | ||
1158 | |||
1159 | if (NULL == cont) | ||
1160 | cont = &drop_status_cont; | ||
1161 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1162 | "Asked to update entry %llu raising priority by %u and expiration to %s\n", | ||
1163 | uid, | ||
1164 | (unsigned int) priority, | ||
1165 | GNUNET_STRINGS_absolute_time_to_string (expiration)); | ||
1166 | env = GNUNET_MQ_msg (um, | ||
1167 | GNUNET_MESSAGE_TYPE_DATASTORE_UPDATE); | ||
1168 | um->priority = htonl (priority); | ||
1169 | um->expiration = GNUNET_TIME_absolute_hton (expiration); | ||
1170 | um->uid = GNUNET_htonll (uid); | ||
1171 | |||
1172 | qc.sc.cont = cont; | ||
1173 | qc.sc.cont_cls = cont_cls; | ||
1174 | qe = make_queue_entry (h, | ||
1175 | env, | ||
1176 | queue_priority, | ||
1177 | max_queue_size, | ||
1178 | GNUNET_MESSAGE_TYPE_DATASTORE_STATUS, | ||
1179 | &qc); | ||
1180 | if (NULL == qe) | ||
1181 | { | ||
1182 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1183 | "Could not create queue entry for UPDATE\n"); | ||
1184 | return NULL; | ||
1185 | } | ||
1186 | GNUNET_STATISTICS_update (h->stats, | ||
1187 | gettext_noop ("# UPDATE requests executed"), 1, | ||
1188 | GNUNET_NO); | ||
1189 | process_queue (h); | ||
1190 | return qe; | ||
1191 | } | ||
1192 | |||
1193 | |||
1194 | /** | ||
1195 | * Explicitly remove some content from the database. | 1129 | * Explicitly remove some content from the database. |
1196 | * The @a cont continuation will be called with `status` | 1130 | * The @a cont continuation will be called with `status` |
1197 | * #GNUNET_OK" if content was removed, #GNUNET_NO | 1131 | * #GNUNET_OK" if content was removed, #GNUNET_NO |
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c index e632e33e0..6f1bd2b6d 100644 --- a/src/datastore/gnunet-service-datastore.c +++ b/src/datastore/gnunet-service-datastore.c | |||
@@ -1080,55 +1080,6 @@ handle_get_key (void *cls, | |||
1080 | 1080 | ||
1081 | 1081 | ||
1082 | /** | 1082 | /** |
1083 | * Function called with the result of an update operation. | ||
1084 | * | ||
1085 | * @param cls closure | ||
1086 | * @param status #GNUNET_OK or #GNUNET_SYSERR | ||
1087 | * @param msg error message on error | ||
1088 | */ | ||
1089 | static void | ||
1090 | update_continuation (void *cls, | ||
1091 | int status, | ||
1092 | const char *msg) | ||
1093 | { | ||
1094 | struct GNUNET_SERVICE_Client *client = cls; | ||
1095 | |||
1096 | transmit_status (client, | ||
1097 | status, | ||
1098 | msg); | ||
1099 | } | ||
1100 | |||
1101 | |||
1102 | /** | ||
1103 | * Handle UPDATE-message. | ||
1104 | * | ||
1105 | * @param cls client identification of the client | ||
1106 | * @param message the actual message | ||
1107 | */ | ||
1108 | static void | ||
1109 | handle_update (void *cls, | ||
1110 | const struct UpdateMessage *msg) | ||
1111 | { | ||
1112 | struct GNUNET_SERVICE_Client *client = cls; | ||
1113 | |||
1114 | GNUNET_STATISTICS_update (stats, | ||
1115 | gettext_noop ("# UPDATE requests received"), | ||
1116 | 1, | ||
1117 | GNUNET_NO); | ||
1118 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1119 | "Processing UPDATE request for %llu\n", | ||
1120 | (unsigned long long) GNUNET_ntohll (msg->uid)); | ||
1121 | plugin->api->update (plugin->api->cls, | ||
1122 | GNUNET_ntohll (msg->uid), | ||
1123 | (int32_t) ntohl (msg->priority), | ||
1124 | GNUNET_TIME_absolute_ntoh (msg->expiration), | ||
1125 | &update_continuation, | ||
1126 | client); | ||
1127 | GNUNET_SERVICE_client_continue (client); | ||
1128 | } | ||
1129 | |||
1130 | |||
1131 | /** | ||
1132 | * Handle GET_REPLICATION-message. | 1083 | * Handle GET_REPLICATION-message. |
1133 | * | 1084 | * |
1134 | * @param cls identification of the client | 1085 | * @param cls identification of the client |
@@ -1857,10 +1808,6 @@ GNUNET_SERVICE_MAIN | |||
1857 | GNUNET_MESSAGE_TYPE_DATASTORE_PUT, | 1808 | GNUNET_MESSAGE_TYPE_DATASTORE_PUT, |
1858 | struct DataMessage, | 1809 | struct DataMessage, |
1859 | NULL), | 1810 | NULL), |
1860 | GNUNET_MQ_hd_fixed_size (update, | ||
1861 | GNUNET_MESSAGE_TYPE_DATASTORE_UPDATE, | ||
1862 | struct UpdateMessage, | ||
1863 | NULL), | ||
1864 | GNUNET_MQ_hd_fixed_size (get, | 1811 | GNUNET_MQ_hd_fixed_size (get, |
1865 | GNUNET_MESSAGE_TYPE_DATASTORE_GET, | 1812 | GNUNET_MESSAGE_TYPE_DATASTORE_GET, |
1866 | struct GetMessage, | 1813 | struct GetMessage, |
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c index 9f89d4087..a99668240 100644 --- a/src/datastore/test_datastore_api.c +++ b/src/datastore/test_datastore_api.c | |||
@@ -130,8 +130,6 @@ enum RunPhase | |||
130 | RP_PUT_MULTIPLE_NEXT = 8, | 130 | RP_PUT_MULTIPLE_NEXT = 8, |
131 | RP_GET_MULTIPLE = 9, | 131 | RP_GET_MULTIPLE = 9, |
132 | RP_GET_MULTIPLE_NEXT = 10, | 132 | RP_GET_MULTIPLE_NEXT = 10, |
133 | RP_UPDATE = 11, | ||
134 | RP_UPDATE_VALIDATE = 12, | ||
135 | 133 | ||
136 | /** | 134 | /** |
137 | * Execution failed with some kind of error. | 135 | * Execution failed with some kind of error. |
@@ -349,7 +347,7 @@ check_multiple (void *cls, | |||
349 | break; | 347 | break; |
350 | case RP_GET_MULTIPLE_NEXT: | 348 | case RP_GET_MULTIPLE_NEXT: |
351 | GNUNET_assert (uid != crc->first_uid); | 349 | GNUNET_assert (uid != crc->first_uid); |
352 | crc->phase = RP_UPDATE; | 350 | crc->phase = RP_DONE; |
353 | break; | 351 | break; |
354 | default: | 352 | default: |
355 | GNUNET_break (0); | 353 | GNUNET_break (0); |
@@ -362,32 +360,6 @@ check_multiple (void *cls, | |||
362 | } | 360 | } |
363 | 361 | ||
364 | 362 | ||
365 | static void | ||
366 | check_update (void *cls, | ||
367 | const struct GNUNET_HashCode *key, | ||
368 | size_t size, | ||
369 | const void *data, | ||
370 | enum GNUNET_BLOCK_Type type, | ||
371 | uint32_t priority, | ||
372 | uint32_t anonymity, | ||
373 | struct GNUNET_TIME_Absolute expiration, | ||
374 | uint64_t uid) | ||
375 | { | ||
376 | struct CpsRunContext *crc = cls; | ||
377 | |||
378 | GNUNET_assert (key != NULL); | ||
379 | if ((anonymity == get_anonymity (42)) && (size == get_size (42)) && | ||
380 | (priority == get_priority (42) + 100)) | ||
381 | crc->phase = RP_DONE; | ||
382 | else | ||
383 | { | ||
384 | GNUNET_assert (size == get_size (43)); | ||
385 | crc->offset++; | ||
386 | } | ||
387 | GNUNET_SCHEDULER_add_now (&run_continuation, crc); | ||
388 | } | ||
389 | |||
390 | |||
391 | /** | 363 | /** |
392 | * Main state machine. Executes the next step of the test | 364 | * Main state machine. Executes the next step of the test |
393 | * depending on the current state. | 365 | * depending on the current state. |
@@ -525,24 +497,6 @@ run_continuation (void *cls) | |||
525 | 1, 1, | 497 | 1, 1, |
526 | &check_multiple, crc)); | 498 | &check_multiple, crc)); |
527 | break; | 499 | break; |
528 | case RP_UPDATE: | ||
529 | GNUNET_assert (crc->uid > 0); | ||
530 | crc->phase = RP_UPDATE_VALIDATE; | ||
531 | GNUNET_DATASTORE_update (datastore, | ||
532 | crc->uid, 100, | ||
533 | get_expiration (42), 1, | ||
534 | 1, | ||
535 | &check_success, crc); | ||
536 | break; | ||
537 | case RP_UPDATE_VALIDATE: | ||
538 | GNUNET_assert (NULL != | ||
539 | GNUNET_DATASTORE_get_key (datastore, | ||
540 | crc->offset, | ||
541 | &crc->key, | ||
542 | get_type (42), | ||
543 | 1, 1, | ||
544 | &check_update, crc)); | ||
545 | break; | ||
546 | case RP_DONE: | 500 | case RP_DONE: |
547 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 501 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
548 | "Finished, disconnecting\n"); | 502 | "Finished, disconnecting\n"); |