diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2023-10-18 20:19:34 +0200 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2023-10-18 20:19:34 +0200 |
commit | 498cb28b16dbebbacb674fa166aeac3fe4ea9922 (patch) | |
tree | cd1f59025a55f263f297ca706d90b1a395f6e163 /src/datastore/datastore.h | |
parent | 11949e419fd7230431646703ac0cf8e34f615673 (diff) | |
download | gnunet-498cb28b16dbebbacb674fa166aeac3fe4ea9922.tar.gz gnunet-498cb28b16dbebbacb674fa166aeac3fe4ea9922.zip |
BUILD: Move dht/datastore to service/cli
Diffstat (limited to 'src/datastore/datastore.h')
-rw-r--r-- | src/datastore/datastore.h | 257 |
1 files changed, 0 insertions, 257 deletions
diff --git a/src/datastore/datastore.h b/src/datastore/datastore.h deleted file mode 100644 index 7af926617..000000000 --- a/src/datastore/datastore.h +++ /dev/null | |||
@@ -1,257 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2004, 2005, 2006, 2007, 2009 GNUnet e.V. | ||
4 | |||
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. | ||
9 | |||
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. | ||
14 | |||
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/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file datastore/datastore.h | ||
23 | * @brief structs for communication between datastore service and API | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | |||
27 | #ifndef DATASTORE_H | ||
28 | #define DATASTORE_H | ||
29 | |||
30 | |||
31 | #include "gnunet_util_lib.h" | ||
32 | |||
33 | GNUNET_NETWORK_STRUCT_BEGIN | ||
34 | |||
35 | /** | ||
36 | * Message from datastore service informing client about | ||
37 | * the current size of the datastore. | ||
38 | */ | ||
39 | struct ReserveMessage | ||
40 | { | ||
41 | /** | ||
42 | * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RESERVE. | ||
43 | */ | ||
44 | struct GNUNET_MessageHeader header; | ||
45 | |||
46 | /** | ||
47 | * Number of items to reserve. | ||
48 | */ | ||
49 | uint32_t entries GNUNET_PACKED; | ||
50 | |||
51 | /** | ||
52 | * Number of bytes to reserve. | ||
53 | */ | ||
54 | uint64_t amount GNUNET_PACKED; | ||
55 | }; | ||
56 | |||
57 | |||
58 | /** | ||
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. | ||
63 | */ | ||
64 | struct StatusMessage | ||
65 | { | ||
66 | /** | ||
67 | * Type is GNUNET_MESSAGE_TYPE_DATASTORE_STATUS. | ||
68 | */ | ||
69 | struct GNUNET_MessageHeader header; | ||
70 | |||
71 | /** | ||
72 | * Status code, -1 for errors. | ||
73 | */ | ||
74 | int32_t status GNUNET_PACKED; | ||
75 | |||
76 | /** | ||
77 | * Minimum expiration time required for content to be stored | ||
78 | * by the datacache at this time, zero for unknown or no limit. | ||
79 | */ | ||
80 | struct GNUNET_TIME_AbsoluteNBO min_expiration; | ||
81 | }; | ||
82 | |||
83 | |||
84 | /** | ||
85 | * Message from datastore client informing service that | ||
86 | * the remainder of the reserved bytes can now be released | ||
87 | * for other requests. | ||
88 | */ | ||
89 | struct ReleaseReserveMessage | ||
90 | { | ||
91 | /** | ||
92 | * Type is GNUNET_MESSAGE_TYPE_DATASTORE_RELEASE_RESERVE. | ||
93 | */ | ||
94 | struct GNUNET_MessageHeader header; | ||
95 | |||
96 | /** | ||
97 | * Reservation id. | ||
98 | */ | ||
99 | int32_t rid GNUNET_PACKED; | ||
100 | }; | ||
101 | |||
102 | |||
103 | /** | ||
104 | * Message to the datastore service asking about specific | ||
105 | * content. | ||
106 | */ | ||
107 | struct GetKeyMessage | ||
108 | { | ||
109 | /** | ||
110 | * Type is #GNUNET_MESSAGE_TYPE_DATASTORE_GET_KEY. | ||
111 | */ | ||
112 | struct GNUNET_MessageHeader header; | ||
113 | |||
114 | /** | ||
115 | * Desired content type. (actually an enum GNUNET_BLOCK_Type) | ||
116 | */ | ||
117 | uint32_t type GNUNET_PACKED; | ||
118 | |||
119 | /** | ||
120 | * UID at which to start the search | ||
121 | */ | ||
122 | uint64_t next_uid GNUNET_PACKED; | ||
123 | |||
124 | /** | ||
125 | * If true return a random result | ||
126 | */ | ||
127 | uint32_t random GNUNET_PACKED; | ||
128 | |||
129 | /** | ||
130 | * Desired key. | ||
131 | */ | ||
132 | struct GNUNET_HashCode key; | ||
133 | }; | ||
134 | |||
135 | |||
136 | /** | ||
137 | * Message to the datastore service asking about specific | ||
138 | * content. | ||
139 | */ | ||
140 | struct GetMessage | ||
141 | { | ||
142 | /** | ||
143 | * Type is #GNUNET_MESSAGE_TYPE_DATASTORE_GET. | ||
144 | */ | ||
145 | struct GNUNET_MessageHeader header; | ||
146 | |||
147 | /** | ||
148 | * Desired content type. (actually an enum GNUNET_BLOCK_Type) | ||
149 | */ | ||
150 | uint32_t type GNUNET_PACKED; | ||
151 | |||
152 | /** | ||
153 | * UID at which to start the search | ||
154 | */ | ||
155 | uint64_t next_uid GNUNET_PACKED; | ||
156 | |||
157 | /** | ||
158 | * If true return a random result | ||
159 | */ | ||
160 | uint32_t random GNUNET_PACKED; | ||
161 | }; | ||
162 | |||
163 | |||
164 | /** | ||
165 | * Message to the datastore service asking about zero | ||
166 | * anonymity content. | ||
167 | */ | ||
168 | struct GetZeroAnonymityMessage | ||
169 | { | ||
170 | /** | ||
171 | * Type is GNUNET_MESSAGE_TYPE_DATASTORE_GET_ZERO_ANONYMITY. | ||
172 | */ | ||
173 | struct GNUNET_MessageHeader header; | ||
174 | |||
175 | /** | ||
176 | * Desired content type (actually an enum GNUNET_BLOCK_Type) | ||
177 | */ | ||
178 | uint32_t type GNUNET_PACKED; | ||
179 | |||
180 | /** | ||
181 | * UID at which to start the search | ||
182 | */ | ||
183 | uint64_t next_uid GNUNET_PACKED; | ||
184 | }; | ||
185 | |||
186 | |||
187 | /** | ||
188 | * Message transmitting content from or to the datastore | ||
189 | * service. | ||
190 | */ | ||
191 | struct DataMessage | ||
192 | { | ||
193 | /** | ||
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. | ||
198 | */ | ||
199 | struct GNUNET_MessageHeader header; | ||
200 | |||
201 | /** | ||
202 | * Reservation ID to use; use zero for none. | ||
203 | */ | ||
204 | uint32_t rid GNUNET_PACKED; | ||
205 | |||
206 | /** | ||
207 | * Number of bytes in the item (NBO). | ||
208 | */ | ||
209 | uint32_t size GNUNET_PACKED; | ||
210 | |||
211 | /** | ||
212 | * Type of the item (NBO), zero for remove, (actually an enum GNUNET_BLOCK_Type) | ||
213 | */ | ||
214 | uint32_t type GNUNET_PACKED; | ||
215 | |||
216 | /** | ||
217 | * Priority of the item (NBO), zero for remove. | ||
218 | */ | ||
219 | uint32_t priority GNUNET_PACKED; | ||
220 | |||
221 | /** | ||
222 | * Desired anonymity level (NBO), zero for remove. | ||
223 | */ | ||
224 | uint32_t anonymity GNUNET_PACKED; | ||
225 | |||
226 | /** | ||
227 | * Desired replication level. | ||
228 | */ | ||
229 | uint32_t replication GNUNET_PACKED; | ||
230 | |||
231 | /** | ||
232 | * For alignment. | ||
233 | */ | ||
234 | uint32_t reserved GNUNET_PACKED; | ||
235 | |||
236 | /** | ||
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). | ||
241 | */ | ||
242 | uint64_t uid; | ||
243 | |||
244 | /** | ||
245 | * Expiration time (NBO); zero for remove. | ||
246 | */ | ||
247 | struct GNUNET_TIME_AbsoluteNBO expiration; | ||
248 | |||
249 | /** | ||
250 | * Key under which the item can be found. | ||
251 | */ | ||
252 | struct GNUNET_HashCode key; | ||
253 | }; | ||
254 | GNUNET_NETWORK_STRUCT_END | ||
255 | |||
256 | |||
257 | #endif | ||