publish records from namestore to GNUnet name system More...
#include "platform.h"
#include <pthread.h>
#include "gnunet_util_lib.h"
#include "gnunet_dht_service.h"
#include "gnunet_namestore_service.h"
#include "gnunet_namecache_service.h"
#include "gnunet_statistics_service.h"
Go to the source code of this file.
Data Structures | |
struct | RecordPublicationJob |
struct | CacheOperation |
Pending operation on the namecache. 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 | DELTA_INTERVAL 100 |
How often do we measure the delta between desired zone iteration speed and actual speed, and tell statistics service about it? More... | |
#define | NS_BLOCK_SIZE 1000 |
How many records do we fetch in one shot from the namestore? More... | |
#define | JOB_QUEUE_LIMIT 5000 |
How many open jobs (and with it maximum amount of pending DHT operations) do we allow at most. More... | |
#define | NAMESTORE_MONITOR_QUEUE_LIMIT 5 |
How many events may the namestore give us before it has to wait for us to keep up? More... | |
#define | INITIAL_ZONE_ITERATION_INTERVAL GNUNET_TIME_UNIT_MILLISECONDS |
The initial interval in milliseconds btween puts in a zone iteration. More... | |
#define | MAXIMUM_ZONE_ITERATION_INTERVAL |
The upper bound for the zone iteration interval (per record). More... | |
#define | LATE_ITERATION_SPEEDUP_FACTOR 2 |
The factor the current zone iteration interval is divided by for each additional new record. More... | |
#define | DHT_GNS_REPLICATION_LEVEL 5 |
What replication level do we use for DHT PUT operations? More... | |
Functions | |
static void | free_job (struct RecordPublicationJob *job) |
static void | shutdown_task (void *cls) |
Task run during shutdown. More... | |
static void | finish_cache_operation (void *cls, int32_t success, const char *emsg) |
Cache operation complete, clean up. More... | |
static void | refresh_block (const struct GNUNET_GNSRECORD_Block *block) |
Refresh the (encrypted) block in the namecache. More... | |
static void | publish_zone_namestore_next (void *cls) |
Method called periodically that triggers iteration over authoritative records. More... | |
static void | publish_zone_dht_start (void *cls) |
Periodically iterate over our zone and store everything in dht. More... | |
static void | calculate_put_interval () |
Calculate target_iteration_velocity_per_record. More... | |
static void | update_velocity (unsigned int cnt) |
Re-calculate our velocity and the desired velocity. More... | |
static void | check_zone_namestore_next () |
Check if the current zone iteration needs to be continued by calling publish_zone_namestore_next(), and if so with what delay. More... | |
static void | cleanup_job (struct RecordPublicationJob *job) |
static void | dht_put_continuation (void *cls) |
Continuation called from DHT once the PUT operation is done. More... | |
static void | dispatch_job (const struct GNUNET_CRYPTO_PrivateKey *key, const char *label, const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count, const struct GNUNET_TIME_Absolute expire) |
Store GNS records in the DHT. More... | |
static void | notification_pipe_cb (void *cls) |
static void | initiate_put_from_pipe_trigger (void *cls) |
static void | zone_iteration_error (void *cls) |
We encountered an error in our zone iteration. More... | |
static void | zone_iteration_finished (void *cls) |
Zone iteration is completed. More... | |
static void | handle_record (void *cls, const struct GNUNET_CRYPTO_PrivateKey *key, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, struct GNUNET_TIME_Absolute expire) |
Function used to put all records successively into the DHT. More... | |
static void | dispatch_job_monitor (const struct GNUNET_CRYPTO_PrivateKey *key, const char *label, const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count, struct GNUNET_TIME_Absolute expire) |
Store GNS records in the DHT. More... | |
static void | handle_monitor_event (void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, struct GNUNET_TIME_Absolute expire) |
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 * | sign_worker (void *cls) |
static void | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_SERVICE_Handle *service) |
Perform zonemaster duties: watch namestore, publish records. More... | |
GNUNET_SERVICE_MAIN (GNUNET_OS_project_data_gnunet(), "zonemaster", GNUNET_SERVICE_OPTION_NONE, &run, NULL, NULL, NULL, GNUNET_MQ_handler_end()) | |
Define "main" method using service macro. More... | |
Variables | |
static pthread_t * | worker |
Our workers. More... | |
static pthread_mutex_t | sign_jobs_lock |
Lock for the sign jobs queue. More... | |
static pthread_mutex_t | sign_results_lock |
Lock for the DHT put jobs queue. More... | |
static pthread_cond_t | sign_jobs_cond |
Wait condition on new sign jobs. More... | |
static int | in_shutdown = GNUNET_NO |
For threads to know we are shutting down. More... | |
static int | monitor_halted = GNUNET_NO |
Monitor halted? More... | |
static struct GNUNET_DISK_PipeHandle * | notification_pipe |
Our notification pipe. More... | |
static struct GNUNET_SCHEDULER_Task * | pipe_read_task |
Pipe read task. More... | |
static struct RecordPublicationJob * | sign_jobs_head |
The DLL for workers to retrieve open jobs that require signing of blocks. More... | |
static struct RecordPublicationJob * | sign_jobs_tail |
See above. More... | |
static struct RecordPublicationJob * | sign_results_head |
The DLL for workers to place jobs that are signed. More... | |
static struct RecordPublicationJob * | sign_results_tail |
See above. More... | |
static struct RecordPublicationJob * | dht_jobs_head |
The DLL for jobs currently in the process of being dispatched into the DHT. More... | |
static struct RecordPublicationJob * | dht_jobs_tail |
See above. More... | |
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 GNUNET_NAMECACHE_Handle * | namecache |
Our handle to the namecache service. More... | |
static int | disable_namecache |
Use the namecache? Doing so creates additional cryptographic operations whenever we touch a record. More... | |
static struct GNUNET_NAMESTORE_ZoneIterator * | namestore_iter |
Handle to iterate over our authoritative zone in namestore. More... | |
static unsigned int | job_queue_length |
Number of entries in the job queue #jobs_head. More... | |
static unsigned long long | num_public_records |
Useful for zone update for DHT put. More... | |
static unsigned long long | last_num_public_records |
Last seen record count. More... | |
static unsigned long long | put_cnt |
Number of successful put operations performed in the current measurement cycle (as measured in check_zone_namestore_next()). More... | |
static struct GNUNET_TIME_Relative | target_iteration_velocity_per_record |
What is the frequency at which we currently would like to perform DHT puts (per record)? Calculated in update_velocity() from the zone_publish_time_window() and the total number of record sets we have (so far) observed in the zone. More... | |
static struct GNUNET_TIME_Relative | min_relative_record_time |
Minimum relative expiration time of records seem during the current zone iteration. More... | |
static struct GNUNET_TIME_Relative | last_min_relative_record_time |
Minimum relative expiration time of records seem during the last zone iteration. More... | |
static struct GNUNET_TIME_Relative | zone_publish_time_window_default |
Default time window for zone iteration. More... | |
static struct GNUNET_TIME_Relative | zone_publish_time_window |
Time window for zone iteration, adjusted based on relative record expiration times in our zone. More... | |
static struct GNUNET_TIME_Absolute | last_put_100 |
When did we last start measuring the DELTA_INTERVAL successful DHT puts? Used for velocity calculations. More... | |
static struct GNUNET_TIME_Relative | sub_delta |
By how much should we try to increase our per-record iteration speed (over the desired speed calculated directly from the #put_interval)? Basically this value corresponds to the per-record CPU time overhead we have. More... | |
static struct GNUNET_SCHEDULER_Task * | zone_publish_task |
zone publish task More... | |
static unsigned int | ns_iteration_left |
How many more values are left for the current query before we need to explicitly ask the namestore for more? More... | |
static int | first_zone_iteration |
GNUNET_YES if zone has never been published before More... | |
static int | cache_keys |
Optimize block insertion by caching map of private keys to public keys in memory? More... | |
static struct CacheOperation * | cop_head |
Head of cop DLL. More... | |
static struct CacheOperation * | cop_tail |
Tail of cop DLL. More... | |
publish records from namestore to GNUnet name system
Definition in file gnunet-service-zonemaster.c.
#define LOG_STRERROR_FILE | ( | kind, | |
syscall, | |||
filename | |||
) |
Definition at line 34 of file gnunet-service-zonemaster.c.
#define PUBLISH_OPS_PER_EXPIRATION 4 |
How often should we (re)publish each record before it expires?
Definition at line 44 of file gnunet-service-zonemaster.c.
#define DELTA_INTERVAL 100 |
How often do we measure the delta between desired zone iteration speed and actual speed, and tell statistics service about it?
Definition at line 51 of file gnunet-service-zonemaster.c.
#define NS_BLOCK_SIZE 1000 |
How many records do we fetch in one shot from the namestore?
Definition at line 56 of file gnunet-service-zonemaster.c.
#define JOB_QUEUE_LIMIT 5000 |
How many open jobs (and with it maximum amount of pending DHT operations) do we allow at most.
Definition at line 61 of file gnunet-service-zonemaster.c.
#define NAMESTORE_MONITOR_QUEUE_LIMIT 5 |
How many events may the namestore give us before it has to wait for us to keep up?
Definition at line 67 of file gnunet-service-zonemaster.c.
#define INITIAL_ZONE_ITERATION_INTERVAL GNUNET_TIME_UNIT_MILLISECONDS |
The initial interval in milliseconds btween puts in a zone iteration.
Definition at line 73 of file gnunet-service-zonemaster.c.
#define MAXIMUM_ZONE_ITERATION_INTERVAL |
The upper bound for the zone iteration interval (per record).
Definition at line 79 of file gnunet-service-zonemaster.c.
#define LATE_ITERATION_SPEEDUP_FACTOR 2 |
The factor the current zone iteration interval is divided by for each additional new record.
Definition at line 86 of file gnunet-service-zonemaster.c.
#define DHT_GNS_REPLICATION_LEVEL 5 |
What replication level do we use for DHT PUT operations?
Definition at line 91 of file gnunet-service-zonemaster.c.
|
static |
Definition at line 387 of file gnunet-service-zonemaster.c.
References GNUNET_free, and job.
Referenced by cleanup_job(), initiate_put_from_pipe_trigger(), and shutdown_task().
|
static |
Task run during shutdown.
cls | unused |
tc | unused |
Definition at line 405 of file gnunet-service-zonemaster.c.
References cop_head, cop_tail, dht_handle, dht_jobs_head, dht_jobs_tail, free_job(), GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_DHT_disconnect(), GNUNET_DHT_put_cancel(), GNUNET_DISK_pipe_close(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_NAMECACHE_cancel(), GNUNET_NAMECACHE_disconnect(), GNUNET_NAMESTORE_disconnect(), GNUNET_NAMESTORE_zone_iteration_stop(), GNUNET_NAMESTORE_zone_monitor_stop(), GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_STATISTICS_destroy(), GNUNET_YES, in_shutdown, job, job_queue_length, namecache, namestore_handle, namestore_iter, notification_pipe, pipe_read_task, CacheOperation::qe, sign_jobs_head, sign_jobs_lock, sign_jobs_tail, sign_results_head, sign_results_lock, sign_results_tail, statistics, zmon, and zone_publish_task.
Referenced by run().
|
static |
Cache operation complete, clean up.
cls | the struct CacheOperation |
success | success |
emsg | error messages |
Definition at line 501 of file gnunet-service-zonemaster.c.
References _, cop_head, cop_tail, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, and GNUNET_log.
Referenced by refresh_block().
|
static |
Refresh the (encrypted) block in the namecache.
zone_key | private key of the zone |
name | label for the records |
rd_count | number of records |
rd | records stored under the given name |
Definition at line 525 of file gnunet-service-zonemaster.c.
References cop_head, cop_tail, disable_namecache, finish_cache_operation(), GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NAMECACHE_block_cache(), GNUNET_new, GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_YES, namecache, CacheOperation::qe, and statistics.
Referenced by initiate_put_from_pipe_trigger().
|
static |
Method called periodically that triggers iteration over authoritative records.
cls | NULL |
Definition at line 558 of file gnunet-service-zonemaster.c.
References GNUNET_assert, GNUNET_NAMESTORE_zone_iterator_next(), namestore_iter, NS_BLOCK_SIZE, ns_iteration_left, and zone_publish_task.
Referenced by check_zone_namestore_next().
|
static |
Periodically iterate over our zone and store everything in dht.
Periodically iterate over all zones and store everything in DHT.
cls | NULL |
Definition at line 1124 of file gnunet-service-zonemaster.c.
References GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNSRECORD_FILTER_NONE, GNUNET_log, GNUNET_NAMESTORE_zone_iteration_start2(), GNUNET_NO, GNUNET_STATISTICS_update(), handle_record(), namestore_handle, namestore_iter, ns_iteration_left, num_public_records, statistics, zone_iteration_error(), zone_iteration_finished(), and zone_publish_task.
Referenced by run(), zone_iteration_error(), and zone_iteration_finished().
|
static |
Calculate target_iteration_velocity_per_record.
If no records are known (startup) or none present we can safely set the interval to the value for a single record
Definition at line 583 of file gnunet-service-zonemaster.c.
References GNUNET_ERROR_TYPE_BULK, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NO, GNUNET_STATISTICS_set(), GNUNET_TIME_relative_divide(), GNUNET_TIME_relative_min(), last_min_relative_record_time, last_num_public_records, MAXIMUM_ZONE_ITERATION_INTERVAL, min_relative_record_time, num_public_records, PUBLISH_OPS_PER_EXPIRATION, GNUNET_TIME_Relative::rel_value_us, statistics, target_iteration_velocity_per_record, zone_publish_time_window, and zone_publish_time_window_default.
Referenced by update_velocity(), and zone_iteration_finished().
|
static |
Re-calculate our velocity and the desired velocity.
We have succeeded in making DELTA_INTERVAL puts, so now calculate the new desired delay between puts.
cnt | how many records were processed since the last call? |
Definition at line 635 of file gnunet-service-zonemaster.c.
References calculate_put_interval(), delta, first_zone_iteration, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NO, GNUNET_STATISTICS_set(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_duration(), GNUNET_TIME_relative_add(), GNUNET_TIME_relative_subtract(), GNUNET_TIME_UNIT_ZERO, GNUNET_YES, job_queue_length, last_num_public_records, last_put_100, LATE_ITERATION_SPEEDUP_FACTOR, num_public_records, GNUNET_TIME_Relative::rel_value_us, statistics, sub_delta, and target_iteration_velocity_per_record.
Referenced by check_zone_namestore_next(), and handle_record().
|
static |
Check if the current zone iteration needs to be continued by calling publish_zone_namestore_next(), and if so with what delay.
Definition at line 737 of file gnunet-service-zonemaster.c.
References first_zone_iteration, GNUNET_assert, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_NO, GNUNET_SCHEDULER_add_delayed(), GNUNET_STATISTICS_set(), GNUNET_TIME_relative_min(), GNUNET_TIME_relative_multiply(), GNUNET_TIME_relative_subtract(), GNUNET_TIME_UNIT_ZERO, GNUNET_YES, job_queue_length, JOB_QUEUE_LIMIT, MAXIMUM_ZONE_ITERATION_INTERVAL, NS_BLOCK_SIZE, ns_iteration_left, publish_zone_namestore_next(), put_cnt, GNUNET_TIME_Relative::rel_value_us, statistics, sub_delta, target_iteration_velocity_per_record, update_velocity(), and zone_publish_task.
Referenced by cleanup_job(), and handle_record().
|
static |
Definition at line 778 of file gnunet-service-zonemaster.c.
References check_zone_namestore_next(), free_job(), GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_NAMESTORE_zone_monitor_next(), GNUNET_NO, GNUNET_YES, job, job_queue_length, JOB_QUEUE_LIMIT, monitor_halted, zmon, and zone_publish_task.
Referenced by dht_put_continuation(), and initiate_put_from_pipe_trigger().
|
static |
Continuation called from DHT once the PUT operation is done.
Definition at line 805 of file gnunet-service-zonemaster.c.
References cleanup_job(), dht_jobs_head, dht_jobs_tail, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, job, and job_queue_length.
Referenced by initiate_put_from_pipe_trigger().
|
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 831 of file gnunet-service-zonemaster.c.
References RecordPublicationJob::block, RecordPublicationJob::block_priv, RecordPublicationJob::block_size, expire, RecordPublicationJob::expire_pub, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_GNSRECORD_block_create_unsigned(), GNUNET_GNSRECORD_block_get_size(), GNUNET_GNSRECORD_FILTER_OMIT_PRIVATE, GNUNET_GNSRECORD_normalize_record_set(), GNUNET_log, GNUNET_new, GNUNET_OK, GNUNET_strdup, GNUNET_STRINGS_absolute_time_to_string(), job, key, RecordPublicationJob::label, num_public_records, rd, rd_count, sign_jobs_cond, sign_jobs_head, sign_jobs_lock, and sign_jobs_tail.
Referenced by handle_record().
|
static |
Definition at line 1338 of file gnunet-service-zonemaster.c.
References GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_SCHEDULER_add_now(), and initiate_put_from_pipe_trigger().
Referenced by initiate_put_from_pipe_trigger(), and run().
|
static |
Definition at line 911 of file gnunet-service-zonemaster.c.
References cleanup_job(), DHT_GNS_REPLICATION_LEVEL, dht_handle, dht_jobs_head, dht_jobs_tail, dht_put_continuation(), free_job(), GNUNET_assert, GNUNET_BLOCK_TYPE_GNS_NAMERECORD, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_DLL_remove, GNUNET_DHT_put(), GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, GNUNET_DISK_file_read(), GNUNET_DISK_PIPE_END_READ, GNUNET_DISK_pipe_handle(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_GNSRECORD_query_from_private_key(), GNUNET_h2s(), GNUNET_log, GNUNET_NO, GNUNET_SCHEDULER_add_read_file(), GNUNET_STATISTICS_update(), GNUNET_TIME_UNIT_FOREVER_REL, job, notification_pipe, notification_pipe_cb(), pipe_read_task, refresh_block(), sign_results_head, sign_results_lock, sign_results_tail, and statistics.
Referenced by notification_pipe_cb().
|
static |
We encountered an error in our zone iteration.
cls | NULL |
Definition at line 997 of file gnunet-service-zonemaster.c.
References GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_cancel(), namestore_iter, publish_zone_dht_start(), and zone_publish_task.
Referenced by publish_zone_dht_start().
|
static |
Zone iteration is completed.
cls | NULL |
Definition at line 1022 of file gnunet-service-zonemaster.c.
References calculate_put_interval(), first_zone_iteration, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NO, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_now(), GNUNET_STATISTICS_set(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, last_min_relative_record_time, last_num_public_records, min_relative_record_time, namestore_iter, num_public_records, publish_zone_dht_start(), GNUNET_TIME_Relative::rel_value_us, statistics, target_iteration_velocity_per_record, and zone_publish_task.
Referenced by publish_zone_dht_start().
|
static |
Function used to put all records successively into the DHT.
cls | the closure (NULL) |
key | the private key of the authority (ours) |
label | the name of the records, NULL once the iteration is done |
rd_count | the number of records in rd |
rd | the record data |
Definition at line 1073 of file gnunet-service-zonemaster.c.
References check_zone_namestore_next(), DELTA_INTERVAL, dispatch_job(), expire, GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_log, GNUNET_MIN, job_queue_length, key, min_relative_record_time, ns_iteration_left, put_cnt, rd, rd_count, GNUNET_TIME_Relative::rel_value_us, and update_velocity().
Referenced by publish_zone_dht_start().
|
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 |
Definition at line 1161 of file gnunet-service-zonemaster.c.
References RecordPublicationJob::block, RecordPublicationJob::block_priv, RecordPublicationJob::block_size, expire, RecordPublicationJob::expire_pub, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_GNSRECORD_block_create_unsigned(), GNUNET_GNSRECORD_block_get_size(), GNUNET_GNSRECORD_FILTER_OMIT_PRIVATE, GNUNET_GNSRECORD_normalize_record_set(), GNUNET_log, GNUNET_new, GNUNET_OK, GNUNET_strdup, job, key, RecordPublicationJob::label, rd, rd_count, sign_jobs_cond, sign_jobs_head, sign_jobs_lock, and sign_jobs_tail.
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 |
expire | expiration of this record set |
Definition at line 1242 of file gnunet-service-zonemaster.c.
References dispatch_job_monitor(), expire, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_NAMESTORE_zone_monitor_next(), GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_YES, job_queue_length, JOB_QUEUE_LIMIT, RecordPublicationJob::label, monitor_halted, rd, rd_count, statistics, zmon, and RecordPublicationJob::zone.
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 1291 of file gnunet-service-zonemaster.c.
References GNUNET_NO, GNUNET_STATISTICS_update(), and statistics.
Referenced by run().
|
static |
Definition at line 1302 of file gnunet-service-zonemaster.c.
References GNUNET_assert, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_DLL_remove, GNUNET_DISK_file_write(), GNUNET_DISK_PIPE_END_WRITE, GNUNET_DISK_pipe_handle(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNSRECORD_block_sign(), GNUNET_log, GNUNET_YES, in_shutdown, job, RecordPublicationJob::label, notification_pipe, sign_jobs_cond, sign_jobs_head, sign_jobs_lock, sign_jobs_tail, sign_results_head, sign_results_lock, and sign_results_tail.
Referenced by run().
|
static |
Perform zonemaster duties: watch namestore, publish records.
cls | closure |
server | the initialized server |
c | configuration to use |
Start worker
Definition at line 1354 of file gnunet-service-zonemaster.c.
References _, cache_keys, dht_handle, disable_namecache, first_zone_iteration, GNUNET_break, GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_get_value_time(), GNUNET_CONFIGURATION_get_value_yesno(), GNUNET_DHT_connect(), GNUNET_DHT_DEFAULT_REPUBLISH_FREQUENCY, GNUNET_DISK_PF_NONE, GNUNET_DISK_pipe(), GNUNET_DISK_PIPE_END_READ, GNUNET_DISK_pipe_handle(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_GNSRECORD_FILTER_NONE, GNUNET_log, GNUNET_log_strerror, GNUNET_malloc, GNUNET_NAMECACHE_connect(), GNUNET_NAMESTORE_connect(), GNUNET_NAMESTORE_zone_monitor_next(), GNUNET_NAMESTORE_zone_monitor_start2(), GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_now(), GNUNET_SCHEDULER_add_read_file(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_STATISTICS_create(), GNUNET_STATISTICS_set(), GNUNET_STATISTICS_update(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_absolute_get(), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, handle_monitor_error(), handle_monitor_event(), INITIAL_ZONE_ITERATION_INTERVAL, last_put_100, min_relative_record_time, namecache, namestore_handle, NAMESTORE_MONITOR_QUEUE_LIMIT, notification_pipe, notification_pipe_cb(), pipe_read_task, publish_zone_dht_start(), GNUNET_TIME_Relative::rel_value_us, service, shutdown_task(), sign_jobs_cond, sign_jobs_lock, sign_results_lock, sign_worker(), statistics, target_iteration_velocity_per_record, worker, zmon, zone_publish_task, zone_publish_time_window, and zone_publish_time_window_default.
GNUNET_SERVICE_MAIN | ( | GNUNET_OS_project_data_gnunet() | , |
"zonemaster" | , | ||
GNUNET_SERVICE_OPTION_NONE | , | ||
& | run, | ||
NULL | , | ||
NULL | , | ||
NULL | , | ||
GNUNET_MQ_handler_end() | |||
) |
Define "main" method using service macro.
|
static |
|
static |
Lock for the sign jobs queue.
Definition at line 101 of file gnunet-service-zonemaster.c.
Referenced by dispatch_job(), dispatch_job_monitor(), run(), shutdown_task(), and sign_worker().
|
static |
Lock for the DHT put jobs queue.
Definition at line 106 of file gnunet-service-zonemaster.c.
Referenced by initiate_put_from_pipe_trigger(), run(), shutdown_task(), and sign_worker().
|
static |
Wait condition on new sign jobs.
Definition at line 111 of file gnunet-service-zonemaster.c.
Referenced by dispatch_job(), dispatch_job_monitor(), run(), and sign_worker().
|
static |
For threads to know we are shutting down.
Definition at line 116 of file gnunet-service-zonemaster.c.
Referenced by shutdown_task(), and sign_worker().
|
static |
Monitor halted?
Definition at line 121 of file gnunet-service-zonemaster.c.
Referenced by cleanup_job(), and handle_monitor_event().
|
static |
Our notification pipe.
Definition at line 126 of file gnunet-service-zonemaster.c.
Referenced by initiate_put_from_pipe_trigger(), run(), shutdown_task(), and sign_worker().
|
static |
Pipe read task.
Definition at line 131 of file gnunet-service-zonemaster.c.
Referenced by initiate_put_from_pipe_trigger(), run(), and shutdown_task().
|
static |
The DLL for workers to retrieve open jobs that require signing of blocks.
Definition at line 198 of file gnunet-service-zonemaster.c.
Referenced by dispatch_job(), dispatch_job_monitor(), shutdown_task(), and sign_worker().
|
static |
See above.
Definition at line 203 of file gnunet-service-zonemaster.c.
Referenced by dispatch_job(), dispatch_job_monitor(), shutdown_task(), and sign_worker().
|
static |
The DLL for workers to place jobs that are signed.
Definition at line 208 of file gnunet-service-zonemaster.c.
Referenced by initiate_put_from_pipe_trigger(), shutdown_task(), and sign_worker().
|
static |
See above.
Definition at line 213 of file gnunet-service-zonemaster.c.
Referenced by initiate_put_from_pipe_trigger(), shutdown_task(), and sign_worker().
|
static |
The DLL for jobs currently in the process of being dispatched into the DHT.
Definition at line 219 of file gnunet-service-zonemaster.c.
Referenced by dht_put_continuation(), initiate_put_from_pipe_trigger(), and shutdown_task().
|
static |
See above.
Definition at line 224 of file gnunet-service-zonemaster.c.
Referenced by dht_put_continuation(), initiate_put_from_pipe_trigger(), and shutdown_task().
|
static |
Handle to the statistics service.
Definition at line 253 of file gnunet-service-zonemaster.c.
Referenced by calculate_put_interval(), check_zone_namestore_next(), handle_monitor_error(), handle_monitor_event(), initiate_put_from_pipe_trigger(), publish_zone_dht_start(), refresh_block(), run(), shutdown_task(), update_velocity(), and zone_iteration_finished().
|
static |
Our handle to the DHT.
Definition at line 258 of file gnunet-service-zonemaster.c.
Referenced by initiate_put_from_pipe_trigger(), run(), and shutdown_task().
|
static |
Our handle to the namestore service.
Definition at line 263 of file gnunet-service-zonemaster.c.
Referenced by publish_zone_dht_start(), run(), and shutdown_task().
|
static |
Handle to monitor namestore changes to instant propagation.
Definition at line 268 of file gnunet-service-zonemaster.c.
Referenced by cleanup_job(), handle_monitor_event(), run(), and shutdown_task().
|
static |
Our handle to the namecache service.
Definition at line 273 of file gnunet-service-zonemaster.c.
Referenced by refresh_block(), run(), and shutdown_task().
|
static |
Use the namecache? Doing so creates additional cryptographic operations whenever we touch a record.
Definition at line 279 of file gnunet-service-zonemaster.c.
Referenced by refresh_block(), and run().
|
static |
Handle to iterate over our authoritative zone in namestore.
Definition at line 284 of file gnunet-service-zonemaster.c.
Referenced by publish_zone_dht_start(), publish_zone_namestore_next(), shutdown_task(), zone_iteration_error(), and zone_iteration_finished().
|
static |
Number of entries in the job queue #jobs_head.
Definition at line 289 of file gnunet-service-zonemaster.c.
Referenced by check_zone_namestore_next(), cleanup_job(), dht_put_continuation(), handle_monitor_event(), handle_record(), shutdown_task(), and update_velocity().
|
static |
Useful for zone update for DHT put.
Definition at line 294 of file gnunet-service-zonemaster.c.
Referenced by calculate_put_interval(), dispatch_job(), publish_zone_dht_start(), update_velocity(), and zone_iteration_finished().
|
static |
Last seen record count.
Definition at line 299 of file gnunet-service-zonemaster.c.
Referenced by calculate_put_interval(), update_velocity(), and zone_iteration_finished().
|
static |
Number of successful put operations performed in the current measurement cycle (as measured in check_zone_namestore_next()).
Definition at line 305 of file gnunet-service-zonemaster.c.
Referenced by check_zone_namestore_next(), and handle_record().
|
static |
What is the frequency at which we currently would like to perform DHT puts (per record)? Calculated in update_velocity() from the zone_publish_time_window() and the total number of record sets we have (so far) observed in the zone.
Definition at line 314 of file gnunet-service-zonemaster.c.
Referenced by calculate_put_interval(), check_zone_namestore_next(), run(), update_velocity(), and zone_iteration_finished().
|
static |
Minimum relative expiration time of records seem during the current zone iteration.
Definition at line 320 of file gnunet-service-zonemaster.c.
Referenced by calculate_put_interval(), handle_record(), run(), and zone_iteration_finished().
|
static |
Minimum relative expiration time of records seem during the last zone iteration.
Definition at line 326 of file gnunet-service-zonemaster.c.
Referenced by calculate_put_interval(), and zone_iteration_finished().
|
static |
Default time window for zone iteration.
Definition at line 331 of file gnunet-service-zonemaster.c.
Referenced by calculate_put_interval(), and run().
|
static |
Time window for zone iteration, adjusted based on relative record expiration times in our zone.
Definition at line 337 of file gnunet-service-zonemaster.c.
Referenced by calculate_put_interval(), and run().
|
static |
When did we last start measuring the DELTA_INTERVAL successful DHT puts? Used for velocity calculations.
Definition at line 343 of file gnunet-service-zonemaster.c.
Referenced by run(), and update_velocity().
|
static |
By how much should we try to increase our per-record iteration speed (over the desired speed calculated directly from the #put_interval)? Basically this value corresponds to the per-record CPU time overhead we have.
Definition at line 351 of file gnunet-service-zonemaster.c.
Referenced by check_zone_namestore_next(), and update_velocity().
|
static |
zone publish task
Definition at line 356 of file gnunet-service-zonemaster.c.
Referenced by check_zone_namestore_next(), cleanup_job(), publish_zone_dht_start(), publish_zone_namestore_next(), run(), shutdown_task(), zone_iteration_error(), and zone_iteration_finished().
|
static |
How many more values are left for the current query before we need to explicitly ask the namestore for more?
Definition at line 362 of file gnunet-service-zonemaster.c.
Referenced by check_zone_namestore_next(), handle_record(), publish_zone_dht_start(), and publish_zone_namestore_next().
|
static |
GNUNET_YES if zone has never been published before
Definition at line 367 of file gnunet-service-zonemaster.c.
Referenced by check_zone_namestore_next(), run(), update_velocity(), and zone_iteration_finished().
|
static |
Optimize block insertion by caching map of private keys to public keys in memory?
Definition at line 373 of file gnunet-service-zonemaster.c.
Referenced by run().
|
static |
Head of cop DLL.
Definition at line 378 of file gnunet-service-zonemaster.c.
Referenced by finish_cache_operation(), refresh_block(), and shutdown_task().
|
static |
Tail of cop DLL.
Definition at line 383 of file gnunet-service-zonemaster.c.
Referenced by finish_cache_operation(), refresh_block(), and shutdown_task().