adding min_expiration argument to GNUNET_DATASTORE_ContinuationWithStatus callback...
authorChristian Grothoff <christian@grothoff.org>
Mon, 19 Dec 2011 13:54:35 +0000 (13:54 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 19 Dec 2011 13:54:35 +0000 (13:54 +0000)
src/datastore/datastore.h
src/datastore/datastore_api.c
src/datastore/perf_datastore_api.c
src/datastore/test_datastore_api.c
src/datastore/test_datastore_api_management.c
src/fs/fs_namespace.c
src/fs/fs_publish.c
src/fs/fs_unindex.c
src/fs/gnunet-service-fs_indexing.c
src/fs/gnunet-service-fs_pr.c
src/include/gnunet_datastore_service.h

index fa8352d2467636752810d79872d7751cdadaa3c5..563b7486cac3fb1d08fb4f5223d0f2368afc5834 100644 (file)
@@ -72,6 +72,12 @@ struct StatusMessage
    */
   int32_t status GNUNET_PACKED;
 
+  /**
+   * Minimum expiration time required for content to be stored
+   * by the datacache at this time, zero for unknown or no limit.
+   */
+  struct GNUNET_TIME_AbsoluteNBO min_expiration;
+
 };
 
 
index 46004c4f330271dee40bfda4e4d8371b2a03689e..36d1d98b7ce671d6bff7fabc0acf84dbd2de65e9 100644 (file)
@@ -697,10 +697,13 @@ process_queue (struct GNUNET_DATASTORE_Handle *h)
  *
  * @param cls closure
  * @param result result
+ * @param min_expiration expiration time
  * @param emsg error message
  */
 static void
-drop_status_cont (void *cls, int32_t result, const char *emsg)
+drop_status_cont (void *cls, int32_t result, 
+                 struct GNUNET_TIME_Absolute min_expiration,
+                 const char *emsg)
 {
   /* do nothing */
 }
@@ -765,6 +768,7 @@ process_status_message (void *cls, const struct GNUNET_MessageHeader *msg)
       process_queue (h);
     if (rc.cont != NULL)
       rc.cont (rc.cont_cls, GNUNET_SYSERR,
+              GNUNET_TIME_UNIT_ZERO_ABS,
                _("Failed to receive status response from database."));
     return;
   }
@@ -778,6 +782,7 @@ process_status_message (void *cls, const struct GNUNET_MessageHeader *msg)
     do_disconnect (h);
     if (rc.cont != NULL)
       rc.cont (rc.cont_cls, GNUNET_SYSERR,
+              GNUNET_TIME_UNIT_ZERO_ABS,
                _("Error reading response from datastore service"));
     return;
   }
@@ -807,7 +812,9 @@ process_status_message (void *cls, const struct GNUNET_MessageHeader *msg)
   h->retry_time.rel_value = 0;
   process_queue (h);
   if (rc.cont != NULL)
-    rc.cont (rc.cont_cls, status, emsg);
+    rc.cont (rc.cont_cls, status, 
+            GNUNET_TIME_absolute_ntoh (sm->min_expiration),
+            emsg);
 }
 
 
index 1ba215374c751cea9422d6a2556aff830f548904..372a61f7da0f04a8884bc1589ddc4de1ddb1cde8 100644 (file)
@@ -111,7 +111,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
 
 
 static void
