mirror of https://gitee.com/bigwinds/arangodb
make RestWalHandler a handler of the MMFiles engine
This commit is contained in:
parent
39d2445ee3
commit
0a07bb3222
|
@ -247,7 +247,6 @@ SET(ARANGOD_SOURCES
|
|||
RestHandler/RestUploadHandler.cpp
|
||||
RestHandler/RestVersionHandler.cpp
|
||||
RestHandler/RestVocbaseBaseHandler.cpp
|
||||
RestHandler/RestWalHandler.cpp
|
||||
RestHandler/WorkMonitorHandler.cpp
|
||||
RestServer/AqlFeature.cpp
|
||||
RestServer/BootstrapFeature.cpp
|
||||
|
@ -377,6 +376,7 @@ set(ARANGOD_SOURCES
|
|||
MMFiles/MMFilesPrimaryIndex.cpp
|
||||
MMFiles/MMFilesRemoverThread.cpp
|
||||
MMFiles/MMFilesRestHandlers.cpp
|
||||
MMFiles/MMFilesRestWalHandler.cpp
|
||||
MMFiles/MMFilesRevisionsCache.cpp
|
||||
MMFiles/MMFilesSkiplistIndex.cpp
|
||||
MMFiles/MMFilesSynchronizerThread.cpp
|
||||
|
|
|
@ -64,7 +64,6 @@
|
|||
#include "RestHandler/RestSimpleQueryHandler.h"
|
||||
#include "RestHandler/RestUploadHandler.h"
|
||||
#include "RestHandler/RestVersionHandler.h"
|
||||
#include "RestHandler/RestWalHandler.h"
|
||||
#include "RestHandler/WorkMonitorHandler.h"
|
||||
#include "RestServer/DatabaseFeature.h"
|
||||
#include "RestServer/EndpointFeature.h"
|
||||
|
@ -75,6 +74,8 @@
|
|||
#include "Scheduler/Scheduler.h"
|
||||
#include "Scheduler/SchedulerFeature.h"
|
||||
#include "Ssl/SslServerFeature.h"
|
||||
#include "StorageEngine/EngineSelectorFeature.h"
|
||||
#include "StorageEngine/StorageEngine.h"
|
||||
#include "V8Server/V8DealerFeature.h"
|
||||
|
||||
using namespace arangodb;
|
||||
|
@ -89,9 +90,7 @@ GeneralServerFeature::GeneralServerFeature(
|
|||
application_features::ApplicationServer* server)
|
||||
: ApplicationFeature(server, "GeneralServer"),
|
||||
_allowMethodOverride(false),
|
||||
_proxyCheck(true),
|
||||
_handlerFactory(nullptr),
|
||||
_jobManager(nullptr) {
|
||||
_proxyCheck(true) {
|
||||
setOptional(true);
|
||||
requiresElevatedPrivileges(false);
|
||||
startsAfter("Agency");
|
||||
|
@ -381,10 +380,6 @@ void GeneralServerFeature::defineHandlers() {
|
|||
aql::QueryRegistry*>,
|
||||
queryRegistry);
|
||||
|
||||
_handlerFactory->addPrefixHandler(
|
||||
RestVocbaseBaseHandler::WAL_PATH,
|
||||
RestHandlerCreator<RestWalHandler>::createNoData);
|
||||
|
||||
_handlerFactory->addPrefixHandler(
|
||||
RestVocbaseBaseHandler::SIMPLE_LOOKUP_PATH,
|
||||
RestHandlerCreator<RestSimpleHandler>::createData<aql::QueryRegistry*>,
|
||||
|
@ -502,4 +497,10 @@ void GeneralServerFeature::defineHandlers() {
|
|||
|
||||
_handlerFactory->addPrefixHandler(
|
||||
"/", RestHandlerCreator<RestActionHandler>::createNoData);
|
||||
|
||||
|
||||
// engine specific handlers
|
||||
StorageEngine* engine = EngineSelectorFeature::ENGINE;
|
||||
TRI_ASSERT(engine != nullptr); // Engine not loaded. Startup broken
|
||||
engine->addRestHandlers(_handlerFactory.get());
|
||||
}
|
||||
|
|
|
@ -2260,8 +2260,8 @@ void MMFilesEngine::addV8Functions() {
|
|||
}
|
||||
|
||||
/// @brief Add engine-specific REST handlers
|
||||
void MMFilesEngine::addRestHandlers() {
|
||||
MMFilesRestHandlers::registerResources();
|
||||
void MMFilesEngine::addRestHandlers(rest::RestHandlerFactory* handlerFactory) {
|
||||
MMFilesRestHandlers::registerResources(handlerFactory);
|
||||
}
|
||||
|
||||
/// @brief transfer markers into a collection, actual work
|
||||
|
|
|
@ -40,6 +40,10 @@ class MMFilesCompactorThread;
|
|||
class TransactionCollection;
|
||||
class TransactionState;
|
||||
|
||||
namespace rest {
|
||||
class RestHandlerFactory;
|
||||
}
|
||||
|
||||
namespace transaction {
|
||||
class ContextData;
|
||||
}
|
||||
|
@ -277,7 +281,7 @@ public:
|
|||
void addV8Functions() override;
|
||||
|
||||
/// @brief Add engine-specific REST handlers
|
||||
void addRestHandlers() override;
|
||||
void addRestHandlers(rest::RestHandlerFactory*) override;
|
||||
|
||||
/// @brief transfer markers into a collection
|
||||
int transferMarkers(LogicalCollection* collection, MMFilesCollectorCache*,
|
||||
|
|
|
@ -22,8 +22,13 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "MMFilesRestHandlers.h"
|
||||
#include "GeneralServer/RestHandlerFactory.h"
|
||||
#include "MMFiles/MMFilesRestWalHandler.h"
|
||||
#include "RestHandler/RestHandlerCreator.h"
|
||||
|
||||
using namespace arangodb;
|
||||
|
||||
void MMFilesRestHandlers::registerResources() {
|
||||
void MMFilesRestHandlers::registerResources(rest::RestHandlerFactory* handlerFactory) {
|
||||
handlerFactory->addPrefixHandler(
|
||||
"/_admin/wal", RestHandlerCreator<MMFilesRestWalHandler>::createNoData);
|
||||
}
|
||||
|
|
|
@ -27,9 +27,12 @@
|
|||
#include "Basics/Common.h"
|
||||
|
||||
namespace arangodb {
|
||||
namespace rest {
|
||||
class RestHandlerFactory;
|
||||
}
|
||||
|
||||
struct MMFilesRestHandlers {
|
||||
static void registerResources();
|
||||
static void registerResources(rest::RestHandlerFactory*);
|
||||
};
|
||||
|
||||
} // namespace arangodb
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
/// @author Jan Steemann
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RestWalHandler.h"
|
||||
#include "MMFilesRestWalHandler.h"
|
||||
#include "Basics/VelocyPackHelper.h"
|
||||
#include "Cluster/ClusterMethods.h"
|
||||
#include "Cluster/ServerState.h"
|
||||
|
@ -30,11 +30,11 @@
|
|||
using namespace arangodb;
|
||||
using namespace arangodb::rest;
|
||||
|
||||
RestWalHandler::RestWalHandler(
|
||||
MMFilesRestWalHandler::MMFilesRestWalHandler(
|
||||
GeneralRequest* request, GeneralResponse* response)
|
||||
: RestVocbaseBaseHandler(request, response) {}
|
||||
|
||||
RestStatus RestWalHandler::execute() {
|
||||
RestStatus MMFilesRestWalHandler::execute() {
|
||||
std::vector<std::string> const& suffixes = _request->suffixes();
|
||||
|
||||
if (suffixes.size() != 1) {
|
||||
|
@ -74,7 +74,7 @@ RestStatus RestWalHandler::execute() {
|
|||
return RestStatus::DONE;
|
||||
}
|
||||
|
||||
void RestWalHandler::properties() {
|
||||
void MMFilesRestWalHandler::properties() {
|
||||
auto l = MMFilesLogfileManager::instance();
|
||||
|
||||
if (_request->requestType() == rest::RequestType::PUT) {
|
||||
|
@ -137,7 +137,7 @@ void RestWalHandler::properties() {
|
|||
generateResult(rest::ResponseCode::OK, builder.slice());
|
||||
}
|
||||
|
||||
void RestWalHandler::flush() {
|
||||
void MMFilesRestWalHandler::flush() {
|
||||
std::shared_ptr<VPackBuilder> parsedRequest;
|
||||
VPackSlice slice;
|
||||
try {
|
||||
|
@ -202,7 +202,7 @@ void RestWalHandler::flush() {
|
|||
generateResult(rest::ResponseCode::OK, basics::VelocyPackHelper::EmptyObjectValue());
|
||||
}
|
||||
|
||||
void RestWalHandler::transactions() {
|
||||
void MMFilesRestWalHandler::transactions() {
|
||||
auto const& info =
|
||||
MMFilesLogfileManager::instance()->runningTransactions();
|
||||
|
|
@ -21,21 +21,21 @@
|
|||
/// @author Jan Steemann
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef ARANGOD_REST_HANDLER_REST_WAL_HANDLER_H
|
||||
#define ARANGOD_REST_HANDLER_REST_WAL_HANDLER_H 1
|
||||
#ifndef ARANGOD_MMFILES_MMFILES_REST_WAL_HANDLER_H
|
||||
#define ARANGOD_MMFILES_MMFILES_REST_WAL_HANDLER_H 1
|
||||
|
||||
#include "Basics/Common.h"
|
||||
#include "RestHandler/RestVocbaseBaseHandler.h"
|
||||
|
||||
namespace arangodb {
|
||||
|
||||
class RestWalHandler : public RestVocbaseBaseHandler {
|
||||
class MMFilesRestWalHandler : public RestVocbaseBaseHandler {
|
||||
public:
|
||||
RestWalHandler(GeneralRequest*, GeneralResponse*);
|
||||
MMFilesRestWalHandler(GeneralRequest*, GeneralResponse*);
|
||||
|
||||
public:
|
||||
RestStatus execute() override final;
|
||||
char const* name() const override final { return "RestWalHandler"; }
|
||||
char const* name() const override final { return "MMFilesRestWalHandler"; }
|
||||
|
||||
private:
|
||||
void flush();
|
|
@ -137,12 +137,6 @@ std::string const RestVocbaseBaseHandler::SIMPLE_REMOVE_PATH =
|
|||
|
||||
std::string const RestVocbaseBaseHandler::UPLOAD_PATH = "/_api/upload";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief wal path
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::string const RestVocbaseBaseHandler::WAL_PATH = "/_admin/wal";
|
||||
|
||||
/// @brief Internal Traverser path
|
||||
|
||||
std::string const RestVocbaseBaseHandler::INTERNAL_TRAVERSER_PATH = "/_internal/traverser";
|
||||
|
|
|
@ -130,12 +130,6 @@ class RestVocbaseBaseHandler : public RestBaseHandler {
|
|||
|
||||
static std::string const UPLOAD_PATH;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief wal path
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static std::string const WAL_PATH;
|
||||
|
||||
/// @brief Internal Traverser path
|
||||
|
||||
static std::string const INTERNAL_TRAVERSER_PATH;
|
||||
|
|
|
@ -46,6 +46,10 @@ class Result;
|
|||
class TransactionCollection;
|
||||
class TransactionState;
|
||||
|
||||
namespace rest {
|
||||
class RestHandlerFactory;
|
||||
}
|
||||
|
||||
namespace transaction {
|
||||
class ContextData;
|
||||
}
|
||||
|
@ -342,7 +346,7 @@ class StorageEngine : public application_features::ApplicationFeature {
|
|||
virtual void addV8Functions() = 0;
|
||||
|
||||
/// @brief Add engine-specific REST handlers
|
||||
virtual void addRestHandlers() = 0;
|
||||
virtual void addRestHandlers(rest::RestHandlerFactory*) = 0;
|
||||
|
||||
protected:
|
||||
void registerCollection(TRI_vocbase_t* vocbase,
|
||||
|
|
Loading…
Reference in New Issue