sync

Backup service to store encrypted wallet databases (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit 8358eb0b86f0fa5c4a413d9cd107cb971d0b256c
parent dccc84c000236df34ec4fed294e72ec69847689c
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 18 Feb 2024 16:05:45 +0100

doxygen fixes, remove test commands obsoleted by taler-unified-setup

Diffstat:
Mcontrib/Makefile.am | 2++
Mcontrib/microhttpd.tag | 6++++++
Acontrib/taler-exchange.tag | 119+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdoc/doxygen/sync.doxy | 2+-
Msrc/include/sync_testing_lib.h | 27---------------------------
Msrc/syncdb/plugin_syncdb_postgres.c | 12++++++------
Msrc/testing/Makefile.am | 1-
Msrc/testing/testing_api_cmd_backup_upload.c | 2+-
Dsrc/testing/testing_api_helpers.c | 196-------------------------------------------------------------------------------
9 files changed, 135 insertions(+), 232 deletions(-)

diff --git a/contrib/Makefile.am b/contrib/Makefile.am @@ -8,5 +8,7 @@ bin_SCRIPTS = \ EXTRA_DIST = \ $(bin_SCRIPTS) \ gnunet.tag \ + microhttpd.tag \ + taler-exchange.tag \ uncrustify.cfg \ uncrustify_precommit diff --git a/contrib/microhttpd.tag b/contrib/microhttpd.tag @@ -64,6 +64,12 @@ <anchorfile>microhttpd.h</anchorfile> <arglist></arglist> </member> + <member kind="define"> + <type>function</type> + <name>MHD_run</name> + <anchorfile>microhttpd.h</anchorfile> + <arglist></arglist> + </member> <member kind="typedef"> <type>int</type> <name>MHD_AccessHandlerCallback</name> diff --git a/contrib/taler-exchange.tag b/contrib/taler-exchange.tag @@ -0,0 +1,118 @@ +<?xml version='1.0' encoding='UTF-8' standalone='yes' ?> +<tagfile doxygen_version="1.9.4"> + <compound kind="file"> + <name>taler_error_codes.h</name> + <path>/research/taler/exchange/src/include/</path> + <filename>d5/dcb/taler__error__codes_8h.html</filename> + <member kind="enumeration"> + <type></type> + <name>TALER_ErrorCode</name> + <anchorfile>d5/dcb/taler__error__codes_8h.html</anchorfile> + <anchor>a05ff23648cb502e6128a53a5aef8d49a</anchor> + <arglist></arglist> + </member> + <member kind="enumvalue"> + <name>TALER_EC_SYNC_ACCOUNT_UNKNOWN</name> + <anchorfile>d5/dcb/taler__error__codes_8h.html</anchorfile> + <anchor>a05ff23648cb502e6128a53a5aef8d49aaeffc5c26407ed73d7638a5588de7c1dd</anchor> + <arglist></arglist> + </member> + <member kind="enumvalue"> + <name>TALER_EC_SYNC_BAD_IF_NONE_MATCH</name> + <anchorfile>d5/dcb/taler__error__codes_8h.html</anchorfile> + <anchor>a05ff23648cb502e6128a53a5aef8d49aab4c0f2469a013643db71e9d1093a17f0</anchor> + <arglist></arglist> + </member> + <member kind="enumvalue"> + <name>TALER_EC_SYNC_BAD_IF_MATCH</name> + <anchorfile>d5/dcb/taler__error__codes_8h.html</anchorfile> + <anchor>a05ff23648cb502e6128a53a5aef8d49aa5deccc6c9d196e9a5d15d2b9e8a462ab</anchor> + <arglist></arglist> + </member> + <member kind="enumvalue"> + <name>TALER_EC_SYNC_BAD_SYNC_SIGNATURE</name> + <anchorfile>d5/dcb/taler__error__codes_8h.html</anchorfile> + <anchor>a05ff23648cb502e6128a53a5aef8d49aa6c88e2f7b362aa75422e188c205501d3</anchor> + <arglist></arglist> + </member> + <member kind="enumvalue"> + <name>TALER_EC_SYNC_INVALID_SIGNATURE</name> + <anchorfile>d5/dcb/taler__error__codes_8h.html</anchorfile> + <anchor>a05ff23648cb502e6128a53a5aef8d49aa0c79eda43c2de90e28521b466bfeb958</anchor> + <arglist></arglist> + </member> + <member kind="enumvalue"> + <name>TALER_EC_SYNC_MALFORMED_CONTENT_LENGTH</name> + <anchorfile>d5/dcb/taler__error__codes_8h.html</anchorfile> + <anchor>a05ff23648cb502e6128a53a5aef8d49aaa811843c4362e3b91ff16563a7f11a9f</anchor> + <arglist></arglist> + </member> + <member kind="enumvalue"> + <name>TALER_EC_SYNC_EXCESSIVE_CONTENT_LENGTH</name> + <anchorfile>d5/dcb/taler__error__codes_8h.html</anchorfile> + <anchor>a05ff23648cb502e6128a53a5aef8d49aac67bcfb7de5cd35d554280caaec494f9</anchor> + <arglist></arglist> + </member> + <member kind="enumvalue"> + <name>TALER_EC_SYNC_OUT_OF_MEMORY_ON_CONTENT_LENGTH</name> + <anchorfile>d5/dcb/taler__error__codes_8h.html</anchorfile> + <anchor>a05ff23648cb502e6128a53a5aef8d49aa8dced986853a382e1fe1478cd4115d57</anchor> + <arglist></arglist> + </member> + <member kind="enumvalue"> + <name>TALER_EC_SYNC_INVALID_UPLOAD</name> + <anchorfile>d5/dcb/taler__error__codes_8h.html</anchorfile> + <anchor>a05ff23648cb502e6128a53a5aef8d49aa4ad086f449ddbabebd4c09af46054728</anchor> + <arglist></arglist> + </member> + <member kind="enumvalue"> + <name>TALER_EC_SYNC_PAYMENT_GENERIC_TIMEOUT</name> + <anchorfile>d5/dcb/taler__error__codes_8h.html</anchorfile> + <anchor>a05ff23648cb502e6128a53a5aef8d49aacdf25dccb3b6e11b8705f1954e881aac</anchor> + <arglist></arglist> + </member> + <member kind="enumvalue"> + <name>TALER_EC_SYNC_PAYMENT_CREATE_BACKEND_ERROR</name> + <anchorfile>d5/dcb/taler__error__codes_8h.html</anchorfile> + <anchor>a05ff23648cb502e6128a53a5aef8d49aabbb8e55ff86dbe38c25747fadb64e2a6</anchor> + <arglist></arglist> + </member> + <member kind="enumvalue"> + <name>TALER_EC_SYNC_PREVIOUS_BACKUP_UNKNOWN</name> + <anchorfile>d5/dcb/taler__error__codes_8h.html</anchorfile> + <anchor>a05ff23648cb502e6128a53a5aef8d49aaeb094aed793a576fdf76fdbca7643686</anchor> + <arglist></arglist> + </member> + <member kind="enumvalue"> + <name>TALER_EC_SYNC_MISSING_CONTENT_LENGTH</name> + <anchorfile>d5/dcb/taler__error__codes_8h.html</anchorfile> + <anchor>a05ff23648cb502e6128a53a5aef8d49aad04abf794980705173d77fd28435d08a</anchor> + <arglist></arglist> + </member> + <member kind="enumvalue"> + <name>TALER_EC_SYNC_GENERIC_BACKEND_ERROR</name> + <anchorfile>d5/dcb/taler__error__codes_8h.html</anchorfile> + <anchor>a05ff23648cb502e6128a53a5aef8d49aab534c9117dccea53d74e87ace8e4fea1</anchor> + <arglist></arglist> + </member> + <member kind="enumvalue"> + <name>TALER_EC_SYNC_GENERIC_BACKEND_TIMEOUT</name> + <anchorfile>d5/dcb/taler__error__codes_8h.html</anchorfile> + <anchor>a05ff23648cb502e6128a53a5aef8d49aa264068a45ffad5779c0de179fdf79658</anchor> + <arglist></arglist> + </member> + </compound> + <compound kind="file"> + <name>taler_mhd_lib.h</name> + <path>/research/taler/exchange/src/include/</path> + <filename>df/d6d/taler__mhd__lib_8h.html</filename> + <includes id="d5/dcb/taler__error__codes_8h" name="taler_error_codes.h" local="yes" imported="no">taler_error_codes.h</includes> + <member kind="define"> + <type>#define</type> + <name>TALER_SIGNATURE_SYNC_BACKUP_UPLOAD</name> + <anchorfile>dc/d61/taler__signatures_8h.html</anchorfile> + <anchor>af15ac86c81f8c3993b56a59a4ccdaa1a</anchor> + <arglist></arglist> + </member> + </compound> +</tagfile> +\ No newline at end of file diff --git a/doc/doxygen/sync.doxy b/doc/doxygen/sync.doxy @@ -2218,7 +2218,7 @@ SKIP_FUNCTION_MACROS = YES # the path). If a tag file is not located in the directory in which doxygen is # run, you must also specify the path to the tagfile here. -TAGFILES = ../../contrib/gnunet.tag ../../contrib/microhttpd.tag +TAGFILES = ../../contrib/gnunet.tag ../../contrib/microhttpd.tag ../../contrib/taler-exchange.tag # When a file name is specified after GENERATE_TAGFILE, doxygen will create a # tag file that is based on the input files it reads. See section "Linking to diff --git a/src/include/sync_testing_lib.h b/src/include/sync_testing_lib.h @@ -31,33 +31,6 @@ /** - * Start the sync backend process. Assume the port - * is available and the database is clean. Use the "prepare - * sync" function to do such tasks. - * - * @param config_filename configuration filename. - * - * @return the process, or NULL if the process could not - * be started. - */ -struct GNUNET_OS_Process * -SYNC_TESTING_run_sync (const char *config_filename, - const char *sync_url); - - -/** - * Prepare the sync execution. Create tables and check if - * the port is available. - * - * @param config_filename configuration filename. - * @return the base url, or NULL upon errors. Must be freed - * by the caller. - */ -char * -SYNC_TESTING_prepare_sync (const char *config_filename); - - -/** * Make the "backup download" command for a non-existent upload. * * @param label command label diff --git a/src/syncdb/plugin_syncdb_postgres.c b/src/syncdb/plugin_syncdb_postgres.c @@ -953,7 +953,7 @@ postgres_update_backup (void *cls, * * @param cls closure * @param account_pub account to store @a backup under - * @param backup_hash[OUT] set to hash of @a backup + * @param[out] backup_hash set to hash of @a backup * @return transaction status */ static enum SYNC_DB_QueryStatus @@ -1037,11 +1037,11 @@ postgres_lookup_account (void *cls, * * @param cls closure * @param account_pub account to store @a backup under - * @param account_sig[OUT] set to signature affirming storage request - * @param prev_hash[OUT] set to hash of previous @a backup, all zeros if none - * @param backup_hash[OUT] set to hash of @a backup - * @param backup_size[OUT] set to number of bytes in @a backup - * @param backup[OUT] set to raw data to backup, caller MUST FREE + * @param[out] account_sig set to signature affirming storage request + * @param[out] prev_hash set to hash of previous @a backup, all zeros if none + * @param[out] backup_hash set to hash of @a backup + * @param[out] backup_size set to number of bytes in @a backup + * @param[out] backup set to raw data to backup, caller MUST FREE */ static enum SYNC_DB_QueryStatus postgres_lookup_backup (void *cls, diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am @@ -15,7 +15,6 @@ libsynctesting_la_LDFLAGS = \ libsynctesting_la_SOURCES = \ testing_api_cmd_backup_download.c \ testing_api_cmd_backup_upload.c \ - testing_api_helpers.c \ testing_api_traits.c libsynctesting_la_LIBADD = \ $(top_builddir)/src/lib/libsync.la \ diff --git a/src/testing/testing_api_cmd_backup_upload.c b/src/testing/testing_api_cmd_backup_upload.c @@ -369,7 +369,7 @@ backup_upload_cleanup (void *cls, * Offer internal data to other commands. * * @param cls closure - * @param ret[out] result (could be anything) + * @param[out] ret result (could be anything) * @param trait name of the trait * @param index index number of the object to extract. * @return #GNUNET_OK on success diff --git a/src/testing/testing_api_helpers.c b/src/testing/testing_api_helpers.c @@ -1,196 +0,0 @@ -/* - This file is part of SYNC - Copyright (C) 2014-2019 Taler Systems SA - - SYNC is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 3, or - (at your option) any later version. - - SYNC is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - SYNCABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with SYNC; see the file COPYING. If not, see - <http://www.gnu.org/licenses/> -*/ -/** - * @file testing/testing_api_helpers.c - * @brief helper functions for test library. - * @author Christian Grothoff - * @author Marcello Stanisci - */ -#include "platform.h" -#include <taler/taler_testing_lib.h> -#include "sync_testing_lib.h" -#include <gnunet/gnunet_curl_lib.h> - - -/** - * Start the sync backend process. Assume the port - * is available and the database is clean. Use the "prepare - * sync" function to do such tasks. - * - * @param config_filename configuration filename. - * - * @return the process, or NULL if the process could not - * be started. - */ -struct GNUNET_OS_Process * -SYNC_TESTING_run_sync (const char *config_filename, - const char *sync_url) -{ - struct GNUNET_OS_Process *sync_proc; - unsigned int iter; - char *wget_cmd; - - sync_proc - = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL, - NULL, NULL, NULL, - "sync-httpd", - "sync-httpd", - "--log=INFO", - "-c", config_filename, - NULL); - if (NULL == sync_proc) - { - GNUNET_break (0); - return NULL; - } - GNUNET_asprintf (&wget_cmd, - "wget -q -t 1 -T 1" - " %s" - " -o /dev/null -O /dev/null", - sync_url); - - /* give child time to start and bind against the socket */ - fprintf (stderr, - "Waiting for `sync-httpd' to be ready\n"); - iter = 0; - do - { - if (10 == iter) - { - fprintf (stderr, - "Failed to launch" - " `sync-httpd' (or `wget')\n"); - GNUNET_OS_process_kill (sync_proc, - SIGTERM); - GNUNET_OS_process_wait (sync_proc); - GNUNET_OS_process_destroy (sync_proc); - GNUNET_break (0); - return NULL; - } - fprintf (stderr, ".\n"); - sleep (1); - iter++; - } - while (0 != system (wget_cmd)); - GNUNET_free (wget_cmd); - fprintf (stderr, "\n"); - return sync_proc; -} - - -/** - * Prepare the sync execution. Create tables and check if - * the port is available. - * - * @param config_filename configuration filename. - * @return the base url, or NULL upon errors. Must be freed - * by the caller. - */ -char * -SYNC_TESTING_prepare_sync (const char *config_filename) -{ - struct GNUNET_CONFIGURATION_Handle *cfg; - unsigned long long port; - struct GNUNET_OS_Process *dbinit_proc; - enum GNUNET_OS_ProcessStatusType type; - unsigned long code; - char *base_url; - - cfg = GNUNET_CONFIGURATION_create (); - if (GNUNET_OK != - GNUNET_CONFIGURATION_load (cfg, - config_filename)) - { - GNUNET_break (0); - return NULL; - } - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_number (cfg, - "sync", - "PORT", - &port)) - { - GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, - "sync", - "PORT"); - GNUNET_CONFIGURATION_destroy (cfg); - GNUNET_break (0); - return NULL; - } - GNUNET_CONFIGURATION_destroy (cfg); - if (GNUNET_OK != - GNUNET_NETWORK_test_port_free (IPPROTO_TCP, - (uint16_t) port)) - { - fprintf (stderr, - "Required port %llu not available, skipping.\n", - port); - GNUNET_break (0); - return NULL; - } - - /* DB preparation */ - if (NULL == (dbinit_proc = GNUNET_OS_start_process ( - GNUNET_OS_INHERIT_STD_ALL, - NULL, NULL, NULL, - "sync-dbinit", - "sync-dbinit", - "-c", config_filename, - "-r", - NULL))) - { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Failed to run sync-dbinit." - " Check your PATH.\n"); - GNUNET_break (0); - return NULL; - } - - if (GNUNET_SYSERR == - GNUNET_OS_process_wait_status (dbinit_proc, - &type, - &code)) - { - GNUNET_OS_process_destroy (dbinit_proc); - GNUNET_break (0); - return NULL; - } - if ( (type == GNUNET_OS_PROCESS_EXITED) && - (0 != code) ) - { - fprintf (stderr, - "Failed to setup database\n"); - GNUNET_break (0); - return NULL; - } - if ( (type != GNUNET_OS_PROCESS_EXITED) || - (0 != code) ) - { - fprintf (stderr, - "Unexpected error running" - " `sync-dbinit'!\n"); - GNUNET_break (0); - return NULL; - } - GNUNET_OS_process_destroy (dbinit_proc); - GNUNET_asprintf (&base_url, - "http://localhost:%llu/", - port); - return base_url; -}