2 This file is part of GNUnet
3 Copyright (C) 2004, 2005, 2006, 2007, 2009 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
22 * @file datastore/datastore.h
23 * @brief structs for communication between datastore service and API
24 * @author Christian Grothoff
31 #include "gnunet_util_lib.h"
33 GNUNET_NETWORK_STRUCT_BEGIN
36 * Message from datastore service informing client about
37 * the current size of the datastore.
42 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RESERVE.
44 struct GNUNET_MessageHeader header;
47 * Number of items to reserve.
49 uint32_t entries GNUNET_PACKED;
52 * Number of bytes to reserve.
54 uint64_t amount GNUNET_PACKED;
59 * Message from datastore service informing client about
60 * the success or failure of a requested operation.
61 * This header is optionally followed by a variable-size,
62 * 0-terminated error message.
67 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_STATUS.
69 struct GNUNET_MessageHeader header;
72 * Status code, -1 for errors.
74 int32_t status GNUNET_PACKED;
77 * Minimum expiration time required for content to be stored
78 * by the datacache at this time, zero for unknown or no limit.
80 struct GNUNET_TIME_AbsoluteNBO min_expiration;
86 * Message from datastore client informing service that
87 * the remainder of the reserved bytes can now be released
90 struct ReleaseReserveMessage
93 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RELEASE_RESERVE.
95 struct GNUNET_MessageHeader header;
100 int32_t rid GNUNET_PACKED;
106 * Message to the datastore service asking about specific
112 * Type is #GNUNET_MESSAGE_TYPE_DATASTORE_GET_KEY.
114 struct GNUNET_MessageHeader header;
117 * Desired content type. (actually an enum GNUNET_BLOCK_Type)
119 uint32_t type GNUNET_PACKED;
122 * UID at which to start the search
124 uint64_t next_uid GNUNET_PACKED;
127 * If true return a random result
129 uint32_t random GNUNET_PACKED;
134 struct GNUNET_HashCode key;
140 * Message to the datastore service asking about specific
146 * Type is #GNUNET_MESSAGE_TYPE_DATASTORE_GET.
148 struct GNUNET_MessageHeader header;
151 * Desired content type. (actually an enum GNUNET_BLOCK_Type)
153 uint32_t type GNUNET_PACKED;
156 * UID at which to start the search
158 uint64_t next_uid GNUNET_PACKED;
161 * If true return a random result
163 uint32_t random GNUNET_PACKED;
169 * Message to the datastore service asking about zero
172 struct GetZeroAnonymityMessage
175 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET_ZERO_ANONYMITY.
177 struct GNUNET_MessageHeader header;
180 * Desired content type (actually an enum GNUNET_BLOCK_Type)
182 uint32_t type GNUNET_PACKED;
185 * UID at which to start the search
187 uint64_t next_uid GNUNET_PACKED;
193 * Message transmitting content from or to the datastore
199 * Type is either GNUNET_MESSAGE_TYPE_DATASTORE_PUT,
200 * GNUNET_MESSAGE_TYPE_DATASTORE_REMOVE or
201 * GNUNET_MESSAGE_TYPE_DATASTORE_DATA. Depending on the message
202 * type, some fields may simply have values of zero.
204 struct GNUNET_MessageHeader header;
207 * Reservation ID to use; use zero for none.
209 uint32_t rid GNUNET_PACKED;
212 * Number of bytes in the item (NBO).
214 uint32_t size GNUNET_PACKED;
217 * Type of the item (NBO), zero for remove, (actually an enum GNUNET_BLOCK_Type)
219 uint32_t type GNUNET_PACKED;
222 * Priority of the item (NBO), zero for remove.
224 uint32_t priority GNUNET_PACKED;
227 * Desired anonymity level (NBO), zero for remove.
229 uint32_t anonymity GNUNET_PACKED;
232 * Desired replication level.
234 uint32_t replication GNUNET_PACKED;
239 uint32_t reserved GNUNET_PACKED;
242 * Unique ID for the content (can be used for UPDATE);
243 * can be zero for remove (which indicates that
244 * the datastore should use whatever UID matches
245 * the key and content).
250 * Expiration time (NBO); zero for remove.
252 struct GNUNET_TIME_AbsoluteNBO expiration;
255 * Key under which the item can be found.
257 struct GNUNET_HashCode key;
260 GNUNET_NETWORK_STRUCT_END