GNUnet  0.17.6
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 #include "gnunet_util_lib.h"
46 #include "gnunet_block_lib.h"
47 
48 #ifdef __cplusplus
49 extern "C"
50 {
51 #if 0 /* keep Emacsens' auto-indent happy */
52 }
53 #endif
54 #endif
55 
60 
65 
69 #define GNUNET_DATASTORE_MAX_VALUE_SIZE 65536
70 
79 
80 
88 void
90  int drop);
91 
92 
106 typedef void
108  int32_t success,
109  struct GNUNET_TIME_Absolute
111  const char *msg);
112 
113 
131  uint64_t amount,
132  uint32_t entries,
134  void *cont_cls);
135 
136 
164  uint32_t rid,
165  const struct GNUNET_HashCode *key,
166  size_t size,
167  const void *data,
168  enum GNUNET_BLOCK_Type type,
169  uint32_t priority,
170  uint32_t anonymity,
171  uint32_t replication,
173  unsigned int queue_priority,
174  unsigned int max_queue_size,
176  void *cont_cls);
177 
178 
201  uint32_t rid, unsigned int queue_priority,
202  unsigned int max_queue_size,
204  void *cont_cls);
205 
206 
228  const struct GNUNET_HashCode *key,
229  size_t size,
230  const void *data,
231  unsigned int queue_priority,
232  unsigned int max_queue_size,
234  void *cont_cls);
235 
236 
252 typedef void
253 (*GNUNET_DATASTORE_DatumProcessor) (void *cls,
254  const struct GNUNET_HashCode *key,
255  size_t size,
256  const void *data,
257  enum GNUNET_BLOCK_Type type,
258  uint32_t priority,
259  uint32_t anonymity,
260  uint32_t replication,
262  uint64_t uid);
263 
264 
285  uint64_t next_uid,
286  bool random,
287  const struct GNUNET_HashCode *key,
288  enum GNUNET_BLOCK_Type type,
289  unsigned int queue_priority,
290  unsigned int max_queue_size,
292  void *proc_cls);
293 
294 
313  uint64_t next_uid,
314  unsigned int queue_priority,
315  unsigned int max_queue_size,
316  enum GNUNET_BLOCK_Type type,
318  void *proc_cls);
319 
320 
341  unsigned int queue_priority,
342  unsigned int max_queue_size,
344  void *proc_cls);
345 
346 
353 void
355 
356 
357 #if 0 /* keep Emacsens' auto-indent happy */
358 {
359 #endif
360 #ifdef __cplusplus
361 }
362 #endif
363 
364 #endif
365  /* end of group */
367  /* 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:67
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.