gnunet_namestore_service.h (27577B)
1 /* 2 This file is part of GNUnet 3 Copyright (C) 2012, 2013, 2018 GNUnet e.V. 4 5 GNUnet is free software: you can redistribute it and/or modify it 6 under the terms of the GNU Affero General Public License as published 7 by the Free Software Foundation, either version 3 of the License, 8 or (at your option) any later version. 9 10 GNUnet is distributed in the hope that it will be useful, but 11 WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Affero General Public License for more details. 14 15 You should have received a copy of the GNU Affero General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 SPDX-License-Identifier: AGPL3.0-or-later 19 */ 20 21 /** 22 * @addtogroup GNS 23 * @{ 24 * 25 * @author Christian Grothoff 26 * 27 * @file 28 * API that can be used to store naming information on a GNUnet node; 29 * 30 * @defgroup namestore Name Store service 31 * Store naming information on a GNUnet node. 32 * 33 * Naming information can either be records for which this peer/user is 34 * authoritative, or blocks which are cached, encrypted naming data from other 35 * peers. 36 * 37 * @see [Documentation](https://gnunet.org/namestore-subsystem) 38 * 39 * @{ 40 */ 41 #ifndef GNUNET_NAMESTORE_SERVICE_H 42 #define GNUNET_NAMESTORE_SERVICE_H 43 44 45 #include "gnunet_error_codes.h" 46 #include "gnunet_util_lib.h" 47 #include "gnunet_gnsrecord_lib.h" 48 49 #ifdef __cplusplus 50 extern "C" 51 { 52 #if 0 /* keep Emacsens' auto-indent happy */ 53 } 54 #endif 55 #endif 56 57 58 /** 59 * Entry in the queue. 60 */ 61 struct GNUNET_NAMESTORE_QueueEntry; 62 63 /** 64 * Handle to the namestore service. 65 */ 66 struct GNUNET_NAMESTORE_Handle; 67 68 /** 69 * Handle to the namestore zone iterator. 70 */ 71 struct GNUNET_NAMESTORE_ZoneIterator; 72 73 /** 74 * Transaction control types. 75 * They roughly correspond to DB transaction controls 76 */ 77 enum GNUNET_NAMESTORE_TxControl 78 { 79 GNUNET_NAMESTORE_TX_BEGIN = 0, 80 GNUNET_NAMESTORE_TX_COMMIT = 1, 81 GNUNET_NAMESTORE_TX_ROLLBACK = 2, 82 }; 83 84 /** 85 * A struct for record bulk import. 86 * The fields are arrays pointing to individual GNS records and names. 87 */ 88 struct GNUNET_NAMESTORE_RecordInfo 89 { 90 const char *a_label; 91 unsigned int a_rd_count; 92 struct GNUNET_GNSRECORD_Data *a_rd; 93 }; 94 95 96 /** 97 * Connect to the namestore service. 98 * 99 * @param cfg configuration to use 100 * @return handle to use to access the service 101 */ 102 struct GNUNET_NAMESTORE_Handle * 103 GNUNET_NAMESTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); 104 105 106 /** 107 * Disconnect from the namestore service (and free associated 108 * resources). Must not be called from within operation callbacks of 109 * the API. 110 * 111 * @param h handle to the namestore 112 */ 113 void 114 GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h); 115 116 117 /** 118 * Continuation called to notify client about result of the 119 * operation. 120 * 121 * @param cls closure 122 * @param success #GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate) 123 * #GNUNET_NO if content was already there or not found 124 * #GNUNET_YES (or other positive value) on success 125 * @param ec the #GNUNET_ErrorCode, #GNUNET_EC_NONE on success. 126 */ 127 typedef void 128 (*GNUNET_NAMESTORE_ContinuationWithStatus) (void *cls, 129 enum GNUNET_ErrorCode ec); 130 131 132 /** 133 * Store an item in the namestore. If the item is already present, 134 * it is replaced with the new record. Use an empty array to 135 * remove all records under the given name. 136 * 137 * The continuation is called after the value has been stored in the 138 * database. Monitors may be notified asynchronously (basically with 139 * a buffer). However, if any monitor is consistently too slow to 140 * keep up with the changes, calling @a cont will be delayed until the 141 * monitors do keep up. 142 * 143 * This always overwrites the record set and unsets any advisory 144 * lock inrrespective of the currently set editor hint/advisory lock value. 145 * 146 * @param h handle to the namestore 147 * @param pkey private key of the zone 148 * @param label name that is being mapped 149 * @param rd_count number of records in the 'rd' array 150 * @param rd array of records with data to store 151 * @param cont continuation to call when done 152 * @param cont_cls closure for @a cont 153 * @return handle to abort the request 154 */ 155 struct GNUNET_NAMESTORE_QueueEntry * 156 GNUNET_NAMESTORE_record_set_store (struct GNUNET_NAMESTORE_Handle *h, 157 const struct 158 GNUNET_CRYPTO_BlindablePrivateKey *pkey, 159 const char *label, 160 unsigned int rd_count, 161 const struct GNUNET_GNSRECORD_Data *rd, 162 GNUNET_NAMESTORE_ContinuationWithStatus cont, 163 void *cont_cls); 164 165 /** 166 * Store one or more record sets in the namestore. If any item is already present, 167 * it is replaced with the new record. Use an empty array to 168 * remove all records under the given name. 169 * 170 * The continuation is called after the records have been stored in the 171 * database. They may not yet have been committed. Monitors may be notified 172 * asynchronously (basically with a buffer when committed). 173 * However, if any monitor is consistently too slow to 174 * keep up with the changes, calling @a cont will be delayed until the 175 * monitors do keep up. 176 * Uncommitted store requests within a transaction (GNUNET_NAMESTORE_transaction_begin) 177 * cause @a cont to be called immediately before the commit and before 178 * notification of monitors. 179 * 180 * This always overwrites the record set and unsets any advisory 181 * lock inrrespective of the currently set editor hint/advisory lock value. 182 * 183 * @param h handle to the namestore 184 * @param pkey private key of the zone 185 * @param rd_set_count the number of record sets 186 * @param record_info the records to add containing @a rd_set_count records 187 * @param cont continuation to call when done 188 * @param rds_sent set to how many record sets could actually be sent 189 * @param cont_cls closure for @a cont 190 * @return handle to abort the request 191 */ 192 struct GNUNET_NAMESTORE_QueueEntry * 193 GNUNET_NAMESTORE_records_store ( 194 struct GNUNET_NAMESTORE_Handle *h, 195 const struct GNUNET_CRYPTO_BlindablePrivateKey *pkey, 196 unsigned int rd_set_count, 197 const struct GNUNET_NAMESTORE_RecordInfo *record_info, 198 unsigned int *rds_sent, 199 GNUNET_NAMESTORE_ContinuationWithStatus cont, 200 void *cont_cls); 201 202 /** 203 * Store an item in the namestore. If the item is already present, 204 * it is replaced with the new record. Use an empty array to 205 * remove all records under the given name. 206 * 207 * The continuation is called after the value has been stored in the 208 * database. Monitors may be notified asynchronously (basically with 209 * a buffer). However, if any monitor is consistently too slow to 210 * keep up with the changes, calling @a cont will be delayed until the 211 * monitors do keep up. 212 * 213 * @param h handle to the namestore 214 * @param pkey private key of the zone 215 * @param label name that is being mapped 216 * @param rd_count number of records in the 'rd' array 217 * @param rd array of records with data to store 218 * @param is_zonemaster update tombstones, do not process monitors 219 * @param cont continuation to call when done 220 * @param cont_cls closure for @a cont 221 * @return handle to abort the request 222 */ 223 struct GNUNET_NAMESTORE_QueueEntry * 224 GNUNET_NAMESTORE_record_set_store_ (struct GNUNET_NAMESTORE_Handle *h, 225 const struct 226 GNUNET_CRYPTO_BlindablePrivateKey *pkey, 227 const char *label, 228 unsigned int rd_count, 229 const struct GNUNET_GNSRECORD_Data *rd, 230 int is_zonemaster, 231 GNUNET_NAMESTORE_ContinuationWithStatus cont 232 , 233 void *cont_cls); 234 235 236 /** 237 * Process a record that was stored in the namestore. 238 * 239 * @param cls closure 240 * @param zone private key of the zone 241 * @param label label of the records 242 * @param rd_count number of entries in @a rd array, 0 if label was deleted 243 * @param rd array of records with data to store 244 */ 245 typedef void 246 (*GNUNET_NAMESTORE_RecordMonitor) (void *cls, 247 const struct 248 GNUNET_CRYPTO_BlindablePrivateKey *zone, 249 const char *label, 250 unsigned int rd_count, 251 const struct GNUNET_GNSRECORD_Data *rd); 252 /** 253 * Process a record that was stored in the namestore. 254 * 255 * @param cls closure 256 * @param ec the error code. #GNUNET_EC_NONE on success. 257 * @param rd_count number of entries in @a rd array, 0 if label was deleted 258 * @param rd array of records with data to store 259 * @param editor_hint the advisory lock value that was replaced. NULL of not advisory lock 260 was set or if lock was equal to provided editor hint. 261 */ 262 typedef void 263 (*GNUNET_NAMESTORE_EditRecordSetBeginCallback) (void *cls, 264 enum GNUNET_ErrorCode ec, 265 unsigned int rd_count, 266 const struct 267 GNUNET_GNSRECORD_Data *rd, 268 const char *editor_hint); 269 270 /** 271 * Process a record set that was stored in the namestore. 272 * The record set expiration value takes existing TOMBSTONE records 273 * into account even if those are not returned. 274 * 275 * @param cls closure 276 * @param zone private key of the zone 277 * @param label label of the records 278 * @param rd_count number of entries in @a rd array, 0 if label was deleted 279 * @param rd array of records with data to store 280 * @param expiry the expiration of this record set. 281 */ 282 typedef void 283 (*GNUNET_NAMESTORE_RecordSetMonitor) (void *cls, 284 const struct 285 GNUNET_CRYPTO_BlindablePrivateKey *zone, 286 const char *label, 287 unsigned int rd_count, 288 const struct GNUNET_GNSRECORD_Data *rd, 289 struct GNUNET_TIME_Absolute expiry); 290 291 292 /** 293 * Lookup an item in the namestore. 294 * 295 * @param h handle to the namestore 296 * @param pkey private key of the zone 297 * @param label name that is being mapped 298 * @param error_cb function to call on error (i.e. disconnect) 299 * the handle is afterwards invalid 300 * @param error_cb_cls closure for @a error_cb 301 * @param rm function to call with the result (with 0 records if we don't have that label); 302 * the handle is afterwards invalid 303 * @param rm_cls closure for @a rm 304 * @return handle to abort the request 305 */ 306 struct GNUNET_NAMESTORE_QueueEntry * 307 GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h, 308 const struct 309 GNUNET_CRYPTO_BlindablePrivateKey *pkey, 310 const char *label, 311 GNUNET_SCHEDULER_TaskCallback error_cb, 312 void *error_cb_cls, 313 GNUNET_NAMESTORE_RecordMonitor rm, 314 void *rm_cls); 315 316 /** 317 * Lookup an item in the namestore with GNSRECORD filter. 318 * 319 * @param h handle to the namestore 320 * @param pkey private key of the zone 321 * @param label name that is being mapped 322 * @param error_cb function to call on error (i.e. disconnect) 323 * the handle is afterwards invalid 324 * @param error_cb_cls closure for @a error_cb 325 * @param rm function to call with the result (with 0 records if we don't have that label); 326 * the handle is afterwards invalid 327 * @param rm_cls closure for @a rm 328 * @param filter the record set filter to use 329 * @return handle to abort the request 330 */ 331 struct GNUNET_NAMESTORE_QueueEntry * 332 GNUNET_NAMESTORE_records_lookup2 (struct GNUNET_NAMESTORE_Handle *h, 333 const struct 334 GNUNET_CRYPTO_BlindablePrivateKey *pkey, 335 const char *label, 336 GNUNET_SCHEDULER_TaskCallback error_cb, 337 void *error_cb_cls, 338 GNUNET_NAMESTORE_RecordMonitor rm, 339 void *rm_cls, 340 enum GNUNET_GNSRECORD_Filter filter); 341 342 343 /** 344 * Look for an existing PKEY delegation record for a given public key. 345 * Returns at most one result to the processor. 346 * 347 * @param h handle to the namestore 348 * @param zone private key of the zone to look up in, never NULL 349 * @param value_zone public key of the target zone (value), never NULL 350 * @param error_cb function to call on error (i.e. disconnect) 351 * the handle is afterwards invalid 352 * @param error_cb_cls closure for @a error_cb 353 * @param proc function to call on the matching records, or with 354 * NULL (rd_count == 0) if there are no matching records; 355 * the handle is afterwards invalid 356 * @param proc_cls closure for @a proc 357 * @return a handle that can be used to 358 * cancel 359 */ 360 struct GNUNET_NAMESTORE_QueueEntry * 361 GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, 362 const struct GNUNET_CRYPTO_BlindablePrivateKey * 363 zone, 364 const struct 365 GNUNET_CRYPTO_BlindablePublicKey *value_zone, 366 GNUNET_SCHEDULER_TaskCallback error_cb, 367 void *error_cb_cls, 368 GNUNET_NAMESTORE_RecordMonitor proc, 369 void *proc_cls); 370 371 372 /** 373 * Cancel a namestore operation. The final callback from the 374 * operation must not have been done yet. Must be called on any 375 * namestore operation that has not yet completed prior to calling 376 * #GNUNET_NAMESTORE_disconnect. 377 * 378 * @param qe operation to cancel 379 */ 380 void 381 GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe); 382 383 384 /** 385 * @deprecated since 0.16.7 will be replaced in 0.18 386 * @see GNUNET_NAMESTORE_zone_iteration_start2() 387 * 388 * Starts a new zone iteration (used to periodically PUT all of our 389 * records into our DHT). This MUST lock the `struct GNUNET_NAMESTORE_Handle` 390 * for any other calls than #GNUNET_NAMESTORE_zone_iterator_next() and 391 * #GNUNET_NAMESTORE_zone_iteration_stop. @a proc will be called once 392 * immediately, and then again after 393 * #GNUNET_NAMESTORE_zone_iterator_next() is invoked. 394 * 395 * On error (disconnect), @a error_cb will be invoked. 396 * On normal completion, @a finish_cb proc will be 397 * invoked. 398 * 399 * @param h handle to the namestore 400 * @param zone zone to access, NULL for all zones 401 * @param error_cb function to call on error (i.e. disconnect), 402 * the handle is afterwards invalid 403 * @param error_cb_cls closure for @a error_cb 404 * @param proc function to call on each name from the zone; it 405 * will be called repeatedly with a value (if available) 406 * @param proc_cls closure for @a proc 407 * @param finish_cb function to call on completion 408 * the handle is afterwards invalid 409 * @param finish_cb_cls closure for @a finish_cb 410 * @return an iterator handle to use for iteration 411 */ 412 struct GNUNET_NAMESTORE_ZoneIterator * 413 GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, 414 const struct 415 GNUNET_CRYPTO_BlindablePrivateKey *zone, 416 GNUNET_SCHEDULER_TaskCallback error_cb, 417 void *error_cb_cls, 418 GNUNET_NAMESTORE_RecordMonitor proc, 419 void *proc_cls, 420 GNUNET_SCHEDULER_TaskCallback finish_cb, 421 void *finish_cb_cls); 422 423 /** 424 * Starts a new zone iteration (used to periodically PUT all of our 425 * records into our DHT). This MUST lock the `struct GNUNET_NAMESTORE_Handle` 426 * for any other calls than #GNUNET_NAMESTORE_zone_iterator_next() and 427 * #GNUNET_NAMESTORE_zone_iteration_stop. @a proc will be called once 428 * immediately, and then again after 429 * #GNUNET_NAMESTORE_zone_iterator_next() is invoked. 430 * 431 * On error (disconnect), @a error_cb will be invoked. 432 * On normal completion, @a finish_cb proc will be 433 * invoked. 434 * 435 * @param h handle to the namestore 436 * @param zone zone to access, NULL for all zones 437 * @param error_cb function to call on error (i.e. disconnect), 438 * the handle is afterwards invalid 439 * @param error_cb_cls closure for @a error_cb 440 * @param proc function to call on each name from the zone; it 441 * will be called repeatedly with a value (if available) 442 * @param proc_cls closure for @a proc 443 * @param finish_cb function to call on completion 444 * the handle is afterwards invalid 445 * @param finish_cb_cls closure for @a finish_cb 446 * @param filter the record set filter to use 447 * @return an iterator handle to use for iteration 448 */ 449 struct GNUNET_NAMESTORE_ZoneIterator * 450 GNUNET_NAMESTORE_zone_iteration_start2 (struct GNUNET_NAMESTORE_Handle *h, 451 const struct 452 GNUNET_CRYPTO_BlindablePrivateKey *zone, 453 GNUNET_SCHEDULER_TaskCallback error_cb, 454 void *error_cb_cls, 455 GNUNET_NAMESTORE_RecordSetMonitor proc, 456 void *proc_cls, 457 GNUNET_SCHEDULER_TaskCallback finish_cb, 458 void *finish_cb_cls, 459 enum GNUNET_GNSRECORD_Filter filter); 460 461 462 /** 463 * Calls the record processor specified in #GNUNET_NAMESTORE_zone_iteration_start 464 * for the next record. 465 * 466 * @param it the iterator 467 * @param limit number of records to return to the iterator in one shot 468 * (before #GNUNET_NAMESTORE_zone_iterator_next is to be called again) 469 */ 470 void 471 GNUNET_NAMESTORE_zone_iterator_next (struct GNUNET_NAMESTORE_ZoneIterator *it, 472 uint64_t limit); 473 474 475 /** 476 * Stops iteration and releases the namestore handle for further calls. Must 477 * be called on any iteration that has not yet completed prior to calling 478 * #GNUNET_NAMESTORE_disconnect. 479 * 480 * @param it the iterator 481 */ 482 void 483 GNUNET_NAMESTORE_zone_iteration_stop (struct GNUNET_NAMESTORE_ZoneIterator *it); 484 485 486 /** 487 * Handle for a monitoring activity. 488 */ 489 struct GNUNET_NAMESTORE_ZoneMonitor; 490 491 492 /** 493 * @deprecated since 0.16.7 will be replaced in 0.18 494 * @see GNUNET_NAMESTORE_zone_monitor_start2() 495 * 496 * Begin monitoring a zone for changes. Will first call the @a 497 * monitor function on all existing records in the selected zone(s) if 498 * @a iterate_first is #GNUNET_YES. In any case, we will then call @a 499 * sync_cb, and then afterwards call the @a monitor whenever a record 500 * changes. If the namestore disconnects, the @a error_cb function is 501 * called with a disconnect event. Once the connection is 502 * re-established, the process begins from the start (depending on @a 503 * iterate_first, we will again first do all existing records, then @a 504 * sync, then updates). 505 * 506 * @param cfg configuration to use to connect to namestore 507 * @param zone zone to monitor, NULL for all zones 508 * @param iterate_first #GNUNET_YES to first iterate over all existing records, 509 * #GNUNET_NO to only return changes that happen from now on 510 * @param error_cb function to call on error (i.e. disconnect); note that 511 * unlike the other error callbacks in this API, a call to this 512 * function does NOT destroy the monitor handle, it merely signals 513 * that monitoring is down. You need to still explicitly call 514 * #GNUNET_NAMESTORE_zone_monitor_stop(). 515 * @param error_cb_cls closure for @a error_cb 516 * @param monitor function to call on zone changes, with an initial limit of 1 517 * @param monitor_cls closure for @a monitor 518 * @param sync_cb function called when we're in sync with the namestore 519 * @param sync_cb_cls closure for @a sync_cb 520 * @return handle to stop monitoring 521 */ 522 struct GNUNET_NAMESTORE_ZoneMonitor * 523 GNUNET_NAMESTORE_zone_monitor_start ( 524 const struct GNUNET_CONFIGURATION_Handle *cfg, 525 const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, 526 int iterate_first, 527 GNUNET_SCHEDULER_TaskCallback error_cb, 528 void *error_cb_cls, 529 GNUNET_NAMESTORE_RecordMonitor monitor, 530 void *monitor_cls, 531 GNUNET_SCHEDULER_TaskCallback sync_cb, 532 void *sync_cb_cls); 533 534 /** 535 * Begin monitoring a zone for changes. Will first call the @a 536 * monitor function on all existing records in the selected zone(s) if 537 * @a iterate_first is #GNUNET_YES. In any case, we will then call @a 538 * sync_cb, and then afterwards call the @a monitor whenever a record 539 * changes. If the namestore disconnects, the @a error_cb function is 540 * called with a disconnect event. Once the connection is 541 * re-established, the process begins from the start (depending on @a 542 * iterate_first, we will again first do all existing records, then @a 543 * sync, then updates). 544 * 545 * @param cfg configuration to use to connect to namestore 546 * @param zone zone to monitor, NULL for all zones 547 * @param iterate_first #GNUNET_YES to first iterate over all existing records, 548 * #GNUNET_NO to only return changes that happen from now on 549 * @param error_cb function to call on error (i.e. disconnect); note that 550 * unlike the other error callbacks in this API, a call to this 551 * function does NOT destroy the monitor handle, it merely signals 552 * that monitoring is down. You need to still explicitly call 553 * #GNUNET_NAMESTORE_zone_monitor_stop(). 554 * @param error_cb_cls closure for @a error_cb 555 * @param monitor function to call on zone changes, with an initial limit of 1 556 * @param monitor_cls closure for @a monitor 557 * @param sync_cb function called when we're in sync with the namestore 558 * @param sync_cb_cls closure for @a sync_cb 559 * @param filter the record set filter to use 560 * @return handle to stop monitoring 561 */ 562 struct GNUNET_NAMESTORE_ZoneMonitor * 563 GNUNET_NAMESTORE_zone_monitor_start2 ( 564 const struct GNUNET_CONFIGURATION_Handle *cfg, 565 const struct GNUNET_CRYPTO_BlindablePrivateKey *zone, 566 int iterate_first, 567 GNUNET_SCHEDULER_TaskCallback error_cb, 568 void *error_cb_cls, 569 GNUNET_NAMESTORE_RecordSetMonitor monitor, 570 void *monitor_cls, 571 GNUNET_SCHEDULER_TaskCallback sync_cb, 572 void *sync_cb_cls, 573 enum GNUNET_GNSRECORD_Filter filter); 574 575 576 /** 577 * Calls the monitor processor specified in #GNUNET_NAMESTORE_zone_monitor_start 578 * for the next record(s). This function is used to allow clients that merely 579 * monitor the NAMESTORE to still throttle namestore operations, so we can be 580 * sure that the monitors can keep up. 581 * 582 * Note that #GNUNET_NAMESTORE_records_store() only waits for this 583 * call if the previous limit set by the client was already reached. 584 * Thus, by using a @a limit greater than 1, monitors basically enable 585 * a queue of notifications to be processed asynchronously with some 586 * delay. Note that even with a limit of 1 the 587 * #GNUNET_NAMESTORE_records_store() function will run asynchronously 588 * and the continuation may be invoked before the monitors completed 589 * (or even started) processing the notification. Thus, monitors will 590 * only closely track the current state of the namestore, but not 591 * be involved in the transactions. 592 * 593 * @param zm the monitor 594 * @param limit number of records to return to the iterator in one shot 595 * (before #GNUNET_NAMESTORE_zone_monitor_next is to be called again) 596 */ 597 void 598 GNUNET_NAMESTORE_zone_monitor_next (struct GNUNET_NAMESTORE_ZoneMonitor *zm, 599 uint64_t limit); 600 601 602 /** 603 * Stop monitoring a zone for changes. 604 * 605 * @param zm handle to the monitor activity to stop 606 */ 607 void 608 GNUNET_NAMESTORE_zone_monitor_stop (struct GNUNET_NAMESTORE_ZoneMonitor *zm); 609 610 611 /** 612 * New API draft. Experimental 613 */ 614 615 /** 616 * This function is used to initiate the editing 617 * of a record set under #label. 618 * It will set the editor hint of the record set to #editor_hint. 619 * The editor hint serves as an advisory lock that is used in 620 * #GNUNET_NAMESTORE_EdtirRecordSetBeginCallback if #editor_hint 621 * differs from the currently set advisory lock in the database. 622 * 623 * @param h handle to the namestore 624 * @param pkey the private key of the zone to edit 625 * @param label the label of the record set to edit 626 * @param editor_hint the editor hint to set as advisory lock 627 * @param error_cb the error callback 628 * @param error_cb_cls closure to #error_cb 629 * @param edit_cb the #GNUNET_NAMESTORE_EditRecordSetBeginCallback 630 * @param edit_cb_cls closure to #edit_cb 631 * @return handle to the operation 632 */ 633 struct GNUNET_NAMESTORE_QueueEntry * 634 GNUNET_NAMESTORE_record_set_edit_begin (struct GNUNET_NAMESTORE_Handle *h, 635 const struct 636 GNUNET_CRYPTO_BlindablePrivateKey *pkey, 637 const char *label, 638 const char *editor_hint, 639 GNUNET_NAMESTORE_EditRecordSetBeginCallback 640 edit_cb, 641 void *edit_cb_cls); 642 643 /** 644 * If the current advisory lock is set to the provided editor hint, 645 * this API cancels the editing of a record set and unsets the advisory lock in database. 646 * Optionally, a new editor hint can be provided: For example, 647 * the value that was returned in in the callback to 648 * #GNUNET_NAMESTORE_record_set_edit_begin. 649 * 650 * If provided editor hint does not match the current advisory lock, 651 * this function is not doing anything (NOP). 652 * 653 * @param h handle to the namestore 654 * @param pkey the private key of the zone to edit 655 * @param label the label of the record set to edit 656 * @param editor_hint the editor hint to set as advisory lock 657 * @param editor_hint_replacement the editor hint to set as advisory lock instead of clearing it 658 * @param finished_cb the callback called when cancelled 659 * @param finished_cb_cls closure to #finished_cb 660 * @return handle to the operation 661 */ 662 struct GNUNET_NAMESTORE_QueueEntry * 663 GNUNET_NAMESTORE_record_set_edit_cancel (struct GNUNET_NAMESTORE_Handle *h, 664 const struct 665 GNUNET_CRYPTO_BlindablePrivateKey *pkey 666 , 667 const char *label, 668 const char *editor_hint, 669 const char *editor_hint_replacement, 670 GNUNET_NAMESTORE_ContinuationWithStatus 671 finished_cb, 672 void *finished_cls); 673 674 #if 0 /* keep Emacsens' auto-indent happy */ 675 { 676 #endif 677 #ifdef __cplusplus 678 } 679 #endif 680 681 #endif 682 683 /** @} */ /* end of group */ 684 685 /** @} */ /* end of group addition */