aboutsummaryrefslogtreecommitdiff
path: root/src/datastore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-12-19 13:54:35 +0000
committerChristian Grothoff <christian@grothoff.org>2011-12-19 13:54:35 +0000
commitbf2d1ccefd7b5bd13295733a36bf19afba46f4b2 (patch)
treec440a5bcf7e328d1dd05dd3b1a5def173adb49df /src/datastore
parent1997d2d086b237e2688d12567933a53b2229ea26 (diff)
downloadgnunet-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/datastore')
-rw-r--r--src/datastore/datastore.h6
-rw-r--r--src/datastore/datastore_api.c11
-rw-r--r--src/datastore/perf_datastore_api.c8
-rw-r--r--src/datastore/test_datastore_api.c6
-rw-r--r--src/datastore/test_datastore_api_management.c4
5 files changed, 25 insertions, 10 deletions
diff --git a/src/datastore/datastore.h b/src/datastore/datastore.h
index fa8352d24..563b7486c 100644
--- a/src/datastore/datastore.h
+++ b/src/datastore/datastore.h
@@ -72,6 +72,12 @@ struct StatusMessage
72 */ 72 */
73 int32_t status GNUNET_PACKED; 73 int32_t status GNUNET_PACKED;
74 74
75 /**
76 * Minimum expiration time required for content to be stored
77 * by the datacache at this time, zero for unknown or no limit.
78 */
79 struct GNUNET_TIME_AbsoluteNBO min_expiration;
80
75}; 81};
76 82
77 83
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c
index 46004c4f3..36d1d98b7 100644
--- a/src/datastore/datastore_api.c
+++ b/src/datastore/datastore_api.c
@@ -697,10 +697,13 @@ process_queue (struct GNUNET_DATASTORE_Handle *h)
697 * 697 *
698 * @param cls closure 698 * @param cls closure
699 * @param result result 699 * @param result result
700 * @param min_expiration expiration time
700 * @param emsg error message 701 * @param emsg error message
701 */ 702 */
702static void 703static void
703drop_status_cont (void *cls, int32_t result, const char *emsg) 704drop_status_cont (void *cls, int32_t result,
705 struct GNUNET_TIME_Absolute min_expiration,
706 const char *emsg)
704{ 707{
705 /* do nothing */ 708 /* do nothing */
706} 709}
@@ -765,6 +768,7 @@ process_status_message (void *cls, const struct GNUNET_MessageHeader *msg)
765 process_queue (h); 768 process_queue (h);
766 if (rc.cont != NULL) 769 if (rc.cont != NULL)
767 rc.cont (rc.cont_cls, GNUNET_SYSERR, 770 rc.cont (rc.cont_cls, GNUNET_SYSERR,
771 GNUNET_TIME_UNIT_ZERO_ABS,
768 _("Failed to receive status response from database.")); 772 _("Failed to receive status response from database."));
769 return; 773 return;
770 } 774 }
@@ -778,6 +782,7 @@ process_status_message (void *cls, const struct GNUNET_MessageHeader *msg)
778 do_disconnect (h); 782 do_disconnect (h);
779 if (rc.cont != NULL) 783 if (rc.cont != NULL)
780 rc.cont (rc.cont_cls, GNUNET_SYSERR, 784 rc.cont (rc.cont_cls, GNUNET_SYSERR,
785 GNUNET_TIME_UNIT_ZERO_ABS,
781 _("Error reading response from datastore service")); 786 _("Error reading response from datastore service"));
782 return; 787 return;
783 } 788 }
@@ -807,7 +812,9 @@ process_status_message (void *cls, const struct GNUNET_MessageHeader *msg)
807 h->retry_time.rel_value = 0; 812 h->retry_time.rel_value = 0;
808 process_queue (h); 813 process_queue (h);
809 if (rc.cont != NULL) 814 if (rc.cont != NULL)
810 rc.cont (rc.cont_cls, status, emsg); 815 rc.cont (rc.cont_cls, status,
816 GNUNET_TIME_absolute_ntoh (sm->min_expiration),
817 emsg);
811} 818}
812 819
813 820
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c
index 1ba215374..372a61f7d 100644
--- a/src/datastore/perf_datastore_api.c
+++ b/src/datastore/perf_datastore_api.c
@@ -111,7 +111,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
111 111
112 112
113static void 113static void
114check_success (void *cls, int success, const char *msg) 114check_success (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
115{ 115{
116 struct CpsRunContext *crc = cls; 116 struct CpsRunContext *crc = cls;
117 117
@@ -149,10 +149,12 @@ check_success (void *cls, int success, const char *msg)
149 * 149 *
150 * @param cls closure 150 * @param cls closure
151 * @param success GNUNET_SYSERR on failure 151 * @param success GNUNET_SYSERR on failure
152 * @param min_expiration minimum expiration time required for content to be stored
153 * by the datacache at this time, zero for unknown
152 * @param msg NULL on success, otherwise an error message 154 * @param msg NULL on success, otherwise an error message
153 */ 155 */
154static void 156static void
155remove_next (void *cls, int success, const char *msg) 157remove_next (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
156{ 158{
157 struct CpsRunContext *crc = cls; 159 struct CpsRunContext *crc = cls;
158 160
@@ -276,7 +278,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
276 278
277 279
278static void 280static void
279run_tests (void *cls, int success, const char *msg) 281run_tests (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
280{ 282{
281 struct CpsRunContext *crc = cls; 283 struct CpsRunContext *crc = cls;
282 284
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c
index 0309a6592..942e0a11e 100644
--- a/src/datastore/test_datastore_api.c
+++ b/src/datastore/test_datastore_api.c
@@ -139,7 +139,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
139 139
140 140
141static void 141static void
142check_success (void *cls, int success, const char *msg) 142check_success (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
143{ 143{
144 struct CpsRunContext *crc = cls; 144 struct CpsRunContext *crc = cls;
145 145
@@ -158,7 +158,7 @@ check_success (void *cls, int success, const char *msg)
158 158
159 159
160static void 160static void
161get_reserved (void *cls, int success, const char *msg) 161get_reserved (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
162{ 162{
163 struct CpsRunContext *crc = cls; 163 struct CpsRunContext *crc = cls;
164 164
@@ -450,7 +450,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
450 450
451 451
452static void 452static void
453run_tests (void *cls, int32_t success, const char *msg) 453run_tests (void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
454{ 454{
455 struct CpsRunContext *crc = cls; 455 struct CpsRunContext *crc = cls;
456 456
diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c
index cb04d31d1..3cb8ed94a 100644
--- a/src/datastore/test_datastore_api_management.c
+++ b/src/datastore/test_datastore_api_management.c
@@ -122,7 +122,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
122 122
123 123
124static void 124static void
125check_success (void *cls, int success, const char *msg) 125check_success (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
126{ 126{
127 struct CpsRunContext *crc = cls; 127 struct CpsRunContext *crc = cls;
128 128
@@ -246,7 +246,7 @@ run_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
246 246
247 247
248static void 248static void
249run_tests (void *cls, int success, const char *msg) 249run_tests (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, const char *msg)
250{ 250{
251 struct CpsRunContext *crc = cls; 251 struct CpsRunContext *crc = cls;
252 252