GNUnet  0.17.6
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, 2022 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 
40 #ifndef GNUNET_DATACACHE_LIB_H
41 #define GNUNET_DATACACHE_LIB_H
42 
43 #include "gnunet_util_lib.h"
44 #include "gnunet_block_lib.h"
45 #include "gnunet_dht_service.h"
46 
47 #ifdef __cplusplus
48 extern "C"
49 {
50 #if 0 /* keep Emacsens' auto-indent happy */
51 }
52 #endif
53 #endif
54 
55 
60 {
64  struct GNUNET_HashCode key;
65 
70 
76 
81 
85  const void *data;
86 
90  size_t data_size;
91 
95  unsigned int put_path_length;
96 
100  enum GNUNET_BLOCK_Type type;
101 
106 };
107 
108 
113 
114 
124  const char *section);
125 
126 
132 void
134 
135 
143 typedef enum GNUNET_GenericReturnValue
144 (*GNUNET_DATACACHE_Iterator)(void *cls,
145  const struct GNUNET_DATACACHE_Block *block);
146 
147 
158  uint32_t xor_distance,
159  const struct GNUNET_DATACACHE_Block *block);
160 
161 
173 unsigned int
175  const struct GNUNET_HashCode *key,
176  enum GNUNET_BLOCK_Type type,
178  void *iter_cls);
179 
180 
195 unsigned int
197  const struct GNUNET_HashCode *key,
198  enum GNUNET_BLOCK_Type type,
199  unsigned int num_results,
201  void *iter_cls);
202 
203 
204 #if 0 /* keep Emacsens' auto-indent happy */
205 {
206 #endif
207 #ifdef __cplusplus
208 }
209 #endif
210 
211 #endif
212  /* end of group */
214  /* end of group addition */
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
struct GNUNET_HashCode key
The key used in the DHT.
Library for data block manipulation.
GNUNET_BLOCK_Type
WARNING: This header is generated! In order to add DHT block types, you must register them in GANA,...
API to the DHT service.
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:303
enum GNUNET_GenericReturnValue GNUNET_DATACACHE_put(struct GNUNET_DATACACHE_Handle *h, uint32_t xor_distance, const struct GNUNET_DATACACHE_Block *block)
Store an item in the datacache.
Definition: datacache.c:261
enum GNUNET_GenericReturnValue(* GNUNET_DATACACHE_Iterator)(void *cls, const struct GNUNET_DATACACHE_Block *block)
An iterator over a set of items stored in the datacache.
struct GNUNET_DATACACHE_Handle * GNUNET_DATACACHE_create(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section)
Create a data cache.
Definition: datacache.c:128
void GNUNET_DATACACHE_destroy(struct GNUNET_DATACACHE_Handle *h)
Destroy a data cache (and free associated resources).
Definition: datacache.c:235
unsigned int GNUNET_DATACACHE_get_closest(struct GNUNET_DATACACHE_Handle *h, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, 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:338
GNUNET_DHT_RouteOption
Options for routing.
GNUNET_GenericReturnValue
Named constants for return values.
Definition: gnunet_common.h:96
Information about a block stored in the datacache.
const struct GNUNET_DHT_PathElement * put_path
PUT path taken by the block, array of peer identities.
enum GNUNET_BLOCK_Type type
Type of the block.
const void * data
Actual block data.
enum GNUNET_DHT_RouteOption ro
Options for routing for the block.
struct GNUNET_PeerIdentity trunc_peer
If the path was truncated, this is the peer ID at which the path was truncated.
struct GNUNET_HashCode key
Key of the block.
size_t data_size
Number of bytes in data.
unsigned int put_path_length
Length of the put_path array.
struct GNUNET_TIME_Absolute expiration_time
When does the block expire?
Internal state of the datacache library.
Definition: datacache.c:41
char * section
Configuration section to use.
Definition: datacache.c:60
A (signed) path tracking a block's flow through the DHT is represented by an array of path elements,...
A 512-bit hashcode.
The identity of the host (wraps the signing key of the peer).
Time for absolute times used by GNUnet, in microseconds.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model