- struct StatusContext *scont;
-
-#if DEBUG_DATASTORE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Asked to reserve %llu bytes of data and %u entries'\n",
- (unsigned long long) amount,
- (unsigned int) entries);
-#endif
- scont = GNUNET_malloc (sizeof (struct StatusContext));
- scont->cont = cont;
- scont->cont_cls = cont_cls;
- qe = make_queue_entry (h, sizeof(struct ReleaseReserveMessage),
- queue_priority, max_queue_size, timeout,
- NULL, NULL, &process_status_message, scont);
- if (qe == NULL)
- return;
- rrm = (struct ReleaseReserveMessage*) &qe[1];
- rrm->header.type = htons(GNUNET_MESSAGE_TYPE_DATASTORE_RELEASE_RESERVE);
- rrm->header.size = htons(sizeof (struct ReleaseReserveMessage));
- rrm->rid = htonl(rid);
- process_queue (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 timeout how long to wait at most for a response
- * @param cont continuation to call when done
- * @param cont_cls closure for cont
- */
-void
-GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h,
- unsigned long long uid,
- uint32_t priority,
- struct GNUNET_TIME_Absolute expiration,
- unsigned int queue_priority,
- unsigned int max_queue_size,
- struct GNUNET_TIME_Relative timeout,
- GNUNET_DATASTORE_ContinuationWithStatus cont,
- void *cont_cls)
-{
- struct QueueEntry *qe;
- struct UpdateMessage *um;
- struct StatusContext *scont;
-
-#if DEBUG_DATASTORE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Asked to update entry %llu raising priority by %u and expiration to %llu\n",
- uid,
- (unsigned int) priority,
- (unsigned long long) expiration.value);
-#endif
- scont = GNUNET_malloc (sizeof (struct StatusContext));
- scont->cont = cont;
- scont->cont_cls = cont_cls;
- qe = make_queue_entry (h, sizeof(struct UpdateMessage),
- queue_priority, max_queue_size, timeout,
- NULL, NULL, &process_status_message, scont);
- if (qe == NULL)
- return;
- um = (struct UpdateMessage*) &qe[1];
- um->header.type = htons(GNUNET_MESSAGE_TYPE_DATASTORE_UPDATE);
- um->header.size = htons(sizeof (struct UpdateMessage));
- um->priority = htonl(priority);
- um->expiration = GNUNET_TIME_absolute_hton(expiration);
- um->uid = GNUNET_htonll(uid);
+ union QueueContext qc;
+
+ if (NULL == cont)
+ cont = &drop_status_cont;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Asked to release reserve %d\n",
+ rid);
+ env = GNUNET_MQ_msg (rrm,
+ GNUNET_MESSAGE_TYPE_DATASTORE_RELEASE_RESERVE);
+ rrm->rid = htonl (rid);
+ 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 to release reserve\n");
+ return NULL;
+ }
+ GNUNET_STATISTICS_update (h->stats,
+ gettext_noop
+ ("# RELEASE RESERVE requests executed"), 1,
+ GNUNET_NO);