1
0
Fork 0

Merge branch 'devel' of github.com:triAGENS/ArangoDB into devel

This commit is contained in:
Michael Hackstein 2014-06-04 11:49:33 +02:00
commit 7e511ddaa9
16 changed files with 264 additions and 266 deletions

View File

@ -35,6 +35,8 @@ v2.2.0 (XXXX-XX-XX)
v2.1.1 (2014-06-06) v2.1.1 (2014-06-06)
------------------- -------------------
* fixed dfdb: should not start any other V8 threads
* signature for collection functions was modified * signature for collection functions was modified
The basic change was the substitution of the input parameter of the The basic change was the substitution of the input parameter of the

View File

@ -247,7 +247,7 @@ pack-winXX-cmake:
cd Build$(BITS) && cpack -G NSIS cd Build$(BITS) && cpack -G NSIS
./installer-generator.sh $(BITS) ./Installation/Windows/installer-generator.sh $(BITS) $(shell pwd)
################################################################################ ################################################################################
### @brief Windows Vista 64-bit bundle ### @brief Windows Vista 64-bit bundle

View File

@ -1,7 +1,10 @@
#!/bin/bash #!/bin/bash
NSIS_PATH="/cygdrive/c/Program Files (x86)/NSIS" NSIS_PATH="/cygdrive/c/Program Files (x86)/NSIS"
#shell parameter:
#1 the bits (64 or 32)
#2 the parent directory which contains the Build64 or Build32 directory
cd $2
bits=$1 bits=$1
INSTALLERNAME=`grep CPACK_PACKAGE_FILE_NAME Build$bits/CPackConfig.cmake | grep -o '".*"' | awk -F\" '{print $2}'` INSTALLERNAME=`grep CPACK_PACKAGE_FILE_NAME Build$bits/CPackConfig.cmake | grep -o '".*"' | awk -F\" '{print $2}'`
if [ ! -f Build$bits/$INSTALLERNAME-internal.exe ]; then if [ ! -f Build$bits/$INSTALLERNAME-internal.exe ]; then

View File

