gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-donau] 01/02: [build] comment out plugin_donaudb_postgres.c


From: gnunet
Subject: [taler-donau] 01/02: [build] comment out plugin_donaudb_postgres.c
Date: Mon, 27 Nov 2023 22:54:14 +0100

This is an automated email from the git hooks/post-receive script.

pius-loosli pushed a commit to branch master
in repository donau.

commit 20a98f8426cc90780eab50fa0b93f26e6f038d1f
Author: Pius Loosli <loosp2@bfh.ch>
AuthorDate: Mon Nov 27 22:52:29 2023 +0100

    [build] comment out plugin_donaudb_postgres.c
---
 src/donaudb/plugin_donaudb_postgres.c | 426 +++++++++++++++++-----------------
 1 file changed, 213 insertions(+), 213 deletions(-)

diff --git a/src/donaudb/plugin_donaudb_postgres.c 
b/src/donaudb/plugin_donaudb_postgres.c
index 2e8c7f4..df1a47d 100644
--- a/src/donaudb/plugin_donaudb_postgres.c
+++ b/src/donaudb/plugin_donaudb_postgres.c
@@ -38,233 +38,233 @@
 // #include "pg_get_link_data.h"
 #include "pg_helper.h"
 
-/**
- * Set to 1 to enable Postgres auto_explain module. This will
- * slow down things a _lot_, but also provide extensive logging
- * in the Postgres database logger for performance analysis.
- */
-#define AUTO_EXPLAIN 1
+// /**
+//  * Set to 1 to enable Postgres auto_explain module. This will
+//  * slow down things a _lot_, but also provide extensive logging
+//  * in the Postgres database logger for performance analysis.
+//  */
+// #define AUTO_EXPLAIN 1
 
 
-/**
- * Log a really unexpected PQ error with all the details we can get hold of.
- *
- * @param result PQ result object of the PQ operation that failed
- * @param conn SQL connection that was used
- */
-#define BREAK_DB_ERR(result,conn) do {                                  \
-    GNUNET_break (0);                                                   \
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,                                \
-                "Database failure: %s/%s/%s/%s/%s",                     \
-                PQresultErrorField (result, PG_DIAG_MESSAGE_PRIMARY),   \
-                PQresultErrorField (result, PG_DIAG_MESSAGE_DETAIL),    \
-                PQresultErrorMessage (result),                          \
-                PQresStatus (PQresultStatus (result)),                  \
-                PQerrorMessage (conn));                                 \
-} while (0)
+// /**
+//  * Log a really unexpected PQ error with all the details we can get hold of.
+//  *
+//  * @param result PQ result object of the PQ operation that failed
+//  * @param conn SQL connection that was used
+//  */
+// #define BREAK_DB_ERR(result,conn) do {                                  \
+//     GNUNET_break (0);                                                   \
+//     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,                                \
+//                 "Database failure: %s/%s/%s/%s/%s",                     \
+//                 PQresultErrorField (result, PG_DIAG_MESSAGE_PRIMARY),   \
+//                 PQresultErrorField (result, PG_DIAG_MESSAGE_DETAIL),    \
+//                 PQresultErrorMessage (result),                          \
+//                 PQresStatus (PQresultStatus (result)),                  \
+//                 PQerrorMessage (conn));                                 \
+// } while (0)
 
 
-/**
- * Connect to the database if the connection does not exist yet.
- *
- * @param pg the plugin-specific state
- * @return #GNUNET_OK on success
- */
-enum GNUNET_GenericReturnValue
-TEH_PG_internal_setup (struct PostgresClosure *pg)
-{
-  if (NULL == pg->conn)
-  {
-#if AUTO_EXPLAIN
-    /* Enable verbose logging to see where queries do not
-       properly use indices */
-    struct GNUNET_PQ_ExecuteStatement es[] = {
-      GNUNET_PQ_make_try_execute ("LOAD 'auto_explain';"),
-      GNUNET_PQ_make_try_execute ("SET auto_explain.log_min_duration=50;"),
-      GNUNET_PQ_make_try_execute ("SET auto_explain.log_timing=TRUE;"),
-      GNUNET_PQ_make_try_execute ("SET auto_explain.log_analyze=TRUE;"),
-      /* https://wiki.postgresql.org/wiki/Serializable suggests to really
-         force the default to 'serializable' if SSI is to be used. */
-      GNUNET_PQ_make_try_execute (
-        "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL 
SERIALIZABLE;"),
-      GNUNET_PQ_make_try_execute ("SET enable_sort=OFF;"),
-      GNUNET_PQ_make_try_execute ("SET enable_seqscan=OFF;"),
-      GNUNET_PQ_make_try_execute ("SET search_path TO donau;"),
-      GNUNET_PQ_EXECUTE_STATEMENT_END
-    };
-#else
-    struct GNUNET_PQ_ExecuteStatement es[] = {
-      GNUNET_PQ_make_try_execute (
-        "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL 
SERIALIZABLE;"),
-      GNUNET_PQ_make_try_execute ("SET enable_sort=OFF;"),
-      GNUNET_PQ_make_try_execute ("SET enable_seqscan=OFF;"),
-      GNUNET_PQ_make_try_execute ("SET autocommit=OFF;"),
-      GNUNET_PQ_make_try_execute ("SET search_path TO donau;"),
-      GNUNET_PQ_EXECUTE_STATEMENT_END
-    };
-#endif
-    struct GNUNET_PQ_Context *db_conn;
+// /**
+//  * Connect to the database if the connection does not exist yet.
+//  *
+//  * @param pg the plugin-specific state
+//  * @return #GNUNET_OK on success
+//  */
+// enum GNUNET_GenericReturnValue
+// TEH_PG_internal_setup (struct PostgresClosure *pg)
+// {
+//   if (NULL == pg->conn)
+//   {
+// #if AUTO_EXPLAIN
+//     /* Enable verbose logging to see where queries do not
+//        properly use indices */
+//     struct GNUNET_PQ_ExecuteStatement es[] = {
+//       GNUNET_PQ_make_try_execute ("LOAD 'auto_explain';"),
+//       GNUNET_PQ_make_try_execute ("SET auto_explain.log_min_duration=50;"),
+//       GNUNET_PQ_make_try_execute ("SET auto_explain.log_timing=TRUE;"),
+//       GNUNET_PQ_make_try_execute ("SET auto_explain.log_analyze=TRUE;"),
+//       /* https://wiki.postgresql.org/wiki/Serializable suggests to really
+//          force the default to 'serializable' if SSI is to be used. */
+//       GNUNET_PQ_make_try_execute (
+//         "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL 
SERIALIZABLE;"),
+//       GNUNET_PQ_make_try_execute ("SET enable_sort=OFF;"),
+//       GNUNET_PQ_make_try_execute ("SET enable_seqscan=OFF;"),
+//       GNUNET_PQ_make_try_execute ("SET search_path TO donau;"),
+//       GNUNET_PQ_EXECUTE_STATEMENT_END
+//     };
+// #else
+//     struct GNUNET_PQ_ExecuteStatement es[] = {
+//       GNUNET_PQ_make_try_execute (
+//         "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL 
SERIALIZABLE;"),
+//       GNUNET_PQ_make_try_execute ("SET enable_sort=OFF;"),
+//       GNUNET_PQ_make_try_execute ("SET enable_seqscan=OFF;"),
+//       GNUNET_PQ_make_try_execute ("SET autocommit=OFF;"),
+//       GNUNET_PQ_make_try_execute ("SET search_path TO donau;"),
+//       GNUNET_PQ_EXECUTE_STATEMENT_END
+//     };
+// #endif
+//     struct GNUNET_PQ_Context *db_conn;
 
-    db_conn = GNUNET_PQ_connect_with_cfg (pg->cfg,
-                                          "donaudb-postgres",
-                                          NULL,
-                                          es,
-                                          NULL);
-    if (NULL == db_conn)
-      return GNUNET_SYSERR;
+//     db_conn = GNUNET_PQ_connect_with_cfg (pg->cfg,
+//                                           "donaudb-postgres",
+//                                           NULL,
+//                                           es,
+//                                           NULL);
+//     if (NULL == db_conn)
+//       return GNUNET_SYSERR;
 
-    pg->prep_gen++;
-    pg->conn = db_conn;
-  }
-  if (NULL == pg->transaction_name)
-    GNUNET_PQ_reconnect_if_down (pg->conn);
-  return GNUNET_OK;
-}
+//     pg->prep_gen++;
+//     pg->conn = db_conn;
+//   }
+//   if (NULL == pg->transaction_name)
+//     GNUNET_PQ_reconnect_if_down (pg->conn);
+//   return GNUNET_OK;
+// }
 
 
-/**
- * Initialize Postgres database subsystem.
- *
- * @param cls a configuration instance
- * @return NULL on error, otherwise a `struct
- *         DONAUDB_Plugin`
- */
-void *
-libtaler_plugin_donaudb_postgres_init (void *cls)
-{
-  const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
-  struct PostgresClosure *pg;
-  struct DONAUDB_Plugin *plugin;
-  unsigned long long dpl;
+// /**
+//  * Initialize Postgres database subsystem.
+//  *
+//  * @param cls a configuration instance
+//  * @return NULL on error, otherwise a `struct
+//  *         DONAUDB_Plugin`
+//  */
+// void *
+// libtaler_plugin_donaudb_postgres_init (void *cls)
+// {
+//   const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
+//   struct PostgresClosure *pg;
+//   struct DONAUDB_Plugin *plugin;
+//   unsigned long long dpl;
 
-  pg = GNUNET_new (struct PostgresClosure);
-  pg->cfg = cfg;
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_filename (cfg,
-                                               "donaudb-postgres",
-                                               "SQL_DIR",
-                                               &pg->sql_dir))
-  {
-    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                               "donaudb-postgres",
-                               "SQL_DIR");
-    GNUNET_free (pg);
-    return NULL;
-  }
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_string (cfg,
-                                             "donau",
-                                             "BASE_URL",
-                                             &pg->donau_url))
-  {
-    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                               "donau",
-                               "BASE_URL");
-    GNUNET_free (pg->sql_dir);
-    GNUNET_free (pg);
-    return NULL;
-  }
-  if ( (GNUNET_OK !=
-        GNUNET_CONFIGURATION_get_value_time (cfg,
-                                             "donaudb",
-                                             "IDLE_RESERVE_EXPIRATION_TIME",
-                                             
&pg->idle_reserve_expiration_time))
-       ||
-       (GNUNET_OK !=
-        GNUNET_CONFIGURATION_get_value_time (cfg,
-                                             "donaudb",
-                                             "LEGAL_RESERVE_EXPIRATION_TIME",
-                                             
&pg->legal_reserve_expiration_time)) )
-  {
-    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                               "donaudb",
-                               "LEGAL/IDLE_RESERVE_EXPIRATION_TIME");
-    GNUNET_free (pg->donau_url);
-    GNUNET_free (pg->sql_dir);
-    GNUNET_free (pg);
-    return NULL;
-  }
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_time (cfg,
-                                           "donaudb",
-                                           "AGGREGATOR_SHIFT",
-                                           &pg->aggregator_shift))
-  {
-    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
-                               "donaudb",
-                               "AGGREGATOR_SHIFT");
-  }
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_number (cfg,
-                                             "donaudb",
-                                             "DEFAULT_PURSE_LIMIT",
-                                             &dpl))
-  {
-    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
-                               "donaudb",
-                               "DEFAULT_PURSE_LIMIT");
-    pg->def_purse_limit = 1;
-  }
-  else
-  {
-    pg->def_purse_limit = (uint32_t) dpl;
-  }
+//   pg = GNUNET_new (struct PostgresClosure);
+//   pg->cfg = cfg;
+//   if (GNUNET_OK !=
+//       GNUNET_CONFIGURATION_get_value_filename (cfg,
+//                                                "donaudb-postgres",
+//                                                "SQL_DIR",
+//                                                &pg->sql_dir))
+//   {
+//     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+//                                "donaudb-postgres",
+//                                "SQL_DIR");
+//     GNUNET_free (pg);
+//     return NULL;
+//   }
+//   if (GNUNET_OK !=
+//       GNUNET_CONFIGURATION_get_value_string (cfg,
+//                                              "donau",
+//                                              "BASE_URL",
+//                                              &pg->donau_url))
+//   {
+//     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+//                                "donau",
+//                                "BASE_URL");
+//     GNUNET_free (pg->sql_dir);
+//     GNUNET_free (pg);
+//     return NULL;
+//   }
+//   if ( (GNUNET_OK !=
+//         GNUNET_CONFIGURATION_get_value_time (cfg,
+//                                              "donaudb",
+//                                              "IDLE_RESERVE_EXPIRATION_TIME",
+//                                              
&pg->idle_reserve_expiration_time))
+//        ||
+//        (GNUNET_OK !=
+//         GNUNET_CONFIGURATION_get_value_time (cfg,
+//                                              "donaudb",
+//                                              
"LEGAL_RESERVE_EXPIRATION_TIME",
+//                                              
&pg->legal_reserve_expiration_time)) )
+//   {
+//     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+//                                "donaudb",
+//                                "LEGAL/IDLE_RESERVE_EXPIRATION_TIME");
+//     GNUNET_free (pg->donau_url);
+//     GNUNET_free (pg->sql_dir);
+//     GNUNET_free (pg);
+//     return NULL;
+//   }
+//   if (GNUNET_OK !=
+//       GNUNET_CONFIGURATION_get_value_time (cfg,
+//                                            "donaudb",
+//                                            "AGGREGATOR_SHIFT",
+//                                            &pg->aggregator_shift))
+//   {
+//     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
+//                                "donaudb",
+//                                "AGGREGATOR_SHIFT");
+//   }
+//   if (GNUNET_OK !=
+//       GNUNET_CONFIGURATION_get_value_number (cfg,
+//                                              "donaudb",
+//                                              "DEFAULT_PURSE_LIMIT",
+//                                              &dpl))
+//   {
+//     GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
+//                                "donaudb",
+//                                "DEFAULT_PURSE_LIMIT");
+//     pg->def_purse_limit = 1;
+//   }
+//   else
+//   {
+//     pg->def_purse_limit = (uint32_t) dpl;
+//   }
 
