GNUnet DHT service's datacache integration. More...
#include "platform.h"
#include "gnunet_datacache_lib.h"
#include "gnunet-service-dht_datacache.h"
#include "gnunet-service-dht_neighbours.h"
#include "gnunet-service-dht_routing.h"
#include "gnunet-service-dht.h"
Go to the source code of this file.
Data Structures | |
struct | GetRequestContext |
Context containing information about a GET request. More... | |
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "dht-dhtcache", __VA_ARGS__) |
#define | NUM_CLOSEST 4 |
How many "closest" results to we return for migration when asked (at most)? More... | |
Functions | |
void | GDS_DATACACHE_handle_put (const struct GNUNET_DATACACHE_Block *bd) |
Handle a datum we've received from another peer. More... | |
static enum GNUNET_GenericReturnValue | datacache_get_iterator (void *cls, const struct GNUNET_DATACACHE_Block *bd) |
Iterator for local get request results,. More... | |
enum GNUNET_BLOCK_ReplyEvaluationResult | GDS_DATACACHE_handle_get (const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, const void *xquery, size_t xquery_size, struct GNUNET_BLOCK_Group *bg, GDS_DATACACHE_GetCallback gc, void *gc_cls) |
Handle a GET request we've received from another peer. More... | |
enum GNUNET_BLOCK_ReplyEvaluationResult | GDS_DATACACHE_get_closest (const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, const void *xquery, size_t xquery_size, struct GNUNET_BLOCK_Group *bg, GDS_DATACACHE_GetCallback cb, void *cb_cls) |
Handle a request for data close to a key that we have received from another peer. More... | |
void | GDS_DATACACHE_init () |
Initialize datacache subsystem. More... | |
void | GDS_DATACACHE_done () |
Shutdown datacache subsystem. More... | |
Variables | |
static struct GNUNET_DATACACHE_Handle * | datacache |
Handle to the datacache service (for inserting/retrieving data) More... | |
GNUnet DHT service's datacache integration.
Definition in file gnunet-service-dht_datacache.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "dht-dhtcache", __VA_ARGS__) |
Definition at line 33 of file gnunet-service-dht_datacache.c.
#define NUM_CLOSEST 4 |
How many "closest" results to we return for migration when asked (at most)?
Definition at line 39 of file gnunet-service-dht_datacache.c.
void GDS_DATACACHE_handle_put | ( | const struct GNUNET_DATACACHE_Block * | bd | ) |
Handle a datum we've received from another peer.
Cache if possible.
bd | block data to cache |
Definition at line 49 of file gnunet-service-dht_datacache.c.
References GNUNET_DATACACHE_Block::data_size, datacache, GDS_my_identity_hash, GDS_stats, GNUNET_break, GNUNET_CRYPTO_hash_count_leading_zeros(), GNUNET_CRYPTO_hash_xor(), GNUNET_DATACACHE_put(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_h2s(), GNUNET_log, GNUNET_MAX_MESSAGE_SIZE, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_DATACACHE_Block::key, LOG, and GNUNET_DATACACHE_Block::put_path_length.
Referenced by handle_dht_local_put(), handle_dht_p2p_put(), and process_reply_with_path().
|
static |
Iterator for local get request results,.
cls | closure for iterator, a struct GetRequestContext |
bd | block data |
Definition at line 136 of file gnunet-service-dht_datacache.c.
References ctx, GNUNET_DATACACHE_Block::data, GNUNET_DATACACHE_Block::data_size, GetRequestContext::eval, GNUNET_DATACACHE_Block::expiration_time, GDS_block_context, GDS_stats, GNUNET_BLOCK_check_reply(), GNUNET_BLOCK_REPLY_IRRELEVANT, GNUNET_BLOCK_REPLY_OK_DUPLICATE, GNUNET_BLOCK_REPLY_OK_LAST, GNUNET_BLOCK_REPLY_OK_MORE, GNUNET_BLOCK_REPLY_TYPE_NOT_SUPPORTED, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_NO, GNUNET_OK, GNUNET_STATISTICS_update(), GNUNET_TIME_absolute_is_past(), GNUNET_DATACACHE_Block::key, LOG, and GNUNET_DATACACHE_Block::type.
Referenced by GDS_DATACACHE_get_closest(), and GDS_DATACACHE_handle_get().
enum GNUNET_BLOCK_ReplyEvaluationResult GDS_DATACACHE_handle_get | ( | const struct GNUNET_HashCode * | key, |
enum GNUNET_BLOCK_Type | type, | ||
const void * | xquery, | ||
size_t | xquery_size, | ||
struct GNUNET_BLOCK_Group * | bg, | ||
GDS_DATACACHE_GetCallback | gc, | ||
void * | gc_cls | ||
) |
Handle a GET request we've received from another peer.
key | the query |
type | requested data type |
xquery | extended query |
xquery_size | number of bytes in xquery |
bg | block group to use for evaluation of replies |
gc | function to call on the results |
gc_cls | closure for gc |
Definition at line 192 of file gnunet-service-dht_datacache.c.
References GetRequestContext::bg, ctx, datacache, datacache_get_iterator(), GetRequestContext::gc, GetRequestContext::gc_cls, GDS_stats, GNUNET_BLOCK_REPLY_TYPE_NOT_SUPPORTED, GNUNET_DATACACHE_get(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_NO, GNUNET_STATISTICS_update(), key, LOG, type, GetRequestContext::xquery, and GetRequestContext::xquery_size.
Referenced by handle_dht_local_get(), and handle_dht_p2p_get().
enum GNUNET_BLOCK_ReplyEvaluationResult GDS_DATACACHE_get_closest | ( | const struct GNUNET_HashCode * | key, |
enum GNUNET_BLOCK_Type | type, | ||
const void * | xquery, | ||
size_t | xquery_size, | ||
struct GNUNET_BLOCK_Group * | bg, | ||
GDS_DATACACHE_GetCallback | cb, | ||
void * | cb_cls | ||
) |
Handle a request for data close to a key that we have received from another peer.
key | the location at which the peer is looking for data that is close |
type | requested data type |
xquery | extended query |
xquery_size | number of bytes in xquery |
bg | block group to use for evaluation of replies |
cb | function to call with the result |
cb_cls | closure for cb |
Definition at line 232 of file gnunet-service-dht_datacache.c.
References GetRequestContext::bg, ctx, datacache, datacache_get_iterator(), GDS_stats, GNUNET_BLOCK_REPLY_TYPE_NOT_SUPPORTED, GNUNET_DATACACHE_get_closest(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_NO, GNUNET_STATISTICS_update(), key, LOG, NUM_CLOSEST, type, GetRequestContext::xquery, and GetRequestContext::xquery_size.
Referenced by handle_dht_p2p_get().
void GDS_DATACACHE_init | ( | void | ) |
Initialize datacache subsystem.
Definition at line 273 of file gnunet-service-dht_datacache.c.
References datacache, GDS_cfg, and GNUNET_DATACACHE_create().
Referenced by run().
void GDS_DATACACHE_done | ( | void | ) |
Shutdown datacache subsystem.
Definition at line 281 of file gnunet-service-dht_datacache.c.
References datacache, and GNUNET_DATACACHE_destroy().
Referenced by shutdown_task().
|
static |
Handle to the datacache service (for inserting/retrieving data)
Definition at line 45 of file gnunet-service-dht_datacache.c.
Referenced by GDS_DATACACHE_done(), GDS_DATACACHE_get_closest(), GDS_DATACACHE_handle_get(), GDS_DATACACHE_handle_put(), and GDS_DATACACHE_init().