diff options
author | Eliot Horowitz <eliot@10gen.com> | 2012-11-27 17:17:42 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2012-11-27 17:17:42 -0500 |
commit | 70c89035a57f2efffd240d93f938b46c001d610e (patch) | |
tree | 2ca72f0fc9b003667c559224ef4945256c486a39 /src/mongo/db/server_parameters.cpp | |
parent | 8d75e030e0e3de931e08996a2157491ed77fef9d (diff) | |
download | mongo-70c89035a57f2efffd240d93f938b46c001d610e.tar.gz |
SERVER-7778 : new parameter management system for runtime (command line later)
Diffstat (limited to 'src/mongo/db/server_parameters.cpp')
-rw-r--r-- | src/mongo/db/server_parameters.cpp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/mongo/db/server_parameters.cpp b/src/mongo/db/server_parameters.cpp new file mode 100644 index 00000000000..05565a79044 --- /dev/null +++ b/src/mongo/db/server_parameters.cpp @@ -0,0 +1,64 @@ +// server_parameters.cpp + +/** +* Copyright (C) 2012 10gen Inc. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License, version 3, +* as published by the Free Software Foundation. +* +* 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 Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "mongo/pch.h" + +#include "mongo/db/server_parameters.h" + +namespace mongo { + + namespace { + ServerParameterSet* GLOBAL = NULL; + } + + ServerParameter::ServerParameter( ServerParameterSet* sps, const std::string& name ) + : _name( name ) { + + if ( sps ) { + sps->add( this ); + } + } + + ServerParameter::~ServerParameter() { + } + + ServerParameterSet* ServerParameterSet::getGlobal() { + if ( !GLOBAL ) { + GLOBAL = new ServerParameterSet(); + } + return GLOBAL; + } + + void ServerParameterSet::add( ServerParameter* sp ) { + ServerParameter*& x = _map[sp->name()]; + if ( x ) abort(); + x = sp; + } + + + // obviously this is a sample, not real + // below this is all samples and won't be in the real one + + ExportedServerParameter<int> logLevelParam( ServerParameterSet::getGlobal(), "logLevel", &logLevel ); + + string x = "a"; + ExportedServerParameter<string> xxx( ServerParameterSet::getGlobal(), "xxx", &x ); + + MONGO_EXPORT_SERVER_PARAMETER( y, string, "hh" ); + +} |