GNUnet  0.19.3
gnunet_datastore_service.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 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 
42 #ifndef GNUNET_DATASTORE_SERVICE_H
43 #define GNUNET_DATASTORE_SERVICE_H
44 
45 
46 #include "gnunet_util_lib.h"
47 #include "gnunet_block_lib.h"
48 
49 #ifdef __cplusplus
50 extern "C"
51 {
52 #if 0 /* keep Emacsens' auto-indent happy */
53 }
54 #endif
55 #endif
56 
61 
66 
70 #define GNUNET_DATASTORE_MAX_VALUE_SIZE 65536
71 
80 
81 
89 void
91  int drop);
92 
93 
107 typedef void
109  int32_t success,
110  struct GNUNET_TIME_Absolute
112  const char *msg);
113 
114 
132  uint64_t amount,
133  uint32_t entries,
135  void *cont_cls);
136 
137 
165  uint32_t rid,
166  const struct GNUNET_HashCode *key,
167  size_t size,
168  const void *data,
169  enum GNUNET_BLOCK_Type type,
170  uint32_t priority,
171  uint32_t anonymity,
172  uint32_t replication,
174  unsigned int queue_priority,
175  unsigned int max_queue_size,
177  void *cont_cls);
178 
179 
202  uint32_t rid, unsigned int queue_priority,
203  unsigned int max_queue_size,
205  void *cont_cls);
206 
207 
229  const struct GNUNET_HashCode *key,
230  size_t size,
231  const void *data,
232  unsigned int queue_priority,
233  unsigned int max_queue_size,
235  void *cont_cls);
236 
237 
253 typedef void
254 (*GNUNET_DATASTORE_DatumProcessor) (void *cls,
255  const struct GNUNET_HashCode *key,
256  size_t size,
257  const void *data,
258  enum GNUNET_BLOCK_Type type,
259  uint32_t priority,
260  uint32_t anonymity,
261  uint32_t replication,
263  uint64_t uid);
264 
265 
286  uint64_t next_uid,
287  bool random,
288  const struct GNUNET_HashCode *key,
289  enum GNUNET_BLOCK_Type type,
290  unsigned int queue_priority,
291  unsigned int max_queue_size,
293  void *proc_cls);
294 
295 
314  uint64_t next_uid,
315  unsigned int queue_priority,
316  unsigned int max_queue_size,
317  enum GNUNET_BLOCK_Type type,
319  void *proc_cls);
320 
321 
342  unsigned int queue_priority,
343  unsigned int max_queue_size,
345  void *proc_cls);
346 
347 
354 void
356 
357 
358 #if 0 /* keep Emacsens' auto-indent happy */
359 {
360 #endif
361 #ifdef __cplusplus
362 }
363 #endif
364 
365 #endif
366  /* end of group */
368  /* end of group addition */
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
GNUNET_BLOCK_Type
WARNING: This header is generated! In order to add DHT block types, you must register them in GANA,...
static char * expiration
Credential TTL.
Definition: gnunet-abd.c:96
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:99
static unsigned int replication
static struct GNUNET_DATASTORE_QueueEntry * qe
Current operation.
struct GNUNET_HashCode key
The key used in the DHT.
static unsigned int anonymity
uint32_t data
The data value.
static struct GNUNET_TIME_Absolute min_expiration
Minimum time that content should have to not be discarded instantly (time stamp of any content that w...
Library for data block manipulation.
struct GNUNET_DATASTORE_QueueEntry * GNUNET_DATASTORE_get_zero_anonymity(struct GNUNET_DATASTORE_Handle *h, uint64_t next_uid, unsigned int queue_priority, unsigned int max_queue_size, enum GNUNET_BLOCK_Type type, GNUNET_DATASTORE_DatumProcessor proc, void *proc_cls)
Get a single zero-anonymity value from the datastore.
struct GNUNET_DATASTORE_Handle * GNUNET_DATASTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the datastore service.
void GNUNET_DATASTORE_disconnect(struct GNUNET_DATASTORE_Handle *h, int drop)
Disconnect from the datastore service (and free associated resources).
struct GNUNET_DATASTORE_QueueEntry * GNUNET_DATASTORE_get_key(struct GNUNET_DATASTORE_Handle *h, uint64_t next_uid, bool random, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, unsigned int queue_priority, unsigned int max_queue_size, GNUNET_DATASTORE_DatumProcessor proc, void *proc_cls)
Get a result for a particular key from the datastore.
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, GNUNET_DATASTORE_ContinuationWithStatus cont, void *cont_cls)
Explicitly remove some content from the database.
void GNUNET_DATASTORE_cancel(struct GNUNET_DATASTORE_QueueEntry *qe)
Cancel a datastore operation.
struct GNUNET_DATASTORE_QueueEntry * GNUNET_DATASTORE_get_for_replication(struct GNUNET_DATASTORE_Handle *h, unsigned int queue_priority, unsigned int max_queue_size, GNUNET_DATASTORE_DatumProcessor proc, void *proc_cls)
Get a random value from the datastore for content replication.
struct GNUNET_DATASTORE_QueueEntry * GNUNET_DATASTORE_reserve(struct GNUNET_DATASTORE_Handle *h, uint64_t amount, uint32_t entries, GNUNET_DATASTORE_ContinuationWithStatus cont, void *cont_cls)
Reserve space in the datastore.
void(* GNUNET_DATASTORE_DatumProcessor)(void *cls, const struct GNUNET_HashCode *key, size_t size, const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, uint32_t anonymity, uint32_t replication, struct GNUNET_TIME_Absolute expiration, uint64_t uid)
Process a datum that was stored in the datastore.
struct GNUNET_DATASTORE_QueueEntry * GNUNET_DATASTORE_put(struct GNUNET_DATASTORE_Handle *h, uint32_t rid, const struct GNUNET_HashCode *key, size_t size, const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, uint32_t anonymity, uint32_t replication, struct GNUNET_TIME_Absolute expiration, unsigned int queue_priority, unsigned int max_queue_size, GNUNET_DATASTORE_ContinuationWithStatus cont, void *cont_cls)
Store an item in the datastore.
struct GNUNET_DATASTORE_QueueEntry * GNUNET_DATASTORE_release_reserve(struct GNUNET_DATASTORE_Handle *h, uint32_t rid, unsigned int queue_priority, unsigned int max_queue_size, GNUNET_DATASTORE_ContinuationWithStatus cont, void *cont_cls)
Signal that all of the data for which a reservation was made has been stored and that whatever excess...
void(* GNUNET_DATASTORE_ContinuationWithStatus)(void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
Continuation called to notify client about result of the operation.
static unsigned int size
Size of the "table".
Definition: peer.c:68
Handle to the datastore service.
Entry in our priority queue.
unsigned int priority
Priority in the queue.
GNUNET_DATASTORE_ContinuationWithStatus cont
Function to call after transmission of the request.
void * cont_cls
Closure for cont.
A 512-bit hashcode.
Time for absolute times used by GNUnet, in microseconds.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct ListEntry * entries
List of peers in the list.