GNUnet  0.10.x
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 
39 #ifndef GNUNET_DATASTORE_SERVICE_H
40 #define GNUNET_DATASTORE_SERVICE_H
41 
42 #include "gnunet_util_lib.h"
43 #include "gnunet_block_lib.h"
44 
45 #ifdef __cplusplus
46 extern "C"
47 {
48 #if 0 /* keep Emacsens' auto-indent happy */
49 }
50 #endif
51 #endif
52 
57 
62 
66 #define GNUNET_DATASTORE_MAX_VALUE_SIZE 65536
67 
76 
77 
85 void
87  int drop);
88 
89 
103 typedef void
105  int32_t success,
107  const char *msg);
108 
109 
127  uint64_t amount,
128  uint32_t entries,
130  void *cont_cls);
131 
132 
160  uint32_t rid,
161  const struct GNUNET_HashCode *key,
162  size_t size,
163  const void *data,
164  enum GNUNET_BLOCK_Type type,
165  uint32_t priority,
166  uint32_t anonymity,
167  uint32_t replication,
169  unsigned int queue_priority,
170  unsigned int max_queue_size,
172  void *cont_cls);
173 
174 
197  uint32_t rid, unsigned int queue_priority,
198  unsigned int max_queue_size,
200  void *cont_cls);
201 
202 
224  const struct GNUNET_HashCode *key,
225  size_t size,
226  const void *data,
227  unsigned int queue_priority,
228  unsigned int max_queue_size,
230  void *cont_cls);
231 
232 
248 typedef void
250  const struct GNUNET_HashCode *key,
251  size_t size,
252  const void *data,
253  enum GNUNET_BLOCK_Type type,
254  uint32_t priority,
255  uint32_t anonymity,
256  uint32_t replication,
258  uint64_t uid);
259 
260 
281  uint64_t next_uid,
282  bool random,
283  const struct GNUNET_HashCode *key,
284  enum GNUNET_BLOCK_Type type,
285  unsigned int queue_priority,
286  unsigned int max_queue_size,
288  void *proc_cls);
289 
290 
309  uint64_t next_uid,
310  unsigned int queue_priority,
311  unsigned int max_queue_size,
312  enum GNUNET_BLOCK_Type type,
314  void *proc_cls);
315 
316 
337  unsigned int queue_priority,
338  unsigned int max_queue_size,
340  void *proc_cls);
341 
342 
343 
350 void
352 
353 
354 #if 0 /* keep Emacsens' auto-indent happy */
355 {
356 #endif
357 #ifdef __cplusplus
358 }
359 #endif
360 
361 #endif
362  /* end of group */
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...
static struct GNUNET_DATASTORE_QueueEntry * qe
Current operation.
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static char * expiration
Credential TTL.
GNUNET_BLOCK_Type
Blocks in the datastore and the datacache must have a unique type.
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_reserve(struct GNUNET_DATASTORE_Handle *h, uint64_t amount, uint32_t entries, GNUNET_DATASTORE_ContinuationWithStatus cont, void *cont_cls)
Reserve space in the datastore.
static unsigned int replication
GNUNET_DATASTORE_ContinuationWithStatus cont
Function to call after transmission of the request.
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...
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:94
Entry in our priority queue.
Definition: datastore_api.c:96
struct ListEntry * entries
List of peers in the list.
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_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.
A 512-bit hashcode.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
struct GNUNET_HashCode key
The key used in the DHT.
static unsigned int size
Size of the "table".
Definition: peer.c:66
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.
void GNUNET_DATASTORE_cancel(struct GNUNET_DATASTORE_QueueEntry *qe)
Cancel a datastore operation.
configuration data
Definition: configuration.c:83
void GNUNET_DATASTORE_disconnect(struct GNUNET_DATASTORE_Handle *h, int drop)
Disconnect from the datastore service (and free associated resources).
Handle to the datastore service.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
void * cont_cls
Closure for cont.
Time for absolute times used by GNUnet, in microseconds.
static unsigned int anonymity
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.
uint32_t data
The data value.
struct GNUNET_DATASTORE_Handle * GNUNET_DATASTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the datastore service.
unsigned int priority
Priority in the queue.
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_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.