diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-12-19 13:54:35 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-12-19 13:54:35 +0000 |
commit | bf2d1ccefd7b5bd13295733a36bf19afba46f4b2 (patch) | |
tree | c440a5bcf7e328d1dd05dd3b1a5def173adb49df /src/fs | |
parent | 1997d2d086b237e2688d12567933a53b2229ea26 (diff) | |
download | gnunet-bf2d1ccefd7b5bd13295733a36bf19afba46f4b2.tar.gz gnunet-bf2d1ccefd7b5bd13295733a36bf19afba46f4b2.zip |
adding min_expiration argument to GNUNET_DATASTORE_ContinuationWithStatus callback to communicate which content has a chance of being stored in the medium term
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/fs_namespace.c | 16 | ||||
-rw-r--r-- | src/fs/fs_publish.c | 22 | ||||
-rw-r--r-- | src/fs/fs_unindex.c | 3 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_indexing.c | 5 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pr.c | 11 |
5 files changed, 40 insertions, 17 deletions
diff --git a/src/fs/fs_namespace.c b/src/fs/fs_namespace.c index 9d754009b..ec4e2495a 100644 --- a/src/fs/fs_namespace.c +++ b/src/fs/fs_namespace.c | |||
@@ -311,10 +311,13 @@ do_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
311 | * | 311 | * |
312 | * @param cls closure (our struct AdvertismentContext) | 312 | * @param cls closure (our struct AdvertismentContext) |
313 | * @param success GNUNET_SYSERR on failure | 313 | * @param success GNUNET_SYSERR on failure |
314 | * @param min_expiration minimum expiration time required for content to be stored | ||
314 | * @param msg NULL on success, otherwise an error message | 315 | * @param msg NULL on success, otherwise an error message |
315 | */ | 316 | */ |
316 | static void | 317 | static void |
317 | advertisement_cont (void *cls, int success, const char *msg) | 318 | advertisement_cont (void *cls, int success, |
319 | struct GNUNET_TIME_Absolute min_expiration, | ||
320 | const char *msg) | ||
318 | { | 321 | { |
319 | struct AdvertisementContext *ac = cls; | 322 | struct AdvertisementContext *ac = cls; |
320 | const char *keyword; | 323 | const char *keyword; |
@@ -475,7 +478,7 @@ GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, | |||
475 | ctx->ns = namespace; | 478 | ctx->ns = namespace; |
476 | ctx->ns->rc++; | 479 | ctx->ns->rc++; |
477 | ctx->bo = *bo; | 480 | ctx->bo = *bo; |
478 | advertisement_cont (ctx, GNUNET_OK, NULL); | 481 | advertisement_cont (ctx, GNUNET_OK, GNUNET_TIME_UNIT_ZERO_ABS, NULL); |
479 | } | 482 | } |
480 | 483 | ||
481 | 484 | ||
@@ -697,10 +700,13 @@ struct PublishSksContext | |||
697 | * | 700 | * |
698 | * @param cls closure of type "struct PublishSksContext*" | 701 | * @param cls closure of type "struct PublishSksContext*" |
699 | * @param success GNUNET_OK on success | 702 | * @param success GNUNET_OK on success |
703 | * @param min_expiration minimum expiration time required for content to be stored | ||
700 | * @param msg error message (or NULL) | 704 | * @param msg error message (or NULL) |
701 | */ | 705 | */ |
702 | static void | 706 | static void |
703 | sb_put_cont (void *cls, int success, const char *msg) | 707 | sb_put_cont (void *cls, int success, |
708 | struct GNUNET_TIME_Absolute min_expiration, | ||
709 | const char *msg) | ||
704 | { | 710 | { |
705 | struct PublishSksContext *psc = cls; | 711 | struct PublishSksContext *psc = cls; |
706 | GNUNET_HashCode hc; | 712 | GNUNET_HashCode hc; |
@@ -867,7 +873,7 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | |||
867 | { | 873 | { |
868 | GNUNET_free (sb_enc); | 874 | GNUNET_free (sb_enc); |
869 | GNUNET_free (sb); | 875 | GNUNET_free (sb); |
870 | sb_put_cont (psc, GNUNET_OK, NULL); | 876 | sb_put_cont (psc, GNUNET_OK, GNUNET_TIME_UNIT_ZERO_ABS, NULL); |
871 | return; | 877 | return; |
872 | } | 878 | } |
873 | psc->dsh = GNUNET_DATASTORE_connect (h->cfg); | 879 | psc->dsh = GNUNET_DATASTORE_connect (h->cfg); |
@@ -875,7 +881,7 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | |||
875 | { | 881 | { |
876 | GNUNET_free (sb_enc); | 882 | GNUNET_free (sb_enc); |
877 | GNUNET_free (sb); | 883 | GNUNET_free (sb); |
878 | sb_put_cont (psc, GNUNET_NO, _("Failed to connect to datastore.")); | 884 | sb_put_cont (psc, GNUNET_NO, GNUNET_TIME_UNIT_ZERO_ABS, _("Failed to connect to datastore.")); |
879 | return; | 885 | return; |
880 | } | 886 | } |
881 | GNUNET_CRYPTO_hash_xor (&sks_uri->data.sks.namespace, &id, &query); | 887 | GNUNET_CRYPTO_hash_xor (&sks_uri->data.sks.namespace, &id, &query); |
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index 9a834ee86..05f667451 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c | |||
@@ -124,10 +124,13 @@ publish_cleanup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
124 | * | 124 | * |
125 | * @param cls the 'struct GNUNET_FS_PublishContext' | 125 | * @param cls the 'struct GNUNET_FS_PublishContext' |
126 | * @param success GNUNET_OK on success | 126 | * @param success GNUNET_OK on success |
127 | * @param min_expiration minimum expiration time required for content to be stored | ||
127 | * @param msg error message (or NULL) | 128 | * @param msg error message (or NULL) |
128 | */ | 129 | */ |
129 | static void | 130 | static void |
130 | ds_put_cont (void *cls, int success, const char *msg) | 131 | ds_put_cont (void *cls, int success, |
132 | struct GNUNET_TIME_Absolute min_expiration, | ||
133 | const char *msg) | ||
131 | { | 134 | { |
132 | struct GNUNET_FS_PublishContext *pc = cls; | 135 | struct GNUNET_FS_PublishContext *pc = cls; |
133 | struct GNUNET_FS_ProgressInfo pi; | 136 | struct GNUNET_FS_ProgressInfo pi; |
@@ -224,10 +227,13 @@ signal_publish_error (struct GNUNET_FS_FileInformation *p, | |||
224 | * | 227 | * |
225 | * @param cls the 'struct GNUNET_FS_PublishContext' | 228 | * @param cls the 'struct GNUNET_FS_PublishContext' |
226 | * @param success success code (not used) | 229 | * @param success success code (not used) |
230 | * @param min_expiration minimum expiration time required for content to be stored | ||
227 | * @param msg error message (typically NULL, not used) | 231 | * @param msg error message (typically NULL, not used) |
228 | */ | 232 | */ |
229 | static void | 233 | static void |
230 | finish_release_reserve (void *cls, int success, const char *msg) | 234 | finish_release_reserve (void *cls, int success, |
235 | struct GNUNET_TIME_Absolute min_expiration, | ||
236 | const char *msg) | ||
231 | { | 237 | { |
232 | struct GNUNET_FS_PublishContext *pc = cls; | 238 | struct GNUNET_FS_PublishContext *pc = cls; |
233 | 239 | ||
@@ -271,7 +277,7 @@ publish_sblocks_cont (void *cls, const struct GNUNET_FS_Uri *uri, | |||
271 | } | 277 | } |
272 | else | 278 | else |
273 | { | 279 | { |
274 | finish_release_reserve (pc, GNUNET_OK, NULL); | 280 | finish_release_reserve (pc, GNUNET_OK, GNUNET_TIME_UNIT_ZERO_ABS, NULL); |
275 | } | 281 | } |
276 | } | 282 | } |
277 | 283 | ||
@@ -1067,10 +1073,13 @@ GNUNET_FS_publish_signal_suspend_ (void *cls) | |||
1067 | * | 1073 | * |
1068 | * @param cls the 'struct GNUNET_FS_PublishContext*' | 1074 | * @param cls the 'struct GNUNET_FS_PublishContext*' |
1069 | * @param success positive reservation ID on success | 1075 | * @param success positive reservation ID on success |
1076 | * @param min_expiration minimum expiration time required for content to be stored | ||
1070 | * @param msg error message on error, otherwise NULL | 1077 | * @param msg error message on error, otherwise NULL |
1071 | */ | 1078 | */ |
1072 | static void | 1079 | static void |
1073 | finish_reserve (void *cls, int success, const char *msg) | 1080 | finish_reserve (void *cls, int success, |
1081 | struct GNUNET_TIME_Absolute min_expiration, | ||
1082 | const char *msg) | ||
1074 | { | 1083 | { |
1075 | struct GNUNET_FS_PublishContext *pc = cls; | 1084 | struct GNUNET_FS_PublishContext *pc = cls; |
1076 | 1085 | ||
@@ -1348,10 +1357,13 @@ publish_ksk_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | |||
1348 | * | 1357 | * |
1349 | * @param cls closure of type "struct PublishKskContext*" | 1358 | * @param cls closure of type "struct PublishKskContext*" |
1350 | * @param success GNUNET_OK on success | 1359 | * @param success GNUNET_OK on success |
1360 | * @param min_expiration minimum expiration time required for content to be stored | ||
1351 | * @param msg error message (or NULL) | 1361 | * @param msg error message (or NULL) |
1352 | */ | 1362 | */ |
1353 | static void | 1363 | static void |
1354 | kb_put_cont (void *cls, int success, const char *msg) | 1364 | kb_put_cont (void *cls, int success, |
1365 | struct GNUNET_TIME_Absolute min_expiration, | ||
1366 | const char *msg) | ||
1355 | { | 1367 | { |
1356 | struct PublishKskContext *pkc = cls; | 1368 | struct PublishKskContext *pkc = cls; |
1357 | 1369 | ||
diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c index 79b7e8c73..fa9147bcd 100644 --- a/src/fs/fs_unindex.c +++ b/src/fs/fs_unindex.c | |||
@@ -144,10 +144,11 @@ signal_unindex_error (struct GNUNET_FS_UnindexContext *uc) | |||
144 | * | 144 | * |
145 | * @param cls closure | 145 | * @param cls closure |
146 | * @param success GNUNET_SYSERR on failure | 146 | * @param success GNUNET_SYSERR on failure |
147 | * @param min_expiration minimum expiration time required for content to be stored | ||
147 | * @param msg NULL on success, otherwise an error message | 148 | * @param msg NULL on success, otherwise an error message |
148 | */ | 149 | */ |
149 | static void | 150 | static void |
150 | process_cont (void *cls, int success, const char *msg) | 151 | process_cont (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg) |
151 | { | 152 | { |
152 | struct GNUNET_FS_UnindexContext *uc = cls; | 153 | struct GNUNET_FS_UnindexContext *uc = cls; |
153 | 154 | ||
diff --git a/src/fs/gnunet-service-fs_indexing.c b/src/fs/gnunet-service-fs_indexing.c index 41a40e125..d3aef8917 100644 --- a/src/fs/gnunet-service-fs_indexing.c +++ b/src/fs/gnunet-service-fs_indexing.c | |||
@@ -477,10 +477,13 @@ GNUNET_FS_handle_unindex (void *cls, struct GNUNET_SERVER_Client *client, | |||
477 | * | 477 | * |
478 | * @param cls unused | 478 | * @param cls unused |
479 | * @param success did the deletion work? | 479 | * @param success did the deletion work? |
480 | * @param min_expiration minimum expiration time required for content to be stored | ||
480 | * @param msg error message | 481 | * @param msg error message |
481 | */ | 482 | */ |
482 | static void | 483 | static void |
483 | remove_cont (void *cls, int success, const char *msg) | 484 | remove_cont (void *cls, int success, |
485 | struct GNUNET_TIME_Absolute min_expiration, | ||
486 | const char *msg) | ||
484 | { | 487 | { |
485 | if (GNUNET_OK != success) | 488 | if (GNUNET_OK != success) |
486 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 489 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index aa18e2fc8..12245c8a6 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c | |||
@@ -890,18 +890,19 @@ struct PutMigrationContext | |||
890 | * | 890 | * |
891 | * @param cls closure | 891 | * @param cls closure |
892 | * @param success GNUNET_SYSERR on failure | 892 | * @param success GNUNET_SYSERR on failure |
893 | * @param min_expiration minimum expiration time required for content to be stored | ||
893 | * @param msg NULL on success, otherwise an error message | 894 | * @param msg NULL on success, otherwise an error message |
894 | */ | 895 | */ |
895 | static void | 896 | static void |
896 | put_migration_continuation (void *cls, int success, const char *msg) | 897 | put_migration_continuation (void *cls, int success, |
898 | struct GNUNET_TIME_Absolute min_expiration, | ||
899 | const char *msg) | ||
897 | { | 900 | { |
898 | struct PutMigrationContext *pmc = cls; | 901 | struct PutMigrationContext *pmc = cls; |
899 | struct GNUNET_TIME_Relative delay; | ||
900 | struct GNUNET_TIME_Relative block_time; | 902 | struct GNUNET_TIME_Relative block_time; |
901 | struct GSF_ConnectedPeer *cp; | 903 | struct GSF_ConnectedPeer *cp; |
902 | struct GSF_PeerPerformanceData *ppd; | 904 | struct GSF_PeerPerformanceData *ppd; |
903 | 905 | ||
904 | delay = GNUNET_TIME_absolute_get_duration (pmc->start); | ||
905 | cp = GSF_peer_get_ (&pmc->origin); | 906 | cp = GSF_peer_get_ (&pmc->origin); |
906 | if ((GNUNET_OK != success) && (GNUNET_NO == pmc->requested)) | 907 | if ((GNUNET_OK != success) && (GNUNET_NO == pmc->requested)) |
907 | { | 908 | { |
@@ -1023,7 +1024,7 @@ handle_dht_reply (void *cls, struct GNUNET_TIME_Absolute exp, | |||
1023 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, | 1024 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, |
1024 | &put_migration_continuation, pmc)) | 1025 | &put_migration_continuation, pmc)) |
1025 | { | 1026 | { |
1026 | put_migration_continuation (pmc, GNUNET_NO, NULL); | 1027 | put_migration_continuation (pmc, GNUNET_NO, GNUNET_TIME_UNIT_ZERO_ABS, NULL); |
1027 | } | 1028 | } |
1028 | } | 1029 | } |
1029 | } | 1030 | } |
@@ -1538,7 +1539,7 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp, | |||
1538 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, | 1539 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, |
1539 | &put_migration_continuation, pmc)) | 1540 | &put_migration_continuation, pmc)) |
1540 | { | 1541 | { |
1541 | put_migration_continuation (pmc, GNUNET_NO, NULL); | 1542 | put_migration_continuation (pmc, GNUNET_NO, GNUNET_TIME_UNIT_ZERO_ABS, NULL); |
1542 | } | 1543 | } |
1543 | } | 1544 | } |
1544 | else | 1545 | else |