1
0
Fork 0

fixed cluster start

This commit is contained in:
jsteemann 2016-04-20 17:36:39 +02:00
parent 2637666698
commit 4a87925b41
2 changed files with 19 additions and 0 deletions

View File

@ -60,6 +60,10 @@ class ClusterFeature : public application_features::ApplicationFeature {
std::string _coordinatorConfig;
public:
AgencyCallbackRegistry* agencyCallbackRegistry() const {
return _agencyCallbackRegistry.get();
}
std::string const agencyCallbacksPath() {
return "/_api/agency/agency-callbacks";
};

View File

@ -27,7 +27,10 @@
#include "Agency/AgencyFeature.h"
#include "Agency/RestAgencyHandler.h"
#include "Agency/RestAgencyPrivHandler.h"
#include "Cluster/AgencyCallbackRegistry.h"
#include "Cluster/ClusterComm.h"
#include "Cluster/ClusterFeature.h"
#include "Cluster/RestAgencyCallbacksHandler.h"
#include "Cluster/RestShardHandler.h"
#include "Dispatcher/DispatcherFeature.h"
#include "HttpServer/HttpHandlerFactory.h"
@ -279,6 +282,10 @@ void RestServerFeature::defineHandlers() {
AgencyFeature* agency = dynamic_cast<AgencyFeature*>(
application_features::ApplicationServer::lookupFeature("Agency"));
TRI_ASSERT(agency != nullptr);
ClusterFeature* cluster = dynamic_cast<ClusterFeature*>(
application_features::ApplicationServer::lookupFeature("Cluster"));
TRI_ASSERT(cluster != nullptr);
auto queryRegistry = DatabaseFeature::DATABASE->queryRegistry();
@ -375,6 +382,14 @@ void RestServerFeature::defineHandlers() {
RestHandlerCreator<RestAgencyPrivHandler>::createData<consensus::Agent*>,
agency->agent());
}
if (cluster->isEnabled()) {
// add "/agency-callbacks" handler
_handlerFactory->addPrefixHandler(
cluster->agencyCallbacksPath(),
RestHandlerCreator<RestAgencyCallbacksHandler>::createData<AgencyCallbackRegistry*>,
cluster->agencyCallbackRegistry());
}
// And now some handlers which are registered in both /_api and /_admin
_handlerFactory->addPrefixHandler(