From 66872cf6ba34329254c82cf948fef333e5dc4c9c Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 30 Apr 2015 08:00:51 +0000 Subject: [PATCH] -towards an API for the successor set --- src/dht/gnunet-service-wdht_datacache.c | 23 +++++++++++++++++++++++ src/dht/gnunet-service-wdht_datacache.h | 10 ++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/dht/gnunet-service-wdht_datacache.c b/src/dht/gnunet-service-wdht_datacache.c index 6bf68028a..978c8f177 100644 --- a/src/dht/gnunet-service-wdht_datacache.c +++ b/src/dht/gnunet-service-wdht_datacache.c @@ -36,6 +36,12 @@ #define DEBUG(...) \ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) +/** + * How many "closest" results to we return for migration when + * asked (at most)? + */ +#define NUM_CLOSEST 42 + /** * Handle to the datacache service (for inserting/retrieving data) */ @@ -423,6 +429,23 @@ GDS_DATACACHE_get_random_key (struct GNUNET_HashCode *key) } +/** + * Handle a request for data close to a key that we have received from + * another peer. + * + * @param key the location at which the peer is looking for data that is close + */ +void +GDS_DATACACHE_get_successors (const struct GNUNET_HashCode *key) +{ + GNUNET_DATACACHE_get_closest (datacache, + key, + NUM_CLOSEST, + NULL /* FIXME */, + NULL); +} + + /** * Initialize datacache subsystem. */ diff --git a/src/dht/gnunet-service-wdht_datacache.h b/src/dht/gnunet-service-wdht_datacache.h index 0b28477c1..818138a87 100644 --- a/src/dht/gnunet-service-wdht_datacache.h +++ b/src/dht/gnunet-service-wdht_datacache.h @@ -87,6 +87,16 @@ int GDS_DATACACHE_get_random_key (struct GNUNET_HashCode *key); +/** + * Handle a request for data close to a key that we have received from + * another peer. + * + * @param key the location at which the peer is looking for data that is close + */ +void +GDS_DATACACHE_get_successors (const struct GNUNET_HashCode *key); + + /** * Initialize datacache subsystem. */ -- 2.25.1