@ -491,6 +491,7 @@ void ArangoServer::buildApplicationServer () {
additional[ApplicationServer::OPTIONS_HIDDEN] additional[ApplicationServer::OPTIONS_HIDDEN]
("no-upgrade", "skip a database upgrade") ("no-upgrade", "skip a database upgrade")
("start-service", "used to start as windows service") ("start-service", "used to start as windows service")
("no-server", "do not start the server, if console is requested")
; ;
// ............................................................................. // .............................................................................
@ -763,6 +764,11 @@ void ArangoServer::buildApplicationServer () {
int ArangoServer::startupServer () { int ArangoServer::startupServer () {
OperationMode::server_operation_mode_e mode = OperationMode::determineMode(_applicationServer->programOptions()); OperationMode::server_operation_mode_e mode = OperationMode::determineMode(_applicationServer->programOptions());
bool startServer = true;
if (_applicationServer->programOptions().has("no-server")) {
startServer = false;
}
// ............................................................................. // .............................................................................
// prepare the various parts of the Arango server // prepare the various parts of the Arango server
@ -789,7 +795,9 @@ int ArangoServer::startupServer () {
if (mode == OperationMode::MODE_CONSOLE) { if (mode == OperationMode::MODE_CONSOLE) {
// one V8 instance is taken by the console // one V8 instance is taken by the console
++concurrency; if (startServer) {
++concurrency;
}
} }
else if (mode == OperationMode::MODE_UNITTESTS || mode == OperationMode::MODE_SCRIPT) { else if (mode == OperationMode::MODE_UNITTESTS || mode == OperationMode::MODE_SCRIPT) {
if (concurrency == 1) { if (concurrency == 1) {
@ -823,11 +831,21 @@ int ArangoServer::startupServer () {
// prepare everything // prepare everything
// ............................................................................. // .............................................................................
if (! startServer) {
_applicationScheduler->disable();
_applicationDispatcher->disable();
_applicationEndpointServer->disable();
_applicationV8->disableActions();
_applicationV8->setStartupFile("");
}
// prepare scheduler and dispatcher // prepare scheduler and dispatcher
_applicationServer->prepare(); _applicationServer->prepare();
// now we can create the queues // now we can create the queues
_applicationDispatcher->buildStandardQueue(_dispatcherThreads, (int) _dispatcherQueueSize); if (startServer) {
_applicationDispatcher->buildStandardQueue(_dispatcherThreads, (int) _dispatcherQueueSize);
}
// and finish prepare // and finish prepare
_applicationServer->prepare2(); _applicationServer->prepare2();
@ -840,7 +858,9 @@ int ArangoServer::startupServer () {
_applicationV8->runVersionCheck(skipUpgrade, performUpgrade); _applicationV8->runVersionCheck(skipUpgrade, performUpgrade);
// setup the V8 actions // setup the V8 actions
_applicationV8->prepareActions(); if (startServer) {
_applicationV8->prepareActions();
}
// ............................................................................. // .............................................................................
// create endpoints and handlers // create endpoints and handlers
@ -851,24 +871,27 @@ int ArangoServer::startupServer () {
httpOptions._vocbase = vocbase; httpOptions._vocbase = vocbase;
httpOptions._queue = "STANDARD"; httpOptions._queue = "STANDARD";
// create the handlers if (startServer) {
httpOptions._contexts.insert("user");
httpOptions._contexts.insert("api");
httpOptions._contexts.insert("admin");
// create the server // create the handlers
_applicationEndpointServer->buildServers(); httpOptions._contexts.insert("user");
httpOptions._contexts.insert("api");
httpOptions._contexts.insert("admin");
HttpHandlerFactory* handlerFactory = _applicationEndpointServer->getHandlerFactory(); // create the server
_applicationEndpointServer->buildServers();
DefineApiHandlers(handlerFactory, _applicationAdminServer, _applicationDispatcher, _jobManager); HttpHandlerFactory* handlerFactory = _applicationEndpointServer->getHandlerFactory();
DefineAdminHandlers(handlerFactory, _applicationAdminServer, _applicationDispatcher, _jobManager, _applicationServer);
// add action handler DefineApiHandlers(handlerFactory, _applicationAdminServer, _applicationDispatcher, _jobManager);
handlerFactory->addPrefixHandler( DefineAdminHandlers(handlerFactory, _applicationAdminServer, _applicationDispatcher, _jobManager, _applicationServer);
"/",
RestHandlerCreator<RestActionHandler>::createData<RestActionHandler::action_options_t*>, // add action handler
(void*) &httpOptions); handlerFactory->addPrefixHandler(
"/",
RestHandlerCreator<RestActionHandler>::createData<RestActionHandler::action_options_t*>,
(void*) &httpOptions);
}
// ............................................................................. // .............................................................................
// start the main event loop // start the main event loop

View File

@ -249,7 +249,9 @@ ApplicationV8::ApplicationV8 (TRI_server_t* server,
_stopping(0), _stopping(0),
_gcThread(0), _gcThread(0),
_scheduler(scheduler), _scheduler(scheduler),
_dispatcher(dispatcher) { _dispatcher(dispatcher),
_definedBooleans(),
_startupFile("server/server.js") {
assert(_server != 0); assert(_server != 0);
} }
@ -784,6 +786,14 @@ void ApplicationV8::prepareActions () {
} }
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief sets an alternate init file
////////////////////////////////////////////////////////////////////////////////
void ApplicationV8::setStartupFile (const string& file) {
_startupFile = file;
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- ApplicationFeature methods // --SECTION-- ApplicationFeature methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -927,7 +937,7 @@ void ApplicationV8::close () {
_contextCondition.broadcast(); _contextCondition.broadcast();
// unregister all tasks // unregister all tasks
if (_scheduler != nullptr) { if (_scheduler != nullptr && _scheduler->scheduler() != nullptr) {
_scheduler->scheduler()->unregisterUserTasks(); _scheduler->scheduler()->unregisterUserTasks();
} }
@ -1006,7 +1016,10 @@ bool ApplicationV8::prepareV8Instance (const size_t i) {
files.push_back("common/bootstrap/monkeypatches.js"); files.push_back("common/bootstrap/monkeypatches.js");
files.push_back("server/bootstrap/module-internal.js"); files.push_back("server/bootstrap/module-internal.js");
files.push_back("server/server.js"); // needs internal
if (! _startupFile.empty()) {
files.push_back(_startupFile); // needs internal
}
LOG_TRACE("initialising V8 context #%d", (int) i); LOG_TRACE("initialising V8 context #%d", (int) i);

View File

@ -334,6 +334,14 @@ namespace triagens {
void prepareActions (); void prepareActions ();
////////////////////////////////////////////////////////////////////////////////
/// @brief sets an alternate init file
///
/// Normally "server.js" will be used. Pass empty string to disable.
////////////////////////////////////////////////////////////////////////////////
void setStartupFile (const string&);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- ApplicationFeature methods // --SECTION-- ApplicationFeature methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -625,6 +633,12 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
std::map<std::string, bool> _definedBooleans; std::map<std::string, bool> _definedBooleans;
////////////////////////////////////////////////////////////////////////////////
/// @brief startup file
////////////////////////////////////////////////////////////////////////////////
std::string _startupFile;
}; };
} }
} }

View File

@ -1,4 +1,5 @@
no-upgrade = true no-upgrade = true
no-server = true
[database] [database]
directory= @LOCALSTATEDIR@/lib/arangodb directory= @LOCALSTATEDIR@/lib/arangodb

View File

@ -1,4 +1,5 @@
no-upgrade = true no-upgrade = true
no-server = true
[database] [database]
# directory= /var/arangodb # directory= /var/arangodb

View File

@ -861,32 +861,32 @@ ArangoCollection.prototype.iterate = function (iterator, options) {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief removes documents matching an example /// @brief removes documents matching an example
/// /// @startDocuBlock documents_collectionRemoveByExample
/// @FUN{@FA{collection}.removeByExample(@FA{example})} /// `collection.removeByExample(example)`
/// ///
/// Removes all documents matching an example. /// Removes all documents matching an example.
/// ///
/// @FUN{@FA{collection}.removeByExample(@FA{document}, @FA{waitForSync})} /// `collection.removeByExample(document, waitForSync)`
/// ///
/// The optional @FA{waitForSync} parameter can be used to force synchronisation /// The optional *waitForSync* parameter can be used to force synchronisation
/// of the document deletion operation to disk even in case that the /// of the document deletion operation to disk even in case that the
/// @LIT{waitForSync} flag had been disabled for the entire collection. Thus, /// *waitForSync* flag had been disabled for the entire collection. Thus,
/// the @FA{waitForSync} parameter can be used to force synchronisation of just /// the *waitForSync* parameter can be used to force synchronisation of just
/// specific operations. To use this, set the @FA{waitForSync} parameter to /// specific operations. To use this, set the *waitForSync* parameter to
/// @LIT{true}. If the @FA{waitForSync} parameter is not specified or set to /// *true*. If the *waitForSync* parameter is not specified or set to
/// @LIT{false}, then the collection's default @LIT{waitForSync} behavior is /// *false*, then the collection's default *waitForSync* behavior is
/// applied. The @FA{waitForSync} parameter cannot be used to disable /// applied. The *waitForSync* parameter cannot be used to disable
/// synchronisation for collections that have a default @LIT{waitForSync} value /// synchronisation for collections that have a default *waitForSync* value
/// of @LIT{true}. /// of *true*.
/// ///
/// @FUN{@FA{collection}.removeByExample(@FA{document}, @FA{waitForSync}, @FA{limit})} /// `collection.removeByExample(document, waitForSync, limit)`
/// ///
/// The optional @FA{limit} parameter can be used to restrict the number of /// The optional *limit* parameter can be used to restrict the number of
/// removals to the specified value. If @FA{limit} is specified but less than the /// removals to the specified value. If *limit* is specified but less than the
/// number of documents in the collection, it is undefined which documents are /// number of documents in the collection, it is undefined which documents are
/// removed. /// removed.
/// ///
/// @EXAMPLES /// *Examples*
/// ///
/// @code /// @code
/// arangod> db.content.removeByExample({ "domain": "de.celler" }) /// arangod> db.content.removeByExample({ "domain": "de.celler" })
@ -899,35 +899,35 @@ ArangoCollection.prototype.removeByExample = function (example, waitForSync, lim
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief replaces documents matching an example /// @brief replaces documents matching an example
/// /// @startDocuBlock documents_collectionReplaceByExample
/// @FUN{@FA{collection}.replaceByExample(@FA{example}, @FA{newValue})} /// `collection.replaceByExample(example, newValue)`
/// ///
/// Replaces all documents matching an example with a new document body. /// Replaces all documents matching an example with a new document body.
/// The entire document body of each document matching the @FA{example} will be /// The entire document body of each document matching the *example* will be
/// replaced with @FA{newValue}. The document meta-attributes such as @LIT{_id}, /// replaced with *newValue*. The document meta-attributes such as *_id*,
/// @LIT{_key}, @LIT{_from}, @LIT{_to} will not be replaced. /// *_key*, *_from*, *_to* will not be replaced.
/// ///
/// @FUN{@FA{collection}.replaceByExample(@FA{document}, @FA{newValue}, @FA{waitForSync})} /// `collection.replaceByExample(document, newValue, waitForSync)`
/// ///
/// The optional @FA{waitForSync} parameter can be used to force synchronisation /// The optional *waitForSync* parameter can be used to force synchronisation
/// of the document replacement operation to disk even in case that the /// of the document replacement operation to disk even in case that the
/// @LIT{waitForSync} flag had been disabled for the entire collection. Thus, /// *waitForSync* flag had been disabled for the entire collection. Thus,
/// the @FA{waitForSync} parameter can be used to force synchronisation of just /// the *waitForSync* parameter can be used to force synchronisation of just
/// specific operations. To use this, set the @FA{waitForSync} parameter to /// specific operations. To use this, set the *waitForSync* parameter to
/// @LIT{true}. If the @FA{waitForSync} parameter is not specified or set to /// *true*. If the *waitForSync* parameter is not specified or set to
/// @LIT{false}, then the collection's default @LIT{waitForSync} behavior is /// *false*, then the collection's default *waitForSync* behavior is
/// applied. The @FA{waitForSync} parameter cannot be used to disable /// applied. The *waitForSync* parameter cannot be used to disable
/// synchronisation for collections that have a default @LIT{waitForSync} value /// synchronisation for collections that have a default *waitForSync* value
/// of @LIT{true}. /// of *true*.
/// ///
/// @FUN{@FA{collection}.replaceByExample(@FA{document}, @FA{newValue}, @FA{waitForSync}, @FA{limit})} /// `collection.replaceByExample(document, newValue, waitForSync, limit)`
/// ///
/// The optional @FA{limit} parameter can be used to restrict the number of /// The optional *limit* parameter can be used to restrict the number of
/// replacements to the specified value. If @FA{limit} is specified but less than /// replacements to the specified value. If *limit* is specified but less than
/// the number of documents in the collection, it is undefined which documents are /// the number of documents in the collection, it is undefined which documents are
/// replaced. /// replaced.
/// ///
/// @EXAMPLES /// *Examples*
/// ///
/// @code /// @code
/// arangod> db.content.replaceByExample({ "domain": "de.celler" }, { "foo": "someValue }, false, 5) /// arangod> db.content.replaceByExample({ "domain": "de.celler" }, { "foo": "someValue }, false, 5)
@ -940,42 +940,42 @@ ArangoCollection.prototype.replaceByExample = function (example, newValue, waitF
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief partially updates documents matching an example /// @brief partially updates documents matching an example
/// /// @startDocuBlock documents_collectionUpdateByExample
/// @FUN{@FA{collection}.updateByExample(@FA{example}, @FA{newValue})} /// `collection.updateByExample(example, newValue`
/// ///
/// Partially updates all documents matching an example with a new document body. /// Partially updates all documents matching an example with a new document body.
/// Specific attributes in the document body of each document matching the /// Specific attributes in the document body of each document matching the
/// @FA{example} will be updated with the values from @FA{newValue}. /// *example* will be updated with the values from *newValue*.
/// The document meta-attributes such as @LIT{_id}, @LIT{_key}, @LIT{_from}, /// The document meta-attributes such as *_id*, *_key*, *_from*,
/// @LIT{_to} cannot be updated. /// *_to* cannot be updated.
/// ///
/// @FUN{@FA{collection}.updateByExample(@FA{document}, @FA{newValue}, @FA{keepNull}, @FA{waitForSync})} /// `collection.updateByExample(document, newValue, keepNull, waitForSync)`
/// ///
/// The optional @FA{keepNull} parameter can be used to modify the behavior when /// The optional *keepNull* parameter can be used to modify the behavior when
/// handling @LIT{null} values. Normally, @LIT{null} values are stored in the /// handling *null* values. Normally, *null* values are stored in the
/// database. By setting the @FA{keepNull} parameter to @LIT{false}, this behavior /// database. By setting the *keepNull* parameter to *false*, this behavior
/// can be changed so that all attributes in @FA{data} with @LIT{null} values will /// can be changed so that all attributes in *data* with *null* values will
/// be removed from the target document. /// be removed from the target document.
/// ///
/// The optional @FA{waitForSync} parameter can be used to force synchronisation /// The optional *waitForSync* parameter can be used to force synchronization
/// of the document replacement operation to disk even in case that the /// of the document replacement operation to disk even in case that the
/// @LIT{waitForSync} flag had been disabled for the entire collection. Thus, /// *waitForSync* flag had been disabled for the entire collection. Thus,
/// the @FA{waitForSync} parameter can be used to force synchronisation of just /// the *waitForSync* parameter can be used to force synchronisation of just
/// specific operations. To use this, set the @FA{waitForSync} parameter to /// specific operations. To use this, set the *waitForSync* parameter to
/// @LIT{true}. If the @FA{waitForSync} parameter is not specified or set to /// *true*. If the *waitForSync* parameter is not specified or set to
/// @LIT{false}, then the collection's default @LIT{waitForSync} behavior is /// *false*, then the collection's default *waitForSync* behavior is
/// applied. The @FA{waitForSync} parameter cannot be used to disable /// applied. The *waitForSync* parameter cannot be used to disable
/// synchronisation for collections that have a default @LIT{waitForSync} value /// synchronisation for collections that have a default *waitForSync* value
/// of @LIT{true}. /// of *true*.
/// ///
/// @FUN{@FA{collection}.updateByExample(@FA{document}, @FA{newValue}, @FA{keepNull}, @FA{waitForSync}, @FA{limit})} /// `collection.updateByExample(document, newValue, keepNull, waitForSync, limit)`
/// ///
/// The optional @FA{limit} parameter can be used to restrict the number of /// The optional *limit* parameter can be used to restrict the number of
/// updates to the specified value. If @FA{limit} is specified but less than /// updates to the specified value. If *limit* is specified but less than
/// the number of documents in the collection, it is undefined which documents are /// the number of documents in the collection, it is undefined which documents are
/// updated. /// updated.
/// ///
/// @EXAMPLES /// *Examples*
/// ///
/// @code /// @code
/// arangod> db.content.updateByExample({ "domain": "de.celler" }, { "foo": "someValue, "domain": null }, false) /// arangod> db.content.updateByExample({ "domain": "de.celler" }, { "foo": "someValue, "domain": null }, false)

View File

@ -31,10 +31,9 @@ var fs = require("fs");
var printf = internal.printf; var printf = internal.printf;
//////////////////////////////////////////////////////////////////////////////// // -----------------------------------------------------------------------------
/// @addtogroup ArangoDB // --SECTION-- private functions
/// @{ // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief unload a collection /// @brief unload a collection
@ -589,9 +588,9 @@ function main (argv) {
} }
} }
//////////////////////////////////////////////////////////////////////////////// // -----------------------------------------------------------------------------
/// @} // --SECTION-- END-OF-FILE
//////////////////////////////////////////////////////////////////////////////// // -----------------------------------------------------------------------------
// Local Variables: // Local Variables:
// mode: outline-minor // mode: outline-minor

View File

@ -5,7 +5,7 @@
/// ///
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2004-2013 triAGENS GmbH, Cologne, Germany /// Copyright 2004-2014 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.
@ -22,7 +22,7 @@
/// Copyright holder is triAGENS GmbH, Cologne, Germany /// Copyright holder is triAGENS GmbH, Cologne, Germany
/// ///
/// @author Dr. Frank Celler /// @author Dr. Frank Celler
/// @author Copyright 2010-2013, triAGENS GmbH, Cologne, Germany /// @author Copyright 2010-2014, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "ApplicationFeature.h" #include "ApplicationFeature.h"
@ -35,17 +35,12 @@ using namespace std;
// --SECTION-- constructors and destructors // --SECTION-- constructors and destructors
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ApplicationServer
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief constructor /// @brief constructor
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ApplicationFeature::ApplicationFeature (string const& name) ApplicationFeature::ApplicationFeature (string const& name)
: _name(name) { : _disabled(false), _name(name) {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -55,19 +50,10 @@ ApplicationFeature::ApplicationFeature (string const& name)
ApplicationFeature::~ApplicationFeature () { ApplicationFeature::~ApplicationFeature () {
} }
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public methods // --SECTION-- public methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ApplicationServer
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief returns the name /// @brief returns the name
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -146,9 +132,17 @@ void ApplicationFeature::stop () {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @} /// @brief disable feature
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ApplicationFeature::disable () {
_disabled = true;
}
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// Local Variables: // Local Variables:
// mode: outline-minor // mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}" // outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}"

View File

@ -5,7 +5,7 @@
/// ///
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2004-2013 triAGENS GmbH, Cologne, Germany /// Copyright 2004-2014 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.
@ -22,7 +22,7 @@
/// Copyright holder is triAGENS GmbH, Cologne, Germany /// Copyright holder is triAGENS GmbH, Cologne, Germany
/// ///
/// @author Dr. Frank Celler /// @author Dr. Frank Celler
/// @author Copyright 2010-2013, triAGENS GmbH, Cologne, Germany /// @author Copyright 2010-2014, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef TRIAGENS_APPLICATION_SERVER_APPLICATION_FEATURE_H #ifndef TRIAGENS_APPLICATION_SERVER_APPLICATION_FEATURE_H
@ -45,11 +45,6 @@ namespace triagens {
// --SECTION-- class ApplicationFeature // --SECTION-- class ApplicationFeature
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ApplicationServer
/// @{
////////////////////////////////////////////////////////////////////////////////
namespace rest { namespace rest {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -61,19 +56,10 @@ namespace triagens {
ApplicationFeature (ApplicationFeature const&); ApplicationFeature (ApplicationFeature const&);
ApplicationFeature& operator= (ApplicationFeature const&); ApplicationFeature& operator= (ApplicationFeature const&);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors // --SECTION-- constructors and destructors
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ApplicationServer
/// @{
////////////////////////////////////////////////////////////////////////////////
public: public:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -88,19 +74,10 @@ namespace triagens {
virtual ~ApplicationFeature (); virtual ~ApplicationFeature ();
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public methods // --SECTION-- public methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ApplicationServer
/// @{
////////////////////////////////////////////////////////////////////////////////
public: public:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -169,18 +146,27 @@ namespace triagens {
virtual void stop (); virtual void stop ();
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @} /// @brief disable feature
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void disable ();
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public methods // --SECTION-- protected variables
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
protected:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ApplicationServer /// @brief feature is disabled
/// @{
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool _disabled;
// -----------------------------------------------------------------------------
// --SECTION-- private variables
// -----------------------------------------------------------------------------
private: private:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -192,10 +178,6 @@ namespace triagens {
} }
} }
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
#endif #endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -172,6 +172,10 @@ void ApplicationDispatcher::setupOptions (map<string, ProgramOptionsDescription>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationDispatcher::prepare () { bool ApplicationDispatcher::prepare () {
if (_disabled) {
return true;
}
buildDispatcher(_applicationScheduler->scheduler()); buildDispatcher(_applicationScheduler->scheduler());
return true; return true;
@ -182,6 +186,10 @@ bool ApplicationDispatcher::prepare () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationDispatcher::start () { bool ApplicationDispatcher::start () {
if (_disabled) {
return true;
}
buildDispatcherReporter(); buildDispatcherReporter();
bool ok = _dispatcher->start(); bool ok = _dispatcher->start();
@ -203,6 +211,10 @@ bool ApplicationDispatcher::start () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationDispatcher::open () { bool ApplicationDispatcher::open () {
if (_disabled) {
return true;
}
if (_dispatcher != 0) { if (_dispatcher != 0) {
return _dispatcher->open(); return _dispatcher->open();
} }
@ -215,6 +227,10 @@ bool ApplicationDispatcher::open () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ApplicationDispatcher::close () { void ApplicationDispatcher::close () {
if (_disabled) {
return;
}
if (_dispatcher != 0) { if (_dispatcher != 0) {
_dispatcher->beginShutdown(); _dispatcher->beginShutdown();
} }
@ -225,6 +241,10 @@ void ApplicationDispatcher::close () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ApplicationDispatcher::stop () { void ApplicationDispatcher::stop () {
if (_disabled) {
return;
}
if (_dispatcherReporterTask != 0) { if (_dispatcherReporterTask != 0) {
_dispatcherReporterTask = 0; _dispatcherReporterTask = 0;
} }

View File

@ -5,7 +5,7 @@
/// ///
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2004-2013 triAGENS GmbH, Cologne, Germany /// Copyright 2004-2014 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.
@ -22,7 +22,7 @@
/// Copyright holder is triAGENS GmbH, Cologne, Germany /// Copyright holder is triAGENS GmbH, Cologne, Germany
/// ///
/// @author Dr. Frank Celler /// @author Dr. Frank Celler
/// @author Copyright 2010-2013, triAGENS GmbH, Cologne, Germany /// @author Copyright 2010-2014, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "ApplicationEndpointServer.h" #include "ApplicationEndpointServer.h"
@ -70,11 +70,6 @@ namespace {
// --SECTION-- constructors and destructors // --SECTION-- constructors and destructors
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Scheduler
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief constructor /// @brief constructor
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -137,19 +132,10 @@ ApplicationEndpointServer::~ApplicationEndpointServer () {
} }
} }
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public methods // --SECTION-- public methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Scheduler
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief builds the endpoint servers /// @brief builds the endpoint servers
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -189,23 +175,14 @@ bool ApplicationEndpointServer::buildServers () {
server->setEndpointList(&_endpointList); server->setEndpointList(&_endpointList);
_servers.push_back(server); _servers.push_back(server);
} }
return true; return true;
} }
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- ApplicationFeature methods // --SECTION-- ApplicationFeature methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ApplicationServer
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc} /// {@inheritDoc}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -249,7 +226,7 @@ bool ApplicationEndpointServer::parsePhase2 (ProgramOptions& options) {
if (! ok) { if (! ok) {
return false; return false;
} }
if (_backlogSize <= 0 || _backlogSize > SOMAXCONN) { if (_backlogSize <= 0 || _backlogSize > SOMAXCONN) {
LOG_FATAL_AND_EXIT("invalid value for --server.backlog-size. maximum allowed value is %d", (int) SOMAXCONN); LOG_FATAL_AND_EXIT("invalid value for --server.backlog-size. maximum allowed value is %d", (int) SOMAXCONN);
} }
@ -337,7 +314,7 @@ bool ApplicationEndpointServer::addEndpoint (std::string const& newEndpoint,
if (save) { if (save) {
saveEndpoints(); saveEndpoints();
} }
LOG_DEBUG("reconfigured endpoint '%s'", newEndpoint.c_str()); LOG_DEBUG("reconfigured endpoint '%s'", newEndpoint.c_str());
// in this case, we updated an existing endpoint and are done // in this case, we updated an existing endpoint and are done
return true; return true;
@ -353,7 +330,7 @@ bool ApplicationEndpointServer::addEndpoint (std::string const& newEndpoint,
LOG_DEBUG("bound to endpoint '%s'", newEndpoint.c_str()); LOG_DEBUG("bound to endpoint '%s'", newEndpoint.c_str());
return true; return true;
} }
LOG_WARNING("failed to bind to endpoint '%s'", newEndpoint.c_str()); LOG_WARNING("failed to bind to endpoint '%s'", newEndpoint.c_str());
return false; return false;
} }
@ -374,7 +351,7 @@ bool ApplicationEndpointServer::removeEndpoint (std::string const& oldEndpoint)
// invalid endpoint // invalid endpoint
return false; return false;
} }
Endpoint::EncryptionType encryption; Endpoint::EncryptionType encryption;
if (unified.substr(0, 6) == "ssl://") { if (unified.substr(0, 6) == "ssl://") {
encryption = Endpoint::ENCRYPTION_SSL; encryption = Endpoint::ENCRYPTION_SSL;
@ -390,7 +367,7 @@ bool ApplicationEndpointServer::removeEndpoint (std::string const& oldEndpoint)
WRITE_LOCKER(_endpointsLock); WRITE_LOCKER(_endpointsLock);
Endpoint* endpoint; Endpoint* endpoint;
bool ok = _endpointList.remove(unified, &endpoint); bool ok = _endpointList.remove(unified, &endpoint);
if (! ok) { if (! ok) {
LOG_WARNING("could not remove endpoint '%s'", oldEndpoint.c_str()); LOG_WARNING("could not remove endpoint '%s'", oldEndpoint.c_str());
@ -415,7 +392,7 @@ bool ApplicationEndpointServer::removeEndpoint (std::string const& oldEndpoint)
return false; return false;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief restores the endpoint list /// @brief restores the endpoint list
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -434,7 +411,7 @@ bool ApplicationEndpointServer::loadEndpoints () {
if (json == 0) { if (json == 0) {
return false; return false;
} }
std::map<std::string, std::vector<std::string> > endpoints; std::map<std::string, std::vector<std::string> > endpoints;
if (! TRI_IsArrayJson(json)) { if (! TRI_IsArrayJson(json)) {
@ -451,7 +428,7 @@ bool ApplicationEndpointServer::loadEndpoints () {
TRI_FreeJson(TRI_CORE_MEM_ZONE, json); TRI_FreeJson(TRI_CORE_MEM_ZONE, json);
return false; return false;
} }
const string endpoint = string(e->_value._string.data, e->_value._string.length - 1); const string endpoint = string(e->_value._string.data, e->_value._string.length - 1);
vector<string> dbNames; vector<string> dbNames;
@ -475,7 +452,7 @@ bool ApplicationEndpointServer::loadEndpoints () {
std::map<std::string, std::vector<std::string> >::const_iterator it; std::map<std::string, std::vector<std::string> >::const_iterator it;
for (it = endpoints.begin(); it != endpoints.end(); ++it) { for (it = endpoints.begin(); it != endpoints.end(); ++it) {
bool ok = _endpointList.add((*it).first, (*it).second, _backlogSize, _reuseAddress); bool ok = _endpointList.add((*it).first, (*it).second, _backlogSize, _reuseAddress);
if (! ok) { if (! ok) {
@ -493,7 +470,7 @@ bool ApplicationEndpointServer::loadEndpoints () {
bool ApplicationEndpointServer::saveEndpoints () { bool ApplicationEndpointServer::saveEndpoints () {
const std::map<std::string, std::vector<std::string> > endpoints = _endpointList.getAll(); const std::map<std::string, std::vector<std::string> > endpoints = _endpointList.getAll();
TRI_json_t* json = TRI_CreateArrayJson(TRI_CORE_MEM_ZONE); TRI_json_t* json = TRI_CreateArrayJson(TRI_CORE_MEM_ZONE);
if (json == 0) { if (json == 0) {
@ -501,7 +478,7 @@ bool ApplicationEndpointServer::saveEndpoints () {
} }
std::map<std::string, std::vector<std::string> >::const_iterator it; std::map<std::string, std::vector<std::string> >::const_iterator it;
for (it = endpoints.begin(); it != endpoints.end(); ++it) { for (it = endpoints.begin(); it != endpoints.end(); ++it) {
TRI_json_t* list = TRI_CreateListJson(TRI_CORE_MEM_ZONE); TRI_json_t* list = TRI_CreateListJson(TRI_CORE_MEM_ZONE);
@ -518,10 +495,10 @@ bool ApplicationEndpointServer::saveEndpoints () {
TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, (*it).first.c_str(), list); TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, (*it).first.c_str(), list);
} }
const string filename = getEndpointsFilename(); const string filename = getEndpointsFilename();
LOG_TRACE("saving endpoint list in file '%s'", filename.c_str()); LOG_TRACE("saving endpoint list in file '%s'", filename.c_str());
bool ok = TRI_SaveJson(filename.c_str(), json, true); bool ok = TRI_SaveJson(filename.c_str(), json, true);
TRI_FreeJson(TRI_CORE_MEM_ZONE, json); TRI_FreeJson(TRI_CORE_MEM_ZONE, json);
@ -537,15 +514,19 @@ const std::vector<std::string> ApplicationEndpointServer::getEndpointMapping (st
return _endpointList.getMapping(endpoint); return _endpointList.getMapping(endpoint);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc} /// {@inheritDoc}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationEndpointServer::prepare () { bool ApplicationEndpointServer::prepare () {
if (_disabled) {
return true;
}
loadEndpoints(); loadEndpoints();
if (_endpointList.empty()) { if (_endpointList.empty()) {
LOG_INFO("please use the '--server.endpoint' option"); LOG_INFO("please use the '--server.endpoint' option");
LOG_FATAL_AND_EXIT("no endpoints have been specified, giving up"); LOG_FATAL_AND_EXIT("no endpoints have been specified, giving up");
} }
@ -558,7 +539,7 @@ bool ApplicationEndpointServer::prepare () {
_allowMethodOverride, _allowMethodOverride,
_setContext, _setContext,
_contextData); _contextData);
LOG_INFO("using default API compatibility: %ld", (long int) _defaultApiCompatibility); LOG_INFO("using default API compatibility: %ld", (long int) _defaultApiCompatibility);
return true; return true;
@ -569,6 +550,10 @@ bool ApplicationEndpointServer::prepare () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationEndpointServer::prepare2 () { bool ApplicationEndpointServer::prepare2 () {
if (_disabled) {
return true;
}
// scheduler might be created after prepare(), so we need to use prepare2()!! // scheduler might be created after prepare(), so we need to use prepare2()!!
Scheduler* scheduler = _applicationScheduler->scheduler(); Scheduler* scheduler = _applicationScheduler->scheduler();
@ -586,6 +571,10 @@ bool ApplicationEndpointServer::prepare2 () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationEndpointServer::open () { bool ApplicationEndpointServer::open () {
if (_disabled) {
return true;
}
for (vector<EndpointServer*>::iterator i = _servers.begin(); i != _servers.end(); ++i) { for (vector<EndpointServer*>::iterator i = _servers.begin(); i != _servers.end(); ++i) {
EndpointServer* server = *i; EndpointServer* server = *i;
@ -600,6 +589,10 @@ bool ApplicationEndpointServer::open () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ApplicationEndpointServer::close () { void ApplicationEndpointServer::close () {
if (_disabled) {
return;
}
// close all open connections // close all open connections
for (vector<EndpointServer*>::iterator i = _servers.begin(); i != _servers.end(); ++i) { for (vector<EndpointServer*>::iterator i = _servers.begin(); i != _servers.end(); ++i) {
EndpointServer* server = *i; EndpointServer* server = *i;
@ -620,6 +613,10 @@ void ApplicationEndpointServer::close () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ApplicationEndpointServer::stop () { void ApplicationEndpointServer::stop () {
if (_disabled) {
return;
}
for (vector<EndpointServer*>::iterator i = _servers.begin(); i != _servers.end(); ++i) { for (vector<EndpointServer*>::iterator i = _servers.begin(); i != _servers.end(); ++i) {
EndpointServer* server = *i; EndpointServer* server = *i;
@ -627,19 +624,10 @@ void ApplicationEndpointServer::stop () {
} }
} }
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- private methods // --SECTION-- private methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup HttpServer
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief creates an ssl context /// @brief creates an ssl context
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -656,7 +644,7 @@ bool ApplicationEndpointServer::createSslContext () {
return false; return false;
} }
LOG_DEBUG("using SSL protocol version '%s'", LOG_DEBUG("using SSL protocol version '%s'",
HttpsServer::protocolName((HttpsServer::protocol_e) _sslProtocol).c_str()); HttpsServer::protocolName((HttpsServer::protocol_e) _sslProtocol).c_str());
if (! FileUtils::exists(_httpsKeyfile)) { if (! FileUtils::exists(_httpsKeyfile)) {
@ -748,10 +736,6 @@ bool ApplicationEndpointServer::createSslContext () {
return true; return true;
} }
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE // --SECTION-- END-OF-FILE
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -5,7 +5,7 @@
/// ///
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2004-2013 triAGENS GmbH, Cologne, Germany /// Copyright 2004-2014 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.
@ -22,7 +22,7 @@
/// Copyright holder is triAGENS GmbH, Cologne, Germany /// Copyright holder is triAGENS GmbH, Cologne, Germany
/// ///
/// @author Dr. Frank Celler /// @author Dr. Frank Celler
/// @author Copyright 2010-2013, triAGENS GmbH, Cologne, Germany /// @author Copyright 2010-2014, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef TRIAGENS_HTTP_SERVER_APPLICATION_ENDPOINT_SERVER_H #ifndef TRIAGENS_HTTP_SERVER_APPLICATION_ENDPOINT_SERVER_H
@ -52,11 +52,6 @@ namespace triagens {
// --SECTION-- class ApplicationEndpointServer // --SECTION-- class ApplicationEndpointServer
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup HttpServer
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief application http server feature /// @brief application http server feature
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -66,19 +61,10 @@ namespace triagens {
ApplicationEndpointServer (ApplicationEndpointServer const&); ApplicationEndpointServer (ApplicationEndpointServer const&);
ApplicationEndpointServer& operator= (ApplicationEndpointServer const&); ApplicationEndpointServer& operator= (ApplicationEndpointServer const&);
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors // --SECTION-- constructors and destructors
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup HttpServer
/// @{
////////////////////////////////////////////////////////////////////////////////
public: public:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -99,19 +85,10 @@ namespace triagens {
~ApplicationEndpointServer (); ~ApplicationEndpointServer ();
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public methods // --SECTION-- public methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup HttpServer
/// @{
////////////////////////////////////////////////////////////////////////////////
public: public:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -136,19 +113,10 @@ namespace triagens {
_basePath = basePath; _basePath = basePath;
} }
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- ApplicationFeature methods // --SECTION-- ApplicationFeature methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ApplicationServer
/// @{
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc} /// {@inheritDoc}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -166,11 +134,11 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
std::map<std::string, std::vector<std::string> > getEndpoints (); std::map<std::string, std::vector<std::string> > getEndpoints ();
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief adds a new endpoint at runtime, and connects to it /// @brief adds a new endpoint at runtime, and connects to it
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool addEndpoint (std::string const&, bool addEndpoint (std::string const&,
std::vector<std::string> const&, std::vector<std::string> const&,
bool); bool);
@ -178,7 +146,7 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief removes an existing endpoint and disconnects from it /// @brief removes an existing endpoint and disconnects from it
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool removeEndpoint (std::string const&); bool removeEndpoint (std::string const&);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -230,19 +198,10 @@ namespace triagens {
void stop (); void stop ();
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- private methods // --SECTION-- private methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup HttpServer
/// @{
////////////////////////////////////////////////////////////////////////////////
private: private:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -257,19 +216,10 @@ namespace triagens {
bool createSslContext (); bool createSslContext ();
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- protected variables // --SECTION-- protected variables
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup HttpServer
/// @{
////////////////////////////////////////////////////////////////////////////////
protected: protected:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -311,7 +261,7 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief context data passed to callback functions /// @brief context data passed to callback functions
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void* _contextData; void* _contextData;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -395,7 +345,7 @@ namespace triagens {
/// ///
/// @CMDOPT{\--server.reuse-address} /// @CMDOPT{\--server.reuse-address}
/// ///
/// If this boolean option is set to `true` then the socket option /// If this boolean option is set to `true` then the socket option
/// SO_REUSEADDR is set on all server endpoints, which is the default. /// SO_REUSEADDR is set on all server endpoints, which is the default.
/// If this option is set to `false` it is possible that it takes up /// If this option is set to `false` it is possible that it takes up
/// to a minute after a server has terminated until it is possible for /// to a minute after a server has terminated until it is possible for
@ -427,24 +377,24 @@ namespace triagens {
double _keepAliveTimeout; double _keepAliveTimeout;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief default API compatibility /// @brief default API compatibility
/// ///
/// @CMDOPT{\--server.default-api-compatibility} /// @CMDOPT{\--server.default-api-compatibility}
/// ///
/// This option can be used to determine the API compatibility of the ArangoDB /// This option can be used to determine the API compatibility of the ArangoDB
/// server. It expects an ArangoDB version number as an integer, calculated as /// server. It expects an ArangoDB version number as an integer, calculated as
/// follows: /// follows:
/// ///
/// `10000 * major + 100 * minor` (example: `10400` for ArangoDB 1.4) /// `10000 * major + 100 * minor` (example: `10400` for ArangoDB 1.4)
/// ///
/// The value of this option will have an influence on some API return values /// The value of this option will have an influence on some API return values
/// when the HTTP client used does not send any compatibility information. /// when the HTTP client used does not send any compatibility information.
/// ///
/// In most cases it will be sufficient to not set this option explicitly but to /// In most cases it will be sufficient to not set this option explicitly but to
/// keep the default value. However, in case an "old" ArangoDB client is used /// keep the default value. However, in case an "old" ArangoDB client is used
/// that does not send any compatibility information and that cannot handle the /// that does not send any compatibility information and that cannot handle the
/// responses of the current version of ArangoDB, it might be reasonable to set /// responses of the current version of ArangoDB, it might be reasonable to set
/// the option to an old version number to improve compatibility with older /// the option to an old version number to improve compatibility with older
/// clients. /// clients.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -456,7 +406,7 @@ namespace triagens {
/// @CMDOPT{\--server.allow-method-override} /// @CMDOPT{\--server.allow-method-override}
/// ///
/// When this option is set to `true`, the HTTP request method will optionally /// When this option is set to `true`, the HTTP request method will optionally
/// be fetched from one of the following HTTP request headers if present in /// be fetched from one of the following HTTP request headers if present in
/// the request: /// the request:
/// ///
/// - `x-http-method` /// - `x-http-method`
@ -466,7 +416,7 @@ namespace triagens {
/// If the option is set to `true` and any of these headers is set, the /// If the option is set to `true` and any of these headers is set, the
/// request method will be overriden by the value of the header. For example, /// request method will be overriden by the value of the header. For example,
/// this allows issuing an HTTP DELETE request which to the outside world will /// this allows issuing an HTTP DELETE request which to the outside world will
/// look like an HTTP GET request. This allows bypassing proxies and tools that /// look like an HTTP GET request. This allows bypassing proxies and tools that
/// will only let certain request types pass. /// will only let certain request types pass.
/// ///
/// Setting this option to `true` may impose a security risk so it should only /// Setting this option to `true` may impose a security risk so it should only
@ -630,10 +580,6 @@ namespace triagens {
} }
} }
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
#endif #endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -461,6 +461,10 @@ bool ApplicationScheduler::parsePhase2 (triagens::basics::ProgramOptions& option
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationScheduler::prepare () { bool ApplicationScheduler::prepare () {
if (_disabled) {
return true;
}
buildScheduler(); buildScheduler();
return true; return true;
@ -471,6 +475,10 @@ bool ApplicationScheduler::prepare () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationScheduler::start () { bool ApplicationScheduler::start () {
if (_disabled) {
return true;
}
buildSchedulerReporter(); buildSchedulerReporter();
buildControlCHandler(); buildControlCHandler();
@ -498,6 +506,10 @@ bool ApplicationScheduler::start () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool ApplicationScheduler::open () { bool ApplicationScheduler::open () {
if (_disabled) {
return true;
}
if (_scheduler != 0) { if (_scheduler != 0) {
return _scheduler->open(); return _scheduler->open();
} }
@ -510,6 +522,10 @@ bool ApplicationScheduler::open () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ApplicationScheduler::stop () { void ApplicationScheduler::stop () {
if (_disabled) {
return;
}
if (_scheduler != 0) { if (_scheduler != 0) {
static size_t const MAX_TRIES = 10; static size_t const MAX_TRIES = 10;