aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_namestore_service.h
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-03-21 13:54:28 +0100
committerMartin Schanzenbach <schanzen@gnunet.org>2022-03-21 13:54:28 +0100
commit4e95b59a6f3cd35c9c1b5dcdc6320f0e0dfef79b (patch)
tree22f87fcea0ea417a7a3ca8b900c3e6c891c28088 /src/include/gnunet_namestore_service.h
parentec8a825b0e56c692c4879db10c6b25cd26bb42e4 (diff)
downloadgnunet-4e95b59a6f3cd35c9c1b5dcdc6320f0e0dfef79b.tar.gz
gnunet-4e95b59a6f3cd35c9c1b5dcdc6320f0e0dfef79b.zip
NAMESTORE: Towards new transaction-based API
Diffstat (limited to 'src/include/gnunet_namestore_service.h')
-rw-r--r--src/include/gnunet_namestore_service.h156
1 files changed, 101 insertions, 55 deletions
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h
index 619b81aed..86572803f 100644
--- a/src/include/gnunet_namestore_service.h
+++ b/src/include/gnunet_namestore_service.h
@@ -212,61 +212,6 @@ GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h,
212 212
213 213
214/** 214/**
215 * Open a record set for editing.
216 * Retrieves an exclusive lock on this set.
217 * Must be commited using @a GNUNET_NAMESTORE_records_commit
218 *
219 * @param h handle to the namestore
220 * @param pkey private key of the zone
221 * @param label name that is being mapped
222 * @param error_cb function to call on error (i.e. disconnect or unable to get lock)
223 * the handle is afterwards invalid
224 * @param error_cb_cls closure for @a error_cb
225 * @param rm function to call with the result (with 0 records if we don't have that label)
226 * @param rm_cls closure for @a rm
227 * @return handle to abort the request
228 */
229struct GNUNET_NAMESTORE_QueueEntry *
230GNUNET_NAMESTORE_records_open (struct GNUNET_NAMESTORE_Handle *h,
231 const struct
232 GNUNET_IDENTITY_PrivateKey *pkey,
233 const char *label,
234 GNUNET_SCHEDULER_TaskCallback error_cb,
235 void *error_cb_cls,
236 GNUNET_NAMESTORE_RecordMonitor rm,
237 void *rm_cls);
238
239/**
240 * Commit the record set to the namestore.
241 * Releases the lock on the record set.
242 * Use an empty array to
243 * remove all records under the given name.
244 *
245 * The continuation is called after the value has been stored in the
246 * database. Monitors may be notified asynchronously (basically with
247 * a buffer). However, if any monitor is consistently too slow to
248 * keep up with the changes, calling @a cont will be delayed until the
249 * monitors do keep up.
250 *
251 * @param h handle to the namestore
252 * @param pkey private key of the zone
253 * @param label name that is being mapped
254 * @param rd_count number of records in the 'rd' array
255 * @param rd array of records with data to store
256 * @param cont continuation to call when done
257 * @param cont_cls closure for @a cont
258 * @return handle to abort the request
259 */
260struct GNUNET_NAMESTORE_QueueEntry *
261GNUNET_NAMESTORE_records_commit (struct GNUNET_NAMESTORE_Handle *h,
262 const struct GNUNET_IDENTITY_PrivateKey *pkey,
263 const char *label,
264 unsigned int rd_count,
265 const struct GNUNET_GNSRECORD_Data *rd,
266 GNUNET_NAMESTORE_ContinuationWithStatus cont,
267 void *cont_cls);
268
269/**
270 * Look for an existing PKEY delegation record for a given public key. 215 * Look for an existing PKEY delegation record for a given public key.
271 * Returns at most one result to the processor. 216 * Returns at most one result to the processor.
272 * 217 *
@@ -448,6 +393,107 @@ void
448GNUNET_NAMESTORE_zone_monitor_stop (struct GNUNET_NAMESTORE_ZoneMonitor *zm); 393GNUNET_NAMESTORE_zone_monitor_stop (struct GNUNET_NAMESTORE_ZoneMonitor *zm);
449 394
450 395
396/**
397 * New API draft. Experimental
398 */
399
400/**
401 * Begin a namestore transaction.
402 *
403 * @param h handle to the namestore
404 * @param error_cb function to call on error (i.e. disconnect or unable to get lock)
405 * the handle is afterwards invalid
406 * @param error_cb_cls closure for @a error_cb
407 * @return handle to abort the request
408 */
409struct GNUNET_NAMESTORE_QueueEntry *
410GNUNET_NAMESTORE_transaction_begin (struct GNUNET_NAMESTORE_Handle *h,
411 GNUNET_SCHEDULER_TaskCallback error_cb,
412 void *error_cb_cls);
413
414/**
415 * Begin rollback all actions in a transaction.
416 * Reverts all actions performed since #GNUNET_NAMESTORE_transaction_begin
417 *
418 * @param h handle to the namestore
419 * @param error_cb function to call on error (i.e. disconnect or unable to get lock)
420 * the handle is afterwards invalid
421 * @param error_cb_cls closure for @a error_cb
422 * @return handle to abort the request
423 */
424struct GNUNET_NAMESTORE_QueueEntry *
425GNUNET_NAMESTORE_transaction_abort (struct GNUNET_NAMESTORE_Handle *h,
426 GNUNET_SCHEDULER_TaskCallback error_cb,
427 void *error_cb_cls);
428/**
429 * Commit a namestore transaction.
430 * Saves all actions performed since #GNUNET_NAMESTORE_transaction_begin
431 *
432 * @param h handle to the namestore
433 * @param error_cb function to call on error (i.e. disconnect or unable to get lock)
434 * the handle is afterwards invalid
435 * @param error_cb_cls closure for @a error_cb
436 * @return handle to abort the request
437 */
438struct GNUNET_NAMESTORE_QueueEntry *
439GNUNET_NAMESTORE_transaction_commit (struct GNUNET_NAMESTORE_Handle *h,
440 GNUNET_SCHEDULER_TaskCallback error_cb,
441 void *error_cb_cls);
442
443/**
444 * Lookup an item in the namestore.
445 *
446 * @param h handle to the namestore
447 * @param pkey private key of the zone
448 * @param label name that is being mapped
449 * @param error_cb function to call on error (i.e. disconnect)
450 * the handle is afterwards invalid
451 * @param error_cb_cls closure for @a error_cb
452 * @param rm function to call with the result (with 0 records if we don't have that label);
453 * the handle is afterwards invalid
454 * @param rm_cls closure for @a rm
455 * @return handle to abort the request
456 */
457struct GNUNET_NAMESTORE_QueueEntry *
458GNUNET_NAMESTORE_records_select (struct GNUNET_NAMESTORE_Handle *h,
459 const struct
460 GNUNET_IDENTITY_PrivateKey *pkey,
461 const char *label,
462 GNUNET_SCHEDULER_TaskCallback error_cb,
463 void *error_cb_cls,
464 GNUNET_NAMESTORE_RecordMonitor rm,
465 void *rm_cls);
466
467
468/**
469 * Creates, deletes or updates an item in the namestore.
470 * If the item is already present, it is replaced with the new record set.
471 * Use an empty array to remove all records under the given name.
472 *
473 * The continuation is called after the value has been stored in the
474 * database. Monitors may be notified asynchronously (basically with
475 * a buffer). However, if any monitor is consistently too slow to
476 * keep up with the changes, calling @a cont will be delayed until the
477 * monitors do keep up.
478 *
479 * @param h handle to the namestore
480 * @param pkey private key of the zone
481 * @param label name that is being mapped
482 * @param rd_count number of records in the 'rd' array
483 * @param rd array of records with data to store
484 * @param cont continuation to call when done
485 * @param cont_cls closure for @a cont
486 * @return handle to abort the request
487 */
488struct GNUNET_NAMESTORE_QueueEntry *
489GNUNET_NAMESTORE_records_replace (struct GNUNET_NAMESTORE_Handle *h,
490 const struct GNUNET_IDENTITY_PrivateKey *pkey,
491 const char *label,
492 unsigned int rd_count,
493 const struct GNUNET_GNSRECORD_Data *rd,
494 GNUNET_NAMESTORE_ContinuationWithStatus cont,
495 void *cont_cls);
496
451#if 0 /* keep Emacsens' auto-indent happy */ 497#if 0 /* keep Emacsens' auto-indent happy */
452{ 498{
453#endif 499#endif