-check_success (void *cls, int success, const char *msg)
+check_success (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration,  const char *msg)
 {
   struct CpsRunContext *crc = cls;
 
@@ -149,10 +149,12 @@ check_success (void *cls, int success, const char *msg)
  *
  * @param cls closure
  * @param success GNUNET_SYSERR on failure
+ * @param min_expiration minimum expiration time required for content to be stored
+ *                by the datacache at this time, zero for unknown
  * @param msg NULL on success, otherwise an error message
  */
 static void
-remove_next (void *cls, int success, const char *msg)
+remove_next (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
 {
   struct CpsRunContext *crc = cls;
 
@@ -276,7 +278,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
 
 static void
-run_tests (void *cls, int success, const char *msg)
+run_tests (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
 {
   struct CpsRunContext *crc = cls;
 
index 0309a6592c42fbfc7d2d1fefef160c1f4d7dd815..942e0a11ef9e9fe44209f7d2d95a908684d61c05 100644 (file)
@@ -139,7 +139,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
 
 
 static void
-check_success (void *cls, int success, const char *msg)
+check_success (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
 {
   struct CpsRunContext *crc = cls;
 
@@ -158,7 +158,7 @@ check_success (void *cls, int success, const char *msg)
 
 
 static void
-get_reserved (void *cls, int success, const char *msg)
+get_reserved (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
 {
   struct CpsRunContext *crc = cls;
 
@@ -450,7 +450,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
 
 static void
-run_tests (void *cls, int32_t success, const char *msg)
+run_tests (void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
 {
   struct CpsRunContext *crc = cls;
 
index cb04d31d18a2c0bb12aee5bf417d301950117931..3cb8ed94a4f4e6ba5d95f84356b8f8a484aeac00 100644 (file)
@@ -122,7 +122,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
 
 
 static void
-check_success (void *cls, int success, const char *msg)
+check_success (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
 {
   struct CpsRunContext *crc = cls;
 
@@ -246,7 +246,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
 
 static void
-run_tests (void *cls, int success, const char *msg)
+run_tests (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
 {
   struct CpsRunContext *crc = cls;
 
index 9d754009b772c8b78a55fb166d5710cf47062f45..ec4e2495a6f987dff279ff53fa81329071ba631e 100644 (file)
@@ -311,10 +311,13 @@ do_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  *
  * @param cls closure (our struct AdvertismentContext)
  * @param success GNUNET_SYSERR on failure
+ * @param min_expiration minimum expiration time required for content to be stored
  * @param msg NULL on success, otherwise an error message
  */
 static void
-advertisement_cont (void *cls, int success, const char *msg)
+advertisement_cont (void *cls, int success, 
+                   struct GNUNET_TIME_Absolute min_expiration,
+                   const char *msg)
 {
   struct AdvertisementContext *ac = cls;
   const char *keyword;
@@ -475,7 +478,7 @@ GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h,
   ctx->ns = namespace;
   ctx->ns->rc++;
   ctx->bo = *bo;
-  advertisement_cont (ctx, GNUNET_OK, NULL);
+  advertisement_cont (ctx, GNUNET_OK, GNUNET_TIME_UNIT_ZERO_ABS, NULL);
 }
 
 
@@ -697,10 +700,13 @@ struct PublishSksContext
  *
  * @param cls closure of type "struct PublishSksContext*"
  * @param success GNUNET_OK on success
+ * @param min_expiration minimum expiration time required for content to be stored
  * @param msg error message (or NULL)
  */
 static void
-sb_put_cont (void *cls, int success, const char *msg)
+sb_put_cont (void *cls, int success, 
+            struct GNUNET_TIME_Absolute min_expiration,
+            const char *msg)
 {
   struct PublishSksContext *psc = cls;
   GNUNET_HashCode hc;
@@ -867,7 +873,7 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
   {
     GNUNET_free (sb_enc);
     GNUNET_free (sb);
-    sb_put_cont (psc, GNUNET_OK, NULL);
+    sb_put_cont (psc, GNUNET_OK, GNUNET_TIME_UNIT_ZERO_ABS, NULL);
     return;
   }
   psc->dsh = GNUNET_DATASTORE_connect (h->cfg);
@@ -875,7 +881,7 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
   {
     GNUNET_free (sb_enc);
     GNUNET_free (sb);
-    sb_put_cont (psc, GNUNET_NO, _("Failed to connect to datastore."));
+    sb_put_cont (psc, GNUNET_NO, GNUNET_TIME_UNIT_ZERO_ABS, _("Failed to connect to datastore."));
     return;
   }
   GNUNET_CRYPTO_hash_xor (&sks_uri->data.sks.namespace, &id, &query);
index 9a834ee86b4af02a81f269b0802ebda687818163..05f66745195020e2eb1ad72242b0d7021a4cd152 100644 (file)
@@ -124,10 +124,13 @@ publish_cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  *
  * @param cls the 'struct GNUNET_FS_PublishContext'
  * @param success GNUNET_OK on success
+ * @param min_expiration minimum expiration time required for content to be stored
  * @param msg error message (or NULL)
  */
 static void
-ds_put_cont (void *cls, int success, const char *msg)
+ds_put_cont (void *cls, int success, 
+            struct GNUNET_TIME_Absolute min_expiration,
+            const char *msg)
 {
   struct GNUNET_FS_PublishContext *pc = cls;
   struct GNUNET_FS_ProgressInfo pi;
@@ -224,10 +227,13 @@ signal_publish_error (struct GNUNET_FS_FileInformation *p,
  *
  * @param cls the 'struct GNUNET_FS_PublishContext'
  * @param success success code (not used)
+ * @param min_expiration minimum expiration time required for content to be stored
  * @param msg error message (typically NULL, not used)
  */
 static void
-finish_release_reserve (void *cls, int success, const char *msg)
+finish_release_reserve (void *cls, int success, 
+                       struct GNUNET_TIME_Absolute min_expiration,
+                       const char *msg)
 {
   struct GNUNET_FS_PublishContext *pc = cls;
 
@@ -271,7 +277,7 @@ publish_sblocks_cont (void *cls, const struct GNUNET_FS_Uri *uri,
   }
   else
   {
-    finish_release_reserve (pc, GNUNET_OK, NULL);
+    finish_release_reserve (pc, GNUNET_OK, GNUNET_TIME_UNIT_ZERO_ABS, NULL);
   }
 }
 
@@ -1067,10 +1073,13 @@ GNUNET_FS_publish_signal_suspend_ (void *cls)
  *
  * @param cls the 'struct GNUNET_FS_PublishContext*'
  * @param success positive reservation ID on success
+ * @param min_expiration minimum expiration time required for content to be stored
  * @param msg error message on error, otherwise NULL
  */
 static void
-finish_reserve (void *cls, int success, const char *msg)
+finish_reserve (void *cls, int success, 
+               struct GNUNET_TIME_Absolute min_expiration,
+               const char *msg)
 {
   struct GNUNET_FS_PublishContext *pc = cls;
 
@@ -1348,10 +1357,13 @@ publish_ksk_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
  *
  * @param cls closure of type "struct PublishKskContext*"
  * @param success GNUNET_OK on success
+ * @param min_expiration minimum expiration time required for content to be stored
  * @param msg error message (or NULL)
  */
 static void
-kb_put_cont (void *cls, int success, const char *msg)
+kb_put_cont (void *cls, int success, 
+            struct GNUNET_TIME_Absolute min_expiration,
+            const char *msg)
 {
   struct PublishKskContext *pkc = cls;
 
index 79b7e8c73b2c816287e19a550b8f43db078fafbc..fa9147bcd967f5402f397ed7cf3b4e3122b445d8 100644 (file)
@@ -144,10 +144,11 @@ signal_unindex_error (struct GNUNET_FS_UnindexContext *uc)
  *
  * @param cls closure
  * @param success GNUNET_SYSERR on failure
+ * @param min_expiration minimum expiration time required for content to be stored
  * @param msg NULL on success, otherwise an error message
  */
 static void
-process_cont (void *cls, int success, const char *msg)
+process_cont (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
 {
   struct GNUNET_FS_UnindexContext *uc = cls;
 
index 41a40e125a9467bc14253601e8fc4442df3ee809..d3aef8917b5a96a630773407eec93e7fadf11d3a 100644 (file)
@@ -477,10 +477,13 @@ GNUNET_FS_handle_unindex (void *cls, struct GNUNET_SERVER_Client *client,
  *
  * @param cls unused
  * @param success did the deletion work?
+ * @param min_expiration minimum expiration time required for content to be stored
  * @param msg error message
  */
 static void
-remove_cont (void *cls, int success, const char *msg)
+remove_cont (void *cls, int success, 
+            struct GNUNET_TIME_Absolute min_expiration,
+            const char *msg)
 {
   if (GNUNET_OK != success)
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
index aa18e2fc832a1ff5ad9dc59c64c612c343192f21..12245c8a6de7b315f2aee79905e8518e576558fe 100644 (file)
@@ -890,18 +890,19 @@ struct PutMigrationContext
  *
  * @param cls closure
  * @param success GNUNET_SYSERR on failure
+ * @param min_expiration minimum expiration time required for content to be stored
  * @param msg NULL on success, otherwise an error message
  */
 static void
-put_migration_continuation (void *cls, int success, const char *msg)
+put_migration_continuation (void *cls, int success, 
+                           struct GNUNET_TIME_Absolute min_expiration,
+                           const char *msg)
 {
   struct PutMigrationContext *pmc = cls;
-  struct GNUNET_TIME_Relative delay;
   struct GNUNET_TIME_Relative block_time;
   struct GSF_ConnectedPeer *cp;
   struct GSF_PeerPerformanceData *ppd;
 
-  delay = GNUNET_TIME_absolute_get_duration (pmc->start);
   cp = GSF_peer_get_ (&pmc->origin);
   if ((GNUNET_OK != success) && (GNUNET_NO == pmc->requested))
   {
@@ -1023,7 +1024,7 @@ handle_dht_reply (void *cls, struct GNUNET_TIME_Absolute exp,
                               GNUNET_CONSTANTS_SERVICE_TIMEOUT,
                               &put_migration_continuation, pmc))
     {
-      put_migration_continuation (pmc, GNUNET_NO, NULL);
+      put_migration_continuation (pmc, GNUNET_NO, GNUNET_TIME_UNIT_ZERO_ABS, NULL);
     }
   }
 }
@@ -1538,7 +1539,7 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
                               GNUNET_CONSTANTS_SERVICE_TIMEOUT,
                               &put_migration_continuation, pmc))
     {
-      put_migration_continuation (pmc, GNUNET_NO, NULL);
+      put_migration_continuation (pmc, GNUNET_NO, GNUNET_TIME_UNIT_ZERO_ABS, NULL);
     }
   }
   else
index 03ec9117c0636e739a01d838c558c0c297766200..db680eaf39c6c8fd1417a39d1a089d8ec7745896 100644 (file)
@@ -86,10 +86,13 @@ GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h, int drop);
  * @param success GNUNET_SYSERR on failure (including timeout/queue drop)
  *                GNUNET_NO if content was already there
  *                GNUNET_YES (or other positive value) on success
+ * @param min_expiration minimum expiration time required for content to be stored
+ *                by the datacache at this time, zero for unknown
  * @param msg NULL on success, otherwise an error message
  */
 typedef void (*GNUNET_DATASTORE_ContinuationWithStatus) (void *cls,
                                                          int32_t success,
+                                                        struct GNUNET_TIME_Absolute min_expiration,
                                                          const char *msg);