diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-04-30 08:00:51 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-04-30 08:00:51 +0000 |
commit | 66872cf6ba34329254c82cf948fef333e5dc4c9c (patch) | |
tree | 831b5bdf3d0b248b258d0fef0e127093402e322a /src/dht | |
parent | a2e148e05518211035b0d992a214a14b3fb14d0a (diff) | |
download | gnunet-66872cf6ba34329254c82cf948fef333e5dc4c9c.tar.gz gnunet-66872cf6ba34329254c82cf948fef333e5dc4c9c.zip |
-towards an API for the successor set
Diffstat (limited to 'src/dht')
-rw-r--r-- | src/dht/gnunet-service-wdht_datacache.c | 23 | ||||
-rw-r--r-- | src/dht/gnunet-service-wdht_datacache.h | 10 |
2 files changed, 33 insertions, 0 deletions
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 | |||
@@ -37,6 +37,12 @@ | |||
37 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) | 37 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * How many "closest" results to we return for migration when | ||
41 | * asked (at most)? | ||
42 | */ | ||
43 | #define NUM_CLOSEST 42 | ||
44 | |||
45 | /** | ||
40 | * Handle to the datacache service (for inserting/retrieving data) | 46 | * Handle to the datacache service (for inserting/retrieving data) |
41 | */ | 47 | */ |
42 | static struct GNUNET_DATACACHE_Handle *datacache; | 48 | static struct GNUNET_DATACACHE_Handle *datacache; |
@@ -424,6 +430,23 @@ GDS_DATACACHE_get_random_key (struct GNUNET_HashCode *key) | |||
424 | 430 | ||
425 | 431 | ||
426 | /** | 432 | /** |
433 | * Handle a request for data close to a key that we have received from | ||
434 | * another peer. | ||
435 | * | ||
436 | * @param key the location at which the peer is looking for data that is close | ||
437 | */ | ||
438 | void | ||
439 | GDS_DATACACHE_get_successors (const struct GNUNET_HashCode *key) | ||
440 | { | ||
441 | GNUNET_DATACACHE_get_closest (datacache, | ||
442 | key, | ||
443 | NUM_CLOSEST, | ||
444 | NULL /* FIXME */, | ||
445 | NULL); | ||
446 | } | ||
447 | |||
448 | |||
449 | /** | ||
427 | * Initialize datacache subsystem. | 450 | * Initialize datacache subsystem. |
428 | */ | 451 | */ |
429 | void | 452 | void |
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 | |||
@@ -88,6 +88,16 @@ GDS_DATACACHE_get_random_key (struct GNUNET_HashCode *key); | |||
88 | 88 | ||
89 | 89 | ||
90 | /** | 90 | /** |
91 | * Handle a request for data close to a key that we have received from | ||
92 | * another peer. | ||
93 | * | ||
94 | * @param key the location at which the peer is looking for data that is close | ||
95 | */ | ||
96 | void | ||
97 | GDS_DATACACHE_get_successors (const struct GNUNET_HashCode *key); | ||
98 | |||
99 | |||
100 | /** | ||
91 | * Initialize datacache subsystem. | 101 | * Initialize datacache subsystem. |
92 | */ | 102 | */ |
93 | void | 103 | void |