1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-17 01:12:23 +02:00

Improve code documentation in config module.

This commit is contained in:
David Steele
2018-03-02 22:42:02 -05:00
parent 406acf9cba
commit c07aa2ae19
3 changed files with 50 additions and 24 deletions

View File

@ -36,6 +36,10 @@
<release-item>
<p>Enable <id>-Wswitch-enum</id> and <id>-Wconversion</id> and silence new warnings.</p>
</release-item>
<release-item>
<p>Improve code documentation in <code>config</code> module.</p>
</release-item>
</release-development-list>
</release-core-list>

View File

@ -1,5 +1,8 @@
/***********************************************************************************************************************************
Command and Option Configuration
This module serves as a database for the configuration options. The configuration rules reside in config/define.c and
config/parse.c sets the command and options and determines which options are valid for a command.
***********************************************************************************************************************************/
#ifndef CONFIG_H
#define CONFIG_H
@ -10,7 +13,41 @@ Command and Option Configuration
#include "config/config.auto.h"
/***********************************************************************************************************************************
Option source enum - defines where an option value came from
Command Functions
Access the current command and command parameters.
***********************************************************************************************************************************/
ConfigCommand cfgCommand();
const char *cfgCommandName(ConfigCommand commandId);
const StringList *cfgCommandParam();
/***********************************************************************************************************************************
Option Functions
Access option values, indexes, and determine if an option is valid for the current command.
***********************************************************************************************************************************/
const Variant *cfgOption(ConfigOption optionId);
bool cfgOptionBool(ConfigOption optionId);
double cfgOptionDbl(ConfigOption optionId);
int cfgOptionInt(ConfigOption optionId);
int64 cfgOptionInt64(ConfigOption optionId);
const KeyValue *cfgOptionKv(ConfigOption optionId);
const VariantList *cfgOptionLst(ConfigOption optionId);
const String *cfgOptionStr(ConfigOption optionId);
unsigned int cfgOptionIndex(ConfigOption optionId);
unsigned int cfgOptionIndexTotal(ConfigOption optionDefId);
const char *cfgOptionName(ConfigOption optionId);
bool cfgOptionValid(ConfigOption optionId);
/***********************************************************************************************************************************
Option Source Enum
Defines where an option was sourced from. The source is only needed when determining what parameters should be passed to a remote
process.
***********************************************************************************************************************************/
typedef enum
{
@ -20,48 +57,34 @@ typedef enum
} ConfigSource;
/***********************************************************************************************************************************
Functions
Load Functions
Used primarily by modules that need to manipulate the configuration. These modules include, but are not limited to, config/parse.c,
config/load.c, perl/config.c, and perl/exec.c.
***********************************************************************************************************************************/
void cfgInit();
ConfigCommand cfgCommand();
bool cfgCommandHelp();
int cfgCommandId(const char *commandName);
const char *cfgCommandName(ConfigCommand commandId);
ConfigDefineCommand cfgCommandDefIdFromId(ConfigCommand commandId);
const StringList *cfgCommandParam();
bool cfgCommandHelp();
void cfgCommandHelpSet(bool helpParam);
int cfgCommandId(const char *commandName);
void cfgCommandParamSet(const StringList *param);
void cfgCommandSet(ConfigCommand commandParam);
const String *cfgExe();
void cfgExeSet(const String *exeParam);
const Variant *cfgOption(ConfigOption optionId);
bool cfgOptionBool(ConfigOption optionId);
const Variant *cfgOptionDefault(ConfigOption optionId);
void cfgOptionDefaultSet(ConfigOption optionId, const Variant *defaultValue);
ConfigDefineOption cfgOptionDefIdFromId(ConfigOption optionId);
double cfgOptionDbl(ConfigOption optionId);
int cfgOptionId(const char *optionName);
ConfigOption cfgOptionIdFromDefId(ConfigDefineOption optionDefId, unsigned int index);
unsigned int cfgOptionIndex(ConfigOption optionId);
unsigned int cfgOptionIndexTotal(ConfigOption optionDefId);
int cfgOptionInt(ConfigOption optionId);
int64 cfgOptionInt64(ConfigOption optionId);
const KeyValue *cfgOptionKv(ConfigOption optionId);
const VariantList *cfgOptionLst(ConfigOption optionId);
const char *cfgOptionName(ConfigOption optionId);
bool cfgOptionNegate(ConfigOption optionId);
void cfgOptionNegateSet(ConfigOption optionId, bool negate);
bool cfgOptionReset(ConfigOption optionId);
void cfgOptionResetSet(ConfigOption optionId, bool reset);
ConfigSource cfgOptionSource(ConfigOption optionId);
const String *cfgOptionStr(ConfigOption optionId);
bool cfgOptionValid(ConfigOption optionId);
void cfgOptionNegateSet(ConfigOption optionId, bool negate);
void cfgOptionSet(ConfigOption optionId, ConfigSource source, const Variant *value);
ConfigSource cfgOptionSource(ConfigOption optionId);
void cfgOptionValidSet(ConfigOption optionId, bool valid);
#endif

View File

@ -398,7 +398,6 @@ testRun()
)));
TEST_RESULT_VOID(configParse(strLstSize(argList), strLstPtr(argList)), TEST_COMMAND_BACKUP " command");
logInit(logLevelInfo, logLevelOff, false);
testLogErrResult(
strPtr(
strNewFmt(