diff options
author | Jonathan Reams <jbreams@mongodb.com> | 2016-08-18 11:01:02 -0400 |
---|---|---|
committer | Jonathan Reams <jbreams@mongodb.com> | 2016-08-24 10:40:28 -0400 |
commit | 29189fc922f8746060e83ba27e46ba249eb3b9e4 (patch) | |
tree | b5c56518ccea864345d8185f2491bd3a8158ab9b /src/mongo/db/commands/server_status.h | |
parent | 2b3da87372ddb61a2226a7c11ba8d0b41c12278e (diff) | |
download | mongo-29189fc922f8746060e83ba27e46ba249eb3b9e4.tar.gz |
SERVER-21757 ServerStatus advisoryHostFQDNs should be optional
Diffstat (limited to 'src/mongo/db/commands/server_status.h')
-rw-r--r-- | src/mongo/db/commands/server_status.h | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/mongo/db/commands/server_status.h b/src/mongo/db/commands/server_status.h index 862cf1960e9..b017688acf2 100644 --- a/src/mongo/db/commands/server_status.h +++ b/src/mongo/db/commands/server_status.h @@ -73,11 +73,35 @@ public: /** * actually generate the result + * + * You should either implement this function or appendSection below, but not both. In + * most cases you should just implement this function. + * * @param configElement the element from the actual command related to this section * so if the section is 'foo', this is cmdObj['foo'] */ - virtual BSONObj generateSection(OperationContext* txn, - const BSONElement& configElement) const = 0; + virtual BSONObj generateSection(OperationContext* txn, const BSONElement& configElement) const { + return BSONObj{}; + }; + + /** + * This is what gets called by the serverStatus command to append the section to the + * command result. + * + * If you are just implementing a normal ServerStatusSection, then you don't need to + * implement this. + * + * If you are doing something a bit more complicated, you can implement this and have + * full control over what gets included in the command result. + */ + virtual void appendSection(OperationContext* txn, + const BSONElement& configElement, + BSONObjBuilder* result) const { + const auto ret = generateSection(txn, configElement); + if (ret.isEmpty()) + return; + result->append(getSectionName(), ret); + } private: const std::string _sectionName; |