From: David Barksdale Date: Mon, 20 Feb 2017 17:18:53 +0000 (-0600) Subject: Remove unused GNUNET_DATASTORE_update() API call X-Git-Tag: taler-0.2.1~128 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4e96704538f882095eca84fed92a7811b299aca1;p=oweals%2Fgnunet.git Remove unused GNUNET_DATASTORE_update() API call --- 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 @@ -179,35 +179,6 @@ struct GetZeroAnonymityMessage }; -/** - * Message to the datastore service requesting an update - * to the priority or expiration for some content. - */ -struct UpdateMessage -{ - /** - * Type is GNUNET_MESSAGE_TYPE_DATASTORE_UPDATE. - */ - struct GNUNET_MessageHeader header; - - /** - * Desired priority increase. - */ - int32_t priority GNUNET_PACKED; - - /** - * Desired new expiration time. - */ - struct GNUNET_TIME_AbsoluteNBO expiration; - - /** - * Unique ID for the content. - */ - uint64_t uid; - -}; - - /** * Message transmitting content from or to the datastore * service. 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 @@ -1125,72 +1125,6 @@ GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, } -/** - * Update a value in the datastore. - * - * @param h handle to the datastore - * @param uid identifier for the value - * @param priority how much to increase the priority of the value - * @param expiration new expiration value should be MAX of existing and this argument - * @param queue_priority ranking of this request in the priority queue - * @param max_queue_size at what queue size should this request be dropped - * (if other requests of higher priority are in the queue) - * @param cont continuation to call when done - * @param cont_cls closure for @a cont - * @return NULL if the entry was not queued, otherwise a handle that can be used to - * cancel; note that even if NULL is returned, the callback will be invoked - * (or rather, will already have been invoked) - */ -struct GNUNET_DATASTORE_QueueEntry * -GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, - uint64_t uid, - uint32_t priority, - struct GNUNET_TIME_Absolute expiration, - unsigned int queue_priority, - unsigned int max_queue_size, - GNUNET_DATASTORE_ContinuationWithStatus cont, - void *cont_cls) -{ - struct GNUNET_DATASTORE_QueueEntry *qe; - struct GNUNET_MQ_Envelope *env; - struct UpdateMessage *um; - union QueueContext qc; - - if (NULL == cont) - cont = &drop_status_cont; - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Asked to update entry %llu raising priority by %u and expiration to %s\n", - uid, - (unsigned int) priority, - GNUNET_STRINGS_absolute_time_to_string (expiration)); - env = GNUNET_MQ_msg (um, - GNUNET_MESSAGE_TYPE_DATASTORE_UPDATE); - um->priority = htonl (priority); - um->expiration = GNUNET_TIME_absolute_hton (expiration); - um->uid = GNUNET_htonll (uid); - - qc.sc.cont = cont; - qc.sc.cont_cls = cont_cls; - qe = make_queue_entry (h, - env, - queue_priority, - max_queue_size, - GNUNET_MESSAGE_TYPE_DATASTORE_STATUS, - &qc); - if (NULL == qe) - { - LOG (GNUNET_ERROR_TYPE_DEBUG, - "Could not create queue entry for UPDATE\n"); - return NULL; - } - GNUNET_STATISTICS_update (h->stats, - gettext_noop ("# UPDATE requests executed"), 1, - GNUNET_NO); - process_queue (h); - return qe; -} - - /** * Explicitly remove some content from the database. * The @a cont continuation will be called with `status` 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 @@ -1079,55 +1079,6 @@ handle_get_key (void *cls, } -/** - * Function called with the result of an update operation. - * - * @param cls closure - * @param status #GNUNET_OK or #GNUNET_SYSERR - * @param msg error message on error - */ -static void -update_continuation (void *cls, - int status, - const char *msg) -{ - struct GNUNET_SERVICE_Client *client = cls; - - transmit_status (client, - status, - msg); -} - - -/** - * Handle UPDATE-message. - * - * @param cls client identification of the client - * @param message the actual message - */ -static void -handle_update (void *cls, - const struct UpdateMessage *msg) -{ - struct GNUNET_SERVICE_Client *client = cls; - - GNUNET_STATISTICS_update (stats, - gettext_noop ("# UPDATE requests received"), - 1, - GNUNET_NO); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Processing UPDATE request for %llu\n", - (unsigned long long) GNUNET_ntohll (msg->uid)); - plugin->api->update (plugin->api->cls, - GNUNET_ntohll (msg->uid), - (int32_t) ntohl (msg->priority), - GNUNET_TIME_absolute_ntoh (msg->expiration), - &update_continuation, - client); - GNUNET_SERVICE_client_continue (client); -} - - /** * Handle GET_REPLICATION-message. * @@ -1857,10 +1808,6 @@ GNUNET_SERVICE_MAIN GNUNET_MESSAGE_TYPE_DATASTORE_PUT, struct DataMessage, NULL), - GNUNET_MQ_hd_fixed_size (update, - GNUNET_MESSAGE_TYPE_DATASTORE_UPDATE, - struct UpdateMessage, - NULL), GNUNET_MQ_hd_fixed_size (get, GNUNET_MESSAGE_TYPE_DATASTORE_GET, 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 RP_PUT_MULTIPLE_NEXT = 8, RP_GET_MULTIPLE = 9, RP_GET_MULTIPLE_NEXT = 10, - RP_UPDATE = 11, - RP_UPDATE_VALIDATE = 12, /** * Execution failed with some kind of error. @@ -349,7 +347,7 @@ check_multiple (void *cls, break; case RP_GET_MULTIPLE_NEXT: GNUNET_assert (uid != crc->first_uid); - crc->phase = RP_UPDATE; + crc->phase = RP_DONE; break; default: GNUNET_break (0); @@ -362,32 +360,6 @@ check_multiple (void *cls, } -static void -check_update (void *cls, - const struct GNUNET_HashCode *key, - size_t size, - const void *data, - enum GNUNET_BLOCK_Type type, - uint32_t priority, - uint32_t anonymity, - struct GNUNET_TIME_Absolute expiration, - uint64_t uid) -{ - struct CpsRunContext *crc = cls; - - GNUNET_assert (key != NULL); - if ((anonymity == get_anonymity (42)) && (size == get_size (42)) && - (priority == get_priority (42) + 100)) - crc->phase = RP_DONE; - else - { - GNUNET_assert (size == get_size (43)); - crc->offset++; - } - GNUNET_SCHEDULER_add_now (&run_continuation, crc); -} - - /** * Main state machine. Executes the next step of the test * depending on the current state. @@ -525,24 +497,6 @@ run_continuation (void *cls) 1, 1, &check_multiple, crc)); break; - case RP_UPDATE: - GNUNET_assert (crc->uid > 0); - crc->phase = RP_UPDATE_VALIDATE; - GNUNET_DATASTORE_update (datastore, - crc->uid, 100, - get_expiration (42), 1, - 1, - &check_success, crc); - break; - case RP_UPDATE_VALIDATE: - GNUNET_assert (NULL != - GNUNET_DATASTORE_get_key (datastore, - crc->offset, - &crc->key, - get_type (42), - 1, 1, - &check_update, crc)); - break; case RP_DONE: GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished, disconnecting\n"); diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 1b6152206..eeb9a8a92 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h @@ -423,11 +423,6 @@ extern "C" */ #define GNUNET_MESSAGE_TYPE_DATASTORE_PUT 95 -/** - * Message sent by datastore client to update data. - */ -#define GNUNET_MESSAGE_TYPE_DATASTORE_UPDATE 96 - /** * Message sent by datastore client to get data. */