diff options
author | Shaun Verch <shaun.verch@10gen.com> | 2013-10-21 13:00:20 -0400 |
---|---|---|
committer | Shaun Verch <shaun.verch@10gen.com> | 2013-10-23 19:41:30 -0400 |
commit | 1c6ad3e411e431cf81da9f7d514fa20ec4fe792a (patch) | |
tree | 8f69f9a92565febf53d251c9399fdba1fe3f2e56 /src/mongo/db | |
parent | 22f5a8622731353890352dbaccdebdc937ae8508 (diff) | |
download | mongo-1c6ad3e411e431cf81da9f7d514fa20ec4fe792a.tar.gz |
SERVER-11144 Use new chaining interface in options
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/mongod_options.cpp | 443 | ||||
-rw-r--r-- | src/mongo/db/server_options.cpp | 308 |
2 files changed, 287 insertions, 464 deletions
diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp index f4fdfd9a269..d98ca671a44 100644 --- a/src/mongo/db/mongod_options.cpp +++ b/src/mongo/db/mongod_options.cpp @@ -85,232 +85,147 @@ namespace mongo { moe::OptionSection replication_options("Replication options"); moe::OptionSection sharding_options("Sharding options"); - ret = general_options.addOption(OD("auth", "auth", moe::Switch, "run with security", true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("cpu", "cpu", moe::Switch, - "periodically show cpu and iowait utilization", true)); - if (!ret.isOK()) { - return ret; - } + general_options.addOptionChaining("auth", "auth", moe::Switch, "run with security"); + + general_options.addOptionChaining("cpu", "cpu", moe::Switch, + "periodically show cpu and iowait utilization"); + #ifdef _WIN32 - ret = general_options.addOption(OD("dbpath", "dbpath", moe::String, - "directory for datafiles - defaults to \\data\\db\\", - true, moe::Value(std::string("\\data\\db\\")))); + general_options.addOptionChaining("dbpath", "dbpath", moe::String, + "directory for datafiles - defaults to \\data\\db\\") + .setDefault(moe::Value(std::string("\\data\\db\\"))); + #else - ret = general_options.addOption(OD("dbpath", "dbpath", moe::String, - "directory for datafiles - defaults to /data/db/", - true, moe::Value(std::string("/data/db")))); + general_options.addOptionChaining("dbpath", "dbpath", moe::String, + "directory for datafiles - defaults to /data/db/") + .setDefault(moe::Value(std::string("/data/db"))); + #endif - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("diaglog", "diaglog", moe::Int, - "0=off 1=W 2=R 3=both 7=W+some reads", true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("directoryperdb", "directoryperdb", moe::Switch, - "each database will be stored in a separate directory", true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("ipv6", "ipv6", moe::Switch, - "enable IPv6 support (disabled by default)", true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("journal", "journal", moe::Switch, "enable journaling", - true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("journalCommitInterval", "journalCommitInterval", - moe::Unsigned, "how often to group/batch commit (ms)", true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("journalOptions", "journalOptions", moe::Int, - "journal diagnostic options", true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("jsonp", "jsonp", moe::Switch, - "allow JSONP access via http (has security implications)", true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("noauth", "noauth", moe::Switch, "run without security", - true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("noIndexBuildRetry", "noIndexBuildRetry", moe::Switch, - "don't retry any index builds that were interrupted by shutdown", true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("nojournal", "nojournal", moe::Switch, - "disable journaling (journaling is on by default for 64 bit)", true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("noprealloc", "noprealloc", moe::Switch, - "disable data file preallocation - will often hurt performance", true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("noscripting", "noscripting", moe::Switch, - "disable scripting engine", true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("notablescan", "notablescan", moe::Switch, - "do not allow table scans", true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("nssize", "nssize", moe::Int, - ".ns file size (in MB) for new databases", true, moe::Value(16))); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("profile", "profile", moe::Int, "0=off 1=slow, 2=all", - true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("quota", "quota", moe::Switch, - "limits each database to a certain number of files (8 default)", true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("quotaFiles", "quotaFiles", moe::Int, - "number of files allowed per db, requires --quota", true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("repair", "repair", moe::Switch, "run repair on all dbs", - true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("repairpath", "repairpath", moe::String, - "root directory for repair files - defaults to dbpath" , true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("rest", "rest", moe::Switch, "turn on simple rest api", - true)); - if (!ret.isOK()) { - return ret; - } + general_options.addOptionChaining("diaglog", "diaglog", moe::Int, + "0=off 1=W 2=R 3=both 7=W+some reads"); + + general_options.addOptionChaining("directoryperdb", "directoryperdb", moe::Switch, + "each database will be stored in a separate directory"); + + general_options.addOptionChaining("ipv6", "ipv6", moe::Switch, + "enable IPv6 support (disabled by default)"); + + general_options.addOptionChaining("journal", "journal", moe::Switch, "enable journaling"); + + general_options.addOptionChaining("journalCommitInterval", "journalCommitInterval", + moe::Unsigned, "how often to group/batch commit (ms)"); + + general_options.addOptionChaining("journalOptions", "journalOptions", moe::Int, + "journal diagnostic options"); + + general_options.addOptionChaining("jsonp", "jsonp", moe::Switch, + "allow JSONP access via http (has security implications)"); + + general_options.addOptionChaining("noauth", "noauth", moe::Switch, "run without security"); + + general_options.addOptionChaining("noIndexBuildRetry", "noIndexBuildRetry", moe::Switch, + "don't retry any index builds that were interrupted by shutdown"); + + general_options.addOptionChaining("nojournal", "nojournal", moe::Switch, + "disable journaling (journaling is on by default for 64 bit)"); + + general_options.addOptionChaining("noprealloc", "noprealloc", moe::Switch, + "disable data file preallocation - will often hurt performance"); + + general_options.addOptionChaining("noscripting", "noscripting", moe::Switch, + "disable scripting engine"); + + general_options.addOptionChaining("notablescan", "notablescan", moe::Switch, + "do not allow table scans"); + + general_options.addOptionChaining("nssize", "nssize", moe::Int, + ".ns file size (in MB) for new databases") + .setDefault(moe::Value(16)); + + general_options.addOptionChaining("profile", "profile", moe::Int, "0=off 1=slow, 2=all"); + + general_options.addOptionChaining("quota", "quota", moe::Switch, + "limits each database to a certain number of files (8 default)"); + + general_options.addOptionChaining("quotaFiles", "quotaFiles", moe::Int, + "number of files allowed per db, requires --quota"); + + general_options.addOptionChaining("repair", "repair", moe::Switch, "run repair on all dbs"); + + general_options.addOptionChaining("repairpath", "repairpath", moe::String, + "root directory for repair files - defaults to dbpath"); + + general_options.addOptionChaining("rest", "rest", moe::Switch, "turn on simple rest api"); + #if defined(__linux__) - ret = general_options.addOption(OD("shutdown", "shutdown", moe::Switch, - "kill a running server (for init scripts)", true)); - if (!ret.isOK()) { - return ret; - } + general_options.addOptionChaining("shutdown", "shutdown", moe::Switch, + "kill a running server (for init scripts)"); + #endif - ret = general_options.addOption(OD("slowms", "slowms", moe::Int, - "value of slow for profile and console log" , true, moe::Value(100))); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("smallfiles", "smallfiles", moe::Switch, - "use a smaller default file size", true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("syncdelay", "syncdelay", moe::Double, - "seconds between disk syncs (0=never, but not recommended)", true, - moe::Value(60.0))); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("sysinfo", "sysinfo", moe::Switch, - "print some diagnostic system information", true)); - if (!ret.isOK()) { - return ret; - } - ret = general_options.addOption(OD("upgrade", "upgrade", moe::Switch, - "upgrade db if needed", true)); - if (!ret.isOK()) { - return ret; - } + general_options.addOptionChaining("slowms", "slowms", moe::Int, + "value of slow for profile and console log") + .setDefault(moe::Value(100)); - ret = replication_options.addOption(OD("oplogSize", "oplogSize", moe::Int, - "size to use (in MB) for replication op log. default is 5% of disk space " - "(i.e. large is good)", true)); - if (!ret.isOK()) { - return ret; - } + general_options.addOptionChaining("smallfiles", "smallfiles", moe::Switch, + "use a smaller default file size"); - ret = ms_options.addOption(OD("master", "master", moe::Switch, "master mode", true)); - if (!ret.isOK()) { - return ret; - } - ret = ms_options.addOption(OD("slave", "slave", moe::Switch, "slave mode", true)); - if (!ret.isOK()) { - return ret; - } - ret = ms_options.addOption(OD("source", "source", moe::String, - "when slave: specify master as <server:port>", true)); - if (!ret.isOK()) { - return ret; - } - ret = ms_options.addOption(OD("only", "only", moe::String, - "when slave: specify a single database to replicate", true)); - if (!ret.isOK()) { - return ret; - } - ret = ms_options.addOption(OD("slavedelay", "slavedelay", moe::Int, - "specify delay (in seconds) to be used when applying master ops to slave", - true)); - if (!ret.isOK()) { - return ret; - } - ret = ms_options.addOption(OD("autoresync", "autoresync", moe::Switch, - "automatically resync if slave data is stale", true)); - if (!ret.isOK()) { - return ret; - } + general_options.addOptionChaining("syncdelay", "syncdelay", moe::Double, + "seconds between disk syncs (0=never, but not recommended)") + .setDefault(moe::Value(60.0)); - ret = rs_options.addOption(OD("replSet", "replSet", moe::String, - "arg is <setname>[/<optionalseedhostlist>]", true)); - if (!ret.isOK()) { - return ret; - } - ret = rs_options.addOption(OD("replIndexPrefetch", "replIndexPrefetch", moe::String, - "specify index prefetching behavior (if secondary) [none|_id_only|all]", true)); - if (!ret.isOK()) { - return ret; - } + general_options.addOptionChaining("sysinfo", "sysinfo", moe::Switch, + "print some diagnostic system information"); - ret = sharding_options.addOption(OD("configsvr", "configsvr", moe::Switch, - "declare this is a config db of a cluster; default port 27019; " - "default dir /data/configdb", true)); - if (!ret.isOK()) { - return ret; - } - ret = sharding_options.addOption(OD("shardsvr", "shardsvr", moe::Switch, - "declare this is a shard db of a cluster; default port 27018", true)); - if (!ret.isOK()) { - return ret; - } + general_options.addOptionChaining("upgrade", "upgrade", moe::Switch, + "upgrade db if needed"); + + + replication_options.addOptionChaining("oplogSize", "oplogSize", moe::Int, + "size to use (in MB) for replication op log. default is 5% of disk space " + "(i.e. large is good)"); + + + ms_options.addOptionChaining("master", "master", moe::Switch, "master mode"); + + ms_options.addOptionChaining("slave", "slave", moe::Switch, "slave mode"); + + ms_options.addOptionChaining("source", "source", moe::String, + "when slave: specify master as <server:port>"); + + ms_options.addOptionChaining("only", "only", moe::String, + "when slave: specify a single database to replicate"); + + ms_options.addOptionChaining("slavedelay", "slavedelay", moe::Int, + "specify delay (in seconds) to be used when applying master ops to slave"); + + ms_options.addOptionChaining("autoresync", "autoresync", moe::Switch, + "automatically resync if slave data is stale"); + + + rs_options.addOptionChaining("replSet", "replSet", moe::String, + "arg is <setname>[/<optionalseedhostlist>]"); + + rs_options.addOptionChaining("replIndexPrefetch", "replIndexPrefetch", moe::String, + "specify index prefetching behavior (if secondary) [none|_id_only|all]"); + + + sharding_options.addOptionChaining("configsvr", "configsvr", moe::Switch, + "declare this is a config db of a cluster; default port 27019; " + "default dir /data/configdb"); + + sharding_options.addOptionChaining("shardsvr", "shardsvr", moe::Switch, + "declare this is a shard db of a cluster; default port 27018"); + + + sharding_options.addOptionChaining("noMoveParanoia", "noMoveParanoia", moe::Switch, + "turn off paranoid saving of data for the moveChunk command; default") + .hidden(); + + sharding_options.addOptionChaining("moveParanoia", "moveParanoia", moe::Switch, + "turn on paranoid saving of data during the moveChunk command " + "(used for internal system diagnostics)") + .hidden(); - ret = sharding_options.addOption(OD("noMoveParanoia", "noMoveParanoia", moe::Switch, - "turn off paranoid saving of data for the moveChunk command; default", false)); - if (!ret.isOK()) { - return ret; - } - ret = sharding_options.addOption(OD("moveParanoia", "moveParanoia", moe::Switch, - "turn on paranoid saving of data during the moveChunk command " - "(used for internal system diagnostics)", false)); - if (!ret.isOK()) { - return ret; - } options->addSection(general_options); #if defined(_WIN32) options->addSection(windows_scm_options); @@ -323,63 +238,49 @@ namespace mongo { options->addSection(ssl_options); #endif - ret = options->addOption(OD("fastsync", "fastsync", moe::Switch, - "indicate that this instance is starting from a " - "dbpath snapshot of the repl peer", false)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("pretouch", "pretouch", moe::Int, - "n pretouch threads for applying master/slave operations", false)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("command", "command", moe::StringVector, "command", false)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("cacheSize", "cacheSize", moe::Long, - "cache size (in MB) for rec store", false)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("nodur", "nodur", moe::Switch, "disable journaling", false)); - if (!ret.isOK()) { - return ret; - } + options->addOptionChaining("fastsync", "fastsync", moe::Switch, + "indicate that this instance is starting from a dbpath snapshot of the repl peer") + .hidden(); + + options->addOptionChaining("pretouch", "pretouch", moe::Int, + "n pretouch threads for applying master/slave operations") + .hidden(); + + options->addOptionChaining("command", "command", moe::StringVector, "command") + .hidden(); + + options->addOptionChaining("cacheSize", "cacheSize", moe::Long, + "cache size (in MB) for rec store") + .hidden(); + + options->addOptionChaining("nodur", "nodur", moe::Switch, "disable journaling") + .hidden(); + // things we don't want people to use - ret = options->addOption(OD("nohints", "nohints", moe::Switch, "ignore query hints", - false)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("nopreallocj", "nopreallocj", moe::Switch, - "don't preallocate journal files", false)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("dur", "dur", moe::Switch, "enable journaling", false)); - if (!ret.isOK()) { - return ret; - } // old name for --journal - ret = options->addOption(OD("durOptions", "durOptions", moe::Int, - "durability diagnostic options", false)); - if (!ret.isOK()) { - return ret; - } // deprecated name + options->addOptionChaining("nohints", "nohints", moe::Switch, "ignore query hints") + .hidden(); + + options->addOptionChaining("nopreallocj", "nopreallocj", moe::Switch, + "don't preallocate journal files") + .hidden(); + + options->addOptionChaining("dur", "dur", moe::Switch, "enable journaling") + .hidden(); + + options->addOptionChaining("durOptions", "durOptions", moe::Int, + "durability diagnostic options") + .hidden(); + // deprecated pairing command line options - ret = options->addOption(OD("pairwith", "pairwith", moe::Switch, "DEPRECATED", false)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("arbiter", "arbiter", moe::Switch, "DEPRECATED", false)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("opIdMem", "opIdMem", moe::Switch, "DEPRECATED", false)); - if (!ret.isOK()) { - return ret; - } + options->addOptionChaining("pairwith", "pairwith", moe::Switch, "DEPRECATED") + .hidden(); + + options->addOptionChaining("arbiter", "arbiter", moe::Switch, "DEPRECATED") + .hidden(); + + options->addOptionChaining("opIdMem", "opIdMem", moe::Switch, "DEPRECATED") + .hidden(); + ret = options->addPositionalOption(POD("command", moe::String, 3)); if (!ret.isOK()) { diff --git a/src/mongo/db/server_options.cpp b/src/mongo/db/server_options.cpp index bbd60e8d684..4c935ee2884 100644 --- a/src/mongo/db/server_options.cpp +++ b/src/mongo/db/server_options.cpp @@ -111,21 +111,13 @@ namespace { maxConnInfoBuilder << "max number of simultaneous connections - " << DEFAULT_MAX_CONN << " by default"; - Status ret = options->addOption(OD("help", "help,h", moe::Switch, - "show this usage information", true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("version", "version", moe::Switch, "show version information", - true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("config", "config,f", moe::String, - "configuration file specifying additional options", true)); - if (!ret.isOK()) { - return ret; - } + options->addOptionChaining("help", "help,h", moe::Switch, "show this usage information"); + + options->addOptionChaining("version", "version", moe::Switch, "show version information"); + + options->addOptionChaining("config", "config,f", moe::String, + "configuration file specifying additional options"); + // The verbosity level can be set at startup in the following ways. Note that if multiple // methods for setting the verbosity are specified simultaneously, the verbosity will be set // based on the whichever option specifies the highest level @@ -155,200 +147,130 @@ namespace { // { "verbose" : "vv" }| 2 (etc.) // { "v" : true } | 1 // { "vv" : true } | 2 (etc.) - ret = options->addOption(OD("verbose", "verbose,v", moe::String, - "be more verbose (include multiple times for more verbosity e.g. -vvvvv)", - true, moe::Value(), - moe::Value(std::string("v")))); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("quiet", "quiet", moe::Switch, "quieter output", true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("port", "port", moe::Int, portInfoBuilder.str().c_str(), true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("bind_ip", "bind_ip", moe::String, - "comma separated list of ip addresses to listen on - all local ips by default", - true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("maxConns", "maxConns", moe::Int, - maxConnInfoBuilder.str().c_str(), true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("logpath", "logpath", moe::String, - "log file to send write to instead of stdout - has to be a file, not directory", - true)); - if (!ret.isOK()) { - return ret; - } + options->addOptionChaining("verbose", "verbose,v", moe::String, + "be more verbose (include multiple times for more verbosity e.g. -vvvvv)") + .setImplicit(moe::Value(std::string("v"))); + + options->addOptionChaining("quiet", "quiet", moe::Switch, "quieter output"); + + options->addOptionChaining("port", "port", moe::Int, portInfoBuilder.str().c_str()); + + options->addOptionChaining("bind_ip", "bind_ip", moe::String, + "comma separated list of ip addresses to listen on - all local ips by default"); + + options->addOptionChaining("maxConns", "maxConns", moe::Int, + maxConnInfoBuilder.str().c_str()); + + options->addOptionChaining("logpath", "logpath", moe::String, + "log file to send write to instead of stdout - has to be a file, not directory"); + #ifndef _WIN32 - ret = options->addOption(OD("syslogFacility", "syslogFacility", moe::String, - "syslog facility used for monogdb syslog message", - true)); - if (!ret.isOK()) { - return ret; - } + options->addOptionChaining("syslogFacility", "syslogFacility", moe::String, + "syslog facility used for monogdb syslog message"); + #endif // _WIN32 - ret = options->addOption(OD("logappend", "logappend", moe::Switch, - "append to logpath instead of over-writing", true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("logTimestampFormat", "logTimestampFormat", moe::String, - "Desired format for timestamps in log messages. One of ctime, " - "iso8601-utc or iso8601-local", true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("pidfilepath", "pidfilepath", moe::String, - "full path to pidfile (if not set, no pidfile is created)", true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("keyFile", "keyFile", moe::String, - "private key for cluster authentication", true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("setParameter", "setParameter", moe::StringVector, - "Set a configurable parameter", true, moe::Value(), moe::Value(), true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("httpinterface", "httpinterface", moe::Switch, - "enable http interface", true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("clusterAuthMode", "clusterAuthMode", moe::String, - "Authentication mode used for cluster authentication. Alternatives are " - "(keyfile|sendKeyfile|sendX509|x509)", true)); - if (!ret.isOK()) { - return ret; - } + options->addOptionChaining("logappend", "logappend", moe::Switch, + "append to logpath instead of over-writing"); + + options->addOptionChaining("logTimestampFormat", "logTimestampFormat", moe::String, + "Desired format for timestamps in log messages. One of ctime, " + "iso8601-utc or iso8601-local"); + + options->addOptionChaining("pidfilepath", "pidfilepath", moe::String, + "full path to pidfile (if not set, no pidfile is created)"); + + options->addOptionChaining("keyFile", "keyFile", moe::String, + "private key for cluster authentication"); + + options->addOptionChaining("setParameter", "setParameter", moe::StringVector, + "Set a configurable parameter") + .composing(); + + options->addOptionChaining("httpinterface", "httpinterface", moe::Switch, + "enable http interface"); + + options->addOptionChaining("clusterAuthMode", "clusterAuthMode", moe::String, + "Authentication mode used for cluster authentication. Alternatives are " + "(keyfile|sendKeyfile|sendX509|x509)"); + #ifndef _WIN32 - ret = options->addOption(OD("nounixsocket", "nounixsocket", moe::Switch, - "disable listening on unix sockets", true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("unixSocketPrefix", "unixSocketPrefix", moe::String, - "alternative directory for UNIX domain sockets (defaults to /tmp)", true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("fork", "fork", moe::Switch, "fork server process", true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("syslog", "syslog", moe::Switch, - "log to system's syslog facility instead of file or stdout", true)); - if (!ret.isOK()) { - return ret; - } + options->addOptionChaining("nounixsocket", "nounixsocket", moe::Switch, + "disable listening on unix sockets"); + + options->addOptionChaining("unixSocketPrefix", "unixSocketPrefix", moe::String, + "alternative directory for UNIX domain sockets (defaults to /tmp)"); + + options->addOptionChaining("fork", "fork", moe::Switch, "fork server process"); + + options->addOptionChaining("syslog", "syslog", moe::Switch, + "log to system's syslog facility instead of file or stdout"); + #endif /* support for -vv -vvvv etc. */ for (string s = "vv"; s.length() <= 12; s.append("v")) { - ret = options->addOption(OD(s.c_str(), s.c_str(), moe::Switch, "verbose", false)); - if(!ret.isOK()) { - return ret; - } + options->addOptionChaining(s.c_str(), s.c_str(), moe::Switch, "verbose") + .hidden(); } // Extra hidden options - ret = options->addOption(OD("nohttpinterface", "nohttpinterface", moe::Switch, - "disable http interface", false)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("objcheck", "objcheck", moe::Switch, - "inspect client data for validity on receipt (DEFAULT)", false)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("noobjcheck", "noobjcheck", moe::Switch, - "do NOT inspect client data for validity on receipt", false)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("traceExceptions", "traceExceptions", moe::Switch, - "log stack traces for every exception", false)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("enableExperimentalIndexStatsCmd", - "enableExperimentalIndexStatsCmd", moe::Switch, - "EXPERIMENTAL (UNSUPPORTED). " - "Enable command computing aggregate statistics on indexes.", false)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("enableExperimentalStorageDetailsCmd", - "enableExperimentalStorageDetailsCmd", moe::Switch, - "EXPERIMENTAL (UNSUPPORTED). " - "Enable command computing aggregate statistics on storage.", false)); - if (!ret.isOK()) { - return ret; - } + options->addOptionChaining("nohttpinterface", "nohttpinterface", moe::Switch, + "disable http interface") + .hidden(); + + options->addOptionChaining("objcheck", "objcheck", moe::Switch, + "inspect client data for validity on receipt (DEFAULT)") + .hidden(); + + options->addOptionChaining("noobjcheck", "noobjcheck", moe::Switch, + "do NOT inspect client data for validity on receipt") + .hidden(); + + options->addOptionChaining("traceExceptions", "traceExceptions", moe::Switch, + "log stack traces for every exception") + .hidden(); + + options->addOptionChaining("enableExperimentalIndexStatsCmd", + "enableExperimentalIndexStatsCmd", moe::Switch, "EXPERIMENTAL (UNSUPPORTED). " + "Enable command computing aggregate statistics on indexes.") + .hidden(); + + options->addOptionChaining("enableExperimentalStorageDetailsCmd", + "enableExperimentalStorageDetailsCmd", moe::Switch, "EXPERIMENTAL (UNSUPPORTED). " + "Enable command computing aggregate statistics on storage.") + .hidden(); + return Status::OK(); } Status addWindowsServerOptions(moe::OptionSection* options) { - Status ret = options->addOption(OD("install", "install", moe::Switch, - "install Windows service", true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("remove", "remove", moe::Switch, "remove Windows service", - true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("reinstall", "reinstall", moe::Switch, - "reinstall Windows service (equivalent to --remove followed by --install)", - true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("serviceName", "serviceName", moe::String, - "Windows service name", true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("serviceDisplayName", "serviceDisplayName", moe::String, - "Windows service display name", true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("serviceDescription", "serviceDescription", moe::String, - "Windows service description", true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("serviceUser", "serviceUser", moe::String, - "account for service execution", true)); - if (!ret.isOK()) { - return ret; - } - ret = options->addOption(OD("servicePassword", "servicePassword", moe::String, - "password used to authenticate serviceUser", true)); - if (!ret.isOK()) { - return ret; - } + options->addOptionChaining("install", "install", moe::Switch, "install Windows service"); + + options->addOptionChaining("remove", "remove", moe::Switch, "remove Windows service"); + + options->addOptionChaining("reinstall", "reinstall", moe::Switch, + "reinstall Windows service (equivalent to --remove followed by --install)"); + + options->addOptionChaining("serviceName", "serviceName", moe::String, + "Windows service name"); + + options->addOptionChaining("serviceDisplayName", "serviceDisplayName", moe::String, + "Windows service display name"); + + options->addOptionChaining("serviceDescription", "serviceDescription", moe::String, + "Windows service description"); + + options->addOptionChaining("serviceUser", "serviceUser", moe::String, + "account for service execution"); + + options->addOptionChaining("servicePassword", "servicePassword", moe::String, + "password used to authenticate serviceUser"); + + + options->addOptionChaining("service", "service", moe::Switch, "start mongodb service") + .hidden(); - ret = options->addOption(OD("service", "service", moe::Switch, "start mongodb service", - false)); - if (!ret.isOK()) { - return ret; - } return Status::OK(); } |