diff options
author | unknown <tomas@poseidon.(none)> | 2004-08-27 11:48:27 +0000 |
---|---|---|
committer | unknown <tomas@poseidon.(none)> | 2004-08-27 11:48:27 +0000 |
commit | 987fc113959189c59e8f6e99d8d5364d9d62bc89 (patch) | |
tree | 553669a934f12f62a64ba7fd2729840a40015ef3 /ndb/src/mgmsrv/ConfigInfo.hpp | |
parent | 6566af8c3599d6ca6f3110a02d4e8476d386888e (diff) | |
download | mariadb-git-987fc113959189c59e8f6e99d8d5364d9d62bc89.tar.gz |
see respective file
ndb/src/mgmsrv/InitConfigFileParser.hpp:
Rename: ndb/src/common/mgmcommon/InitConfigFileParser.hpp -> ndb/src/mgmsrv/InitConfigFileParser.hpp
ndb/src/mgmsrv/InitConfigFileParser.cpp:
Rename: ndb/src/common/mgmcommon/InitConfigFileParser.cpp -> ndb/src/mgmsrv/InitConfigFileParser.cpp
ndb/src/mgmsrv/ConfigInfo.hpp:
Rename: ndb/src/common/mgmcommon/ConfigInfo.hpp -> ndb/src/mgmsrv/ConfigInfo.hpp
ndb/src/common/mgmcommon/Makefile.am:
moved files to mgmsrv
ndb/src/mgmclient/CommandInterpreter.cpp:
added shutdown command
ndb/src/mgmclient/CommandInterpreter.hpp:
added shutdown command
ndb/src/mgmsrv/Config.cpp:
.
ndb/src/mgmsrv/Config.hpp:
.
ndb/src/mgmsrv/ConfigInfo.cpp:
wait with this
ndb/src/mgmsrv/Makefile.am:
moved files to mgmsrv
ndb/test/include/NdbBackup.hpp:
backup not necessarily in file system path
ndb/test/ndbapi/testDict.cpp:
compile error
ndb/test/src/NdbBackup.cpp:
aligned with new config param
Diffstat (limited to 'ndb/src/mgmsrv/ConfigInfo.hpp')
-rw-r--r-- | ndb/src/mgmsrv/ConfigInfo.hpp | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/ndb/src/mgmsrv/ConfigInfo.hpp b/ndb/src/mgmsrv/ConfigInfo.hpp new file mode 100644 index 00000000000..50190082e3f --- /dev/null +++ b/ndb/src/mgmsrv/ConfigInfo.hpp @@ -0,0 +1,142 @@ +/* Copyright (C) 2003 MySQL AB + + This program 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 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef ConfigInfo_H +#define ConfigInfo_H + +#include <kernel_types.h> +#include <Properties.hpp> +#include <ndb_limits.h> +#include <NdbOut.hpp> +#include "InitConfigFileParser.hpp" + +/** + * A MANDATORY parameters must be specified in the config file + * An UNDEFINED parameter may or may not be specified in the config file + */ +static const char* MANDATORY = (char*)~(UintPtr)0; // Default value for mandatory params. +static const char* UNDEFINED = 0; // Default value for undefined params. + +/** + * @class ConfigInfo + * @brief Metainformation about ALL cluster configuration parameters + * + * Use the getters to find out metainformation about parameters. + */ +class ConfigInfo { +public: + enum Type { BOOL, INT, INT64, STRING, SECTION }; + enum Status { USED, ///< Active + DEPRICATED, ///< Can be, but shouldn't + NOTIMPLEMENTED, ///< Is ignored. + INTERNAL ///< Not configurable by the user + }; + + /** + * Entry for one configuration parameter + */ + struct ParamInfo { + Uint32 _paramId; + const char* _fname; + const char* _section; + const char* _description; + Status _status; + bool _updateable; + Type _type; + const char* _default; + const char* _min; + const char* _max; + }; + + struct AliasPair{ + const char * name; + const char * alias; + }; + + /** + * Entry for one section rule + */ + struct SectionRule { + const char * m_section; + bool (* m_sectionRule)(struct InitConfigFileParser::Context &, + const char * m_ruleData); + const char * m_ruleData; + }; + + /** + * Entry for config rule + */ + struct ConfigRuleSection { + BaseString m_sectionType; + Properties * m_sectionData; + }; + + struct ConfigRule { + bool (* m_configRule)(Vector<ConfigRuleSection>&, + struct InitConfigFileParser::Context &, + const char * m_ruleData); + const char * m_ruleData; + }; + + ConfigInfo(); + + /** + * Checks if the suggested value is valid for the suggested parameter + * (i.e. if it is >= than min and <= than max). + * + * @param section Init Config file section name + * @param fname Name of parameter + * @param value Value to check + * @return true if parameter value is valid. + * + * @note Result is not defined if section/name are wrong! + */ + bool verify(const Properties* secti, const char* fname, Uint64 value) const; + const char* getAlias(const char*) const; + bool isSection(const char*) const; + + const char* getDescription(const Properties * sec, const char* fname) const; + Type getType(const Properties * section, const char* fname) const; + Status getStatus(const Properties* section, const char* fname) const; + Uint64 getMin(const Properties * section, const char* fname) const; + Uint64 getMax(const Properties * section, const char* fname) const; + Uint64 getDefault(const Properties * section, const char* fname) const; + + const Properties * getInfo(const char * section) const; + const Properties * getDefaults(const char * section) const; + + void print() const; + void print(const char* section) const; + void print(const Properties * section, const char* parameter) const; + +private: + Properties m_info; + Properties m_systemDefaults; + + static const ParamInfo m_ParamInfo[]; + static const int m_NoOfParams; + + static const AliasPair m_sectionNameAliases[]; + static const char* m_sectionNames[]; + static const int m_noOfSectionNames; + +public: + static const SectionRule m_SectionRules[]; + static const ConfigRule m_ConfigRules[]; + static const int m_NoOfRules; +}; + +#endif // ConfigInfo_H |