guix-env: some update.
[oweals/gnunet.git] / src / datastore / perf_plugin_datastore.c
index 0aeb426abf7269252ebfe5d674d7f5313430ba9a..d6f44bf9fd53f47cac6143756f74887ad77bb298 100644 (file)
@@ -133,6 +133,7 @@ put_continuation (void *cls,
   GNUNET_SCHEDULER_add_now (&test, crc);
 }
 
+
 static void
 do_put (struct CpsRunContext *crc)
 {
@@ -178,10 +179,16 @@ do_put (struct CpsRunContext *crc)
   if (i > 255)
     memset (value, i - 255, size / 2);
   value[0] = crc->i;
-  memcpy (&value[4], &i, sizeof (i));
+  GNUNET_memcpy (&value[4], &i, sizeof (i));
   prio = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100);
-  crc->api->put (crc->api->cls, &key, size, value, 1 + i % 4 /* type */ ,
-                 prio, i % 4 /* anonymity */ ,
+  crc->api->put (crc->api->cls,
+                 &key,
+                 false /* absent */,
+                 size,
+                 value,
+                 1 + i % 4 /* type */ ,
+                 prio,
+                 i % 4 /* anonymity */ ,
                  0 /* replication */ ,
                  GNUNET_TIME_relative_to_absolute
                  (GNUNET_TIME_relative_multiply
@@ -189,15 +196,22 @@ do_put (struct CpsRunContext *crc)
                     60 * 60 * 60 * 1000 +
                     GNUNET_CRYPTO_random_u32
                       (GNUNET_CRYPTO_QUALITY_WEAK, 1000))),
-                 put_continuation, crc);
+                 put_continuation,
+                 crc);
   i++;
 }
 
 
 static int
-iterate_zeros (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
-               const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
-               uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
+iterate_zeros (void *cls,
+               const struct GNUNET_HashCode *key,
+               uint32_t size,
+               const void *data,
+               enum GNUNET_BLOCK_Type type,
+               uint32_t priority,
+               uint32_t anonymity,
+               uint32_t replication,
+               struct GNUNET_TIME_Absolute expiration,
                uint64_t uid)
 {
   struct CpsRunContext *crc = cls;
@@ -206,7 +220,7 @@ iterate_zeros (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
 
   GNUNET_assert (key != NULL);
   GNUNET_assert (size >= 8);
-  memcpy (&i, &cdata[4], sizeof (i));
+  GNUNET_memcpy (&i, &cdata[4], sizeof (i));
   hits[i / 8] |= (1 << (i % 8));
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -246,17 +260,23 @@ iterate_zeros (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
 
 
 static int
-expiration_get (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
-                const void *data, enum GNUNET_BLOCK_Type type,
-                uint32_t priority, uint32_t anonymity,
-                struct GNUNET_TIME_Absolute expiration, uint64_t uid)
+expiration_get (void *cls,
+                const struct GNUNET_HashCode *key,
+                uint32_t size,
+                const void *data,
+                enum GNUNET_BLOCK_Type type,
+                uint32_t priority,
+                uint32_t anonymity,
+                uint32_t replication,
+                struct GNUNET_TIME_Absolute expiration,
+                uint64_t uid)
 {
   struct CpsRunContext *crc = cls;
   int i;
   const char *cdata = data;
 
   GNUNET_assert (size >= 8);
-  memcpy (&i, &cdata[4], sizeof (i));
+  GNUNET_memcpy (&i, &cdata[4], sizeof (i));
   hits[i / 8] |= (1 << (i % 8));
   crc->cnt++;
   if (PUT_10 <= crc->cnt)
@@ -293,10 +313,16 @@ expiration_get (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
 
 
 static int
-replication_get (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
-                 const void *data, enum GNUNET_BLOCK_Type type,
-                 uint32_t priority, uint32_t anonymity,
-                 struct GNUNET_TIME_Absolute expiration, uint64_t uid)
+replication_get (void *cls,
+                 const struct GNUNET_HashCode *key,
+                 uint32_t size,
+                 const void *data,
+                 enum GNUNET_BLOCK_Type type,
+                 uint32_t priority,
+                 uint32_t anonymity,
+                 uint32_t replication,
+                 struct GNUNET_TIME_Absolute expiration,
+                 uint64_t uid)
 {
   struct CpsRunContext *crc = cls;
   int i;
@@ -304,7 +330,7 @@ replication_get (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
 
   GNUNET_assert (NULL != key);
   GNUNET_assert (size >= 8);
-  memcpy (&i, &cdata[4], sizeof (i));
+  GNUNET_memcpy (&i, &cdata[4], sizeof (i));
   hits[i / 8] |= (1 << (i % 8));
   crc->cnt++;
   if (PUT_10 <= crc->cnt)
@@ -388,14 +414,7 @@ static void
 test (void *cls)
 {
   struct CpsRunContext *crc = cls;
-  const struct GNUNET_SCHEDULER_TaskContext *tc;
 
-  tc = GNUNET_SCHEDULER_get_task_context ();
-  if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
-  {
-    GNUNET_break (0);
-    crc->phase = RP_ERROR;
-  }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "In phase %d, iteration %u\n", crc->phase, crc->cnt);
   switch (crc->phase)