diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-05-02 17:27:36 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-05-02 17:27:42 +0200 |
commit | 7fc3ecc8e8859e8cd47c37457f7991460d81b1ed (patch) | |
tree | baab47fe05f324b10263bcd92828d74ffc1a5b63 /src/include | |
parent | 32cc463b677a8bc46b61111fe1bbc38554cb2ca0 (diff) | |
download | gnunet-7fc3ecc8e8859e8cd47c37457f7991460d81b1ed.tar.gz gnunet-7fc3ecc8e8859e8cd47c37457f7991460d81b1ed.zip |
start preparations for flow control by namestore monitors
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_namestore_service.h | 34 | ||||
-rw-r--r-- | src/include/gnunet_protocols.h | 9 |
2 files changed, 41 insertions, 2 deletions
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h index 4828f72ad..b8c7ea810 100644 --- a/src/include/gnunet_namestore_service.h +++ b/src/include/gnunet_namestore_service.h | |||
@@ -109,6 +109,12 @@ typedef void | |||
109 | * it is replaced with the new record. Use an empty array to | 109 | * it is replaced with the new record. Use an empty array to |
110 | * remove all records under the given name. | 110 | * remove all records under the given name. |
111 | * | 111 | * |
112 | * The continuation is called after the value has been stored in the | ||
113 | * database. Monitors may be notified asynchronously (basically with | ||
114 | * a buffer). However, if any monitor is consistently too slow to | ||
115 | * keep up with the changes, calling @a cont will be delayed until the | ||
116 | * monitors do keep up. | ||
117 | * | ||
112 | * @param h handle to the namestore | 118 | * @param h handle to the namestore |
113 | * @param pkey private key of the zone | 119 | * @param pkey private key of the zone |
114 | * @param label name that is being mapped | 120 | * @param label name that is being mapped |
@@ -313,7 +319,7 @@ struct GNUNET_NAMESTORE_ZoneMonitor; | |||
313 | * that monitoring is down. You need to still explicitly call | 319 | * that monitoring is down. You need to still explicitly call |
314 | * #GNUNET_NAMESTORE_zone_monitor_stop(). | 320 | * #GNUNET_NAMESTORE_zone_monitor_stop(). |
315 | * @param error_cb_cls closure for @a error_cb | 321 | * @param error_cb_cls closure for @a error_cb |
316 | * @param monitor function to call on zone changes | 322 | * @param monitor function to call on zone changes, with an initial limit of 1 |
317 | * @param monitor_cls closure for @a monitor | 323 | * @param monitor_cls closure for @a monitor |
318 | * @param sync_cb function called when we're in sync with the namestore | 324 | * @param sync_cb function called when we're in sync with the namestore |
319 | * @param sync_cb_cls closure for @a sync_cb | 325 | * @param sync_cb_cls closure for @a sync_cb |
@@ -332,6 +338,32 @@ GNUNET_NAMESTORE_zone_monitor_start (const struct GNUNET_CONFIGURATION_Handle *c | |||
332 | 338 | ||
333 | 339 | ||
334 | /** | 340 | /** |
341 | * Calls the monitor processor specified in #GNUNET_NAMESTORE_zone_monitor_start | ||
342 | * for the next record(s). This function is used to allow clients that merely | ||
343 | * monitor the NAMESTORE to still throttle namestore operations, so we can be | ||
344 | * sure that the monitors can keep up. | ||
345 | * | ||
346 | * Note that #GNUNET_NAMESTORE_records_store() only waits for this | ||
347 | * call if the previous limit set by the client was already reached. | ||
348 | * Thus, by using a @a limit greater than 1, monitors basically enable | ||
349 | * a queue of notifications to be processed asynchronously with some | ||
350 | * delay. Note that even with a limit of 1 the | ||
351 | * #GNUNET_NAMESTORE_records_store() function will run asynchronously | ||
352 | * and the continuation may be invoked before the monitors completed | ||
353 | * (or even started) processing the notification. Thus, monitors will | ||
354 | * only closely track the current state of the namestore, but not | ||
355 | * be involved in the transactions. | ||
356 | * | ||
357 | * @param zm the monitor | ||
358 | * @param limit number of records to return to the iterator in one shot | ||
359 | * (before #GNUNET_NAMESTORE_zone_monitor_next is to be called again) | ||
360 | */ | ||
361 | void | ||
362 | GNUNET_NAMESTORE_zone_monitor_next (struct GNUNET_NAMESTORE_ZoneMonitor *zm, | ||
363 | uint64_t limit); | ||
364 | |||
365 | |||
366 | /** | ||
335 | * Stop monitoring a zone for changes. | 367 | * Stop monitoring a zone for changes. |
336 | * | 368 | * |
337 | * @param zm handle to the monitor activity to stop | 369 | * @param zm handle to the monitor activity to stop |
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index bf1b48679..1ef00cfc8 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -1306,13 +1306,20 @@ extern "C" | |||
1306 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT 443 | 1306 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT 443 |
1307 | 1307 | ||
1308 | /** | 1308 | /** |
1309 | * Client to service: I am now ready for the next (set of) monitor | ||
1310 | * events. Monitoring equivlaent of | ||
1311 | * #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT. | ||
1312 | */ | ||
1313 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_NEXT 444 | ||
1314 | |||
1315 | /** | ||
1309 | * Client to service: please start iteration; receives | 1316 | * Client to service: please start iteration; receives |
1310 | * "GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE" messages in return. | 1317 | * "GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_NAME_RESPONSE" messages in return. |
1311 | */ | 1318 | */ |
1312 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START 445 | 1319 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START 445 |
1313 | 1320 | ||
1314 | /** | 1321 | /** |
1315 | * Client to service: next record in iteration please. | 1322 | * Client to service: next record(s) in iteration please. |
1316 | */ | 1323 | */ |
1317 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT 447 | 1324 | #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT 447 |
1318 | 1325 | ||