+/**
+ * Explicitly remove some content from the database.
+ * The "cont"inuation will be called with status
+ * "GNUNET_OK" if content was removed, "GNUNET_NO"
+ * if no matching entry was found and "GNUNET_SYSERR"
+ * on all other types of errors.
+ *
+ * @param h handle to the datastore
+ * @param key key for the value
+ * @param size number of bytes in data
+ * @param data content stored
+ * @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
+ * @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_remove (struct GNUNET_DATASTORE_Handle *h,
+ const struct GNUNET_HashCode * key, size_t size,
+ const void *data, unsigned int queue_priority,
+ unsigned int max_queue_size,
+ struct GNUNET_TIME_Relative timeout,
+ GNUNET_DATASTORE_ContinuationWithStatus cont,
+ void *cont_cls)
+{
+ struct GNUNET_DATASTORE_QueueEntry *qe;
+ struct DataMessage *dm;
+ size_t msize;
+ union QueueContext qc;
+
+ if (cont == NULL)
+ cont = &drop_status_cont;
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to remove %u bytes under key `%s'\n",
+ size, GNUNET_h2s (key));
+ qc.sc.cont = cont;
+ qc.sc.cont_cls = cont_cls;
+ msize = sizeof (struct DataMessage) + size;
+ GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE);
+ qe = make_queue_entry (h, msize, queue_priority, max_queue_size, timeout,
+ &process_status_message, &qc);
+ if (qe == NULL)
+ {
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Could not create queue entry for REMOVE\n");
+ return NULL;
+ }
+ GNUNET_STATISTICS_update (h->stats,
+ gettext_noop ("# REMOVE requests executed"), 1,
+ GNUNET_NO);
+ dm = (struct DataMessage *) &qe[1];
+ dm->header.type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_REMOVE);
+ dm->header.size = htons (msize);
+ dm->rid = htonl (0);
+ dm->size = htonl (size);
+ dm->type = htonl (0);
+ dm->priority = htonl (0);
+ dm->anonymity = htonl (0);
+ dm->uid = GNUNET_htonll (0);
+ dm->expiration = GNUNET_TIME_absolute_hton (GNUNET_TIME_UNIT_ZERO_ABS);
+ dm->key = *key;
+ memcpy (&dm[1], data, size);
+ process_queue (h);
+ return qe;
+}