-  if (GNUNET_OK !=
-      TALER_config_get_currency (cfg,
-                                 &pg->currency))
-  {
-    GNUNET_free (pg->donau_url);
-    GNUNET_free (pg->sql_dir);
-    GNUNET_free (pg);
-    return NULL;
-  }
-  if (GNUNET_OK !=
-      TEH_PG_internal_setup (pg))
-  {
-    GNUNET_free (pg->donau_url);
-    GNUNET_free (pg->currency);
-    GNUNET_free (pg->sql_dir);
-    GNUNET_free (pg);
-    return NULL;
-  }
-  plugin = GNUNET_new (struct DONAUDB_Plugin);
-  plugin->cls = pg;
-  plugin->do_reserve_open
-    = &TEH_PG_do_reserve_open;
-  plugin->drop_tables
-    = &TEH_PG_drop_tables;
-  plugin->do_withdraw
-    = &TEH_PG_do_withdraw;
+//   if (GNUNET_OK !=
+//       TALER_config_get_currency (cfg,
+//                                  &pg->currency))
+//   {
+//     GNUNET_free (pg->donau_url);
+//     GNUNET_free (pg->sql_dir);
+//     GNUNET_free (pg);
+//     return NULL;
+//   }
+//   if (GNUNET_OK !=
+//       TEH_PG_internal_setup (pg))
+//   {
+//     GNUNET_free (pg->donau_url);
+//     GNUNET_free (pg->currency);
+//     GNUNET_free (pg->sql_dir);
+//     GNUNET_free (pg);
+//     return NULL;
+//   }
+//   plugin = GNUNET_new (struct DONAUDB_Plugin);
+//   plugin->cls = pg;
+//   plugin->do_reserve_open
+//     = &TEH_PG_do_reserve_open;
+//   plugin->drop_tables
+//     = &TEH_PG_drop_tables;
+//   plugin->do_withdraw
+//     = &TEH_PG_do_withdraw;
 
