aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/namestore_api_monitor.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-02 17:27:36 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-02 17:27:42 +0200
commit7fc3ecc8e8859e8cd47c37457f7991460d81b1ed (patch)
treebaab47fe05f324b10263bcd92828d74ffc1a5b63 /src/namestore/namestore_api_monitor.c
parent32cc463b677a8bc46b61111fe1bbc38554cb2ca0 (diff)
downloadgnunet-7fc3ecc8e8859e8cd47c37457f7991460d81b1ed.tar.gz
gnunet-7fc3ecc8e8859e8cd47c37457f7991460d81b1ed.zip
start preparations for flow control by namestore monitors
Diffstat (limited to 'src/namestore/namestore_api_monitor.c')
-rw-r--r--src/namestore/namestore_api_monitor.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/namestore/namestore_api_monitor.c b/src/namestore/namestore_api_monitor.c
index 8e6d39ad7..9ba90833b 100644
--- a/src/namestore/namestore_api_monitor.c
+++ b/src/namestore/namestore_api_monitor.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2013, 2016 GNUnet e.V. 3 Copyright (C) 2013, 2016, 2018 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -17,7 +17,6 @@
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA. 18 Boston, MA 02110-1301, USA.
19*/ 19*/
20
21/** 20/**
22 * @file namestore/namestore_api_monitor.c 21 * @file namestore/namestore_api_monitor.c
23 * @brief API to monitor changes in the NAMESTORE 22 * @brief API to monitor changes in the NAMESTORE
@@ -340,6 +339,42 @@ GNUNET_NAMESTORE_zone_monitor_start (const struct GNUNET_CONFIGURATION_Handle *c
340 339
341 340
342/** 341/**
342 * Calls the monitor processor specified in #GNUNET_NAMESTORE_zone_monitor_start
343 * for the next record(s). This function is used to allow clients that merely
344 * monitor the NAMESTORE to still throttle namestore operations, so we can be
345 * sure that the monitors can keep up.
346 *
347 * Note that #GNUNET_NAMESTORE_records_store() only waits for this
348 * call if the previous limit set by the client was already reached.
349 * Thus, by using a @a limit greater than 1, monitors basically enable
350 * a queue of notifications to be processed asynchronously with some
351 * delay. Note that even with a limit of 1 the
352 * #GNUNET_NAMESTORE_records_store() function will run asynchronously
353 * and the continuation may be invoked before the monitors completed
354 * (or even started) processing the notification. Thus, monitors will
355 * only closely track the current state of the namestore, but not
356 * be involved in the transactions.
357 *
358 * @param zm the monitor
359 * @param limit number of records to return to the iterator in one shot
360 * (before #GNUNET_NAMESTORE_zone_monitor_next is to be called again)
361 */
362void
363GNUNET_NAMESTORE_zone_monitor_next (struct GNUNET_NAMESTORE_ZoneMonitor *zm,
364 uint64_t limit)
365{
366 struct GNUNET_MQ_Envelope *env;
367 struct ZoneMonitorNextMessage *nm;
368
369 env = GNUNET_MQ_msg (nm,
370 GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_NEXT);
371 nm->limit = GNUNET_htonll (limit);
372 GNUNET_MQ_send (zm->mq,
373 env);
374}
375
376
377/**
343 * Stop monitoring a zone for changes. 378 * Stop monitoring a zone for changes.
344 * 379 *
345 * @param zm handle to the monitor activity to stop 380 * @param zm handle to the monitor activity to stop