GNUnet DHT service's datacache integration. More...
#include "gnunet_util_lib.h"#include "gnunet_block_lib.h"#include "gnunet_dht_service.h"#include "gnunet_datacache_lib.h"Go to the source code of this file.
Typedefs | |
| typedef void(* | GDS_DATACACHE_GetCallback) (void *cls, const struct GNUNET_DATACACHE_Block *bd) |
| Handle a result for a GET operation. | |
Functions | |
| void | GDS_DATACACHE_handle_put (const struct GNUNET_DATACACHE_Block *bd) |
| Handle a datum we've received from another peer. | |
| 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. | |
| 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. | |
| void | GDS_DATACACHE_init (void) |
| Initialize datacache subsystem. | |
| void | GDS_DATACACHE_done (void) |
| Shutdown datacache subsystem. | |
GNUnet DHT service's datacache integration.
Definition in file gnunet-service-dht_datacache.h.
| typedef void(* GDS_DATACACHE_GetCallback) (void *cls, const struct GNUNET_DATACACHE_Block *bd) |
Handle a result for a GET operation.
| cls | closure |
| bd | block details |
Definition at line 52 of file gnunet-service-dht_datacache.h.
| 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().
| 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().