GNUnet  0.10.x
gnunet_datacache_lib.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2006, 2009, 2015 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 
37 #ifndef GNUNET_DATACACHE_LIB_H
38 #define GNUNET_DATACACHE_LIB_H
39 
40 #include "gnunet_util_lib.h"
41 #include "gnunet_block_lib.h"
42 
43 #ifdef __cplusplus
44 extern "C"
45 {
46 #if 0 /* keep Emacsens' auto-indent happy */
47 }
48 #endif
49 #endif
50 
51 
56 
57 
67  const char *section);
68 
69 
75 void
77 
78 
92 typedef int
94  const struct GNUNET_HashCode *key,
95  size_t data_size,
96  const char *data,
98  struct GNUNET_TIME_Absolute exp,
99  unsigned int path_info_len,
100  const struct GNUNET_PeerIdentity *path_info);
101 
102 
117 int
119  const struct GNUNET_HashCode *key,
120  uint32_t xor_distance,
121  size_t data_size,
122  const char *data,
123  enum GNUNET_BLOCK_Type type,
124  struct GNUNET_TIME_Absolute discard_time,
125  unsigned int path_info_len,
126  const struct GNUNET_PeerIdentity *path_info);
127 
128 
140 unsigned int
142  const struct GNUNET_HashCode *key,
143  enum GNUNET_BLOCK_Type type,
145  void *iter_cls);
146 
147 
156 unsigned int
159  void *iter_cls);
160 
161 
175 unsigned int
177  const struct GNUNET_HashCode *key,
178  unsigned int num_results,
180  void *iter_cls);
181 
182 
183 #if 0 /* keep Emacsens' auto-indent happy */
184 {
185 #endif
186 #ifdef __cplusplus
187 }
188 #endif
189 
190 #endif
191  /* end of group */
GNUNET_BLOCK_Type
Blocks in the datastore and the datacache must have a unique type.
void GNUNET_DATACACHE_destroy(struct GNUNET_DATACACHE_Handle *h)
Destroy a data cache (and free associated resources).
Definition: datacache.c:211
int GNUNET_DATACACHE_put(struct GNUNET_DATACACHE_Handle *h, const struct GNUNET_HashCode *key, uint32_t xor_distance, size_t data_size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute discard_time, unsigned int path_info_len, const struct GNUNET_PeerIdentity *path_info)
Store an item in the datacache.
Definition: datacache.c:249
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:94
static char * section
Name of the section.
Definition: gnunet-config.c:33
unsigned int GNUNET_DATACACHE_get(struct GNUNET_DATACACHE_Handle *h, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, GNUNET_DATACACHE_Iterator iter, void *iter_cls)
Iterate over the results for a particular key in the datacache.
Definition: datacache.c:312
struct GNUNET_DATACACHE_Handle * GNUNET_DATACACHE_create(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section)
Create a data cache.
Definition: datacache.c:132
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.
The identity of the host (wraps the signing key of the peer).
Internal state of the datacache library.
Definition: datacache.c:40
configuration data
Definition: configuration.c:83
int(* GNUNET_DATACACHE_Iterator)(void *cls, const struct GNUNET_HashCode *key, size_t data_size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute exp, unsigned int path_info_len, const struct GNUNET_PeerIdentity *path_info)
An iterator over a set of items stored in the datacache.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
Time for absolute times used by GNUnet, in microseconds.
uint32_t data
The data value.
static size_t data_size
Number of bytes in data.
unsigned int GNUNET_DATACACHE_get_closest(struct GNUNET_DATACACHE_Handle *h, const struct GNUNET_HashCode *key, unsigned int num_results, GNUNET_DATACACHE_Iterator iter, void *iter_cls)
Iterate over the results that are "close" to a particular key in the datacache.
Definition: datacache.c:379
unsigned int GNUNET_DATACACHE_get_random(struct GNUNET_DATACACHE_Handle *h, GNUNET_DATACACHE_Iterator iter, void *iter_cls)
Obtain a random element from the datacache.
Definition: datacache.c:351