GNUnet  0.11.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,
106  struct GNUNET_TIME_Absolute
108  const char *msg);
109 
110 
128  uint64_t amount,
129  uint32_t entries,
131  void *cont_cls);
132 
133 
161  uint32_t rid,
162  const struct GNUNET_HashCode *key,
163  size_t size,
164  const void *data,
165  enum GNUNET_BLOCK_Type type,
166  uint32_t priority,
167  uint32_t anonymity,
168  uint32_t replication,
170  unsigned int queue_priority,
171  unsigned int max_queue_size,
173  void *cont_cls);
174 
175 
198  uint32_t rid, unsigned int queue_priority,
199  unsigned int max_queue_size,
201  void *cont_cls);
202 
203 
225  const struct GNUNET_HashCode *key,
226  size_t size,
227  const void *data,
228  unsigned int queue_priority,
229  unsigned int max_queue_size,
231  void *cont_cls);
232 
233 
249 typedef void
251  const struct GNUNET_HashCode *key,
252  size_t size,
253  const void *data,
254  enum GNUNET_BLOCK_Type type,
255  uint32_t priority,
256  uint32_t anonymity,
257  uint32_t replication,
259  uint64_t uid);
260 
261 
282  uint64_t next_uid,
283  bool random,
284  const struct GNUNET_HashCode *key,
285  enum GNUNET_BLOCK_Type type,
286  unsigned int queue_priority,
287  unsigned int max_queue_size,
289  void *proc_cls);
290 
291 
310  uint64_t next_uid,
311  unsigned int queue_priority,
312  unsigned int max_queue_size,
313  enum GNUNET_BLOCK_Type type,
315  void *proc_cls);
316 
317 
338  unsigned int queue_priority,
339  unsigned int max_queue_size,
341  void *proc_cls);
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 const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
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:99
Entry in our priority queue.
Definition: datastore_api.c:99
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 char * expiration
Credential TTL.
Definition: gnunet-abd.c:96
struct GNUNET_HashCode key
The key used in the DHT.
static unsigned int size
Size of the "table".
Definition: peer.c:67
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:85
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.