diff options
Diffstat (limited to 'src/mongo/db/repl/primary_only_service.cpp')
-rw-r--r-- | src/mongo/db/repl/primary_only_service.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/repl/primary_only_service.cpp b/src/mongo/db/repl/primary_only_service.cpp index acf79190d1b..ab7f25ec861 100644 --- a/src/mongo/db/repl/primary_only_service.cpp +++ b/src/mongo/db/repl/primary_only_service.cpp @@ -227,9 +227,21 @@ void PrimaryOnlyServiceRegistry::onStepDown() { } } +void PrimaryOnlyServiceRegistry::reportServiceInfo(BSONObjBuilder* result) { + BSONObjBuilder subBuilder(result->subobjStart("primaryOnlyServices")); + for (auto& service : _servicesByName) { + subBuilder.appendNumber(service.first, service.second->getNumberOfInstances()); + } +} + PrimaryOnlyService::PrimaryOnlyService(ServiceContext* serviceContext) : _serviceContext(serviceContext) {} +size_t PrimaryOnlyService::getNumberOfInstances() { + stdx::lock_guard lk(_mutex); + return _instances.size(); +} + bool PrimaryOnlyService::isRunning() const { stdx::lock_guard lk(_mutex); return _state == State::kRunning; |