-  return plugin;
-}
+//   return plugin;
+// }
 
 
-/**
- * Shutdown Postgres database subsystem.
- *
- * @param cls a `struct DONAUDB_Plugin`
- * @return NULL (always)
- */
-void *
-libtaler_plugin_donaudb_postgres_done (void *cls)
-{
-  struct DONAUDB_Plugin *plugin = cls;
-  struct PostgresClosure *pg = plugin->cls;
+// /**
+//  * Shutdown Postgres database subsystem.
+//  *
+//  * @param cls a `struct DONAUDB_Plugin`
+//  * @return NULL (always)
+//  */
+// void *
+// libtaler_plugin_donaudb_postgres_done (void *cls)
+// {
+//   struct DONAUDB_Plugin *plugin = cls;
+//   struct PostgresClosure *pg = plugin->cls;
 
-  if (NULL != pg->conn)
-  {
-    GNUNET_PQ_disconnect (pg->conn);
-    pg->conn = NULL;
-  }
-  GNUNET_free (pg->donau_url);
-  GNUNET_free (pg->sql_dir);
-  GNUNET_free (pg->currency);
-  GNUNET_free (pg);
-  GNUNET_free (plugin);
-  return NULL;
-}
+//   if (NULL != pg->conn)
+//   {
+//     GNUNET_PQ_disconnect (pg->conn);
+//     pg->conn = NULL;
+//   }
+//   GNUNET_free (pg->donau_url);
+//   GNUNET_free (pg->sql_dir);
+//   GNUNET_free (pg->currency);
+//   GNUNET_free (pg);
+//   GNUNET_free (plugin);
+//   return NULL;
+// }
 
 
 /* end of plugin_donaudb_postgres.c */

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]