Store naming information on a GNUnet node. More...
Data Structures | |
struct | GNUNET_NAMESTORE_RecordInfo |
A struct for record bulk import. More... | |
Typedefs | |
typedef void(* | GNUNET_NAMESTORE_ContinuationWithStatus) (void *cls, enum GNUNET_ErrorCode ec) |
Continuation called to notify client about result of the operation. More... | |
typedef void(* | GNUNET_NAMESTORE_RecordMonitor) (void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
Process a record that was stored in the namestore. More... | |
typedef void(* | GNUNET_NAMESTORE_EditRecordSetBeginCallback) (void *cls, enum GNUNET_ErrorCode ec, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, const char *editor_hint) |
Process a record that was stored in the namestore. More... | |
typedef void(* | GNUNET_NAMESTORE_RecordSetMonitor) (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 expiry) |
Process a record set that was stored in the namestore. More... | |
Enumerations | |
enum | GNUNET_NAMESTORE_TxControl { GNUNET_NAMESTORE_TX_BEGIN = 0 , GNUNET_NAMESTORE_TX_COMMIT = 1 , GNUNET_NAMESTORE_TX_ROLLBACK = 2 } |
Transaction control types. More... | |
Store naming information on a GNUnet node.
Naming information can either be records for which this peer/user is authoritative, or blocks which are cached, encrypted naming data from other peers.
typedef void(* GNUNET_NAMESTORE_ContinuationWithStatus) (void *cls, enum GNUNET_ErrorCode ec) |
Continuation called to notify client about result of the operation.
cls | closure |
success | GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate) GNUNET_NO if content was already there or not found GNUNET_YES (or other positive value) on success |
ec | the GNUNET_ErrorCode, GNUNET_EC_NONE on success. |
Definition at line 127 of file gnunet_namestore_service.h.
typedef void(* GNUNET_NAMESTORE_RecordMonitor) (void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
Process a record that was stored in the namestore.
cls | closure |
zone | private key of the zone |
label | label of the records |
rd_count | number of entries in rd array, 0 if label was deleted |
rd | array of records with data to store |
Definition at line 242 of file gnunet_namestore_service.h.
typedef void(* GNUNET_NAMESTORE_EditRecordSetBeginCallback) (void *cls, enum GNUNET_ErrorCode ec, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, const char *editor_hint) |
Process a record that was stored in the namestore.
cls | closure |
ec | the error code. GNUNET_EC_NONE on success. |
rd_count | number of entries in rd array, 0 if label was deleted |
rd | array of records with data to store |
editor_hint | the advisory lock value that was replaced. NULL of not advisory lock was set or if lock was equal to provided editor hint. |
Definition at line 259 of file gnunet_namestore_service.h.
typedef void(* GNUNET_NAMESTORE_RecordSetMonitor) (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 expiry) |
Process a record set that was stored in the namestore.
The record set expiration value takes existing TOMBSTONE records into account even if those are not returned.
cls | closure |
zone | private key of the zone |
label | label of the records |
rd_count | number of entries in rd array, 0 if label was deleted |
rd | array of records with data to store |
expiry | the expiration of this record set. |
Definition at line 279 of file gnunet_namestore_service.h.
Transaction control types.
They roughly correspond to DB transaction controls
Enumerator | |
---|---|
GNUNET_NAMESTORE_TX_BEGIN | |
GNUNET_NAMESTORE_TX_COMMIT | |
GNUNET_NAMESTORE_TX_ROLLBACK |
Definition at line 77 of file gnunet_namestore_service.h.
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg | ) |
Connect to the namestore service.
cfg | configuration to use |
Connect to the namestore service.
cfg | configuration to use |
Definition at line 1040 of file namestore_api.c.
References cfg, GNUNET_ARM_Handle::cfg, GNUNET_free, GNUNET_new, h, GNUNET_ARM_Handle::mq, and reconnect().
Referenced by GNUNET_CONVERSATION_phone_create(), namestore_import(), RECLAIM_TICKETS_init(), REST_namestore_init(), run(), and store_cb().
void GNUNET_NAMESTORE_disconnect | ( | struct GNUNET_NAMESTORE_Handle * | h | ) |
Disconnect from the namestore service (and free associated resources).
Must not be called from within operation callbacks of the API.
h | handle to the namestore |
h | handle to the namestore |
Definition at line 1063 of file namestore_api.c.
References GNUNET_break, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), h, LOG, GNUNET_ARM_Handle::mq, q, and GNUNET_ARM_Handle::reconnect_task.
Referenced by cleanup(), cleanup_handle(), do_shutdown(), GNUNET_CONVERSATION_phone_destroy(), RECLAIM_TICKETS_deinit(), REST_namestore_done(), and shutdown_task().
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_record_set_store | ( | struct GNUNET_NAMESTORE_Handle * | h, |
const struct GNUNET_CRYPTO_PrivateKey * | pkey, | ||
const char * | label, | ||
unsigned int | rd_count, | ||
const struct GNUNET_GNSRECORD_Data * | rd, | ||
GNUNET_NAMESTORE_ContinuationWithStatus | cont, | ||
void * | cont_cls | ||
) |
Store an item in the namestore.
If the item is already present, it is replaced with the new record. Use an empty array to remove all records under the given name.
The continuation is called after the value has been stored in the database. Monitors may be notified asynchronously (basically with a buffer). However, if any monitor is consistently too slow to keep up with the changes, calling cont will be delayed until the monitors do keep up.
This always overwrites the record set and unsets any advisory lock inrrespective of the currently set editor hint/advisory lock value.
h | handle to the namestore |
pkey | private key of the zone |
label | name that is being mapped |
rd_count | number of records in the 'rd' array |
rd | array of records with data to store |
cont | continuation to call when done |
cont_cls | closure for cont |
Definition at line 1121 of file namestore_api.c.
References GNUNET_NAMESTORE_RecordInfo::a_label, GNUNET_NAMESTORE_RecordInfo::a_rd, GNUNET_NAMESTORE_RecordInfo::a_rd_count, GNUNET_NAMESTORE_records_store(), h, pkey, rd, and rd_count.
Referenced by attr_store_task(), cred_add_cb(), del_monitor(), DID_create_namestore_lookup_cb(), get_existing_record(), handle_attribute_delete_message(), handle_credential_delete_message(), issue_ticket(), move_attr_finished(), namestore_delete(), ns_lookup_cb(), parse(), process_result(), process_tickets(), purge_attributes(), purge_next_record(), remove_did_document_ego_lookup_cb(), revoke_attrs_cb(), run_with_zone_pkey(), rvk_move_attr_cb(), and update_tickets().
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store | ( | struct GNUNET_NAMESTORE_Handle * | h, |
const struct GNUNET_CRYPTO_PrivateKey * | pkey, | ||
unsigned int | rd_set_count, | ||
const struct GNUNET_NAMESTORE_RecordInfo * | record_info, | ||
unsigned int * | rds_sent, | ||
GNUNET_NAMESTORE_ContinuationWithStatus | cont, | ||
void * | cont_cls | ||
) |
Store one or more record sets in the namestore.
If any item is already present, it is replaced with the new record. Use an empty array to remove all records under the given name.
The continuation is called after the records have been stored in the database. They may not yet have been committed. Monitors may be notified asynchronously (basically with a buffer when committed). However, if any monitor is consistently too slow to keep up with the changes, calling cont will be delayed until the monitors do keep up. Uncommitted store requests within a transaction (GNUNET_NAMESTORE_transaction_begin) cause cont to be called immediately before the commit and before notification of monitors.
This always overwrites the record set and unsets any advisory lock inrrespective of the currently set editor hint/advisory lock value.
h | handle to the namestore |
pkey | private key of the zone |
rd_set_count | the number of record sets |
record_info | the records to add containing rd_set_count records |
cont | continuation to call when done |
rds_sent | set to how many record sets could actually be sent |
cont_cls | closure for cont |
Definition at line 1141 of file namestore_api.c.
References GNUNET_NAMESTORE_RecordInfo::a_label, GNUNET_NAMESTORE_RecordInfo::a_rd, GNUNET_NAMESTORE_RecordInfo::a_rd_count, GNUNET_DATASTORE_QueueEntry::cont, GNUNET_DATASTORE_QueueEntry::cont_cls, env, GNUNET_DATASTORE_QueueEntry::env, get_op_id(), GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_GNSRECORD_records_get_size(), GNUNET_GNSRECORD_records_serialize(), GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_SCHEDULER_add_delayed(), GNUNET_YES, h, GNUNET_DATASTORE_QueueEntry::h, LOG, MAX_NAME_LEN, GNUNET_ARM_Handle::mq, msg, RecordSet::name_len, NAMESTORE_DELAY_TOLERANCE, pkey, qe, rd, rd_count, RecordSet::rd_count, RecordSet::rd_len, RecordStoreMessage::rd_set_count, record_info, RecordSet::reserved, and warn_delay().
Referenced by batch_insert_recordinfo(), bulk_tx_start(), GNUNET_NAMESTORE_record_set_store(), and import_next_cb().
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_record_set_store_ | ( | struct GNUNET_NAMESTORE_Handle * | h, |
const struct GNUNET_CRYPTO_PrivateKey * | pkey, | ||
const char * | label, | ||
unsigned int | rd_count, | ||
const struct GNUNET_GNSRECORD_Data * | rd, | ||
int | is_zonemaster, | ||
GNUNET_NAMESTORE_ContinuationWithStatus | cont, | ||
void * | cont_cls | ||
) |
Store an item in the namestore.
If the item is already present, it is replaced with the new record. Use an empty array to remove all records under the given name.
The continuation is called after the value has been stored in the database. Monitors may be notified asynchronously (basically with a buffer). However, if any monitor is consistently too slow to keep up with the changes, calling cont will be delayed until the monitors do keep up.
h | handle to the namestore |
pkey | private key of the zone |
label | name that is being mapped |
rd_count | number of records in the 'rd' array |
rd | array of records with data to store |
is_zonemaster | update tombstones, do not process monitors |
cont | continuation to call when done |
cont_cls | closure for cont |
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup | ( | struct GNUNET_NAMESTORE_Handle * | h, |
const struct GNUNET_CRYPTO_PrivateKey * | pkey, | ||
const char * | label, | ||
GNUNET_SCHEDULER_TaskCallback | error_cb, | ||
void * | error_cb_cls, | ||
GNUNET_NAMESTORE_RecordMonitor | rm, | ||
void * | rm_cls | ||
) |
Lookup an item in the namestore.
h | handle to the namestore |
pkey | private key of the zone |
label | name that is being mapped |
error_cb | function to call on error (i.e. disconnect) the handle is afterwards invalid |
error_cb_cls | closure for error_cb |
rm | function to call with the result (with 0 records if we don't have that label); the handle is afterwards invalid |
rm_cls | closure for rm |
Definition at line 1321 of file namestore_api.c.
References error_cb(), GNUNET_NAMESTORE_QueueEntry::error_cb_cls, GNUNET_GNSRECORD_FILTER_NONE, h, pkey, and records_lookup().
Referenced by cred_store_task(), DID_create(), handle_collect(), move_attrs(), namestore_add_or_update(), RECLAIM_TICKETS_revoke(), run_with_zone_pkey(), and store_cb().
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup2 | ( | struct GNUNET_NAMESTORE_Handle * | h, |
const struct GNUNET_CRYPTO_PrivateKey * | pkey, | ||
const char * | label, | ||
GNUNET_SCHEDULER_TaskCallback | error_cb, | ||
void * | error_cb_cls, | ||
GNUNET_NAMESTORE_RecordMonitor | rm, | ||
void * | rm_cls, | ||
enum GNUNET_GNSRECORD_Filter | filter | ||
) |
Lookup an item in the namestore with GNSRECORD filter.
h | handle to the namestore |
pkey | private key of the zone |
label | name that is being mapped |
error_cb | function to call on error (i.e. disconnect) the handle is afterwards invalid |
error_cb_cls | closure for error_cb |
rm | function to call with the result (with 0 records if we don't have that label); the handle is afterwards invalid |
rm_cls | closure for rm |
filter | the record set filter to use |
Definition at line 1338 of file namestore_api.c.
References error_cb(), GNUNET_NAMESTORE_QueueEntry::error_cb_cls, filter, h, pkey, and records_lookup().
Referenced by namestore_get(), and run_with_zone_pkey().
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_zone_to_name | ( | struct GNUNET_NAMESTORE_Handle * | h, |
const struct GNUNET_CRYPTO_PrivateKey * | zone, | ||
const struct GNUNET_CRYPTO_PublicKey * | value_zone, | ||
GNUNET_SCHEDULER_TaskCallback | error_cb, | ||
void * | error_cb_cls, | ||
GNUNET_NAMESTORE_RecordMonitor | proc, | ||
void * | proc_cls | ||
) |
Look for an existing PKEY delegation record for a given public key.
Returns at most one result to the processor.
h | handle to the namestore |
zone | private key of the zone to look up in, never NULL |
value_zone | public key of the target zone (value), never NULL |
error_cb | function to call on error (i.e. disconnect) the handle is afterwards invalid |
error_cb_cls | closure for error_cb |
proc | function to call on the matching records, or with NULL (rd_count == 0) if there are no matching records; the handle is afterwards invalid |
proc_cls | closure for proc |
Definition at line 1356 of file namestore_api.c.
References env, GNUNET_DATASTORE_QueueEntry::env, error_cb(), get_op_id(), GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_public_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_CRYPTO_write_public_key_to_buffer(), GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, h, GNUNET_DATASTORE_QueueEntry::h, ZoneToNameMessage::key_len, GNUNET_ARM_Handle::mq, msg, ZoneToNameMessage::pkey_len, and qe.
Referenced by run_with_zone_pkey().
void GNUNET_NAMESTORE_cancel | ( | struct GNUNET_NAMESTORE_QueueEntry * | qe | ) |
Cancel a namestore operation.
The final callback from the operation must not have been done yet. Must be called on any namestore operation that has not yet completed prior to calling GNUNET_NAMESTORE_disconnect.
qe | operation to cancel |
The final callback from the operation must not have been done yet.
qe | operation to cancel |
Definition at line 1550 of file namestore_api.c.
Referenced by cleanup_adh(), cleanup_as_handle(), cleanup_handle(), cleanup_issue_handle(), cleanup_rvk(), do_shutdown(), reset_handles(), and warn_delay().
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start | ( | struct GNUNET_NAMESTORE_Handle * | h, |
const struct GNUNET_CRYPTO_PrivateKey * | zone, | ||
GNUNET_SCHEDULER_TaskCallback | error_cb, | ||
void * | error_cb_cls, | ||
GNUNET_NAMESTORE_RecordMonitor | proc, | ||
void * | proc_cls, | ||
GNUNET_SCHEDULER_TaskCallback | finish_cb, | ||
void * | finish_cb_cls | ||
) |
Starts a new zone iteration (used to periodically PUT all of our records into our DHT). This MUST lock the struct GNUNET_NAMESTORE_Handle
for any other calls than GNUNET_NAMESTORE_zone_iterator_next() and GNUNET_NAMESTORE_zone_iteration_stop. proc will be called once immediately, and then again after GNUNET_NAMESTORE_zone_iterator_next() is invoked.
On error (disconnect), error_cb will be invoked. On normal completion, finish_cb proc will be invoked.
h | handle to the namestore |
zone | zone to access, NULL for all zones |
error_cb | function to call on error (i.e. disconnect), the handle is afterwards invalid |
error_cb_cls | closure for error_cb |
proc | function to call on each name from the zone; it will be called repeatedly with a value (if available) |
proc_cls | closure for proc |
finish_cb | function to call on completion the handle is afterwards invalid |
finish_cb_cls | closure for finish_cb |
Definition at line 1402 of file namestore_api.c.
References env, GNUNET_NAMESTORE_ZoneIterator::env, error_cb(), GNUNET_NAMESTORE_ZoneIterator::error_cb, GNUNET_NAMESTORE_ZoneIterator::error_cb_cls, GNUNET_NAMESTORE_ZoneIterator::finish_cb, GNUNET_NAMESTORE_ZoneIterator::finish_cb_cls, get_op_id(), GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, h, GNUNET_NAMESTORE_ZoneIterator::h, ZoneIterationStartMessage::key_len, LOG, GNUNET_ARM_Handle::mq, msg, GNUNET_NAMESTORE_ZoneIterator::op_id, GNUNET_NAMESTORE_ZoneIterator::proc, GNUNET_NAMESTORE_ZoneIterator::proc_cls, and GNUNET_NAMESTORE_ZoneIterator::zone.
Referenced by get_ego(), handle_credential_iteration_start(), handle_iteration_start(), iterate_zones(), move_attrs(), RECLAIM_TICKETS_issue(), RECLAIM_TICKETS_iteration_start(), and start_consistency_update().
struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start2 | ( | struct GNUNET_NAMESTORE_Handle * | h, |
const struct GNUNET_CRYPTO_PrivateKey * | zone, | ||
GNUNET_SCHEDULER_TaskCallback | error_cb, | ||
void * | error_cb_cls, | ||
GNUNET_NAMESTORE_RecordSetMonitor | proc, | ||
void * | proc_cls, | ||
GNUNET_SCHEDULER_TaskCallback | finish_cb, | ||
void * | finish_cb_cls, | ||
enum GNUNET_GNSRECORD_Filter | filter | ||
) |
Starts a new zone iteration (used to periodically PUT all of our records into our DHT).
This MUST lock the struct GNUNET_NAMESTORE_Handle
for any other calls than GNUNET_NAMESTORE_zone_iterator_next() and GNUNET_NAMESTORE_zone_iteration_stop. proc will be called once immediately, and then again after GNUNET_NAMESTORE_zone_iterator_next() is invoked.
On error (disconnect), error_cb will be invoked. On normal completion, finish_cb proc will be invoked.
h | handle to the namestore |
zone | zone to access, NULL for all zones |
error_cb | function to call on error (i.e. disconnect), the handle is afterwards invalid |
error_cb_cls | closure for error_cb |
proc | function to call on each name from the zone; it will be called repeatedly with a value (if available) |
proc_cls | closure for proc |
finish_cb | function to call on completion the handle is afterwards invalid |
finish_cb_cls | closure for finish_cb |
filter | the record set filter to use |
Definition at line 1451 of file namestore_api.c.
References env, GNUNET_NAMESTORE_ZoneIterator::env, error_cb(), GNUNET_NAMESTORE_ZoneIterator::error_cb, GNUNET_NAMESTORE_ZoneIterator::error_cb_cls, filter, GNUNET_NAMESTORE_ZoneIterator::finish_cb, GNUNET_NAMESTORE_ZoneIterator::finish_cb_cls, get_op_id(), GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, h, GNUNET_NAMESTORE_ZoneIterator::h, ZoneIterationStartMessage::key_len, LOG, GNUNET_ARM_Handle::mq, msg, GNUNET_NAMESTORE_ZoneIterator::op_id, GNUNET_NAMESTORE_ZoneIterator::proc2, GNUNET_NAMESTORE_ZoneIterator::proc_cls, and GNUNET_NAMESTORE_ZoneIterator::zone.
Referenced by namestore_get(), publish_zone_dht_start(), and run_with_zone_pkey().
void GNUNET_NAMESTORE_zone_iterator_next | ( | struct GNUNET_NAMESTORE_ZoneIterator * | it, |
uint64_t | limit | ||
) |
Calls the record processor specified in GNUNET_NAMESTORE_zone_iteration_start for the next record.
it | the iterator |
limit | number of records to return to the iterator in one shot (before GNUNET_NAMESTORE_zone_iterator_next is to be called again) |
Definition at line 1502 of file namestore_api.c.
References env, GNUNET_ERROR_TYPE_DEBUG, GNUNET_htonll(), GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT, GNUNET_MQ_msg, GNUNET_MQ_send(), h, GNUNET_NAMESTORE_ZoneIterator::h, LOG, GNUNET_ARM_Handle::mq, msg, and GNUNET_NAMESTORE_ZoneIterator::op_id.
Referenced by attr_iter_cb(), collect_tickets_cb(), consistency_iter(), cred_iter_cb(), display_record_iterator(), filter_tickets_cb(), handle_credential_iteration_next(), handle_iteration_next(), namestore_list_iteration(), ns_lookup_result_cb(), publish_zone_namestore_next(), purge_orphans_iterator(), purge_zone_iterator(), RECLAIM_TICKETS_iteration_next(), rvk_ticket_update(), and zone_iterator().
void GNUNET_NAMESTORE_zone_iteration_stop | ( | struct GNUNET_NAMESTORE_ZoneIterator * | it | ) |
Stops iteration and releases the namestore handle for further calls.
Must be called on any iteration that has not yet completed prior to calling GNUNET_NAMESTORE_disconnect.
it | the iterator |
it | the iterator |
Definition at line 1525 of file namestore_api.c.
References env, free_ze(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP, GNUNET_MQ_msg, GNUNET_MQ_send(), h, GNUNET_NAMESTORE_ZoneIterator::h, GNUNET_ARM_Handle::mq, msg, and GNUNET_NAMESTORE_ZoneIterator::op_id.
Referenced by cleanup_adh(), cleanup_handle(), cleanup_iter(), cleanup_rvk(), do_shutdown(), filter_tickets_cb(), RECLAIM_TICKETS_iteration_stop(), reset_handles(), and shutdown_task().
struct GNUNET_NAMESTORE_ZoneMonitor * GNUNET_NAMESTORE_zone_monitor_start | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const struct GNUNET_CRYPTO_PrivateKey * | zone, | ||
int | iterate_first, | ||
GNUNET_SCHEDULER_TaskCallback | error_cb, | ||
void * | error_cb_cls, | ||
GNUNET_NAMESTORE_RecordMonitor | monitor, | ||
void * | monitor_cls, | ||
GNUNET_SCHEDULER_TaskCallback | sync_cb, | ||
void * | sync_cb_cls | ||
) |
Begin monitoring a zone for changes. Will first call the monitor function on all existing records in the selected zone(s) if iterate_first is GNUNET_YES. In any case, we will then call sync_cb, and then afterwards call the monitor whenever a record changes. If the namestore disconnects, the error_cb function is called with a disconnect event. Once the connection is re-established, the process begins from the start (depending on iterate_first, we will again first do all existing records, then sync, then updates).
cfg | configuration to use to connect to namestore |
zone | zone to monitor, NULL for all zones |
iterate_first | GNUNET_YES to first iterate over all existing records, GNUNET_NO to only return changes that happen from now on |
error_cb | function to call on error (i.e. disconnect); note that unlike the other error callbacks in this API, a call to this function does NOT destroy the monitor handle, it merely signals that monitoring is down. You need to still explicitly call GNUNET_NAMESTORE_zone_monitor_stop(). |
error_cb_cls | closure for error_cb |
monitor | function to call on zone changes, with an initial limit of 1 |
monitor_cls | closure for monitor |
sync_cb | function called when we're in sync with the namestore |
sync_cb_cls | closure for sync_cb |
Definition at line 316 of file namestore_api_monitor.c.
References cfg, GNUNET_NAMESTORE_ZoneMonitor::cfg, error_cb(), GNUNET_NAMESTORE_ZoneMonitor::error_cb, GNUNET_NAMESTORE_ZoneMonitor::error_cb_cls, GNUNET_CRYPTO_private_key_get_length(), GNUNET_free, GNUNET_new, GNUNET_NAMESTORE_ZoneMonitor::iterate_first, GNUNET_NAMESTORE_ZoneMonitor::key_len, monitor, GNUNET_NAMESTORE_ZoneMonitor::monitor, GNUNET_NAMESTORE_ZoneMonitor::monitor_cls, GNUNET_NAMESTORE_ZoneMonitor::mq, reconnect(), sync_cb(), GNUNET_NAMESTORE_ZoneMonitor::sync_cb, GNUNET_NAMESTORE_ZoneMonitor::sync_cb_cls, zm, and GNUNET_NAMESTORE_ZoneMonitor::zone.
struct GNUNET_NAMESTORE_ZoneMonitor * GNUNET_NAMESTORE_zone_monitor_start2 | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const struct GNUNET_CRYPTO_PrivateKey * | zone, | ||
int | iterate_first, | ||
GNUNET_SCHEDULER_TaskCallback | error_cb, | ||
void * | error_cb_cls, | ||
GNUNET_NAMESTORE_RecordSetMonitor | monitor, | ||
void * | monitor_cls, | ||
GNUNET_SCHEDULER_TaskCallback | sync_cb, | ||
void * | sync_cb_cls, | ||
enum GNUNET_GNSRECORD_Filter | filter | ||
) |
Begin monitoring a zone for changes.
Will first call the monitor function on all existing records in the selected zone(s) if iterate_first is GNUNET_YES. In any case, we will then call sync_cb, and then afterwards call the monitor whenever a record changes. If the namestore disconnects, the error_cb function is called with a disconnect event. Once the connection is re-established, the process begins from the start (depending on iterate_first, we will again first do all existing records, then sync, then updates).
cfg | configuration to use to connect to namestore |
zone | zone to monitor, NULL for all zones |
iterate_first | GNUNET_YES to first iterate over all existing records, GNUNET_NO to only return changes that happen from now on |
error_cb | function to call on error (i.e. disconnect); note that unlike the other error callbacks in this API, a call to this function does NOT destroy the monitor handle, it merely signals that monitoring is down. You need to still explicitly call GNUNET_NAMESTORE_zone_monitor_stop(). |
error_cb_cls | closure for error_cb |
monitor | function to call on zone changes, with an initial limit of 1 |
monitor_cls | closure for monitor |
sync_cb | function called when we're in sync with the namestore |
sync_cb_cls | closure for sync_cb |
filter | the record set filter to use |
Definition at line 353 of file namestore_api_monitor.c.
References cfg, GNUNET_NAMESTORE_ZoneMonitor::cfg, error_cb(), GNUNET_NAMESTORE_ZoneMonitor::error_cb, GNUNET_NAMESTORE_ZoneMonitor::error_cb_cls, filter, GNUNET_NAMESTORE_ZoneMonitor::filter, GNUNET_CRYPTO_private_key_get_length(), GNUNET_free, GNUNET_new, GNUNET_NAMESTORE_ZoneMonitor::iterate_first, GNUNET_NAMESTORE_ZoneMonitor::key_len, monitor, GNUNET_NAMESTORE_ZoneMonitor::monitor2, GNUNET_NAMESTORE_ZoneMonitor::monitor_cls, GNUNET_NAMESTORE_ZoneMonitor::mq, reconnect(), sync_cb(), GNUNET_NAMESTORE_ZoneMonitor::sync_cb, GNUNET_NAMESTORE_ZoneMonitor::sync_cb_cls, zm, and GNUNET_NAMESTORE_ZoneMonitor::zone.
Referenced by run(), and run_with_zone_pkey().
void GNUNET_NAMESTORE_zone_monitor_next | ( | struct GNUNET_NAMESTORE_ZoneMonitor * | zm, |
uint64_t | limit | ||
) |
Calls the monitor processor specified in GNUNET_NAMESTORE_zone_monitor_start for the next record(s).
This function is used to allow clients that merely monitor the NAMESTORE to still throttle namestore operations, so we can be sure that the monitors can keep up.
Note that GNUNET_NAMESTORE_records_store() only waits for this call if the previous limit set by the client was already reached. Thus, by using a limit greater than 1, monitors basically enable a queue of notifications to be processed asynchronously with some delay. Note that even with a limit of 1 the GNUNET_NAMESTORE_records_store() function will run asynchronously and the continuation may be invoked before the monitors completed (or even started) processing the notification. Thus, monitors will only closely track the current state of the namestore, but not be involved in the transactions.
zm | the monitor |
limit | number of records to return to the iterator in one shot (before GNUNET_NAMESTORE_zone_monitor_next is to be called again) |
Definition at line 414 of file namestore_api_monitor.c.
References env, GNUNET_htonll(), GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_NEXT, GNUNET_MQ_msg, GNUNET_MQ_send(), ZoneMonitorNextMessage::limit, GNUNET_NAMESTORE_ZoneMonitor::mq, and zm.
Referenced by cleanup_job(), display_record_monitor(), handle_monitor_event(), and run().
void GNUNET_NAMESTORE_zone_monitor_stop | ( | struct GNUNET_NAMESTORE_ZoneMonitor * | zm | ) |
Stop monitoring a zone for changes.
zm | handle to the monitor activity to stop |
Definition at line 432 of file namestore_api_monitor.c.
References GNUNET_free, GNUNET_MQ_destroy(), GNUNET_NAMESTORE_ZoneMonitor::mq, and zm.
Referenced by reset_handles(), and shutdown_task().
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_record_set_edit_begin | ( | struct GNUNET_NAMESTORE_Handle * | h, |
const struct GNUNET_CRYPTO_PrivateKey * | pkey, | ||
const char * | label, | ||
const char * | editor_hint, | ||
GNUNET_NAMESTORE_EditRecordSetBeginCallback | edit_cb, | ||
void * | edit_cb_cls | ||
) |
New API draft.
Experimental This function is used to initiate the editing of a record set under #label. It will set the editor hint of the record set to #editor_hint. The editor hint serves as an advisory lock that is used in #GNUNET_NAMESTORE_EdtirRecordSetBeginCallback if #editor_hint differs from the currently set advisory lock in the database.
h | handle to the namestore |
pkey | the private key of the zone to edit |
label | the label of the record set to edit |
editor_hint | the editor hint to set as advisory lock |
error_cb | the error callback |
error_cb_cls | closure to error_cb |
edit_cb | the GNUNET_NAMESTORE_EditRecordSetBeginCallback |
edit_cb_cls | closure to #edit_cb |
Experimental
Definition at line 1561 of file namestore_api.c.
References EditRecordSetMessage::editor_hint_len, env, GNUNET_DATASTORE_QueueEntry::env, get_op_id(), GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_SET_EDIT, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, h, GNUNET_DATASTORE_QueueEntry::h, EditRecordSetMessage::key_len, EditRecordSetMessage::label_len, GNUNET_ARM_Handle::mq, msg, pkey, and qe.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_record_set_edit_cancel | ( | struct GNUNET_NAMESTORE_Handle * | h, |
const struct GNUNET_CRYPTO_PrivateKey * | pkey, | ||
const char * | label, | ||
const char * | editor_hint, | ||
const char * | editor_hint_replacement, | ||
GNUNET_NAMESTORE_ContinuationWithStatus | finished_cb, | ||
void * | finished_cls | ||
) |
If the current advisory lock is set to the provided editor hint, this API cancels the editing of a record set and unsets the advisory lock in database.
Optionally, a new editor hint can be provided: For example, the value that was returned in in the callback to GNUNET_NAMESTORE_record_set_edit_begin.
If provided editor hint does not match the current advisory lock, this function is not doing anything (NOP).
h | handle to the namestore |
pkey | the private key of the zone to edit |
label | the label of the record set to edit |
editor_hint | the editor hint to set as advisory lock |
editor_hint_replacement | the editor hint to set as advisory lock instead of clearing it |
finished_cb | the callback called when cancelled |
finished_cb_cls | closure to finished_cb |
Definition at line 1615 of file namestore_api.c.
References GNUNET_DATASTORE_QueueEntry::cont, GNUNET_DATASTORE_QueueEntry::cont_cls, EditRecordSetCancelMessage::editor_hint_len, EditRecordSetCancelMessage::editor_hint_replacement_len, env, GNUNET_DATASTORE_QueueEntry::env, finished_cb(), get_op_id(), GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_CRYPTO_private_key_get_length(), GNUNET_CRYPTO_write_private_key_to_buffer(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_SET_EDIT_CANCEL, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, h, GNUNET_DATASTORE_QueueEntry::h, EditRecordSetCancelMessage::key_len, EditRecordSetCancelMessage::label_len, GNUNET_ARM_Handle::mq, msg, pkey, and qe.