33 #define LOG(kind, ...) GNUNET_log_from (kind, "dht-dhtcache", __VA_ARGS__) 39 #define NUM_CLOSEST 42 62 unsigned int put_path_length,
70 if (NULL == datacache)
73 _ (
"%s request received, but have no datacache!\n"),
"PUT");
97 "DATACACHE PUT for key %s [%lu] completed (%d) after %u hops\n",
99 (
unsigned long) data_size,
168 unsigned int put_path_length,
171 static char non_null;
180 if ((NULL == data) &&
195 "Found reply for query %s in datacache, evaluation result is %d\n",
206 (
"# Good RESULTS found in datacache"), 1,
212 put_path_length, put_path,
220 "# Duplicate RESULTS found in datacache"),
228 "# Invalid RESULTS found in datacache"),
236 "# Irrelevant RESULTS found in datacache"),
252 "# Unsupported RESULTS found in datacache"),
256 _ (
"Unsupported block type (%u) in local response!\n"),
288 if (NULL == datacache)
307 "DATACACHE GET for key %s completed (%d). %u results found.\n",
336 unsigned int path_info_len,
409 unsigned int put_path_length,
422 put_path_length, put_path,
471 if (NULL != datacache)
Block does not match query (invalid result)
#define NUM_CLOSEST
How many "closest" results to we return for migration when asked (at most)?
enum GNUNET_BLOCK_EvaluationResult eval
Return value to give back.
struct GNUNET_STATISTICS_Handle * GDS_stats
Handle for the statistics service.
We should keep track of the route that the message took in the P2P network.
size_t xquery_size
Number of bytes in xquery.
void GDS_DATACACHE_init()
Initialize datacache subsystem.
GNUNET_BLOCK_Type
Blocks in the datastore and the datacache must have a unique type.
void(* GDS_DATACACHE_GetCallback)(void *cls, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute expiration_time, const struct GNUNET_HashCode *key, unsigned int put_path_length, const struct GNUNET_PeerIdentity *put_path, unsigned int get_path_length, const struct GNUNET_PeerIdentity *get_path, const void *data, size_t data_size)
Handle a result for a GET operation.
unsigned int GNUNET_CRYPTO_hash_matching_bits(const struct GNUNET_HashCode *first, const struct GNUNET_HashCode *second)
Determine how many low order bits match in two struct GNUNET_HashCodes.
static size_t data_size
Number of bytes in data.
void GDS_DATACACHE_done()
Shutdown datacache subsystem.
void GNUNET_DATACACHE_destroy(struct GNUNET_DATACACHE_Handle *h)
Destroy a data cache (and free associated resources).
GDS_DATACACHE_GetCallback gc
Function to call on results.
void(* GDS_DATACACHE_SuccessorCallback)(void *cls, enum GNUNET_DHT_RouteOption options, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, unsigned int put_path_length, const struct GNUNET_PeerIdentity *put_path, struct GNUNET_TIME_Absolute expiration, const void *data, size_t data_size)
Send the get result to requesting client.
Block does not match xquery (valid result, not relevant for the request)
int GNUNET_DATACACHE_put(struct GNUNET_DATACACHE_Handle *h, const struct GNUNET_HashCode *key, uint32_t xor_distance, size_t data_size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute discard_time, unsigned int path_info_len, const struct GNUNET_PeerIdentity *path_info)
Store an item in the datastore.
static int datacache_get_successors_iterator(void *cls, const struct GNUNET_HashCode *key, size_t size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute exp, unsigned int put_path_length, const struct GNUNET_PeerIdentity *put_path)
Iterator for local get request results,.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
struct GNUNET_HashCode my_identity_hash
Hash of the identity of this peer.
struct GNUNET_BLOCK_Context * GDS_block_context
Our handle to the BLOCK library.
struct GNUNET_HashCode key
The key this request was about.
int GDS_DATACACHE_get_random_key(struct GNUNET_HashCode *key)
Obtain a random key from the datacache.
void * cb_cls
Closure for cb.
void GNUNET_CRYPTO_hash_create_random(enum GNUNET_CRYPTO_Quality mode, struct GNUNET_HashCode *result)
Create a random hash code.
Valid result, but suppressed because it is a duplicate.
unsigned int GNUNET_DATACACHE_get(struct GNUNET_DATACACHE_Handle *h, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, GNUNET_DATACACHE_Iterator iter, void *iter_cls)
Iterate over the results for a particular key in the datacache.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
enum GNUNET_BLOCK_EvaluationResult GNUNET_BLOCK_evaluate(struct GNUNET_BLOCK_Context *ctx, enum GNUNET_BLOCK_Type type, struct GNUNET_BLOCK_Group *group, enum GNUNET_BLOCK_EvaluationOptions eo, const struct GNUNET_HashCode *query, const void *xquery, size_t xquery_size, const void *reply_block, size_t reply_block_size)
Function called to validate a reply or a request.
void GDS_DATACACHE_handle_put(struct GNUNET_TIME_Absolute expiration, const struct GNUNET_HashCode *key, unsigned int put_path_length, const struct GNUNET_PeerIdentity *put_path, enum GNUNET_BLOCK_Type type, size_t data_size, const void *data)
Handle a datum we've received from another peer.
struct GNUNET_DATACACHE_Handle * GNUNET_DATACACHE_create(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section)
Create a data cache.
Last possible valid result.
GNUnet DHT tracking of requests for routing replies.
Context containing information about a GET request.
static char * expiration
Credential TTL.
struct GNUNET_BLOCK_Group * bg
Block group to use to evaluate replies (updated)
The block is obtained from the local database, skip cryptographic checks.
Valid result, and there may be more.
struct GNUNET_HashCode key
The key used in the DHT.
static unsigned int size
Size of the "table".
GNUNET_BLOCK_EvaluationResult
Possible ways for how a block may relate to a query.
static struct GNUNET_FS_SearchContext * sc
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message...
GDS_DATACACHE_SuccessorCallback cb
Function to call on the result.
Specified block type not supported by this plugin.
Closure for datacache_get_successors_iterator().
void GDS_DATACACHE_get_successors(const struct GNUNET_HashCode *key, GDS_DATACACHE_SuccessorCallback cb, void *cb_cls)
Handle a request for data close to a key that we have received from another peer. ...
GNUnet DHT service's datacache integration.
The identity of the host (wraps the signing key of the peer).
Internal state of the datacache library.
Query format does not match block type (invalid query).
static int datacache_get_iterator(void *cls, const struct GNUNET_HashCode *key, size_t data_size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute exp, unsigned int put_path_length, const struct GNUNET_PeerIdentity *put_path)
Iterator for local get request results,.
#define GNUNET_log(kind,...)
void * gc_cls
Closure for gc.
enum GNUNET_BLOCK_EvaluationResult 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.
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
Time for absolute times used by GNUnet, in microseconds.
static int datacache_random_iterator(void *cls, const struct GNUNET_HashCode *key, size_t data_size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute exp, unsigned int path_info_len, const struct GNUNET_PeerIdentity *path_info)
Function called with a random element from the datacache.
const struct GNUNET_CONFIGURATION_Handle * GDS_cfg
Configuration we use.
static struct GNUNET_DATACACHE_Handle * datacache
Handle to the datacache service (for inserting/retrieving data)
uint32_t data
The data value.
unsigned int GNUNET_DATACACHE_get_closest(struct GNUNET_DATACACHE_Handle *h, const struct GNUNET_HashCode *key, unsigned int num_results, GNUNET_DATACACHE_Iterator iter, void *iter_cls)
Iterate over the results that are "close" to a particular key in the datacache.
Query is valid, no reply given.
unsigned int GNUNET_DATACACHE_get_random(struct GNUNET_DATACACHE_Handle *h, GNUNET_DATACACHE_Iterator iter, void *iter_cls)
Obtain a random element from the datacache.
const void * xquery
extended query (see gnunet_block_lib.h).
#define gettext_noop(String)