*/
/**
- * @file datastore/datastore.hc
+ * @file datastore/datastore.h
* @brief structs for communication between datastore service and API
* @author Christian Grothoff
*/
#ifndef DATASTORE_H
#define DATASTORE_H
+#define DEBUG_DATASTORE GNUNET_NO
+
#include "gnunet_util_lib.h"
/**
* Message from datastore service informing client about
* the current size of the datastore.
*/
-struct SizeMessage
+struct ReserveMessage
{
/**
- * Type is GNUNET_MESSAGE_TYPE_DATASTORE_SIZE.
+ * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RESERVE.
*/
struct GNUNET_MessageHeader header;
/**
- * Always zero.
+ * Number of items to reserve.
+ */
+ uint32_t entries GNUNET_PACKED;
+
+ /**
+ * Number of bytes to reserve.
+ */
+ uint64_t amount GNUNET_PACKED;
+};
+
+
+/**
+ * Message from datastore service informing client about
+ * the success or failure of a requested operation.
+ * This header is optionally followed by a variable-size,
+ * 0-terminated error message.
+ */
+struct StatusMessage
+{
+ /**
+ * Type is GNUNET_MESSAGE_TYPE_DATASTORE_STATUS.
*/
- uint32_t reserved GNUNET_PACKED;
+ struct GNUNET_MessageHeader header;
/**
- * Size of the datastore in bytes.
+ * Status code, -1 for errors.
*/
- uint64_t size GNUNET_PACKED;
+ int32_t status GNUNET_PACKED;
+
+};
+
+
+/**
+ * Message from datastore client informing service that
+ * the remainder of the reserved bytes can now be released
+ * for other requests.
+ */
+struct ReleaseReserveMessage
+{
+ /**
+ * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RELEASE_RESERVE.
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * Reservation id.
+ */
+ int32_t rid GNUNET_PACKED;
+
};
};
+/**
+ * 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.
struct GNUNET_MessageHeader header;
/**
- * Always zero.
+ * Reservation ID to use; use zero for none.
*/
- uint32_t reserved GNUNET_PACKED;
+ uint32_t rid GNUNET_PACKED;
/**
* Number of bytes in the item (NBO).
* Desired anonymity level (NBO), zero for remove.
*/
uint32_t anonymity GNUNET_PACKED;
+
+ /**
+ * Unique ID for the content (can be used for UPDATE);
+ * can be zero for remove (which indicates that
+ * the datastore should use whatever UID matches
+ * the key and content).
+ */
+ uint64_t uid;
/**
* Expiration time (NBO); zero for remove.