aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-dht_datacache.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-02-20 17:19:47 +0100
committerChristian Grothoff <christian@grothoff.org>2017-02-20 17:19:47 +0100
commitf6f7fbbe98c110867febbcca647da8308be123c7 (patch)
treeaf69447cf4f08c417197685855c097c132aea8a1 /src/dht/gnunet-service-dht_datacache.c
parenta3882b58f1c5976677aa65b0af8a48e8e946b06e (diff)
downloadgnunet-f6f7fbbe98c110867febbcca647da8308be123c7.tar.gz
gnunet-f6f7fbbe98c110867febbcca647da8308be123c7.zip
completed big block refactoring in preparation for SET-BLOCK integration
Diffstat (limited to 'src/dht/gnunet-service-dht_datacache.c')
-rw-r--r--src/dht/gnunet-service-dht_datacache.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/src/dht/gnunet-service-dht_datacache.c b/src/dht/gnunet-service-dht_datacache.c
index 74fa1cc29..fef637cad 100644
--- a/src/dht/gnunet-service-dht_datacache.c
+++ b/src/dht/gnunet-service-dht_datacache.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009, 2010, 2011, 2015 GNUnet e.V. 3 Copyright (C) 2009, 2010, 2011, 2015, 2017 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -109,39 +109,34 @@ struct GetRequestContext
109 const void *xquery; 109 const void *xquery;
110 110
111 /** 111 /**
112 * Bloomfilter to filter out duplicate replies (updated)
113 */
114 struct GNUNET_CONTAINER_BloomFilter **reply_bf;
115
116 /**
117 * The key this request was about 112 * The key this request was about
118 */ 113 */
119 struct GNUNET_HashCode key; 114 struct GNUNET_HashCode key;
120 115
121 /** 116 /**
122 * Number of bytes in xquery. 117 * Block group to use to evaluate replies (updated)
123 */ 118 */
124 size_t xquery_size; 119 struct GNUNET_BLOCK_Group *bg;
125 120
126 /** 121 /**
127 * Mutator value for the @e reply_bf, see gnunet_block_lib.h 122 * Function to call on results.
128 */ 123 */
129 uint32_t reply_bf_mutator; 124 GDS_DATACACHE_GetCallback gc;
130 125
131 /** 126 /**
132 * Return value to give back. 127 * Closure for @e gc.
133 */ 128 */
134 enum GNUNET_BLOCK_EvaluationResult eval; 129 void *gc_cls;
135 130
136 /** 131 /**
137 * Function to call on results. 132 * Number of bytes in xquery.
138 */ 133 */
139 GDS_DATACACHE_GetCallback gc; 134 size_t xquery_size;
140 135
141 /** 136 /**
142 * Closure for @e gc. 137 * Return value to give back.
143 */ 138 */
144 void *gc_cls; 139 enum GNUNET_BLOCK_EvaluationResult eval;
145 140
146}; 141};
147 142
@@ -181,10 +176,9 @@ datacache_get_iterator (void *cls,
181 eval 176 eval
182 = GNUNET_BLOCK_evaluate (GDS_block_context, 177 = GNUNET_BLOCK_evaluate (GDS_block_context,
183 type, 178 type,
179 ctx->bg,
184 GNUNET_BLOCK_EO_LOCAL_SKIP_CRYPTO, 180 GNUNET_BLOCK_EO_LOCAL_SKIP_CRYPTO,
185 key, 181 key,
186 ctx->reply_bf,
187 ctx->reply_bf_mutator,
188 ctx->xquery, 182 ctx->xquery,
189 ctx->xquery_size, 183 ctx->xquery_size,
190 data, 184 data,
@@ -256,8 +250,7 @@ datacache_get_iterator (void *cls,
256 * @param type requested data type 250 * @param type requested data type
257 * @param xquery extended query 251 * @param xquery extended query
258 * @param xquery_size number of bytes in @a xquery 252 * @param xquery_size number of bytes in @a xquery
259 * @param reply_bf where the reply bf is (to be) stored, possibly updated, can be NULL 253 * @param bg block group to use for reply evaluation
260 * @param reply_bf_mutator mutation value for @a reply_bf
261 * @param gc function to call on the results 254 * @param gc function to call on the results
262 * @param gc_cls closure for @a gc 255 * @param gc_cls closure for @a gc
263 * @return evaluation result for the local replies 256 * @return evaluation result for the local replies
@@ -267,8 +260,7 @@ GDS_DATACACHE_handle_get (const struct GNUNET_HashCode *key,
267 enum GNUNET_BLOCK_Type type, 260 enum GNUNET_BLOCK_Type type,
268 const void *xquery, 261 const void *xquery,
269 size_t xquery_size, 262 size_t xquery_size,
270 struct GNUNET_CONTAINER_BloomFilter **reply_bf, 263 struct GNUNET_BLOCK_Group *bg,
271 uint32_t reply_bf_mutator,
272 GDS_DATACACHE_GetCallback gc, 264 GDS_DATACACHE_GetCallback gc,
273 void *gc_cls) 265 void *gc_cls)
274{ 266{
@@ -285,8 +277,7 @@ GDS_DATACACHE_handle_get (const struct GNUNET_HashCode *key,
285 ctx.key = *key; 277 ctx.key = *key;
286 ctx.xquery = xquery; 278 ctx.xquery = xquery;
287 ctx.xquery_size = xquery_size; 279 ctx.xquery_size = xquery_size;
288 ctx.reply_bf = reply_bf; 280 ctx.bg = bg;
289 ctx.reply_bf_mutator = reply_bf_mutator;
290 ctx.gc = gc; 281 ctx.gc = gc;
291 ctx.gc_cls = gc_cls; 282 ctx.gc_cls = gc_cls;
292 r = GNUNET_DATACACHE_get (datacache, 283 r = GNUNET_DATACACHE_get (datacache,