#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;
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)
type,
discard_time);
if (used == 0)
- return GNUNET_SYSERR;
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
GNUNET_STATISTICS_update (h->stats,
gettext_noop ("# bytes stored"),
size,