#include "gnunet_util_lib.h"
#include "gnunet_datacache_lib.h"
#include "gnunet_statistics_service.h"
-#include "plugin_datacache.h"
+#include "gnunet_datacache_plugin.h"
/**
* Internal state of the datacache library.
static void
env_delete_notify (void *cls,
const GNUNET_HashCode *key,
- uint32_t size)
+ size_t size)
{
struct GNUNET_DATACACHE_Handle * h = cls;
GNUNET_assert (h->utilization >= size);
/**
* Create a data cache.
*
- * @param sched scheduler to use
* @param cfg configuration to use
* @param section section in the configuration that contains our options
* @return handle to use to access the service
*/
struct GNUNET_DATACACHE_Handle *
-GNUNET_DATACACHE_create (struct GNUNET_SCHEDULER_Handle *sched,
- const struct GNUNET_CONFIGURATION_Handle *cfg,
+GNUNET_DATACACHE_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *section)
{
unsigned int bf_size;
{
ret->filter = GNUNET_CONTAINER_bloomfilter_load (NULL, bf_size, 5); /* approx. 3% false positives at max use */
}
- ret->stats = GNUNET_STATISTICS_create (sched,
- "datacache",
+ ret->stats = GNUNET_STATISTICS_create ("datacache",
cfg);
ret->section = GNUNET_strdup (section);
- ret->env.sched = sched;
ret->env.cfg = cfg;
ret->env.delete_notify = &env_delete_notify;
ret->env.section = ret->section;
GNUNET_DATACACHE_destroy (ret);
return NULL;
}
- GNUNET_assert (ret->api->get != NULL);
return ret;
}
int
GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h,
const GNUNET_HashCode * key,
- uint32_t size,
+ size_t size,
const char *data,
enum GNUNET_BLOCK_Type type,
struct GNUNET_TIME_Absolute discard_time)
{
uint32_t used;
- GNUNET_assert (h->api->get != NULL);
used = h->api->put (h->api->cls,
key,
size,
GNUNET_DATACACHE_Iterator iter,
void *iter_cls)
{
- GNUNET_assert (h->api->get != NULL);
GNUNET_STATISTICS_update (h->stats,
gettext_noop ("# requests received"),
1,
GNUNET_NO);
return 0; /* can not be present */
}
- GNUNET_assert (h->api->get != NULL);
return h->api->get (h->api->cls,
key,
type,