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;
85 * Message from datastore client informing service that
86 * the remainder of the reserved bytes can now be released
89 struct ReleaseReserveMessage
92 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RELEASE_RESERVE.
94 struct GNUNET_MessageHeader header;
99 int32_t rid GNUNET_PACKED;
104 * Message to the datastore service asking about specific
110 * Type is #GNUNET_MESSAGE_TYPE_DATASTORE_GET_KEY.
112 struct GNUNET_MessageHeader header;
115 * Desired content type. (actually an enum GNUNET_BLOCK_Type)
117 uint32_t type GNUNET_PACKED;
120 * UID at which to start the search
122 uint64_t next_uid GNUNET_PACKED;
125 * If true return a random result
127 uint32_t random GNUNET_PACKED;
132 struct GNUNET_HashCode key;
137 * Message to the datastore service asking about specific
143 * Type is #GNUNET_MESSAGE_TYPE_DATASTORE_GET.
145 struct GNUNET_MessageHeader header;
148 * Desired content type. (actually an enum GNUNET_BLOCK_Type)
150 uint32_t type GNUNET_PACKED;
153 * UID at which to start the search
155 uint64_t next_uid GNUNET_PACKED;
158 * If true return a random result
160 uint32_t random GNUNET_PACKED;
165 * Message to the datastore service asking about zero
168 struct GetZeroAnonymityMessage
171 * Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET_ZERO_ANONYMITY.
173 struct GNUNET_MessageHeader header;
176 * Desired content type (actually an enum GNUNET_BLOCK_Type)
178 uint32_t type GNUNET_PACKED;
181 * UID at which to start the search
183 uint64_t next_uid GNUNET_PACKED;
188 * Message transmitting content from or to the datastore
194 * Type is either GNUNET_MESSAGE_TYPE_DATASTORE_PUT,
195 * GNUNET_MESSAGE_TYPE_DATASTORE_REMOVE or
196 * GNUNET_MESSAGE_TYPE_DATASTORE_DATA. Depending on the message
197 * type, some fields may simply have values of zero.
199 struct GNUNET_MessageHeader header;
202 * Reservation ID to use; use zero for none.
204 uint32_t rid GNUNET_PACKED;
207 * Number of bytes in the item (NBO).
209 uint32_t size GNUNET_PACKED;
212 * Type of the item (NBO), zero for remove, (actually an enum GNUNET_BLOCK_Type)
214 uint32_t type GNUNET_PACKED;
217 * Priority of the item (NBO), zero for remove.
219 uint32_t priority GNUNET_PACKED;
222 * Desired anonymity level (NBO), zero for remove.
224 uint32_t anonymity GNUNET_PACKED;
227 * Desired replication level.
229 uint32_t replication GNUNET_PACKED;
234 uint32_t reserved GNUNET_PACKED;
237 * Unique ID for the content (can be used for UPDATE);
238 * can be zero for remove (which indicates that
239 * the datastore should use whatever UID matches
240 * the key and content).
245 * Expiration time (NBO); zero for remove.
247 struct GNUNET_TIME_AbsoluteNBO expiration;
250 * Key under which the item can be found.
252 struct GNUNET_HashCode key;
254 GNUNET_NETWORK_STRUCT_END