aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-dht_datacache.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/gnunet-service-dht_datacache.h')
-rw-r--r--src/dht/gnunet-service-dht_datacache.h169
1 files changed, 0 insertions, 169 deletions
diff --git a/src/dht/gnunet-service-dht_datacache.h b/src/dht/gnunet-service-dht_datacache.h
deleted file mode 100644
index 5be59c90e..000000000
--- a/src/dht/gnunet-service-dht_datacache.h
+++ /dev/null
@@ -1,169 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 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
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 * Handle a datum we've received from another peer. Cache if
36 * possible.
37 *
38 * @param expiration when will the reply expire
39 * @param key the query this reply is for
40 * @param put_path_length number of peers in 'put_path'
41 * @param put_path path the reply took on put
42 * @param type type of the reply
43 * @param data_size number of bytes in 'data'
44 * @param data application payload data
45 */
46void
47GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration,
48 const struct GNUNET_HashCode *key,
49 unsigned int put_path_length,
50 const struct GNUNET_PeerIdentity *put_path,
51 enum GNUNET_BLOCK_Type type,
52 size_t data_size,
53 const void *data);
54
55
56/**
57 * Handle a result for a GET operation.
58 *
59 * @param cls closure
60 * @param type type of the block
61 * @param expiration_time when does the content expire
62 * @param key key for the content
63 * @param put_path_length number of entries in @a put_path
64 * @param put_path peers the original PUT traversed (if tracked)
65 * @param get_path_length number of entries in @a get_path
66 * @param get_path peers this reply has traversed so far (if tracked)
67 * @param data payload of the reply
68 * @param data_size number of bytes in @a data
69 */
70typedef void
71(*GDS_DATACACHE_GetCallback)(void *cls,
72 enum GNUNET_BLOCK_Type type,
73 struct GNUNET_TIME_Absolute expiration_time,
74 const struct GNUNET_HashCode *key,
75 unsigned int put_path_length,
76 const struct GNUNET_PeerIdentity *put_path,
77 unsigned int get_path_length,
78 const struct GNUNET_PeerIdentity *get_path,
79 const void *data,
80 size_t data_size);
81
82
83/**
84 * Handle a GET request we've received from another peer.
85 *
86 * @param key the query
87 * @param type requested data type
88 * @param xquery extended query
89 * @param xquery_size number of bytes in xquery
90 * @param bg block group to use for evaluation of replies
91 * @param gc function to call on the results
92 * @param gc_cls closure for @a gc
93 * @return evaluation result for the local replies
94 */
95enum GNUNET_BLOCK_EvaluationResult
96GDS_DATACACHE_handle_get (const struct GNUNET_HashCode *key,
97 enum GNUNET_BLOCK_Type type,
98 const void *xquery,
99 size_t xquery_size,
100 struct GNUNET_BLOCK_Group *bg,
101 GDS_DATACACHE_GetCallback gc,
102 void *gc_cls);
103
104
105/**
106 * Obtain a random key from the datacache.
107 * Used by Whanau for load-balancing.
108 *
109 * @param[out] key where to store the key of a random element,
110 * randomized by PRNG if datacache is empty
111 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the datacache is empty
112 */
113int
114GDS_DATACACHE_get_random_key (struct GNUNET_HashCode *key);
115
116
117/**
118 * Send the get result to requesting client.
119 *
120 * @param cls closure
121 * @param options routing options (from GET request)
122 * @param key key of the requested data.
123 * @param type block type
124 * @param put_path_length number of peers in @a put_path
125 * @param put_path path taken to put the data at its stored location.
126 * @param expiration when will this result expire?
127 * @param data payload to store
128 * @param data_size size of the @a data
129 */
130typedef void
131(*GDS_DATACACHE_SuccessorCallback)(void *cls,
132 enum GNUNET_DHT_RouteOption options,
133 const struct GNUNET_HashCode *key,
134 enum GNUNET_BLOCK_Type type,
135 unsigned int put_path_length,
136 const struct GNUNET_PeerIdentity *put_path,
137 struct GNUNET_TIME_Absolute expiration,
138 const void *data,
139 size_t data_size);
140
141
142/**
143 * Handle a request for data close to a key that we have received from
144 * another peer.
145 *
146 * @param key the location at which the peer is looking for data that is close
147 * @param cb function to call with the result
148 * @param cb_cls closure for @a cb
149 */
150void
151GDS_DATACACHE_get_successors (const struct GNUNET_HashCode *key,
152 GDS_DATACACHE_SuccessorCallback cb,
153 void *cb_cls);
154
155
156/**
157 * Initialize datacache subsystem.
158 */
159void
160GDS_DATACACHE_init (void);
161
162
163/**
164 * Shutdown datacache subsystem.
165 */
166void
167GDS_DATACACHE_done (void);
168
169#endif