mirror of https://gitee.com/bigwinds/arangodb
destroy can only be called if initialised
This commit is contained in:
parent
9a5a11c146
commit
b58347138f
|
@ -97,11 +97,6 @@ using namespace triagens::arango;
|
|||
// --SECTION-- private functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief define "_api" handlers
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -112,7 +107,7 @@ static void DefineApiHandlers (HttpHandlerFactory* factory,
|
|||
|
||||
// add "/version" handler
|
||||
admin->addBasicHandlers(factory, "/_api", (void*) jobManager);
|
||||
|
||||
|
||||
// add "/batch" handler
|
||||
factory->addPrefixHandler(RestVocbaseBaseHandler::BATCH_PATH,
|
||||
RestHandlerCreator<RestBatchHandler>::createNoData);
|
||||
|
@ -164,7 +159,7 @@ static TRI_vocbase_t* LookupDatabaseFromRequest (triagens::rest::HttpRequest* re
|
|||
// get the request endpoint
|
||||
ConnectionInfo ci = request->connectionInfo();
|
||||
const string& endpoint = ci.endpoint;
|
||||
|
||||
|
||||
// get the databases mapped to the endpoint
|
||||
ApplicationEndpointServer* s = static_cast<ApplicationEndpointServer*>(server->_applicationEndpointServer);
|
||||
const vector<string> databases = s->getEndpointMapping(endpoint);
|
||||
|
@ -174,7 +169,7 @@ static TRI_vocbase_t* LookupDatabaseFromRequest (triagens::rest::HttpRequest* re
|
|||
|
||||
if (databases.empty()) {
|
||||
// no databases defined. this means all databases are accessible via the endpoint
|
||||
|
||||
|
||||
if (dbName.empty()) {
|
||||
// if no databases was specified in the request, use system database name as a fallback
|
||||
dbName = TRI_VOC_SYSTEM_DATABASE;
|
||||
|
@ -204,14 +199,14 @@ static TRI_vocbase_t* LookupDatabaseFromRequest (triagens::rest::HttpRequest* re
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TRI_vocbase_t* vocbase = TRI_UseDatabaseServer(server, dbName.c_str());
|
||||
|
||||
|
||||
TRI_vocbase_t* vocbase = TRI_UseDatabaseServer(server, dbName.c_str());
|
||||
|
||||
if (vocbase == 0) {
|
||||
// database not found
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return vocbase;
|
||||
}
|
||||
|
@ -220,7 +215,7 @@ static TRI_vocbase_t* LookupDatabaseFromRequest (triagens::rest::HttpRequest* re
|
|||
/// @brief add the context to a request
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static bool SetRequestContext (triagens::rest::HttpRequest* request,
|
||||
static bool SetRequestContext (triagens::rest::HttpRequest* request,
|
||||
void* data) {
|
||||
|
||||
TRI_server_t* server = (TRI_server_t*) data;
|
||||
|
@ -237,17 +232,13 @@ static bool SetRequestContext (triagens::rest::HttpRequest* request,
|
|||
// out of memory
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// the "true" means the request is the owner of the context
|
||||
request->setRequestContext(ctx, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- class ArangoServer
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -256,11 +247,6 @@ static bool SetRequestContext (triagens::rest::HttpRequest* request,
|
|||
// --SECTION-- constructors and destructors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief constructor
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -304,8 +290,8 @@ ArangoServer::ArangoServer (int argc, char** argv)
|
|||
|
||||
_defaultLanguage = Utf8Helper::DefaultUtf8Helper.getCollatorLanguage();
|
||||
|
||||
|
||||
TRI_InitialiseServer();
|
||||
|
||||
TRI_InitServerGlobals();
|
||||
|
||||
_server = TRI_CreateServer();
|
||||
|
||||
|
@ -313,7 +299,7 @@ ArangoServer::ArangoServer (int argc, char** argv)
|
|||
LOG_FATAL_AND_EXIT("could not create server instance");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief destructor
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -326,25 +312,16 @@ ArangoServer::~ArangoServer () {
|
|||
if (_server != 0) {
|
||||
TRI_FreeServer(_server);
|
||||
}
|
||||
|
||||
TRI_ShutdownServer();
|
||||
|
||||
TRI_FreeServerGlobals();
|
||||
|
||||
Nonce::destroy();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- AnyServer methods
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// {@inheritDoc}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -390,9 +367,11 @@ void ArangoServer::buildApplicationServer () {
|
|||
// .............................................................................
|
||||
|
||||
_applicationV8 = new ApplicationV8(_server);
|
||||
|
||||
if (_applicationV8 == 0) {
|
||||
LOGGER_FATAL_AND_EXIT("out of memory");
|
||||
}
|
||||
|
||||
_applicationServer->addFeature(_applicationV8);
|
||||
|
||||
// .............................................................................
|
||||
|
@ -402,9 +381,11 @@ void ArangoServer::buildApplicationServer () {
|
|||
#ifdef TRI_ENABLE_MRUBY
|
||||
|
||||
_applicationMR = new ApplicationMR(_server);
|
||||
|
||||
if (_applicationMR == 0) {
|
||||
LOGGER_FATAL_AND_EXIT("out of memory");
|
||||
}
|
||||
|
||||
_applicationServer->addFeature(_applicationMR);
|
||||
|
||||
#else
|
||||
|
@ -419,7 +400,7 @@ void ArangoServer::buildApplicationServer () {
|
|||
;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// .............................................................................
|
||||
// and start a simple admin server
|
||||
// .............................................................................
|
||||
|
@ -482,7 +463,7 @@ void ArangoServer::buildApplicationServer () {
|
|||
("jslint", &_jslint, "do not start as server, run js lint instead")
|
||||
("javascript.unit-tests", &_unitTests, "do not start as server, run unit tests instead")
|
||||
;
|
||||
|
||||
|
||||
// .............................................................................
|
||||
// database options
|
||||
// .............................................................................
|
||||
|
@ -530,7 +511,7 @@ void ArangoServer::buildApplicationServer () {
|
|||
additional["THREAD Options:help-admin"]
|
||||
("server.threads", &_dispatcherThreads, "number of threads for basic operations")
|
||||
;
|
||||
|
||||
|
||||
additional["Server Options:help-extended"]
|
||||
("scheduler.maximal-queue-size", &_dispatcherQueueSize, "maximum size of queue for asynchronous operations")
|
||||
;
|
||||
|
@ -561,9 +542,9 @@ void ArangoServer::buildApplicationServer () {
|
|||
if (! _applicationServer->parse(_argc, _argv, additional)) {
|
||||
CLEANUP_LOGGING_AND_EXIT_ON_FATAL_ERROR();
|
||||
}
|
||||
|
||||
|
||||
// set the temp-path
|
||||
_tempPath = StringUtils::rTrim(_tempPath, TRI_DIR_SEPARATOR_STR);
|
||||
_tempPath = StringUtils::rTrim(_tempPath, TRI_DIR_SEPARATOR_STR);
|
||||
if (_applicationServer->programOptions().has("temp-path")) {
|
||||
TRI_SetUserTempPath((char*) _tempPath.c_str());
|
||||
}
|
||||
|
@ -631,14 +612,14 @@ void ArangoServer::buildApplicationServer () {
|
|||
}
|
||||
|
||||
// strip trailing separators
|
||||
_databasePath = StringUtils::rTrim(_databasePath, TRI_DIR_SEPARATOR_STR);
|
||||
|
||||
_databasePath = StringUtils::rTrim(_databasePath, TRI_DIR_SEPARATOR_STR);
|
||||
|
||||
_applicationEndpointServer->setBasePath(_databasePath);
|
||||
|
||||
// .............................................................................
|
||||
// now run arangod
|
||||
// .............................................................................
|
||||
|
||||
|
||||
// dump version details
|
||||
LOGGER_INFO(rest::Version::getVerboseVersionString());
|
||||
|
||||
|
@ -706,7 +687,7 @@ void ArangoServer::buildApplicationServer () {
|
|||
|
||||
int ArangoServer::startupServer () {
|
||||
v8::HandleScope scope;
|
||||
|
||||
|
||||
// .............................................................................
|
||||
// prepare the various parts of the Arango server
|
||||
// .............................................................................
|
||||
|
@ -714,7 +695,7 @@ int ArangoServer::startupServer () {
|
|||
if (_dispatcherThreads < 1) {
|
||||
_dispatcherThreads = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// open all databases
|
||||
openDatabases();
|
||||
|
@ -751,7 +732,7 @@ int ArangoServer::startupServer () {
|
|||
_applicationDispatcher->buildStandardQueue(_dispatcherThreads, (int) _dispatcherQueueSize);
|
||||
|
||||
_applicationServer->prepare2();
|
||||
|
||||
|
||||
|
||||
// we pass the options by reference, so keep them until shutdown
|
||||
RestActionHandler::action_options_t httpOptions;
|
||||
|
@ -812,19 +793,10 @@ int ArangoServer::startupServer () {
|
|||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private methods
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief executes the JavaScript emergency console
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1254,9 +1226,9 @@ int ArangoServer::executeRubyConsole () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void ArangoServer::openDatabases () {
|
||||
TRI_vocbase_defaults_t defaults;
|
||||
TRI_vocbase_defaults_t defaults;
|
||||
|
||||
// override with command-line options
|
||||
// override with command-line options
|
||||
defaults.defaultMaximalSize = _defaultMaximalSize;
|
||||
defaults.removeOnDrop = _removeOnDrop;
|
||||
defaults.removeOnCompacted = _removeOnCompacted;
|
||||
|
@ -1265,18 +1237,18 @@ void ArangoServer::openDatabases () {
|
|||
defaults.forceSyncProperties = _forceSyncProperties;
|
||||
defaults.requireAuthentication = ! _disableAuthentication;
|
||||
defaults.authenticateSystemOnly = _authenticateSystemOnly;
|
||||
|
||||
assert(_server != 0);
|
||||
|
||||
int res = TRI_InitServer(_server,
|
||||
|
||||
assert(_server != 0);
|
||||
|
||||
int res = TRI_InitServer(_server,
|
||||
_applicationEndpointServer,
|
||||
_databasePath.c_str(),
|
||||
_applicationV8->appPath().c_str(),
|
||||
_applicationV8->devAppPath().c_str(),
|
||||
&defaults,
|
||||
_disableReplicationLogger,
|
||||
_applicationV8->devAppPath().c_str(),
|
||||
&defaults,
|
||||
_disableReplicationLogger,
|
||||
_disableReplicationApplier);
|
||||
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
LOG_FATAL_AND_EXIT("cannot create server instance: out of memory");
|
||||
}
|
||||
|
@ -1287,7 +1259,7 @@ void ArangoServer::openDatabases () {
|
|||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
LOG_FATAL_AND_EXIT("cannot start server: %s", TRI_errno_string(res));
|
||||
}
|
||||
|
||||
|
||||
LOG_TRACE("found system database");
|
||||
}
|
||||
|
||||
|
@ -1306,10 +1278,6 @@ void ArangoServer::closeDatabases () {
|
|||
LOGGER_INFO("ArangoDB has been shut down");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- END-OF-FILE
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -66,11 +66,6 @@ namespace triagens {
|
|||
// --SECTION-- class ArangoServer
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief ArangoDB server
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -80,19 +75,10 @@ namespace triagens {
|
|||
ArangoServer (const ArangoServer&);
|
||||
ArangoServer& operator= (const ArangoServer&);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- constructors and destructors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -107,19 +93,10 @@ namespace triagens {
|
|||
|
||||
~ArangoServer ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- AnyServer methods
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -134,34 +111,16 @@ namespace triagens {
|
|||
|
||||
int startupServer ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public static methods
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private methods
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -189,20 +148,11 @@ namespace triagens {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void closeDatabases ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -274,15 +224,15 @@ namespace triagens {
|
|||
///
|
||||
/// Controls whether incoming requests need authentication only if they are
|
||||
/// directed to the ArangoDB's internal APIs and features, located at `/_api/`,
|
||||
/// `/_admin/` etc.
|
||||
/// `/_admin/` etc.
|
||||
///
|
||||
/// IF the flag is set to @LIT{true}, then HTTP authentication is only
|
||||
/// required for requests going to URLs starting with `/_`, but not for other
|
||||
/// required for requests going to URLs starting with `/_`, but not for other
|
||||
/// URLs. The flag can thus be used to expose a user-made API without HTTP
|
||||
/// authentication to the outside world, but to prevent the outside world from
|
||||
/// using the ArangoDB API and the admin interface without authentication.
|
||||
/// Note that checking the URL is performed after any database name prefix
|
||||
/// has been removed. That means when the actual URL called is
|
||||
/// has been removed. That means when the actual URL called is
|
||||
/// `/_db/_system/myapp/myaction`, the URL `/myapp/myaction` will be used for
|
||||
/// `authenticate-system-only` check.
|
||||
///
|
||||
|
@ -292,8 +242,8 @@ namespace triagens {
|
|||
/// in order for HTTP authentication to be forced for the ArangoDB API and the
|
||||
/// web interface. Setting only this flag is not enough.
|
||||
///
|
||||
/// You can control ArangoDB's general authentication feature with the
|
||||
/// `--server.disable-authentication` flag.
|
||||
/// You can control ArangoDB's general authentication feature with the
|
||||
/// `--server.disable-authentication` flag.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool _authenticateSystemOnly;
|
||||
|
@ -399,7 +349,7 @@ namespace triagens {
|
|||
/// development mode forces reloading of all actions and Foxx applications on
|
||||
/// every HTTP request. This is very resource-intensive and slow, but makes
|
||||
/// developing server-side actions and Foxx applications much easier.
|
||||
///
|
||||
///
|
||||
/// Never use this option in production.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -410,10 +360,10 @@ namespace triagens {
|
|||
///
|
||||
/// @CMDOPT{\--database.force-sync-properties @CA{boolean}}
|
||||
///
|
||||
/// Force syncing of collection properties to disk after creating a collection
|
||||
/// Force syncing of collection properties to disk after creating a collection
|
||||
/// or updating its properties.
|
||||
///
|
||||
/// If turned off, syncing will still happen for collection that have a
|
||||
/// If turned off, syncing will still happen for collection that have a
|
||||
/// waitForSync value of @LIT{true}. If turned on, syncing of properties will
|
||||
/// always happen, regardless of the value of waitForSync.
|
||||
///
|
||||
|
@ -445,7 +395,7 @@ namespace triagens {
|
|||
/// If @LIT{true} the server will start with the replication logger turned off,
|
||||
/// even if the replication logger is configured with the `autoStart` option.
|
||||
/// Using this option will not change the value of the `autoStart` option in
|
||||
/// the logger configuration, but will suppress auto-starting the replication
|
||||
/// the logger configuration, but will suppress auto-starting the replication
|
||||
/// logger just once.
|
||||
///
|
||||
/// If the option is not used, ArangoDB will read the logger configuration from
|
||||
|
@ -465,7 +415,7 @@ namespace triagens {
|
|||
/// If @LIT{true} the server will start with the replication applier turned off,
|
||||
/// even if the replication applier is configured with the `autoStart` option.
|
||||
/// Using the command-line option will not change the value of the `autoStart`
|
||||
/// option in the applier configuration, but will suppress auto-starting the
|
||||
/// option in the applier configuration, but will suppress auto-starting the
|
||||
/// replication applier just once.
|
||||
///
|
||||
/// If the option is not used, ArangoDB will read the applier configuration from
|
||||
|
@ -573,10 +523,6 @@ namespace triagens {
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -44,11 +44,6 @@ extern "C" {
|
|||
// --SECTION-- public types
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup VocBase
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief server structure
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -70,7 +65,7 @@ typedef struct TRI_server_s {
|
|||
char* _lockFilename;
|
||||
char* _shutdownFilename;
|
||||
char* _serverIdFilename;
|
||||
|
||||
|
||||
char* _appPath;
|
||||
char* _devAppPath;
|
||||
|
||||
|
@ -78,6 +73,8 @@ typedef struct TRI_server_s {
|
|||
bool _disableReplicationAppliers;
|
||||
|
||||
bool _wasShutdownCleanly;
|
||||
|
||||
bool _initialised;
|
||||
}
|
||||
TRI_server_t;
|
||||
|
||||
|
@ -87,19 +84,10 @@ TRI_server_t;
|
|||
|
||||
extern size_t PageSize;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- constructors / destructors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup VocBase
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief create a server instance
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -112,9 +100,9 @@ TRI_server_t* TRI_CreateServer (void);
|
|||
|
||||
int TRI_InitServer (TRI_server_t* server,
|
||||
void*,
|
||||
char const*,
|
||||
char const*,
|
||||
char const*,
|
||||
char const*,
|
||||
char const*,
|
||||
char const*,
|
||||
TRI_vocbase_defaults_t const*,
|
||||
bool,
|
||||
bool);
|
||||
|
@ -135,27 +123,18 @@ void TRI_FreeServer (TRI_server_t*);
|
|||
/// @brief initialise globals
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_InitialiseServer (void);
|
||||
void TRI_InitServerGlobals (void);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief de-initialise globals
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TRI_ShutdownServer (void);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void TRI_FreeServerGlobals (void);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup VocBase
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief get the global server id
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -176,7 +155,7 @@ int TRI_StartServer (TRI_server_t*,
|
|||
int TRI_StopServer (TRI_server_t*);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief create a new database
|
||||
/// @brief create a new database
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_CreateDatabaseServer (TRI_server_t*,
|
||||
|
@ -230,19 +209,10 @@ int TRI_GetDatabaseNamesServer (TRI_server_t*,
|
|||
void TRI_GetDatabaseDefaultsServer (TRI_server_t*,
|
||||
TRI_vocbase_defaults_t*);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- tick functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup VocBase
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief create a new tick
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -267,19 +237,10 @@ void TRI_FastUpdateTickServer (TRI_voc_tick_t);
|
|||
|
||||
TRI_voc_tick_t TRI_CurrentTickServer (void);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- other functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup VocBase
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief msyncs a memory block between begin (incl) and end (excl)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -289,10 +250,6 @@ bool TRI_MSync (int,
|
|||
char const*,
|
||||
char const*);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -39,11 +39,6 @@
|
|||
// --SECTION-- private macros
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Threading
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief busy wait delay (in microseconds)
|
||||
///
|
||||
|
@ -54,10 +49,6 @@
|
|||
|
||||
#define BUSY_LOCK_DELAY (10 * 1000)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- MUTEX
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -66,11 +57,6 @@
|
|||
// --SECTION-- constructors and destructors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Threading
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief initialises a new mutex
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -87,19 +73,10 @@ int TRI_DestroyMutex (TRI_mutex_t* mutex) {
|
|||
return pthread_mutex_destroy(mutex);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Threading
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief locks mutex
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -131,10 +108,6 @@ void TRI_UnlockMutex (TRI_mutex_t* mutex) {
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- SPIN
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -145,11 +118,6 @@ void TRI_UnlockMutex (TRI_mutex_t* mutex) {
|
|||
// --SECTION-- constructors and destructors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Threading
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief initialises a new spin-lock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -166,19 +134,10 @@ void TRI_DestroySpin (TRI_spin_t* spinLock) {
|
|||
pthread_spin_destroy(spinLock);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Threading
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief locks spin-lock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -210,10 +169,6 @@ void TRI_UnlockSpin (TRI_spin_t* spinLock) {
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -224,11 +179,6 @@ void TRI_UnlockSpin (TRI_spin_t* spinLock) {
|
|||
// --SECTION-- constructors and destructors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Threading
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief initialises a new read-write lock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -245,19 +195,10 @@ void TRI_DestroyReadWriteLock (TRI_read_write_lock_t* lock) {
|
|||
pthread_rwlock_destroy(lock);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Threading
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief tries to read lock read-write lock
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -365,10 +306,6 @@ void TRI_WriteUnlockReadWriteLock (TRI_read_write_lock_t* lock) {
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- CONDITION VARIABLE
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -377,11 +314,6 @@ void TRI_WriteUnlockReadWriteLock (TRI_read_write_lock_t* lock) {
|
|||
// --SECTION-- constructors and destructors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Threading
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief initialises a new condition variable
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -408,19 +340,10 @@ void TRI_DestroyCondition (TRI_condition_t* cond) {
|
|||
TRI_Free(TRI_CORE_MEM_ZONE, cond->_mutex);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Threading
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief signals a condition variable
|
||||
///
|
||||
|
@ -541,7 +464,7 @@ void TRI_UnlockCondition (TRI_condition_t* cond) {
|
|||
// Note that for the MAC OS we use the 'barrier' functions which ensure that
|
||||
// read/write operations on the scalars are executed in order. According to the
|
||||
// available documentation, the GCC variants of these COMPARE & SWAP operations
|
||||
// are implemented with a memory barrier. The MS Windows variants of these
|
||||
// are implemented with a memory barrier. The MS Windows variants of these
|
||||
// operations (according to the documentation on MS site) also provide a full
|
||||
// memory barrier.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -662,10 +585,6 @@ bool TRI_ComparePointer(void* volatile* theValue, void* oldValue) {
|
|||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -42,11 +42,6 @@ extern "C" {
|
|||
// --SECTION-- public types
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Threading
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief mutex type
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -77,10 +72,6 @@ typedef struct TRI_condition_s {
|
|||
}
|
||||
TRI_condition_t;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue