fix
[oweals/gnunet.git] / src / datacache / datacache.c
index 6e9b0770878d0f5f723f07c629a90d9d7c1d2933..10b2721ee53287d79bb1c7ca2583853b66b57f38 100644 (file)
@@ -27,7 +27,7 @@
 #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.
@@ -100,7 +100,7 @@ struct GNUNET_DATACACHE_Handle
 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);
@@ -116,14 +116,12 @@ env_delete_notify (void *cls,
 /**
  * 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;
@@ -167,11 +165,9 @@ GNUNET_DATACACHE_create (struct GNUNET_SCHEDULER_Handle *sched,
     {
       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;
@@ -191,7 +187,6 @@ GNUNET_DATACACHE_create (struct GNUNET_SCHEDULER_Handle *sched,
       GNUNET_DATACACHE_destroy (ret);
       return NULL;
     }
-  GNUNET_assert (ret->api->get != NULL);
   return ret;
 }
 
@@ -238,14 +233,13 @@ void GNUNET_DATACACHE_destroy (struct GNUNET_DATACACHE_Handle *h)
 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,
@@ -287,7 +281,6 @@ GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h,
                      GNUNET_DATACACHE_Iterator iter,
                      void *iter_cls)
 {
-  GNUNET_assert (h->api->get != NULL);
   GNUNET_STATISTICS_update (h->stats,
                            gettext_noop ("# requests received"),
                            1,
@@ -301,7 +294,6 @@ GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h,
                                GNUNET_NO);
       return 0; /* can not be present */
     } 
-  GNUNET_assert (h->api->get != NULL);
   return h->api->get (h->api->cls,
                      key,
                      type,