mirror of https://gitee.com/bigwinds/arangodb
added RubyDispatcherThread
This commit is contained in:
parent
35ee4a3bff
commit
2a89e6e176
|
@ -5,7 +5,7 @@
|
||||||
///
|
///
|
||||||
/// DISCLAIMER
|
/// DISCLAIMER
|
||||||
///
|
///
|
||||||
/// Copyright 2004-2012 triagens GmbH, Cologne, Germany
|
/// Copyright 2004-2012 triAGENS GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
/// you may not use this file except in compliance with the License.
|
/// you may not use this file except in compliance with the License.
|
||||||
|
@ -57,5 +57,5 @@ ArangoHttpServer::ArangoHttpServer (Scheduler* scheduler, Dispatcher* dispatcher
|
||||||
|
|
||||||
// Local Variables:
|
// Local Variables:
|
||||||
// mode: outline-minor
|
// mode: outline-minor
|
||||||
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)"
|
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}\\)"
|
||||||
// End:
|
// End:
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
///
|
///
|
||||||
/// DISCLAIMER
|
/// DISCLAIMER
|
||||||
///
|
///
|
||||||
/// Copyright 2004-2012 triagens GmbH, Cologne, Germany
|
/// Copyright 2004-2012 triAGENS GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
/// you may not use this file except in compliance with the License.
|
/// you may not use this file except in compliance with the License.
|
||||||
|
@ -80,5 +80,5 @@ namespace triagens {
|
||||||
|
|
||||||
// Local Variables:
|
// Local Variables:
|
||||||
// mode: outline-minor
|
// mode: outline-minor
|
||||||
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)"
|
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}\\)"
|
||||||
// End:
|
// End:
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
///
|
///
|
||||||
/// DISCLAIMER
|
/// DISCLAIMER
|
||||||
///
|
///
|
||||||
/// Copyright 2004-2012 triagens GmbH, Cologne, Germany
|
/// Copyright 2004-2012 triAGENS GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
/// you may not use this file except in compliance with the License.
|
/// you may not use this file except in compliance with the License.
|
||||||
|
@ -80,6 +80,7 @@ using namespace triagens::arango;
|
||||||
#include "MRuby/MRLineEditor.h"
|
#include "MRuby/MRLineEditor.h"
|
||||||
#include "MRuby/MRLoader.h"
|
#include "MRuby/MRLoader.h"
|
||||||
#include "MRuby/mr-actions.h"
|
#include "MRuby/mr-actions.h"
|
||||||
|
#include "RestServer/RubyDispatcherThread.h"
|
||||||
|
|
||||||
#include "mruby.h"
|
#include "mruby.h"
|
||||||
#include "mruby/compile.h"
|
#include "mruby/compile.h"
|
||||||
|
@ -200,17 +201,13 @@ static DispatcherThread* SystemActionDispatcherThreadCreatorJS (DispatcherQueue*
|
||||||
#ifdef TRI_ENABLE_MRUBY
|
#ifdef TRI_ENABLE_MRUBY
|
||||||
|
|
||||||
static DispatcherThread* ClientActionDispatcherThreadCreatorMR (DispatcherQueue* queue) {
|
static DispatcherThread* ClientActionDispatcherThreadCreatorMR (DispatcherQueue* queue) {
|
||||||
return 0;
|
return new RubyDispatcherThread(queue,
|
||||||
#if 0
|
Vocbase,
|
||||||
return new ActionDispatcherThread(queue,
|
"CLIENT-RUBY",
|
||||||
Vocbase,
|
AllowedClientActions,
|
||||||
GcIntervalJS,
|
StartupModulesMR,
|
||||||
"CLIENT-RUBY",
|
&StartupLoaderMR,
|
||||||
AllowedClientActions,
|
&ActionLoaderMR);
|
||||||
StartupModulesJS,
|
|
||||||
&StartupLoaderJS,
|
|
||||||
&ActionLoaderJS);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -222,17 +219,13 @@ static DispatcherThread* ClientActionDispatcherThreadCreatorMR (DispatcherQueue*
|
||||||
#ifdef TRI_ENABLE_MRUBY
|
#ifdef TRI_ENABLE_MRUBY
|
||||||
|
|
||||||
static DispatcherThread* SystemActionDispatcherThreadCreatorMR (DispatcherQueue* queue) {
|
static DispatcherThread* SystemActionDispatcherThreadCreatorMR (DispatcherQueue* queue) {
|
||||||
return 0;
|
return new RubyDispatcherThread(queue,
|
||||||
#if 0
|
Vocbase,
|
||||||
return new ActionDispatcherThread(queue,
|
"SYSTEM-RUBY",
|
||||||
Vocbase,
|
AllowedAdminActions,
|
||||||
GcIntervalJS,
|
StartupModulesMR,
|
||||||
"SYSTEM-RUBY",
|
&StartupLoaderMR,
|
||||||
AllowedAdminActions,
|
&ActionLoaderMR);
|
||||||
StartupModulesJS,
|
|
||||||
&StartupLoaderJS,
|
|
||||||
&ActionLoaderJS);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -242,7 +235,7 @@ static DispatcherThread* SystemActionDispatcherThreadCreatorMR (DispatcherQueue*
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static void DefineApiHandlers (HttpHandlerFactory* factory,
|
static void DefineApiHandlers (HttpHandlerFactory* factory,
|
||||||
ApplicationAdminServer* admin,
|
ApplicationAdminServer* admin,
|
||||||
TRI_vocbase_t* vocbase) {
|
TRI_vocbase_t* vocbase) {
|
||||||
|
|
||||||
// add "/version" handler
|
// add "/version" handler
|
||||||
|
@ -340,7 +333,7 @@ ArangoServer::ArangoServer (int argc, char** argv)
|
||||||
// .............................................................................
|
// .............................................................................
|
||||||
|
|
||||||
#ifdef TRI_ENABLE_RELATIVE_SYSTEM
|
#ifdef TRI_ENABLE_RELATIVE_SYSTEM
|
||||||
|
|
||||||
_workingDirectory = _binaryPath + "/../tmp";
|
_workingDirectory = _binaryPath + "/../tmp";
|
||||||
_actionPathJS = _binaryPath + "/../share/arango/js/actions/system";
|
_actionPathJS = _binaryPath + "/../share/arango/js/actions/system";
|
||||||
_startupModulesJS = _binaryPath + "/../share/arango/js/server/modules"
|
_startupModulesJS = _binaryPath + "/../share/arango/js/server/modules"
|
||||||
|
@ -439,37 +432,37 @@ void ArangoServer::buildApplicationServer () {
|
||||||
vector<right_t> rightsManager;
|
vector<right_t> rightsManager;
|
||||||
rightsManager.push_back(RIGHT_TO_MANAGE_USER);
|
rightsManager.push_back(RIGHT_TO_MANAGE_USER);
|
||||||
rightsManager.push_back(RIGHT_TO_MANAGE_ADMIN);
|
rightsManager.push_back(RIGHT_TO_MANAGE_ADMIN);
|
||||||
|
|
||||||
_applicationUserManager->createRole("manager", rightsManager, 0);
|
_applicationUserManager->createRole("manager", rightsManager, 0);
|
||||||
|
|
||||||
// create admin role
|
// create admin role
|
||||||
vector<right_t> rightsAdmin;
|
vector<right_t> rightsAdmin;
|
||||||
rightsAdmin.push_back(RIGHT_TO_MANAGE_USER);
|
rightsAdmin.push_back(RIGHT_TO_MANAGE_USER);
|
||||||
rightsAdmin.push_back(RIGHT_TO_BE_DELETED);
|
rightsAdmin.push_back(RIGHT_TO_BE_DELETED);
|
||||||
|
|
||||||
_applicationUserManager->createRole("admin", rightsAdmin, RIGHT_TO_MANAGE_ADMIN);
|
_applicationUserManager->createRole("admin", rightsAdmin, RIGHT_TO_MANAGE_ADMIN);
|
||||||
|
|
||||||
// create user role
|
// create user role
|
||||||
vector<right_t> rightsUser;
|
vector<right_t> rightsUser;
|
||||||
rightsUser.push_back(RIGHT_TO_BE_DELETED);
|
rightsUser.push_back(RIGHT_TO_BE_DELETED);
|
||||||
|
|
||||||
_applicationUserManager->createRole("user", rightsUser, RIGHT_TO_MANAGE_USER);
|
_applicationUserManager->createRole("user", rightsUser, RIGHT_TO_MANAGE_USER);
|
||||||
|
|
||||||
// create a standard user
|
// create a standard user
|
||||||
_applicationUserManager->createUser("manager", "manager");
|
_applicationUserManager->createUser("manager", "manager");
|
||||||
|
|
||||||
// added a anonymous right for session which are not logged in
|
// added a anonymous right for session which are not logged in
|
||||||
vector<right_t> rightsAnonymous;
|
vector<right_t> rightsAnonymous;
|
||||||
rightsAnonymous.push_back(RIGHT_TO_LOGIN);
|
rightsAnonymous.push_back(RIGHT_TO_LOGIN);
|
||||||
|
|
||||||
_applicationUserManager->setAnonymousRights(rightsAnonymous);
|
_applicationUserManager->setAnonymousRights(rightsAnonymous);
|
||||||
|
|
||||||
// .............................................................................
|
// .............................................................................
|
||||||
// use relative system paths
|
// use relative system paths
|
||||||
// .............................................................................
|
// .............................................................................
|
||||||
|
|
||||||
#ifdef TRI_ENABLE_RELATIVE_SYSTEM
|
#ifdef TRI_ENABLE_RELATIVE_SYSTEM
|
||||||
|
|
||||||
_applicationServer->setSystemConfigFile("arango.conf", _binaryPath + "/../etc");
|
_applicationServer->setSystemConfigFile("arango.conf", _binaryPath + "/../etc");
|
||||||
_applicationAdminServer->allowAdminDirectory(_binaryPath + "/../share/arango/html/admin");
|
_applicationAdminServer->allowAdminDirectory(_binaryPath + "/../share/arango/html/admin");
|
||||||
|
|
||||||
|
@ -736,7 +729,7 @@ int ArangoServer::startupServer () {
|
||||||
|
|
||||||
Vocbase = _vocbase;
|
Vocbase = _vocbase;
|
||||||
StartupModulesJS = _startupModulesJS;
|
StartupModulesJS = _startupModulesJS;
|
||||||
GcIntervalJS = _gcIntervalJS;
|
GcIntervalJS = _gcIntervalJS;
|
||||||
|
|
||||||
// .............................................................................
|
// .............................................................................
|
||||||
// create the various parts of the Arango server
|
// create the various parts of the Arango server
|
||||||
|
@ -763,7 +756,7 @@ int ArangoServer::startupServer () {
|
||||||
|
|
||||||
#if TRI_ENABLE_MRUBY
|
#if TRI_ENABLE_MRUBY
|
||||||
if (0 < _actionThreadsMR) {
|
if (0 < _actionThreadsMR) {
|
||||||
// safe_cast<DispatcherImpl*>(dispatcher)->addQueue("CLIENT-RUBY", ClientActionDispatcherThreadCreatorMR, _actionThreadsMR);
|
safe_cast<DispatcherImpl*>(dispatcher)->addQueue("CLIENT-RUBY", ClientActionDispatcherThreadCreatorMR, _actionThreadsMR);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -773,7 +766,7 @@ int ArangoServer::startupServer () {
|
||||||
safe_cast<DispatcherImpl*>(dispatcher)->addQueue("SYSTEM-JAVASCRIPT", SystemActionDispatcherThreadCreatorJS, 2);
|
safe_cast<DispatcherImpl*>(dispatcher)->addQueue("SYSTEM-JAVASCRIPT", SystemActionDispatcherThreadCreatorJS, 2);
|
||||||
|
|
||||||
#if TRI_ENABLE_MRUBY
|
#if TRI_ENABLE_MRUBY
|
||||||
// safe_cast<DispatcherImpl*>(dispatcher)->addQueue("SYSTEM-RUBY", SystemActionDispatcherThreadCreatorMR, 2);
|
safe_cast<DispatcherImpl*>(dispatcher)->addQueue("SYSTEM-RUBY", SystemActionDispatcherThreadCreatorMR, 2);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -805,7 +798,7 @@ int ArangoServer::startupServer () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add action handler
|
// add action handler
|
||||||
factory->addPrefixHandler("/",
|
factory->addPrefixHandler("/",
|
||||||
RestHandlerCreator<RestActionHandler>::createData<RestActionHandler::action_options_t*>,
|
RestHandlerCreator<RestActionHandler>::createData<RestActionHandler::action_options_t*>,
|
||||||
(void*) &httpOptions);
|
(void*) &httpOptions);
|
||||||
|
|
||||||
|
@ -833,7 +826,7 @@ int ArangoServer::startupServer () {
|
||||||
DefineAdminHandlers(factory, _applicationAdminServer, _applicationUserManager, _vocbase);
|
DefineAdminHandlers(factory, _applicationAdminServer, _applicationUserManager, _vocbase);
|
||||||
|
|
||||||
// add action handler
|
// add action handler
|
||||||
factory->addPrefixHandler("/",
|
factory->addPrefixHandler("/",
|
||||||
RestHandlerCreator<RestActionHandler>::createData<RestActionHandler::action_options_t*>,
|
RestHandlerCreator<RestActionHandler>::createData<RestActionHandler::action_options_t*>,
|
||||||
(void*) &adminOptions);
|
(void*) &adminOptions);
|
||||||
|
|
||||||
|
@ -984,7 +977,7 @@ int ArangoServer::executeShell (bool tests) {
|
||||||
// run tests
|
// run tests
|
||||||
char const* input = "require(\"jsunity\").runCommandLineTests();";
|
char const* input = "require(\"jsunity\").runCommandLineTests();";
|
||||||
TRI_ExecuteJavaScriptString(context, v8::String::New(input), name, true);
|
TRI_ExecuteJavaScriptString(context, v8::String::New(input), name, true);
|
||||||
|
|
||||||
if (tryCatch.HasCaught()) {
|
if (tryCatch.HasCaught()) {
|
||||||
cout << TRI_StringifyV8Exception(&tryCatch);
|
cout << TRI_StringifyV8Exception(&tryCatch);
|
||||||
ok = false;
|
ok = false;
|
||||||
|
@ -1026,7 +1019,7 @@ int ArangoServer::executeShell (bool tests) {
|
||||||
|
|
||||||
TRI_ExecuteJavaScriptString(context, v8::String::New(input), name, true);
|
TRI_ExecuteJavaScriptString(context, v8::String::New(input), name, true);
|
||||||
TRI_FreeString(TRI_UNKNOWN_MEM_ZONE, input);
|
TRI_FreeString(TRI_UNKNOWN_MEM_ZONE, input);
|
||||||
|
|
||||||
if (tryCatch.HasCaught()) {
|
if (tryCatch.HasCaught()) {
|
||||||
cout << TRI_StringifyV8Exception(&tryCatch);
|
cout << TRI_StringifyV8Exception(&tryCatch);
|
||||||
}
|
}
|
||||||
|
@ -1097,7 +1090,7 @@ mrb_value MR_ArangoDatabase_Collection (mrb_state* mrb, mrb_value self) {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check
|
// check
|
||||||
|
|
||||||
printf("using collection '%s'\n", name);
|
printf("using collection '%s'\n", name);
|
||||||
|
|
||||||
|
@ -1110,7 +1103,7 @@ mrb_value MR_ArangoDatabase_Collection (mrb_state* mrb, mrb_value self) {
|
||||||
printf("unknown collection (TODO raise error)\n");
|
printf("unknown collection (TODO raise error)\n");
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mrb_obj_value(Data_Wrap_Struct(mrb, ArangoCollectionClass, &MR_ArangoCollection_Type, (void*) collection));
|
return mrb_obj_value(Data_Wrap_Struct(mrb, ArangoCollectionClass, &MR_ArangoCollection_Type, (void*) collection));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1178,7 +1171,7 @@ int ArangoServer::executeRubyShell () {
|
||||||
MRLineEditor* console = new MRLineEditor(mrs, ".arango-mrb");
|
MRLineEditor* console = new MRLineEditor(mrs, ".arango-mrb");
|
||||||
|
|
||||||
console->open(false);
|
console->open(false);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
char* input = console->prompt("arangod> ");
|
char* input = console->prompt("arangod> ");
|
||||||
|
|
||||||
|
@ -1222,7 +1215,7 @@ int ArangoServer::executeRubyShell () {
|
||||||
mrb_p(&mrs->_mrb, result);
|
mrb_p(&mrs->_mrb, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// close the console
|
// close the console
|
||||||
console->close();
|
console->close();
|
||||||
delete console;
|
delete console;
|
||||||
|
@ -1248,7 +1241,7 @@ void ArangoServer::openDatabase () {
|
||||||
LOGGER_FATAL << "cannot open database '" << _databasePath << "'";
|
LOGGER_FATAL << "cannot open database '" << _databasePath << "'";
|
||||||
LOGGER_INFO << "please use the '--database.directory' option";
|
LOGGER_INFO << "please use the '--database.directory' option";
|
||||||
TRI_FlushLogging();
|
TRI_FlushLogging();
|
||||||
|
|
||||||
ApplicationUserManager::unloadUsers();
|
ApplicationUserManager::unloadUsers();
|
||||||
ApplicationUserManager::unloadRoles();
|
ApplicationUserManager::unloadRoles();
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -1282,5 +1275,5 @@ void ArangoServer::closeDatabase () {
|
||||||
|
|
||||||
// Local Variables:
|
// Local Variables:
|
||||||
// mode: outline-minor
|
// mode: outline-minor
|
||||||
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)"
|
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}\\)"
|
||||||
// End:
|
// End:
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
///
|
///
|
||||||
/// DISCLAIMER
|
/// DISCLAIMER
|
||||||
///
|
///
|
||||||
/// Copyright 2004-2012 triagens GmbH, Cologne, Germany
|
/// Copyright 2004-2012 triAGENS GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
/// you may not use this file except in compliance with the License.
|
/// you may not use this file except in compliance with the License.
|
||||||
|
@ -270,8 +270,8 @@ namespace triagens {
|
||||||
/// @CMDOPT{--javascript.directory @CA{directory}}
|
/// @CMDOPT{--javascript.directory @CA{directory}}
|
||||||
///
|
///
|
||||||
/// Specifies the @CA{directory} path to alternate startup Javascript files.
|
/// Specifies the @CA{directory} path to alternate startup Javascript files.
|
||||||
/// Normally, the server will start using built-in Javascript core
|
/// Normally, the server will start using built-in Javascript core
|
||||||
/// functionality. To override the core functionality with a different
|
/// functionality. To override the core functionality with a different
|
||||||
/// implementation, this option can be used.
|
/// implementation, this option can be used.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ namespace triagens {
|
||||||
///
|
///
|
||||||
/// @CMDOPT{--javascript.action-threads @CA{number}}
|
/// @CMDOPT{--javascript.action-threads @CA{number}}
|
||||||
///
|
///
|
||||||
/// Specifies the @CA{number} of threads that are spawned to handle action
|
/// Specifies the @CA{number} of threads that are spawned to handle action
|
||||||
/// requests using JavaScript.
|
/// requests using JavaScript.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ namespace triagens {
|
||||||
///
|
///
|
||||||
/// @CMDOPT{--javascript.gc-interval @CA{interval}}
|
/// @CMDOPT{--javascript.gc-interval @CA{interval}}
|
||||||
///
|
///
|
||||||
/// Specifies the interval (approximately in number of requests) that the
|
/// Specifies the interval (approximately in number of requests) that the
|
||||||
/// garbage collection for Javascript objects will be run in each thread.
|
/// garbage collection for Javascript objects will be run in each thread.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ namespace triagens {
|
||||||
///
|
///
|
||||||
/// @CMDOPT{--ruby.action-threads @CA{number}}
|
/// @CMDOPT{--ruby.action-threads @CA{number}}
|
||||||
///
|
///
|
||||||
/// Specifies the @CA{number} of threads that are spawned to handle action
|
/// Specifies the @CA{number} of threads that are spawned to handle action
|
||||||
/// requests using MRuby.
|
/// requests using MRuby.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -441,5 +441,5 @@ namespace triagens {
|
||||||
|
|
||||||
// Local Variables:
|
// Local Variables:
|
||||||
// mode: outline-minor
|
// mode: outline-minor
|
||||||
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)"
|
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}\\)"
|
||||||
// End:
|
// End:
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
///
|
///
|
||||||
/// DISCLAIMER
|
/// DISCLAIMER
|
||||||
///
|
///
|
||||||
/// Copyright 2004-2012 triagens GmbH, Cologne, Germany
|
/// Copyright 2004-2012 triAGENS GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
/// you may not use this file except in compliance with the License.
|
/// you may not use this file except in compliance with the License.
|
||||||
|
@ -161,7 +161,7 @@ void JavascriptDispatcherThread::run () {
|
||||||
_context->Enter();
|
_context->Enter();
|
||||||
|
|
||||||
DispatcherThread::run();
|
DispatcherThread::run();
|
||||||
|
|
||||||
// free memory for this thread
|
// free memory for this thread
|
||||||
TRI_v8_global_t* v8g = (TRI_v8_global_t*) _isolate->GetData();
|
TRI_v8_global_t* v8g = (TRI_v8_global_t*) _isolate->GetData();
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ void JavascriptDispatcherThread::run () {
|
||||||
|
|
||||||
_context->Exit();
|
_context->Exit();
|
||||||
_context.Dispose();
|
_context.Dispose();
|
||||||
|
|
||||||
_isolate->Exit();
|
_isolate->Exit();
|
||||||
_isolate->Dispose();
|
_isolate->Dispose();
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ void JavascriptDispatcherThread::initialise () {
|
||||||
LOGGER_FATAL << "cannot load actions from directory '" << _actionLoader->getDirectory() << "'";
|
LOGGER_FATAL << "cannot load actions from directory '" << _actionLoader->getDirectory() << "'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// and return from the context
|
// and return from the context
|
||||||
_context->Exit();
|
_context->Exit();
|
||||||
_isolate->Exit();
|
_isolate->Exit();
|
||||||
|
@ -267,5 +267,5 @@ void JavascriptDispatcherThread::initialise () {
|
||||||
|
|
||||||
// Local Variables:
|
// Local Variables:
|
||||||
// mode: outline-minor
|
// mode: outline-minor
|
||||||
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)"
|
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}\\)"
|
||||||
// End:
|
// End:
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
///
|
///
|
||||||
/// DISCLAIMER
|
/// DISCLAIMER
|
||||||
///
|
///
|
||||||
/// Copyright 2004-2012 triagens GmbH, Cologne, Germany
|
/// Copyright 2004-2012 triAGENS GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
/// you may not use this file except in compliance with the License.
|
/// you may not use this file except in compliance with the License.
|
||||||
|
@ -199,7 +199,7 @@ namespace triagens {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief Javascript garbage collection interval (each x requests)
|
/// @brief Javascript garbage collection interval (each x requests)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
uint64_t _gcInterval;
|
uint64_t _gcInterval;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -261,5 +261,5 @@ namespace triagens {
|
||||||
|
|
||||||
// Local Variables:
|
// Local Variables:
|
||||||
// mode: outline-minor
|
// mode: outline-minor
|
||||||
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)"
|
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}\\)"
|
||||||
// End:
|
// End:
|
||||||
|
|
|
@ -0,0 +1,271 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief dispatcher thread for JavaScript actions
|
||||||
|
///
|
||||||
|
/// @file
|
||||||
|
///
|
||||||
|
/// DISCLAIMER
|
||||||
|
///
|
||||||
|
/// Copyright 2004-2012 triAGENS GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
/// you may not use this file except in compliance with the License.
|
||||||
|
/// You may obtain a copy of the License at
|
||||||
|
///
|
||||||
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
///
|
||||||
|
/// Unless required by applicable law or agreed to in writing, software
|
||||||
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
/// See the License for the specific language governing permissions and
|
||||||
|
/// limitations under the License.
|
||||||
|
///
|
||||||
|
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// @author Dr. Frank Celler
|
||||||
|
/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "JavascriptDispatcherThread.h"
|
||||||
|
|
||||||
|
#include "Actions/actions.h"
|
||||||
|
#include "Logger/Logger.h"
|
||||||
|
#include "V8/v8-actions.h"
|
||||||
|
#include "V8/v8-conv.h"
|
||||||
|
#include "V8/v8-query.h"
|
||||||
|
#include "V8/v8-shell.h"
|
||||||
|
#include "V8/v8-utils.h"
|
||||||
|
#include "V8/v8-vocbase.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace triagens::basics;
|
||||||
|
using namespace triagens::rest;
|
||||||
|
using namespace triagens::arango;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- class ActionDispatcherThread
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- constructors and destructors
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief constructs a new dispatcher thread
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
JavascriptDispatcherThread::JavascriptDispatcherThread (rest::DispatcherQueue* queue,
|
||||||
|
TRI_vocbase_t* vocbase,
|
||||||
|
uint64_t gcInterval,
|
||||||
|
string const& actionQueue,
|
||||||
|
set<string> const& allowedContexts,
|
||||||
|
string startupModules,
|
||||||
|
JSLoader* startupLoader,
|
||||||
|
JSLoader* actionLoader)
|
||||||
|
: ActionDispatcherThread(queue),
|
||||||
|
_vocbase(vocbase),
|
||||||
|
_gcInterval(gcInterval),
|
||||||
|
_gc(0),
|
||||||
|
_isolate(0),
|
||||||
|
_context(),
|
||||||
|
_actionQueue(actionQueue),
|
||||||
|
_allowedContexts(allowedContexts),
|
||||||
|
_startupModules(startupModules),
|
||||||
|
_startupLoader(startupLoader),
|
||||||
|
_actionLoader(actionLoader) {
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- ActionDispatcherThread methods
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// {@inheritDoc}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void* JavascriptDispatcherThread::context () {
|
||||||
|
return (void*) _isolate; // the isolate is the execution context
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- DispatcherThread methods
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// {@inheritDoc}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void JavascriptDispatcherThread::reportStatus () {
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// {@inheritDoc}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void JavascriptDispatcherThread::tick (bool idle) {
|
||||||
|
_gc += (idle ? 10 : 1);
|
||||||
|
|
||||||
|
if (_gc > _gcInterval) {
|
||||||
|
LOGGER_TRACE << "collecting garbage...";
|
||||||
|
|
||||||
|
while (! v8::V8::IdleNotification()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
_gc = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- Thread methods
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// {@inheritDoc}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void JavascriptDispatcherThread::run () {
|
||||||
|
initialise();
|
||||||
|
|
||||||
|
_isolate->Enter();
|
||||||
|
_context->Enter();
|
||||||
|
|
||||||
|
DispatcherThread::run();
|
||||||
|
|
||||||
|
// free memory for this thread
|
||||||
|
TRI_v8_global_t* v8g = (TRI_v8_global_t*) _isolate->GetData();
|
||||||
|
|
||||||
|
if (v8g) {
|
||||||
|
delete v8g;
|
||||||
|
}
|
||||||
|
|
||||||
|
_context->Exit();
|
||||||
|
_context.Dispose();
|
||||||
|
|
||||||
|
_isolate->Exit();
|
||||||
|
_isolate->Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- private methods
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief initialises the isolate and context
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void JavascriptDispatcherThread::initialise () {
|
||||||
|
bool ok;
|
||||||
|
char const* files[] = { "common/bootstrap/modules.js",
|
||||||
|
"common/bootstrap/print.js",
|
||||||
|
"common/bootstrap/errors.js",
|
||||||
|
"server/ahuacatl.js",
|
||||||
|
"server/server.js"
|
||||||
|
};
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
// enter a new isolate
|
||||||
|
_isolate = v8::Isolate::New();
|
||||||
|
_isolate->Enter();
|
||||||
|
|
||||||
|
// create the context
|
||||||
|
_context = v8::Context::New(0);
|
||||||
|
|
||||||
|
if (_context.IsEmpty()) {
|
||||||
|
LOGGER_FATAL << "cannot initialize V8 engine";
|
||||||
|
_isolate->Exit();
|
||||||
|
TRI_FlushLogging();
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
_context->Enter();
|
||||||
|
|
||||||
|
TRI_InitV8VocBridge(_context, _vocbase);
|
||||||
|
TRI_InitV8Queries(_context);
|
||||||
|
TRI_InitV8Actions(_context, _actionQueue, _allowedContexts);
|
||||||
|
TRI_InitV8Conversions(_context);
|
||||||
|
TRI_InitV8Utils(_context, _startupModules);
|
||||||
|
TRI_InitV8Shell(_context);
|
||||||
|
|
||||||
|
// load all init files
|
||||||
|
for (i = 0; i < sizeof(files) / sizeof(files[0]); ++i) {
|
||||||
|
ok = _startupLoader->loadScript(_context, files[i]);
|
||||||
|
|
||||||
|
if (! ok) {
|
||||||
|
LOGGER_FATAL << "cannot load json utilities from file '" << files[i] << "'";
|
||||||
|
_context->Exit();
|
||||||
|
_isolate->Exit();
|
||||||
|
|
||||||
|
TRI_FlushLogging();
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// load all actions
|
||||||
|
if (_actionLoader == 0) {
|
||||||
|
LOGGER_WARNING << "no action loader has been defined";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ok = _actionLoader->executeAllScripts(_context);
|
||||||
|
|
||||||
|
if (! ok) {
|
||||||
|
LOGGER_FATAL << "cannot load actions from directory '" << _actionLoader->getDirectory() << "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// and return from the context
|
||||||
|
_context->Exit();
|
||||||
|
_isolate->Exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- END-OF-FILE
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Local Variables:
|
||||||
|
// mode: outline-minor
|
||||||
|
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}\\)"
|
||||||
|
// End:
|
|
@ -0,0 +1,243 @@
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief dispatcher thread for Ruby actions
|
||||||
|
///
|
||||||
|
/// @file
|
||||||
|
///
|
||||||
|
/// DISCLAIMER
|
||||||
|
///
|
||||||
|
/// Copyright 2004-2012 triAGENS GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
/// you may not use this file except in compliance with the License.
|
||||||
|
/// You may obtain a copy of the License at
|
||||||
|
///
|
||||||
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
///
|
||||||
|
/// Unless required by applicable law or agreed to in writing, software
|
||||||
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
/// See the License for the specific language governing permissions and
|
||||||
|
/// limitations under the License.
|
||||||
|
///
|
||||||
|
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// @author Dr. Frank Celler
|
||||||
|
/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef TRIAGENS_REST_SERVER_RUBY_DISPATCHER_THREAD_H
|
||||||
|
#define TRIAGENS_REST_SERVER_RUBY_DISPATCHER_THREAD_H 1
|
||||||
|
|
||||||
|
#include "Actions/ActionDispatcherThread.h"
|
||||||
|
|
||||||
|
#include "MRuby/MRLoader.h"
|
||||||
|
#include "VocBase/vocbase.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- class ActionDispatcherThread
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
namespace triagens {
|
||||||
|
namespace arango {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief dispatcher thread
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class RubyDispatcherThread : public ActionDispatcherThread {
|
||||||
|
private:
|
||||||
|
RubyDispatcherThread (RubyDispatcherThread const&);
|
||||||
|
RubyDispatcherThread& operator= (RubyDispatcherThread const&);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- constructors and destructors
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief constructs a new dispatcher thread
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
RubyDispatcherThread (rest::DispatcherQueue*,
|
||||||
|
TRI_vocbase_t*,
|
||||||
|
string const& actionQueue,
|
||||||
|
set<string> const& allowedContexts,
|
||||||
|
std::string startupModules,
|
||||||
|
MRLoader* startupLoader,
|
||||||
|
MRLoader* actionLoader);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- ActionDispatcherThread methods
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// {@inheritDoc}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void* context ();
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- DispatcherThread methods
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// {@inheritDoc}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void reportStatus ();
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// {@inheritDoc}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void tick (bool idle);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- Thread methods
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// {@inheritDoc}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void run ();
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- private methods
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief initialises the isolate and context
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void initialise ();
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- private variables
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @addtogroup ArangoDB
|
||||||
|
/// @{
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief vocbase
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
TRI_vocbase_t* _vocbase;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief V8 isolate
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
MR_state_t* _mrs;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief action queue
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
std::string _actionQueue;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief allowed action contexts
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
std::set<std::string> _allowedContexts;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief modules path
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
string _startupModules;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief startup path
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
MRLoader* _startupLoader;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief action path
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
MRLoader* _actionLoader;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @}
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Local Variables:
|
||||||
|
// mode: outline-minor
|
||||||
|
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}\\)"
|
||||||
|
// End:
|
|
@ -5,7 +5,7 @@
|
||||||
///
|
///
|
||||||
/// DISCLAIMER
|
/// DISCLAIMER
|
||||||
///
|
///
|
||||||
/// Copyright 2004-2012 triagens GmbH, Cologne, Germany
|
/// Copyright 2004-2012 triAGENS GmbH, Cologne, Germany
|
||||||
///
|
///
|
||||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
/// you may not use this file except in compliance with the License.
|
/// you may not use this file except in compliance with the License.
|
||||||
|
@ -70,5 +70,5 @@ int main (int argc, char* argv[]) {
|
||||||
|
|
||||||
// Local Variables:
|
// Local Variables:
|
||||||
// mode: outline-minor
|
// mode: outline-minor
|
||||||
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)"
|
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}\\)"
|
||||||
// End:
|
// End:
|
||||||
|
|
|
@ -39,9 +39,9 @@ class ArangoError
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
################################################################################
|
## -----------------------------------------------------------------------------
|
||||||
## --SECTION-- END-OF-FILE
|
## --SECTION-- END-OF-FILE
|
||||||
################################################################################
|
## -----------------------------------------------------------------------------
|
||||||
|
|
||||||
## Local Variables:
|
## Local Variables:
|
||||||
## mode: outline-minor
|
## mode: outline-minor
|
||||||
|
|
|
@ -40,9 +40,9 @@ static string MR_common_bootstrap_error =
|
||||||
" end\n"
|
" end\n"
|
||||||
"end\n"
|
"end\n"
|
||||||
"\n"
|
"\n"
|
||||||
"################################################################################\n"
|
"## -----------------------------------------------------------------------------\n"
|
||||||
"## --SECTION-- END-OF-FILE\n"
|
"## --SECTION-- END-OF-FILE\n"
|
||||||
"################################################################################\n"
|
"## -----------------------------------------------------------------------------\n"
|
||||||
"\n"
|
"\n"
|
||||||
"## Local Variables:\n"
|
"## Local Variables:\n"
|
||||||
"## mode: outline-minor\n"
|
"## mode: outline-minor\n"
|
||||||
|
|
|
@ -77,9 +77,9 @@ static string MR_server_server =
|
||||||
"\n"
|
"\n"
|
||||||
"end\n"
|
"end\n"
|
||||||
"\n"
|
"\n"
|
||||||
"################################################################################\n"
|
"## -----------------------------------------------------------------------------\n"
|
||||||
"## --SECTION-- END-OF-FILE\n"
|
"## --SECTION-- END-OF-FILE\n"
|
||||||
"################################################################################\n"
|
"## -----------------------------------------------------------------------------\n"
|
||||||
"\n"
|
"\n"
|
||||||
"## Local Variables:\n"
|
"## Local Variables:\n"
|
||||||
"## mode: outline-minor\n"
|
"## mode: outline-minor\n"
|
||||||
|
|
|
@ -76,9 +76,9 @@ module Arango
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
################################################################################
|
## -----------------------------------------------------------------------------
|
||||||
## --SECTION-- END-OF-FILE
|
## --SECTION-- END-OF-FILE
|
||||||
################################################################################
|
## -----------------------------------------------------------------------------
|
||||||
|
|
||||||
## Local Variables:
|
## Local Variables:
|
||||||
## mode: outline-minor
|
## mode: outline-minor
|
||||||
|
|
Loading…
Reference in New Issue