Simple, transient hash table of bounded size with content expiration. More...
Data Structures | |
struct | GNUNET_DATACACHE_Block |
Information about a block stored in the datacache. More... | |
Typedefs | |
typedef enum GNUNET_GenericReturnValue(* | GNUNET_DATACACHE_Iterator) (void *cls, const struct GNUNET_DATACACHE_Block *block) |
An iterator over a set of items stored in the datacache. More... | |
Functions | |
struct GNUNET_DATACACHE_Handle * | GNUNET_DATACACHE_create (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section) |
Create a data cache. More... | |
void | GNUNET_DATACACHE_destroy (struct GNUNET_DATACACHE_Handle *h) |
Destroy a data cache (and free associated resources). More... | |
enum GNUNET_GenericReturnValue | GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, uint32_t xor_distance, const struct GNUNET_DATACACHE_Block *block) |
Store an item in the datacache. More... | |
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. More... | |
unsigned int | GNUNET_DATACACHE_get_closest (struct GNUNET_DATACACHE_Handle *h, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, 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. More... | |
Simple, transient hash table of bounded size with content expiration.
In contrast to the sqstore there is no prioritization, deletion or iteration. All of the data is discarded when the peer shuts down!
typedef enum GNUNET_GenericReturnValue(* GNUNET_DATACACHE_Iterator) (void *cls, const struct GNUNET_DATACACHE_Block *block) |
An iterator over a set of items stored in the datacache.
cls | closure |
block | a block from the datacache |
Definition at line 134 of file gnunet_datacache_lib.h.
struct GNUNET_DATACACHE_Handle * GNUNET_DATACACHE_create | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | section | ||
) |
Create a data cache.
cfg | configuration to use |
section | section in the configuration that contains our options |
Definition at line 128 of file datacache.c.
References cfg, env_delete_notify(), GNUNET_asprintf(), GNUNET_CONFIGURATION_get_project_data(), GNUNET_CONFIGURATION_get_value_size(), GNUNET_CONFIGURATION_get_value_string(), GNUNET_CONFIGURATION_get_value_yesno(), GNUNET_CONTAINER_bloomfilter_init(), GNUNET_CONTAINER_bloomfilter_load(), GNUNET_DATACACHE_destroy(), GNUNET_DISK_mktemp(), GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_log_config_missing(), GNUNET_new, GNUNET_OK, GNUNET_PLUGIN_load(), GNUNET_STATISTICS_create(), GNUNET_strdup, GNUNET_YES, LOG, name, quota, ret, and GNUNET_DATACACHE_Handle::section.
Referenced by GDS_DATACACHE_init().
void GNUNET_DATACACHE_destroy | ( | struct GNUNET_DATACACHE_Handle * | h | ) |
Destroy a data cache (and free associated resources).
h | handle to the datastore |
Definition at line 224 of file datacache.c.
References GNUNET_break, GNUNET_CONTAINER_bloomfilter_free(), GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log_from_strerror_file, GNUNET_NO, GNUNET_PLUGIN_unload(), GNUNET_STATISTICS_destroy(), and h.
Referenced by GDS_DATACACHE_done(), and GNUNET_DATACACHE_create().
enum GNUNET_GenericReturnValue GNUNET_DATACACHE_put | ( | struct GNUNET_DATACACHE_Handle * | h, |
uint32_t | xor_distance, | ||
const struct GNUNET_DATACACHE_Block * | block | ||
) |
Store an item in the datacache.
h | handle to the datacache |
xor_distance | how close is the block's key to our pid? |
block | actual block data to store |
Definition at line 250 of file datacache.c.
References GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_bloomfilter_add(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_NO, GNUNET_OK, GNUNET_STATISTICS_update(), GNUNET_SYSERR, h, GNUNET_DATACACHE_Block::key, and LOG.
Referenced by GDS_DATACACHE_handle_put().
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.
h | handle to the datacache |
key | what to look up |
type | entries of which type are relevant? |
iter | maybe NULL (to just count) |
iter_cls | closure for iter |
Definition at line 292 of file datacache.c.
References GNUNET_CONTAINER_bloomfilter_test(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_NO, GNUNET_OK, GNUNET_STATISTICS_update(), h, key, LOG, and type.
Referenced by GDS_DATACACHE_handle_get().
unsigned int GNUNET_DATACACHE_get_closest | ( | struct GNUNET_DATACACHE_Handle * | h, |
const struct GNUNET_HashCode * | key, | ||
enum GNUNET_BLOCK_Type | type, | ||
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.
"close" is defined as numerically larger than key (when interpreted as a circular address space), with small distance.
h | handle to the datacache |
key | area of the keyspace to look into |
type | entries of which type are relevant? |
num_results | number of results that should be returned to iter |
iter | maybe NULL (to just count) |
iter_cls | closure for iter |
Definition at line 327 of file datacache.c.
References GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_NO, GNUNET_STATISTICS_update(), h, key, LOG, and type.
Referenced by GDS_DATACACHE_get_closest().