diff options
Diffstat (limited to 'src/dht/gnunet-service-dht_datacache.h')
-rw-r--r-- | src/dht/gnunet-service-dht_datacache.h | 156 |
1 files changed, 0 insertions, 156 deletions
diff --git a/src/dht/gnunet-service-dht_datacache.h b/src/dht/gnunet-service-dht_datacache.h deleted file mode 100644 index d860139f5..000000000 --- a/src/dht/gnunet-service-dht_datacache.h +++ /dev/null | |||
@@ -1,156 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2009, 2010, 2011, 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 | |||
21 | /** | ||
22 | * @file dht/gnunet-service-dht_datacache.h | ||
23 | * @brief GNUnet DHT service's datacache integration | ||
24 | * @author Christian Grothoff | ||
25 | * @author Nathan Evans | ||
26 | */ | ||
27 | #ifndef GNUNET_SERVICE_DHT_DATACACHE_H | ||
28 | #define GNUNET_SERVICE_DHT_DATACACHE_H | ||
29 | |||
30 | #include "gnunet_util_lib.h" | ||
31 | #include "gnunet_block_lib.h" | ||
32 | #include "gnunet_dht_service.h" | ||
33 | |||
34 | |||
35 | /** | ||
36 | * Information about a block stored in the datacache. | ||
37 | */ | ||
38 | struct GDS_DATACACHE_BlockData | ||
39 | { | ||
40 | /** | ||
41 | * Key of the block. | ||
42 | */ | ||
43 | struct GNUNET_HashCode key; | ||
44 | |||
45 | /** | ||
46 | * When does the block expire? | ||
47 | */ | ||
48 | struct GNUNET_TIME_Absolute expiration_time; | ||
49 | |||
50 | /** | ||
51 | * PUT path taken by the block, array of peer identities. | ||
52 | */ | ||
53 | const struct GNUNET_DHT_PathElement *put_path; | ||
54 | |||
55 | /** | ||
56 | * Actual block data. | ||
57 | */ | ||
58 | const void *data; | ||
59 | |||
60 | /** | ||
61 | * Number of bytes in @a data. | ||
62 | */ | ||
63 | size_t data_size; | ||
64 | |||
65 | /** | ||
66 | * Length of the @e put_path array. | ||
67 | */ | ||
68 | unsigned int put_path_length; | ||
69 | |||
70 | /** | ||
71 | * Type of the block. | ||
72 | */ | ||
73 | enum GNUNET_BLOCK_Type type; | ||
74 | }; | ||
75 | |||
76 | |||
77 | /** | ||
78 | * Handle a datum we've received from another peer. Cache if | ||
79 | * possible. | ||
80 | * | ||
81 | * @param bd block data to cache | ||
82 | */ | ||
83 | void | ||
84 | GDS_DATACACHE_handle_put (const struct GDS_DATACACHE_BlockData *bd); | ||
85 | |||
86 | |||
87 | /** | ||
88 | * Handle a result for a GET operation. | ||
89 | * | ||
90 | * @param cls closure | ||
91 | * @param bd block details | ||
92 | */ | ||
93 | typedef void | ||
94 | (*GDS_DATACACHE_GetCallback)(void *cls, | ||
95 | const struct GDS_DATACACHE_BlockData *bd); | ||
96 | |||
97 | |||
98 | /** | ||
99 | * Handle a GET request we've received from another peer. | ||
100 | * | ||
101 | * @param key the query | ||
102 | * @param type requested data type | ||
103 | * @param xquery extended query | ||
104 | * @param xquery_size number of bytes in xquery | ||
105 | * @param bg block group to use for evaluation of replies | ||
106 | * @param gc function to call on the results | ||
107 | * @param gc_cls closure for @a gc | ||
108 | * @return evaluation result for the local replies | ||
109 | */ | ||
110 | enum GNUNET_BLOCK_ReplyEvaluationResult | ||
111 | GDS_DATACACHE_handle_get (const struct GNUNET_HashCode *key, | ||
112 | enum GNUNET_BLOCK_Type type, | ||
113 | const void *xquery, | ||
114 | size_t xquery_size, | ||
115 | struct GNUNET_BLOCK_Group *bg, | ||
116 | GDS_DATACACHE_GetCallback gc, | ||
117 | void *gc_cls); | ||
118 | |||
119 | |||
120 | /** | ||
121 | * Handle a request for data close to a key that we have received from | ||
122 | * another peer. | ||
123 | * | ||
124 | * @param key the location at which the peer is looking for data that is close | ||
125 | * @param type requested data type | ||
126 | * @param xquery extended query | ||
127 | * @param xquery_size number of bytes in xquery | ||
128 | * @param bg block group to use for evaluation of replies | ||
129 | * @param cb function to call with the result | ||
130 | * @param cb_cls closure for @a cb | ||
131 | * @return evaluation result for the local replies | ||
132 | */ | ||
133 | enum GNUNET_BLOCK_ReplyEvaluationResult | ||
134 | GDS_DATACACHE_get_closest (const struct GNUNET_HashCode *key, | ||
135 | enum GNUNET_BLOCK_Type type, | ||
136 | const void *xquery, | ||
137 | size_t xquery_size, | ||
138 | struct GNUNET_BLOCK_Group *bg, | ||
139 | GDS_DATACACHE_GetCallback cb, | ||
140 | void *cb_cls); | ||
141 | |||
142 | |||
143 | /** | ||
144 | * Initialize datacache subsystem. | ||
145 | */ | ||
146 | void | ||
147 | GDS_DATACACHE_init (void); | ||
148 | |||
149 | |||
150 | /** | ||
151 | * Shutdown datacache subsystem. | ||
152 | */ | ||
153 | void | ||
154 | GDS_DATACACHE_done (void); | ||
155 | |||
156 | #endif | ||