![]() |
GNUnet
0.11.x
|
monitor namestore changes and publish them immediately to GNUnet name system More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_dht_service.h"
#include "gnunet_namestore_service.h"
#include "gnunet_statistics_service.h"
Go to the source code of this file.
Data Structures | |
struct | DhtPutActivity |
Handle for DHT PUT activity triggered from the namestore monitor. More... | |
Macros | |
#define | LOG_STRERROR_FILE(kind, syscall, filename) |
#define | PUBLISH_OPS_PER_EXPIRATION 4 |
How often should we (re)publish each record before it expires? More... | |
#define | DHT_QUEUE_LIMIT 2000 |
How many pending DHT operations do we allow at most? More... | |
#define | NAMESTORE_QUEUE_LIMIT 5 |
How many events may the namestore give us before it has to wait for us to keep up? More... | |
#define | DHT_GNS_REPLICATION_LEVEL 5 |
What replication level do we use for DHT PUT operations? More... | |
Functions | |
static void | shutdown_task (void *cls) |
Task run during shutdown. More... | |
static void | dht_put_monitor_continuation (void *cls) |
Continuation called from DHT once the PUT operation triggered by a monitor is done. More... | |
static unsigned int | convert_records_for_export (const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count, struct GNUNET_GNSRECORD_Data *rd_public) |
Convert namestore records from the internal format to that suitable for publication (removes private records, converts to absolute expiration time). More... | |
static struct GNUNET_DHT_PutHandle * | perform_dht_put (const struct GNUNET_IDENTITY_PrivateKey *key, const char *label, const struct GNUNET_GNSRECORD_Data *rd_public, unsigned int rd_public_count, struct DhtPutActivity *ma) |
Store GNS records in the DHT. More... | |
static void | handle_monitor_event (void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
Process a record that was stored in the namestore (invoked by the monitor). More... | |
static void | handle_monitor_error (void *cls) |
The zone monitor encountered an IPC error trying to to get in sync. More... | |
static void | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_SERVICE_Handle *service) |
Performe zonemaster duties: watch namestore, publish records. More... | |
GNUNET_SERVICE_MAIN ("zonemaster-monitor", GNUNET_SERVICE_OPTION_NONE, &run, NULL, NULL, NULL, GNUNET_MQ_handler_end()) | |
Define "main" method using service macro. More... | |
Variables | |
static struct GNUNET_STATISTICS_Handle * | statistics |
Handle to the statistics service. More... | |
static struct GNUNET_DHT_Handle * | dht_handle |
Our handle to the DHT. More... | |
static struct GNUNET_NAMESTORE_Handle * | namestore_handle |
Our handle to the namestore service. More... | |
static struct GNUNET_NAMESTORE_ZoneMonitor * | zmon |
Handle to monitor namestore changes to instant propagation. More... | |
static struct DhtPutActivity * | ma_head |
Head of monitor activities; kept in a DLL. More... | |
static struct DhtPutActivity * | ma_tail |
Tail of monitor activities; kept in a DLL. More... | |
static unsigned int | ma_queue_length |
Number of entries in the DHT queue ma_head. More... | |
static int | cache_keys |
Optimize block insertion by caching map of private keys to public keys in memory? More... | |
monitor namestore changes and publish them immediately to GNUnet name system
Definition in file gnunet-service-zonemaster-monitor.c.
#define LOG_STRERROR_FILE | ( | kind, | |
syscall, | |||
filename | |||
) |
Definition at line 33 of file gnunet-service-zonemaster-monitor.c.
#define PUBLISH_OPS_PER_EXPIRATION 4 |
How often should we (re)publish each record before it expires?
Definition at line 43 of file gnunet-service-zonemaster-monitor.c.
#define DHT_QUEUE_LIMIT 2000 |
How many pending DHT operations do we allow at most?
Definition at line 48 of file gnunet-service-zonemaster-monitor.c.
Referenced by handle_monitor_event().
#define NAMESTORE_QUEUE_LIMIT 5 |
How many events may the namestore give us before it has to wait for us to keep up?
Definition at line 54 of file gnunet-service-zonemaster-monitor.c.
Referenced by run().
#define DHT_GNS_REPLICATION_LEVEL 5 |
What replication level do we use for DHT PUT operations?
Definition at line 59 of file gnunet-service-zonemaster-monitor.c.
Referenced by perform_dht_put().
|
static |
Task run during shutdown.
cls | unused |
tc | unused |
Definition at line 138 of file gnunet-service-zonemaster-monitor.c.
References GNUNET_CONTAINER_DLL_remove, GNUNET_DHT_disconnect(), GNUNET_DHT_put_cancel(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_NAMESTORE_disconnect(), GNUNET_NAMESTORE_zone_monitor_stop(), GNUNET_NO, GNUNET_STATISTICS_destroy(), ma_queue_length, and DhtPutActivity::ph.
Referenced by run().
|
static |
Continuation called from DHT once the PUT operation triggered by a monitor is done.
cls | a struct DhtPutActivity |
Definition at line 185 of file gnunet-service-zonemaster-monitor.c.
References GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_NAMESTORE_zone_monitor_next(), and ma_queue_length.
Referenced by perform_dht_put().
|
static |
Convert namestore records from the internal format to that suitable for publication (removes private records, converts to absolute expiration time).
rd | input records |
rd_count | size of the rd and rd_public arrays |
rd_public | where to write the converted records |
Definition at line 210 of file gnunet-service-zonemaster-monitor.c.
References GNUNET_TIME_Absolute::abs_value_us, GNUNET_GNSRECORD_RF_PRIVATE, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, and GNUNET_TIME_absolute_get().
Referenced by handle_monitor_event().
|
static |
Store GNS records in the DHT.
key | key of the zone |
label | label to store under |
rd_public | public record data |
rd_public_count | number of records in rd_public |
ma | handle for the PUT operation |
Definition at line 243 of file gnunet-service-zonemaster-monitor.c.
References cache_keys, DHT_GNS_REPLICATION_LEVEL, dht_put_monitor_continuation(), GNUNET_BLOCK_TYPE_GNS_NAMERECORD, GNUNET_break, GNUNET_DHT_put(), GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNSRECORD_block_create(), GNUNET_GNSRECORD_block_create2(), GNUNET_GNSRECORD_block_get_size(), GNUNET_GNSRECORD_query_from_private_key(), GNUNET_GNSRECORD_record_get_expiration_time(), GNUNET_h2s(), GNUNET_log, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_STRINGS_absolute_time_to_string(), and ret.
Referenced by handle_monitor_event().
|
static |
Process a record that was stored in the namestore (invoked by the monitor).
cls | closure, NULL |
zone | private key of the zone; NULL on disconnect |
label | label of the records; NULL on disconnect |
rd_count | number of entries in rd array, 0 if label was deleted |
rd | array of records with data to store |
Definition at line 314 of file gnunet-service-zonemaster-monitor.c.
References convert_records_for_export(), DHT_QUEUE_LIMIT, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CONTAINER_DLL_remove, GNUNET_DHT_put_cancel(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_NAMESTORE_zone_monitor_next(), GNUNET_new, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_duration(), GNUNET_YES, ma_head, ma_queue_length, perform_dht_put(), DhtPutActivity::ph, and DhtPutActivity::start_date.
Referenced by run().
|
static |
The zone monitor encountered an IPC error trying to to get in sync.
Restart from the beginning.
cls | NULL |
Definition at line 388 of file gnunet-service-zonemaster-monitor.c.
References GNUNET_NO, and GNUNET_STATISTICS_update().
Referenced by run().
|
static |
Performe zonemaster duties: watch namestore, publish records.
cls | closure |
server | the initialized server |
c | configuration to use |
Definition at line 406 of file gnunet-service-zonemaster-monitor.c.
References _, cache_keys, GNUNET_break, GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_get_value_yesno(), GNUNET_DHT_connect(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_MQ_handler_end, GNUNET_NAMESTORE_connect(), GNUNET_NAMESTORE_zone_monitor_next(), GNUNET_NAMESTORE_zone_monitor_start(), GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_SERVICE_MAIN(), GNUNET_SERVICE_OPTION_NONE, GNUNET_STATISTICS_create(), handle_monitor_error(), handle_monitor_event(), NAMESTORE_QUEUE_LIMIT, and shutdown_task().
GNUNET_SERVICE_MAIN | ( | "zonemaster-monitor" | , |
GNUNET_SERVICE_OPTION_NONE | , | ||
& | run, | ||
NULL | , | ||
NULL | , | ||
NULL | , | ||
GNUNET_MQ_handler_end() | |||
) |
Define "main" method using service macro.
Referenced by run().
|
static |
Handle to the statistics service.
Definition at line 92 of file gnunet-service-zonemaster-monitor.c.
|
static |
Our handle to the DHT.
Definition at line 97 of file gnunet-service-zonemaster-monitor.c.
|
static |
Our handle to the namestore service.
Definition at line 102 of file gnunet-service-zonemaster-monitor.c.
|
static |
Handle to monitor namestore changes to instant propagation.
Definition at line 107 of file gnunet-service-zonemaster-monitor.c.
|
static |
Head of monitor activities; kept in a DLL.
Definition at line 112 of file gnunet-service-zonemaster-monitor.c.
Referenced by handle_monitor_event().
|
static |
Tail of monitor activities; kept in a DLL.
Definition at line 117 of file gnunet-service-zonemaster-monitor.c.
|
static |
Number of entries in the DHT queue ma_head.
Definition at line 122 of file gnunet-service-zonemaster-monitor.c.
Referenced by dht_put_monitor_continuation(), handle_monitor_event(), and shutdown_task().
|
static |
Optimize block insertion by caching map of private keys to public keys in memory?
Definition at line 128 of file gnunet-service-zonemaster-monitor.c.
Referenced by perform_dht_put(), and run().