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; std::string _coordinatorConfig;
public: public:
AgencyCallbackRegistry* agencyCallbackRegistry() const {
return _agencyCallbackRegistry.get();
}
std::string const agencyCallbacksPath() { std::string const agencyCallbacksPath() {
return "/_api/agency/agency-callbacks"; return "/_api/agency/agency-callbacks";
}; };

View File

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