+/**
+ * Get a single zero-anonymity value from the datastore.
+ *
+ * @param h handle to the datastore
+ * @param offset offset of the result (modulo num-results); set to
+ * a random 64-bit value initially; then increment by
+ * one each time; detect that all results have been found by uid
+ * being again the first uid ever returned.
+ * @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 type allowed type for the operation (never zero)
+ * @param proc function to call on a random value; it
+ * will be called once with a value (if available)
+ * or with NULL if none value exists.
+ * @param proc_cls closure for proc
+ * @return NULL if the entry was not queued, otherwise a handle that can be used to
+ * cancel
+ */
+struct GNUNET_DATASTORE_QueueEntry *
+GNUNET_DATASTORE_get_zero_anonymity (struct GNUNET_DATASTORE_Handle *h,
+ uint64_t offset,
+ unsigned int queue_priority,
+ unsigned int max_queue_size,
+ struct GNUNET_TIME_Relative timeout,
+ enum GNUNET_BLOCK_Type type,
+ GNUNET_DATASTORE_DatumProcessor proc,
+ void *proc_cls)
+{
+ struct GNUNET_DATASTORE_QueueEntry *qe;
+ struct GetZeroAnonymityMessage *m;
+ union QueueContext qc;
+
+ GNUNET_assert (NULL != proc);
+ GNUNET_assert (type != GNUNET_BLOCK_TYPE_ANY);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Asked to get %llu-th zero-anonymity entry of type %d in %llu ms\n",
+ (unsigned long long) offset, type,
+ (unsigned long long) timeout.rel_value);
+ qc.rc.proc = proc;
+ qc.rc.proc_cls = proc_cls;
+ qe = make_queue_entry (h, sizeof (struct GetZeroAnonymityMessage),
+ queue_priority, max_queue_size, timeout,
+ &process_result_message, &qc);
+ if (qe == NULL)
+ {
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Could not create queue entry for zero-anonymity procation\n");
+ return NULL;
+ }
+ GNUNET_STATISTICS_update (h->stats,
+ gettext_noop
+ ("# GET ZERO ANONYMITY requests executed"), 1,
+ GNUNET_NO);
+ m = (struct GetZeroAnonymityMessage *) &qe[1];
+ m->header.type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_GET_ZERO_ANONYMITY);
+ m->header.size = htons (sizeof (struct GetZeroAnonymityMessage));
+ m->type = htonl ((uint32_t) type);
+ m->offset = GNUNET_htonll (offset);
+ process_queue (h);
+ return qe;
+}
+