aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_namestore_service.h
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-09-23 12:44:45 +0900
committerMartin Schanzenbach <schanzen@gnunet.org>2022-09-23 12:44:45 +0900
commit52babbd648cd8b9ab7f49f26641f8ccf7d2fc4e8 (patch)
treef49953af9a446eab96a985e7e3f58ef948bc5011 /src/include/gnunet_namestore_service.h
parent127ad07a3abaee00fb206aaf8b980f258d2933c8 (diff)
downloadgnunet-52babbd648cd8b9ab7f49f26641f8ccf7d2fc4e8.tar.gz
gnunet-52babbd648cd8b9ab7f49f26641f8ccf7d2fc4e8.zip
NAMESTORE: Add begin, commit and rollback API messages
Namestore service can now handle begin commit and rollback. A test for rollback exists and works for sqlite.
Diffstat (limited to 'src/include/gnunet_namestore_service.h')
-rw-r--r--src/include/gnunet_namestore_service.h40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h
index 8b42945e1..68aeebef8 100644
--- a/src/include/gnunet_namestore_service.h
+++ b/src/include/gnunet_namestore_service.h
@@ -70,6 +70,16 @@ struct GNUNET_NAMESTORE_Handle;
70 */ 70 */
71struct GNUNET_NAMESTORE_ZoneIterator; 71struct GNUNET_NAMESTORE_ZoneIterator;
72 72
73/**
74 * Transaction control types.
75 * They roughly correspond to DB transaction controls
76 */
77enum GNUNET_NAMESTORE_TxControl
78{
79 GNUNET_NAMESTORE_TX_BEGIN = 0,
80 GNUNET_NAMESTORE_TX_COMMIT = 1,
81 GNUNET_NAMESTORE_TX_ROLLBACK = 2,
82};
73 83
74/** 84/**
75 * Connect to the namestore service. 85 * Connect to the namestore service.
@@ -404,44 +414,44 @@ GNUNET_NAMESTORE_zone_monitor_stop (struct GNUNET_NAMESTORE_ZoneMonitor *zm);
404 * Begin a namestore transaction. 414 * Begin a namestore transaction.
405 * 415 *
406 * @param h handle to the namestore 416 * @param h handle to the namestore
407 * @param error_cb function to call on error (i.e. disconnect or unable to get lock) 417 * @param cont function to call on result
408 * the handle is afterwards invalid 418 * @param cont_cls closure for @a cont
409 * @param error_cb_cls closure for @a error_cb
410 * @return handle to abort the request 419 * @return handle to abort the request
411 */ 420 */
412struct GNUNET_NAMESTORE_QueueEntry * 421struct GNUNET_NAMESTORE_QueueEntry *
413GNUNET_NAMESTORE_transaction_begin (struct GNUNET_NAMESTORE_Handle *h, 422GNUNET_NAMESTORE_transaction_begin (struct GNUNET_NAMESTORE_Handle *h,
414 GNUNET_SCHEDULER_TaskCallback error_cb, 423 GNUNET_NAMESTORE_ContinuationWithStatus
415 void *error_cb_cls); 424 cont,
425 void *cont_cls);
416 426
417/** 427/**
418 * Begin rollback all actions in a transaction. 428 * Begin rollback all actions in a transaction.
419 * Reverts all actions performed since #GNUNET_NAMESTORE_transaction_begin 429 * Reverts all actions performed since #GNUNET_NAMESTORE_transaction_begin
420 * 430 *
421 * @param h handle to the namestore 431 * @param h handle to the namestore
422 * @param error_cb function to call on error (i.e. disconnect or unable to get lock) 432 * @param cont function to call on result
423 * the handle is afterwards invalid 433 * @param cont_cls closure for @a cont
424 * @param error_cb_cls closure for @a error_cb
425 * @return handle to abort the request 434 * @return handle to abort the request
426 */ 435 */
427struct GNUNET_NAMESTORE_QueueEntry * 436struct GNUNET_NAMESTORE_QueueEntry *
428GNUNET_NAMESTORE_transaction_rollback (struct GNUNET_NAMESTORE_Handle *h, 437GNUNET_NAMESTORE_transaction_rollback (struct GNUNET_NAMESTORE_Handle *h,
429 GNUNET_SCHEDULER_TaskCallback error_cb, 438 GNUNET_NAMESTORE_ContinuationWithStatus
430 void *error_cb_cls); 439 cont,
440 void *cont_cls);
431/** 441/**
432 * Commit a namestore transaction. 442 * Commit a namestore transaction.
433 * Saves all actions performed since #GNUNET_NAMESTORE_transaction_begin 443 * Saves all actions performed since #GNUNET_NAMESTORE_transaction_begin
434 * 444 *
435 * @param h handle to the namestore 445 * @param h handle to the namestore
436 * @param error_cb function to call on error (i.e. disconnect or unable to get lock) 446 * @param cont function to call on result
437 * the handle is afterwards invalid 447 * @param cont_cls closure for @a cont
438 * @param error_cb_cls closure for @a error_cb
439 * @return handle to abort the request 448 * @return handle to abort the request
440 */ 449 */
441struct GNUNET_NAMESTORE_QueueEntry * 450struct GNUNET_NAMESTORE_QueueEntry *
442GNUNET_NAMESTORE_transaction_commit (struct GNUNET_NAMESTORE_Handle *h, 451GNUNET_NAMESTORE_transaction_commit (struct GNUNET_NAMESTORE_Handle *h,
443 GNUNET_SCHEDULER_TaskCallback error_cb, 452 GNUNET_NAMESTORE_ContinuationWithStatus
444 void *error_cb_cls); 453 cont,
454 void *cont_cls);
445 455
446#if 0 /* keep Emacsens' auto-indent happy */ 456#if 0 /* keep Emacsens' auto-indent happy */
447{ 457{