diff options
Diffstat (limited to 'src/namestore/plugin_namestore_postgres.c')
-rw-r--r-- | src/namestore/plugin_namestore_postgres.c | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c index 378a88f51..a9c19d517 100644 --- a/src/namestore/plugin_namestore_postgres.c +++ b/src/namestore/plugin_namestore_postgres.c | |||
@@ -518,80 +518,6 @@ database_shutdown (struct Plugin *plugin) | |||
518 | 518 | ||
519 | 519 | ||
520 | /** | 520 | /** |
521 | * Start a transaction. | ||
522 | * | ||
523 | * @param cls closure | ||
524 | * @return #GNUNET_OK on success, #GNUNET_NO if transactions are not supported, | ||
525 | * #GNUNET_SYSERR on internal errors | ||
526 | */ | ||
527 | static int | ||
528 | namestore_postgres_begin_transaction (void *cls) | ||
529 | { | ||
530 | struct Plugin *plugin = cls; | ||
531 | PGresult *result; | ||
532 | ExecStatusType ex; | ||
533 | |||
534 | result = PQexec (plugin->dbh, | ||
535 | "START TRANSACTION ISOLATION LEVEL SERIALIZABLE"); | ||
536 | if (PGRES_COMMAND_OK != | ||
537 | (ex = PQresultStatus (result))) | ||
538 | { | ||
539 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
540 | "Failed to start transaction (%s): %s\n", | ||
541 | PQresStatus (ex), | ||
542 | PQerrorMessage (plugin->dbh)); | ||
543 | GNUNET_break (0); | ||
544 | PQclear (result); | ||
545 | return GNUNET_SYSERR; | ||
546 | } | ||
547 | PQclear (result); | ||
548 | return GNUNET_OK; | ||
549 | } | ||
550 | |||
551 | |||
552 | /** | ||
553 | * Try to commit a transaction. | ||
554 | * | ||
555 | * @param cls closure | ||
556 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | ||
557 | */ | ||
558 | static int | ||
559 | namestore_postgres_commit_transaction (void *cls) | ||
560 | { | ||
561 | struct Plugin *plugin = cls; | ||
562 | PGresult *result; | ||
563 | ExecStatusType status; | ||
564 | int ret; | ||
565 | |||
566 | result = PQexec (plugin->dbh, | ||
567 | "COMMIT"); | ||
568 | status = PQresultStatus (result); | ||
569 | ret = (PGRES_COMMAND_OK == status) ? GNUNET_OK : GNUNET_SYSERR; | ||
570 | PQclear (result); | ||
571 | return ret; | ||
572 | } | ||
573 | |||
574 | |||
575 | /** | ||
576 | * Rollback a transaction. | ||
577 | * | ||
578 | * @param cls closure | ||
579 | */ | ||
580 | static void | ||
581 | namestore_postgres_rollback_transaction (void *cls) | ||
582 | { | ||
583 | struct Plugin *plugin = cls; | ||
584 | PGresult *result; | ||
585 | |||
586 | result = PQexec (plugin->dbh, | ||
587 | "ROLLBACK"); | ||
588 | GNUNET_break (PGRES_COMMAND_OK == | ||
589 | PQresultStatus (result)); | ||
590 | PQclear (result); | ||
591 | } | ||
592 | |||
593 | |||
594 | /** | ||
595 | * Entry point for the plugin. | 521 | * Entry point for the plugin. |
596 | * | 522 | * |
597 | * @param cls the `struct GNUNET_NAMESTORE_PluginEnvironment*` | 523 | * @param cls the `struct GNUNET_NAMESTORE_PluginEnvironment*` |
@@ -619,9 +545,6 @@ libgnunet_plugin_namestore_postgres_init (void *cls) | |||
619 | api->iterate_records = &namestore_postgres_iterate_records; | 545 | api->iterate_records = &namestore_postgres_iterate_records; |
620 | api->zone_to_name = &namestore_postgres_zone_to_name; | 546 | api->zone_to_name = &namestore_postgres_zone_to_name; |
621 | api->lookup_records = &namestore_postgres_lookup_records; | 547 | api->lookup_records = &namestore_postgres_lookup_records; |
622 | api->begin_transaction = &namestore_postgres_begin_transaction; | ||
623 | api->commit_transaction = &namestore_postgres_commit_transaction; | ||
624 | api->rollback_transaction = &namestore_postgres_rollback_transaction; | ||
625 | LOG (GNUNET_ERROR_TYPE_INFO, | 548 | LOG (GNUNET_ERROR_TYPE_INFO, |
626 | "Postgres namestore plugin running\n"); | 549 | "Postgres namestore plugin running\n"); |
627 | return api; | 550 | return api; |