From d29894ad24be716a3a6b9aa757b8a846bdc6a779 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Fri, 9 Mar 2012 14:38:00 +0100 Subject: [PATCH 1/8] fixed lock --- VocBase/simple-collection.c | 160 +++++++++++++++++------------------- 1 file changed, 76 insertions(+), 84 deletions(-) diff --git a/VocBase/simple-collection.c b/VocBase/simple-collection.c index ebe27aa335..26f48092e0 100644 --- a/VocBase/simple-collection.c +++ b/VocBase/simple-collection.c @@ -273,6 +273,11 @@ static TRI_doc_mptr_t* CreateDocument (TRI_sim_collection_t* collection, if (journal == NULL) { collection->base.base._lastError = TRI_set_errno(TRI_VOC_ERROR_NO_JOURNAL); + + if (release) { + collection->base.endWrite(&collection->base); + } + return NULL; } @@ -368,6 +373,11 @@ static TRI_doc_mptr_t const* UpdateDocument (TRI_sim_collection_t* collection, if (rid != 0) { if (rid != header->_rid) { TRI_set_errno(TRI_VOC_ERROR_CONFLICT); + + if (release) { + collection->base.endWrite(&collection->base); + } + return NULL; } } @@ -379,10 +389,20 @@ static TRI_doc_mptr_t const* UpdateDocument (TRI_sim_collection_t* collection, case TRI_DOC_UPDATE_CONFLICT: TRI_set_errno(TRI_VOC_ERROR_ILLEGAL_PARAMETER); + + if (release) { + collection->base.endWrite(&collection->base); + } + return NULL; case TRI_DOC_UPDATE_ILLEGAL: TRI_set_errno(TRI_VOC_ERROR_ILLEGAL_PARAMETER); + + if (release) { + collection->base.endWrite(&collection->base); + } + return NULL; } @@ -395,6 +415,11 @@ static TRI_doc_mptr_t const* UpdateDocument (TRI_sim_collection_t* collection, if (journal == NULL) { collection->base.base._lastError = TRI_set_errno(TRI_VOC_ERROR_NO_JOURNAL); + + if (release) { + collection->base.endWrite(&collection->base); + } + return NULL; } @@ -470,6 +495,11 @@ static bool DeleteDocument (TRI_sim_collection_t* collection, if (header == NULL || header->_deletion != 0) { TRI_set_errno(TRI_VOC_ERROR_DOCUMENT_NOT_FOUND); + + if (release) { + collection->base.endWrite(&collection->base); + } + return false; } @@ -479,6 +509,11 @@ static bool DeleteDocument (TRI_sim_collection_t* collection, if (rid != 0) { if (rid != header->_rid) { TRI_set_errno(TRI_VOC_ERROR_CONFLICT); + + if (release) { + collection->base.endWrite(&collection->base); + } + return NULL; } } @@ -490,10 +525,20 @@ static bool DeleteDocument (TRI_sim_collection_t* collection, case TRI_DOC_UPDATE_CONFLICT: TRI_set_errno(TRI_VOC_ERROR_ILLEGAL_PARAMETER); + + if (release) { + collection->base.endWrite(&collection->base); + } + return NULL; case TRI_DOC_UPDATE_ILLEGAL: TRI_set_errno(TRI_VOC_ERROR_ILLEGAL_PARAMETER); + + if (release) { + collection->base.endWrite(&collection->base); + } + return NULL; } @@ -506,6 +551,11 @@ static bool DeleteDocument (TRI_sim_collection_t* collection, if (journal == NULL) { collection->base.base._lastError = TRI_set_errno(TRI_VOC_ERROR_NO_JOURNAL); + + if (release) { + collection->base.endWrite(&collection->base); + } + return false; } @@ -1120,7 +1170,7 @@ static bool OpenIterator (TRI_df_marker_t const* marker, void* data, TRI_datafil /// @brief iterator for index open //////////////////////////////////////////////////////////////////////////////// -static bool OpenIndex (char const* filename, void* data) { +static bool OpenIndexIterator (char const* filename, void* data) { TRI_idx_iid_t iid; TRI_index_t* idx; TRI_json_t* fieldCount; @@ -1219,10 +1269,10 @@ static bool OpenIndex (char const* filename, void* data) { } // ........................................................................... - // HASH INDEX + // HASH INDEX OR SKIPLIST INDEX // ........................................................................... - else if (TRI_EqualString(typeStr, "hash")) { + else if (TRI_EqualString(typeStr, "hash") || TRI_EqualString(typeStr, "skiplist")) { // Determine if the hash index is unique or non-unique gjs = TRI_LookupArrayJson(json, "unique"); @@ -1232,7 +1282,8 @@ static bool OpenIndex (char const* filename, void* data) { uniqueIndex = gjs->_value._boolean; } else { - LOG_ERROR("ignore hash-index %lu, could not determine if unique or non-unique", + LOG_ERROR("ignore %s-index %lu, could not determine if unique or non-unique", + typeStr, (unsigned long) iid); TRI_FreeJson(json); @@ -1249,7 +1300,7 @@ static bool OpenIndex (char const* filename, void* data) { } if (intCount < 1) { - LOG_ERROR("ignore hash-index %lu, field count missing", (unsigned long) iid); + LOG_ERROR("ignore %s-index %lu, field count missing", typeStr, (unsigned long) iid); TRI_FreeJson(json); return false; @@ -1266,7 +1317,7 @@ static bool OpenIndex (char const* filename, void* data) { fieldStr = TRI_LookupArrayJson(json, fieldChar); if (fieldStr->_type != TRI_JSON_STRING) { - LOG_ERROR("ignore hash-index %lu, invalid field name for hash index", + LOG_ERROR("ignore %s-index %lu, invalid field name for hash index", (unsigned long) iid); TRI_DestroyVector(&attributes); @@ -1278,81 +1329,17 @@ static bool OpenIndex (char const* filename, void* data) { } // create the index - idx = CreateHashIndexSimCollection (doc, &attributes, iid, uniqueIndex); - - TRI_DestroyVector(&attributes); - TRI_FreeJson(json); - - if (idx == NULL) { - LOG_ERROR("cannot create hash index %lu", (unsigned long) iid); - return false; + if (TRI_EqualString(typeStr, "hash")) { + idx = CreateHashIndexSimCollection (doc, &attributes, iid, uniqueIndex); } - - return true; - } - - // ........................................................................... - // SKIPLIST INDEX - // ........................................................................... - - else if (TRI_EqualString(typeStr, "skiplist")) { - - // Determine if the skiplist index is unique or non-unique - gjs = TRI_LookupArrayJson(json, "unique"); - uniqueIndex = false; - - if (gjs != NULL && gjs->_type == TRI_JSON_BOOLEAN) { - uniqueIndex = gjs->_value._boolean; + else if (TRI_EqualString(typeStr, "skiplist")) { + idx = CreateSkiplistIndexSimCollection (doc, &attributes, iid, uniqueIndex); } else { - LOG_ERROR("ignore skiplist-index %lu, could not determine if unique or non-unique", - (unsigned long) iid); - - TRI_FreeJson(json); - return false; - } - - // Extract the list of fields - fieldCount = 0; - fieldCount = TRI_LookupArrayJson(json, "fieldCount"); - intCount = 0; - - if ( (fieldCount != NULL) && (fieldCount->_type == TRI_JSON_NUMBER) ) { - intCount = fieldCount->_value._number; + LOG_ERROR("internal error for hash type '%s'", typeStr); + idx = NULL; } - if (intCount < 1) { - LOG_ERROR("ignore skiplist-index %lu, field count missing", (unsigned long) iid); - - TRI_FreeJson(json); - return false; - } - - // Initialise the vector in which we store the fields on which the hashing - // will be based. - TRI_InitVector(&attributes, sizeof(char*)); - - // find fields - for (int j = 0; j < intCount; ++j) { - sprintf(fieldChar, "field_%i", j); - - fieldStr = TRI_LookupArrayJson(json, fieldChar); - - if (fieldStr->_type != TRI_JSON_STRING) { - LOG_ERROR("ignore skiplist-index %lu, invalid field name for hash index", - (unsigned long) iid); - - TRI_DestroyVector(&attributes); - TRI_FreeJson(json); - return false; - } - - TRI_PushBackVector(&attributes, &(fieldStr->_value._string.data)); - } - - // create the index - idx = CreateSkiplistIndexSimCollection (doc, &attributes, iid, uniqueIndex); - TRI_DestroyVector(&attributes); TRI_FreeJson(json); @@ -1363,7 +1350,7 @@ static bool OpenIndex (char const* filename, void* data) { return true; } - + // ......................................................................... // ups, unknown index type // ......................................................................... @@ -1647,7 +1634,7 @@ TRI_sim_collection_t* TRI_OpenSimCollection (char const* path) { // read all documents and fill indexes TRI_IterateCollection(collection, OpenIterator, collection); - TRI_IterateIndexCollection(collection, OpenIndex, collection); + TRI_IterateIndexCollection(collection, OpenIndexIterator, collection); // output infomations about datafiles and journals if (TRI_IsTraceLogging(__FILE__)) { @@ -1970,6 +1957,7 @@ static bool DeleteImmediateIndexes (TRI_sim_collection_t* collection, static bool FillIndex (TRI_sim_collection_t* collection, TRI_index_t* idx) { + TRI_doc_mptr_t const* mptr; size_t n; size_t scanned; void** end; @@ -1983,15 +1971,19 @@ static bool FillIndex (TRI_sim_collection_t* collection, scanned = 0; for (; ptr < end; ++ptr) { - if (*ptr) { + if (*ptr != NULL) { + mptr = *ptr; + ++scanned; - if (! idx->insert(idx, *ptr)) { - LOG_TRACE("failed to insert document '%lu:%lu'", - (unsigned long) collection->base.base._cid, - (unsigned long) ((TRI_doc_mptr_t const*) ptr)->_did); + if (mptr->_deletion == 0) { + if (! idx->insert(idx, *ptr)) { + LOG_WARNING("failed to insert document '%lu:%lu'", + (unsigned long) collection->base.base._cid, + (unsigned long) mptr->_did); - return false; + return false; + } } if (scanned % 10000 == 0) { From e4c5135cbb02f0b79c547f2a637cd0da0bf6c7e5 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sun, 11 Mar 2012 07:36:34 +0100 Subject: [PATCH 2/8] doc --- RestServer/{install.h => install-manual.dox} | 0 RestServer/ref-manual.dox | 157 ++++++++++++ RestServer/user-manual-avocsh.dox | 199 +++++++++++++++ RestServer/user-manual-server.dox | 254 +++++++++++++++++++ 4 files changed, 610 insertions(+) rename RestServer/{install.h => install-manual.dox} (100%) create mode 100644 RestServer/ref-manual.dox create mode 100644 RestServer/user-manual-avocsh.dox create mode 100644 RestServer/user-manual-server.dox diff --git a/RestServer/install.h b/RestServer/install-manual.dox similarity index 100% rename from RestServer/install.h rename to RestServer/install-manual.dox diff --git a/RestServer/ref-manual.dox b/RestServer/ref-manual.dox new file mode 100644 index 0000000000..5392ee7604 --- /dev/null +++ b/RestServer/ref-manual.dox @@ -0,0 +1,157 @@ +//////////////////////////////////////////////////////////////////////////////// +/// @brief installation guide +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2012 triagens GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Dr. Frank Celler +/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page RefManual AvocadoDB Reference Manual +/// +///
    +///
  1. @ref JSModules +///
      +///
    1. @ref JSModuleActions +///
    2. +///
    3. @ref JSModuleConsole +///
    4. +///
    5. @ref JSModuleFs +///
    6. +///
    7. @ref JSModuleGraph +///
    8. +///
    9. @ref JSModuleInternal +///
    10. +///
    +///
  2. @ref CommandLine +///
      +///
    1. @ref CommandLineAvocado +///
    2. +///
    3. @ref CommandLineScheduler +///
    4. +///
    5. @ref CommandLineLogging +///
    6. +///
    7. @ref CommandLineRandom +///
    8. +///
    +///
  3. +///
+//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page CommandLineTOC +/// +///
    +///
  1. configuration
  2. +///
  3. daemon
  4. +///
  5. gid
  6. +///
  7. help
  8. +///
  9. pid-file
  10. +///
  11. uid
  12. +///
  13. version
  14. +///
+//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page CommandLine Command-Line Options +/// +///
+/// @copydoc CommandLineTOC +///
+/// +/// @section GeneralOptions General Options +/// +/// @copydetails triagens::rest::ApplicationServerImpl::initFile +/// +/// @CMDOPT{--daemon} +/// +/// Runs the server as a daemon (as a background process). This parameter can +/// only be set if the pid (process id) file is specified. That is, unless a +/// value to the parameter pid-file is given, then the server will report an +/// error and exit. +/// +/// @copydetails triagens::rest::ApplicationServerImpl::gid +/// +/// @copydetails triagens::rest::ApplicationServerImpl::options +/// +/// @copydetails triagens::rest::AnyServer::_pidFile +/// +/// @CMDOPT{--show-io-backends} +/// +/// If this option is specified, then the server will list available backends +/// and exit. This option is useful only when used in conjunction with the +/// option scheduler.backend. An integer is returned (which is platform +/// dependent) which indicates available backends on your platform. See libev +/// for further details and for the meaning of the integer returned. This +/// describes the allowed integers for @CODE{scheduler.backend}, see +/// @ref CommandLineScheduler "here" for details. +/// +/// @CMDOPT{--supervisor} +/// +/// Executes the server in supervisor mode. In the event that the server +/// unexpectedly terminates due to an internal error, the supervisor will +/// automatically restart the server. Setting this flag automatically implies +/// that the server will run as a daemon. Note that, as with the daemon flag, +/// this flag requires that the pid-file parameter will set. +/// +/// @copydetails triagens::rest::ApplicationServerImpl::uid +/// +/// @copydetails triagens::rest::ApplicationServerImpl::version +/// +///
+/// Next steps: +/// +/// - @ref CommandLineAvocado "Command-Line Options for the AvocadoDB" +/// - @ref CommandLineScheduler "Command-Line Options for Communication" +/// - @ref CommandLineLogging "Command-Line Options for Logging" +/// - @ref CommandLineRandom "Command-Line Options for Random Numbers" +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page CommandLineAvocadoTOC +/// +///
    +///
  1. database.directory
  2. +///
  3. server.admin-port
  4. +///
  5. server.http-port
  6. +///
+//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page CommandLineAvocado Command-Line Options for the AvocadoDB +/// +///
+/// @copydoc CommandLineAvocadoTOC +///
+/// +/// @copydetails triagens::avocado::AvocadoServer::_databasePath +/// +/// @copydetails triagens::avocado::AvocadoServer::_adminPort +/// +/// @copydetails triagens::avocado::AvocadoServer::_httpPort +//////////////////////////////////////////////////////////////////////////////// + +// Local Variables: +// mode: c++ +// mode: outline-minor +// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)" +// End: diff --git a/RestServer/user-manual-avocsh.dox b/RestServer/user-manual-avocsh.dox new file mode 100644 index 0000000000..077e7087c8 --- /dev/null +++ b/RestServer/user-manual-avocsh.dox @@ -0,0 +1,199 @@ +//////////////////////////////////////////////////////////////////////////////// +/// @brief installation guide +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2012 triagens GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Dr. Frank Celler +/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page UserManualShell User Manual for the AvocadoDB Shell +/// +///
    +///
  1. @ref UserManualShellBasics +///
      +///
    1. @ref StartStop +///
    2. +///
    3. AvocadoScript +///
        +///
      1. @ref SimpleQueries +///
      2. +///
      +///
    4. +///
    5. Vertices, Edges, and Graphs +///
        +///
      1. @ref Graphs +///
      2. +///
      3. @ref JSModuleGraph +///
      4. +///
      +///
    6. +///
    +///
  2. +///
+//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page UserManualShellBasics Basics +/// +/// The AvocadoDB groups documents into collections. Each collection can be +/// accessed using queries. For simple queries involving just one collection, +/// you can use a fluent interface from within JavaScript code, see @ref +/// AvocadoScript. This interface allows you to select documents from one +/// collection based on simple search criteria. The @ref HttpInterface +/// lets you create, modify, or delete a single document via HTTP. For +/// more complex queries, you can use the Avocado Query Language, which is +/// an extension of SQL resp. UNQL. +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page StartStopTOC +/// +///
    +///
  1. @ref StartStopHttp "Starting the HTTP Server"
  2. +///
  3. @ref StartStopDebug "Starting the Debug Shell"
  4. +///
  5. @ref StartStopOptions "Frequently Used Options"
  6. +///
+//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page StartStop Starting the AvocadoDB +/// +/// The AvocadoDB has two mode of operation: as server, where it will answer to +/// HTTP requests, see @ref HttpInterface, and a debug shell, where you can +/// access the database directly. Using the debug shell allows you to issue all +/// commands normally available in actions and transactions, see @ref +/// AvocadoScript. +/// +/// You should never start more than one server for the same database, +/// independent from the mode of operation. +/// +///
+/// @copydoc StartStopTOC +///
+/// +/// @section StartStopHttp Starting the HTTP Server +/// +/// The following command starts the AvocadoDB in server mode. You will be able +/// to access the server using HTTP request on port 8529. See below for a list +/// of frequently used options, see @ref CommandLine "here" for a complete list. +/// +/// @verbinclude start2 +/// +/// @section StartStopDebug Starting the Debug Shell +/// +/// The following command starts a debug shell. See below for a list of +/// frequently used options, see @ref CommandLine "here" for a complete list. +/// +/// @verbinclude start1 +/// +/// @section StartStopOptions Frequently Used Options +/// +/// The following command-line options are frequently used. For a full +/// list of options see @ref CommandLine "here". +/// +/// @CMDOPT{@CA{database-directory}} +/// +/// Uses the @CA{database-directory} as base directory. There is an alternative +/// version available for use in configuration files, see @ref +/// CommandLineAvocado "here". +/// +/// @copydetails triagens::rest::ApplicationServerImpl::options +/// +/// @CMDOPT{--log @CA{level}} +/// +/// Allows the user to choose the level of information which is logged by the +/// server. The @CA{level} is specified as a string and can be one of the +/// following values: fatal, error, warning, info, debug, trace. For more +/// information see @ref CommandLineLogging "here". +/// +/// @copydetails triagens::avocado::AvocadoServer::_httpPort +/// +/// @CMDOPT{--shell} +/// +/// Opens a debug shell instead of starting the HTTP server. +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page DBAdminTOC +/// +///
    +///
  1. @ref DBAdminDurability +///
  2. +///
  3. @ref DBAdminIndex +///
      +///
    1. @ref DBAdminIndexGeo +///
    +///
  4. +///
+//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page DBAdmin Database Administration +/// +///
+/// @copydetails DBAdminTOC +///
+/// +/// @section DBAdminDurability Durability +/// +/// @subsection DBAdminDurability1 Mostly Memory/Durability +/// +/// Database documents are stored in the memory-memory-mapped files are used to +/// store them. The operating system has the advantageous option to decide +/// swapping sparsely used areas out of the main memory. Per default, these +/// memory-mapped files are synced frequently - advantageously storing all +/// documents securely at once (durability). +/// +/// @subsection DBAdminDurability2 AppendOnly/MVCC +/// +/// Instead of overwriting existing documents, a completely new version of the +/// document is generated. The two benefits are: +/// +/// - Objects can be stored coherently and compactly in the main memory. +/// - Objects are preserved-isolated writing and reading transactions allow +/// accessing these objects for parallel operations. +/// +/// The system collects obsolete versions as garbage, recognizing them as +/// forsaken. Garbage collection is asynchronous and runs parallel to other +/// processes. +/// +/// @subsection DBAdminDurability3 Configuration +/// +/// @copydetails JS_ParameterVocbaseCol +/// +/// @section DBAdminIndex Index Management +/// +/// @subsection DBAdminIndexHash Hash Indexes +/// +/// @copydetails JS_EnsureHashIndexVocbaseCol +/// +/// @subsection DBAdminIndexGeo Geo Indexes +/// +/// @copydetails JS_EnsureGeoIndexVocbaseCol +//////////////////////////////////////////////////////////////////////////////// + +// Local Variables: +// mode: c++ +// mode: outline-minor +// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)" +// End: diff --git a/RestServer/user-manual-server.dox b/RestServer/user-manual-server.dox new file mode 100644 index 0000000000..8b09cbc3ce --- /dev/null +++ b/RestServer/user-manual-server.dox @@ -0,0 +1,254 @@ +//////////////////////////////////////////////////////////////////////////////// +/// @brief installation guide +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2012 triagens GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Dr. Frank Celler +/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page UserManualServer User Manual for the AvocadoDB Server +/// +///
    +///
  1. @ref UserManualServerBasics +///
      +///
    1. @ref UserManualServerStartStop +///
    2. +///
    3. AvocadoScript +///
        +///
      1. @ref SimpleQueries +///
      2. +///
      +///
    4. +///
    5. @ref AQL +///
        +///
      1. @ref Optimizer +///
      2. +///
      3. @ref IndexUsage +///
      4. +///
      +///
    6. +///
    7. @ref AvocadoScript +///
        +///
      1. @ref GeoCoordinates +///
      2. +///
      +///
    8. +///
    9. Vertices, Edges, and Graphs +///
        +///
      1. @ref Graphs +///
      2. +///
      3. @ref JSModuleGraph +///
      4. +///
      +///
    10. +///
    +///
  2. +///
  3. Client Communication +///
      +///
    1. @ref HttpInterface +///
        +///
      1. @ref RestDocument +///
      2. +///
      +///
    2. +///
    +///
  4. +///
  5. @ref DBAdmin +///
      +///
    1. @ref DBAdminDurability +///
    2. +///
    3. @ref DBAdminIndex +///
        +///
      1. @ref DBAdminIndexGeo +///
      +///
    4. +///
    +///
  6. +///
  7. Advanced Topics +///
      +///
    1. Actions +///
        +///
      1. @ref Actions +///
      2. +///
      3. @ref DefineAction +///
      4. +///
      +///
    2. +///
    3. @ref HttpInterface +///
        +///
      1. @ref RestSystem +///
      2. +///
      +///
    4. +///
    5. @ref jsUnity +///
    6. +///
    +///
  8. +///
+//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page UserManualServerBasics Basics +/// +/// The AvocadoDB groups documents into collections. Each collection can be +/// accessed using queries. For simple queries involving just one collection, +/// you can use a fluent interface from within JavaScript code, see @ref +/// AvocadoScript. This interface allows you to select documents from one +/// collection based on simple search criteria. The @ref HttpInterface +/// lets you create, modify, or delete a single document via HTTP. For +/// more complex queries, you can use the Avocado Query Language, which is +/// an extension of SQL resp. UNQL. +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page UserManualServerStartStopTOC +/// +///
    +///
  1. @ref UserManualServerStartStopHttp "Starting the HTTP Server"
  2. +///
  3. @ref UserManualServerStartStopDebug "Starting the Debug Shell"
  4. +///
  5. @ref UserManualServerStartStopOptions "Frequently Used Options"
  6. +///
+//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page UserManualServerStartStop Starting the AvocadoDB +/// +/// The AvocadoDB has two mode of operation: as server, where it will answer to +/// HTTP requests, see @ref HttpInterface, and a debug shell, where you can +/// access the database directly. Using the debug shell allows you to issue all +/// commands normally available in actions and transactions, see @ref +/// AvocadoScript. +/// +/// You should never start more than one server for the same database, +/// independent from the mode of operation. +/// +///
+/// @copydoc UserManualServerStartStopTOC +///
+/// +/// @section UserManualServerStartStopHttp Starting the HTTP Server +/// +/// The following command starts the AvocadoDB in server mode. You will be able +/// to access the server using HTTP request on port 8529. See below for a list +/// of frequently used options, see @ref CommandLine "here" for a complete list. +/// +/// @verbinclude start2 +/// +/// @section UserManualServerStartStopDebug Starting the Debug Shell +/// +/// The following command starts a debug shell. See below for a list of +/// frequently used options, see @ref CommandLine "here" for a complete list. +/// +/// @verbinclude start1 +/// +/// @section UserManualServerStartStopOptions Frequently Used Options +/// +/// The following command-line options are frequently used. For a full +/// list of options see @ref CommandLine "here". +/// +/// @CMDOPT{@CA{database-directory}} +/// +/// Uses the @CA{database-directory} as base directory. There is an alternative +/// version available for use in configuration files, see @ref +/// CommandLineAvocado "here". +/// +/// @copydetails triagens::rest::ApplicationServerImpl::options +/// +/// @CMDOPT{--log @CA{level}} +/// +/// Allows the user to choose the level of information which is logged by the +/// server. The @CA{level} is specified as a string and can be one of the +/// following values: fatal, error, warning, info, debug, trace. For more +/// information see @ref CommandLineLogging "here". +/// +/// @copydetails triagens::avocado::AvocadoServer::_httpPort +/// +/// @CMDOPT{--shell} +/// +/// Opens a debug shell instead of starting the HTTP server. +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page DBAdminTOC +/// +///
    +///
  1. @ref DBAdminDurability +///
  2. +///
  3. @ref DBAdminIndex +///
      +///
    1. @ref DBAdminIndexGeo +///
    +///
  4. +///
+//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page DBAdmin Database Administration +/// +///
+/// @copydetails DBAdminTOC +///
+/// +/// @section DBAdminDurability Durability +/// +/// @subsection DBAdminDurability1 Mostly Memory/Durability +/// +/// Database documents are stored in the memory-memory-mapped files are used to +/// store them. The operating system has the advantageous option to decide +/// swapping sparsely used areas out of the main memory. Per default, these +/// memory-mapped files are synced frequently - advantageously storing all +/// documents securely at once (durability). +/// +/// @subsection DBAdminDurability2 AppendOnly/MVCC +/// +/// Instead of overwriting existing documents, a completely new version of the +/// document is generated. The two benefits are: +/// +/// - Objects can be stored coherently and compactly in the main memory. +/// - Objects are preserved-isolated writing and reading transactions allow +/// accessing these objects for parallel operations. +/// +/// The system collects obsolete versions as garbage, recognizing them as +/// forsaken. Garbage collection is asynchronous and runs parallel to other +/// processes. +/// +/// @subsection DBAdminDurability3 Configuration +/// +/// @copydetails JS_ParameterVocbaseCol +/// +/// @section DBAdminIndex Index Management +/// +/// @subsection DBAdminIndexHash Hash Indexes +/// +/// @copydetails JS_EnsureHashIndexVocbaseCol +/// +/// @subsection DBAdminIndexGeo Geo Indexes +/// +/// @copydetails JS_EnsureGeoIndexVocbaseCol +//////////////////////////////////////////////////////////////////////////////// + +// Local Variables: +// mode: c++ +// mode: outline-minor +// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)" +// End: From 9d10ae943e7c3a887327e9d6cc15209e3f6e3aaa Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sun, 11 Mar 2012 07:36:36 +0100 Subject: [PATCH 3/8] doc --- Makefile.files | 3 +- Makefile.in | 3 +- RestServer/avocado.cpp | 370 ---------------------------------- RestServer/install-manual.dox | 16 +- 4 files changed, 18 insertions(+), 374 deletions(-) diff --git a/Makefile.files b/Makefile.files index 62cf36dfae..7fecbf4e2b 100644 --- a/Makefile.files +++ b/Makefile.files @@ -314,5 +314,6 @@ WIKI = \ Doxygen/xml/RestDocument.md \ Doxygen/xml/RestSystem.md \ Doxygen/xml/StartStop.md \ - Doxygen/xml/UserManual.md \ + Doxygen/xml/UserManualServer.md \ + Doxygen/xml/UserManualShell.md \ Doxygen/xml/jsUnity.md diff --git a/Makefile.in b/Makefile.in index 92bab57387..9120837ccc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -820,7 +820,8 @@ WIKI = \ Doxygen/xml/RestDocument.md \ Doxygen/xml/RestSystem.md \ Doxygen/xml/StartStop.md \ - Doxygen/xml/UserManual.md \ + Doxygen/xml/UserManualServer.md \ + Doxygen/xml/UserManualShell.md \ Doxygen/xml/jsUnity.md @ENABLE_32BIT_TRUE@@ENABLE_ALL_IN_ONE_TRUE@LIBEV_BUILD_VERSION = ARCH.ia32 diff --git a/RestServer/avocado.cpp b/RestServer/avocado.cpp index f44c78facf..42ebb6b68d 100644 --- a/RestServer/avocado.cpp +++ b/RestServer/avocado.cpp @@ -35,376 +35,6 @@ using namespace triagens::basics; using namespace triagens::rest; using namespace triagens::avocado; -// ----------------------------------------------------------------------------- -// --SECTION-- USER MANUAL -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @page UserManual AvocadoDB User Manual -/// -///
    -///
  1. @ref Basics -///
      -///
    1. @ref StartStop -///
    2. -///
    3. AvocadoScript -///
        -///
      1. @ref SimpleQueries -///
      2. -///
      -///
    4. -///
    5. @ref AQL -///
        -///
      1. @ref Optimizer -///
      2. -///
      3. @ref IndexUsage -///
      4. -///
      -///
    6. -///
    7. @ref AvocadoScript -///
        -///
      1. @ref GeoCoordinates -///
      2. -///
      -///
    8. -///
    9. Vertices, Edges, and Graphs -///
        -///
      1. @ref Graphs -///
      2. -///
      3. @ref JSModuleGraph -///
      4. -///
      -///
    10. -///
    -///
  2. -///
  3. Client Communication -///
      -///
    1. @ref HttpInterface -///
        -///
      1. @ref RestDocument -///
      2. -///
      -///
    2. -///
    -///
  4. -///
  5. @ref DBAdmin -///
      -///
    1. @ref DBAdminDurability -///
    2. -///
    3. @ref DBAdminIndex -///
        -///
      1. @ref DBAdminIndexGeo -///
      -///
    4. -///
    -///
  6. -///
  7. Advanced Topics -///
      -///
    1. Actions -///
        -///
      1. @ref Actions -///
      2. -///
      3. @ref DefineAction -///
      4. -///
      -///
    2. -///
    3. @ref HttpInterface -///
        -///
      1. @ref RestSystem -///
      2. -///
      -///
    4. -///
    5. @ref jsUnity -///
    6. -///
    -///
  8. -///
-//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page Basics Basics -/// -/// The AvocadoDB groups documents into collections. Each collection can be -/// accessed using queries. For simple queries involving just one collection, -/// you can use a fluent interface from within JavaScript code, see @ref -/// AvocadoScript. This interface allows you to select documents from one -/// collection based on simple search criteria. The @ref HttpInterface -/// lets you create, modify, or delete a single document via HTTP. For -/// more complex queries, you can use the Avocado Query Language, which is -/// an extension of SQL resp. UNQL. -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page StartStopTOC -/// -///
    -///
  1. @ref StartStopHttp "Starting the HTTP Server"
  2. -///
  3. @ref StartStopDebug "Starting the Debug Shell"
  4. -///
  5. @ref StartStopOptions "Frequently Used Options"
  6. -///
-//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page StartStop Starting the AvocadoDB -/// -/// The AvocadoDB has two mode of operation: as server, where it will answer to -/// HTTP requests, see @ref HttpInterface, and a debug shell, where you can -/// access the database directly. Using the debug shell allows you to issue all -/// commands normally available in actions and transactions, see @ref -/// AvocadoScript. -/// -/// You should never start more than one server for the same database, -/// independent from the mode of operation. -/// -///
-/// @copydoc StartStopTOC -///
-/// -/// @section StartStopHttp Starting the HTTP Server -/// -/// The following command starts the AvocadoDB in server mode. You will be able -/// to access the server using HTTP request on port 8529. See below for a list -/// of frequently used options, see @ref CommandLine "here" for a complete list. -/// -/// @verbinclude start2 -/// -/// @section StartStopDebug Starting the Debug Shell -/// -/// The following command starts a debug shell. See below for a list of -/// frequently used options, see @ref CommandLine "here" for a complete list. -/// -/// @verbinclude start1 -/// -/// @section StartStopOptions Frequently Used Options -/// -/// The following command-line options are frequently used. For a full -/// list of options see @ref CommandLine "here". -/// -/// @CMDOPT{@CA{database-directory}} -/// -/// Uses the @CA{database-directory} as base directory. There is an alternative -/// version available for use in configuration files, see @ref -/// CommandLineAvocado "here". -/// -/// @copydetails triagens::rest::ApplicationServerImpl::options -/// -/// @CMDOPT{--log @CA{level}} -/// -/// Allows the user to choose the level of information which is logged by the -/// server. The @CA{level} is specified as a string and can be one of the -/// following values: fatal, error, warning, info, debug, trace. For more -/// information see @ref CommandLineLogging "here". -/// -/// @copydetails triagens::avocado::AvocadoServer::_httpPort -/// -/// @CMDOPT{--shell} -/// -/// Opens a debug shell instead of starting the HTTP server. -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page DBAdminTOC -/// -///
    -///
  1. @ref DBAdminDurability -///
  2. -///
  3. @ref DBAdminIndex -///
      -///
    1. @ref DBAdminIndexGeo -///
    -///
  4. -///
-//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page DBAdmin Database Administration -/// -///
-/// @copydetails DBAdminTOC -///
-/// -/// @section DBAdminDurability Durability -/// -/// @subsection DBAdminDurability1 Mostly Memory/Durability -/// -/// Database documents are stored in the memory-memory-mapped files are used to -/// store them. The operating system has the advantageous option to decide -/// swapping sparsely used areas out of the main memory. Per default, these -/// memory-mapped files are synced frequently - advantageously storing all -/// documents securely at once (durability). -/// -/// @subsection DBAdminDurability2 AppendOnly/MVCC -/// -/// Instead of overwriting existing documents, a completely new version of the -/// document is generated. The two benefits are: -/// -/// - Objects can be stored coherently and compactly in the main memory. -/// - Objects are preserved-isolated writing and reading transactions allow -/// accessing these objects for parallel operations. -/// -/// The system collects obsolete versions as garbage, recognizing them as -/// forsaken. Garbage collection is asynchronous and runs parallel to other -/// processes. -/// -/// @subsection DBAdminDurability3 Configuration -/// -/// @copydetails JS_ParameterVocbaseCol -/// -/// @section DBAdminIndex Index Management -/// -/// @subsection DBAdminIndexHash Hash Indexes -/// -/// @copydetails JS_EnsureHashIndexVocbaseCol -/// -/// @subsection DBAdminIndexGeo Geo Indexes -/// -/// @copydetails JS_EnsureGeoIndexVocbaseCol -//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- INSTALLATION MANUAL -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @page InstallManual AvocadoDB Installation Manual -/// -///
    -///
  1. @ref Installing -///
  2. -///
  3. @ref Compiling -///
  4. -///
-//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- REFERENCE MANUAL -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @page RefManual AvocadoDB Reference Manual -/// -///
    -///
  1. @ref JSModules -///
      -///
    1. @ref JSModuleActions -///
    2. -///
    3. @ref JSModuleConsole -///
    4. -///
    5. @ref JSModuleFs -///
    6. -///
    7. @ref JSModuleGraph -///
    8. -///
    9. @ref JSModuleInternal -///
    10. -///
    -///
  2. @ref CommandLine -///
      -///
    1. @ref CommandLineAvocado -///
    2. -///
    3. @ref CommandLineScheduler -///
    4. -///
    5. @ref CommandLineLogging -///
    6. -///
    7. @ref CommandLineRandom -///
    8. -///
    -///
  3. -///
-//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page CommandLineTOC -/// -///
    -///
  1. configuration
  2. -///
  3. daemon
  4. -///
  5. gid
  6. -///
  7. help
  8. -///
  9. pid-file
  10. -///
  11. uid
  12. -///
  13. version
  14. -///
-//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page CommandLine Command-Line Options -/// -///
-/// @copydoc CommandLineTOC -///
-/// -/// @section GeneralOptions General Options -/// -/// @copydetails triagens::rest::ApplicationServerImpl::initFile -/// -/// @CMDOPT{--daemon} -/// -/// Runs the server as a daemon (as a background process). This parameter can -/// only be set if the pid (process id) file is specified. That is, unless a -/// value to the parameter pid-file is given, then the server will report an -/// error and exit. -/// -/// @copydetails triagens::rest::ApplicationServerImpl::gid -/// -/// @copydetails triagens::rest::ApplicationServerImpl::options -/// -/// @copydetails triagens::rest::AnyServer::_pidFile -/// -/// @CMDOPT{--show-io-backends} -/// -/// If this option is specified, then the server will list available backends -/// and exit. This option is useful only when used in conjunction with the -/// option scheduler.backend. An integer is returned (which is platform -/// dependent) which indicates available backends on your platform. See libev -/// for further details and for the meaning of the integer returned. This -/// describes the allowed integers for @CODE{scheduler.backend}, see -/// @ref CommandLineScheduler "here" for details. -/// -/// @CMDOPT{--supervisor} -/// -/// Executes the server in supervisor mode. In the event that the server -/// unexpectedly terminates due to an internal error, the supervisor will -/// automatically restart the server. Setting this flag automatically implies -/// that the server will run as a daemon. Note that, as with the daemon flag, -/// this flag requires that the pid-file parameter will set. -/// -/// @copydetails triagens::rest::ApplicationServerImpl::uid -/// -/// @copydetails triagens::rest::ApplicationServerImpl::version -/// -///
-/// Next steps: -/// -/// - @ref CommandLineAvocado "Command-Line Options for the AvocadoDB" -/// - @ref CommandLineScheduler "Command-Line Options for Communication" -/// - @ref CommandLineLogging "Command-Line Options for Logging" -/// - @ref CommandLineRandom "Command-Line Options for Random Numbers" -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page CommandLineAvocadoTOC -/// -///
    -///
  1. database.directory
  2. -///
  3. server.admin-port
  4. -///
  5. server.http-port
  6. -///
-//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page CommandLineAvocado Command-Line Options for the AvocadoDB -/// -///
-/// @copydoc CommandLineAvocadoTOC -///
-/// -/// @copydetails triagens::avocado::AvocadoServer::_databasePath -/// -/// @copydetails triagens::avocado::AvocadoServer::_adminPort -/// -/// @copydetails triagens::avocado::AvocadoServer::_httpPort -//////////////////////////////////////////////////////////////////////////////// - // ----------------------------------------------------------------------------- // --SECTION-- public functions // ----------------------------------------------------------------------------- diff --git a/RestServer/install-manual.dox b/RestServer/install-manual.dox index 1d4dd3b0d7..db1131d215 100644 --- a/RestServer/install-manual.dox +++ b/RestServer/install-manual.dox @@ -5,7 +5,7 @@ /// /// DISCLAIMER /// -/// Copyright 2004-2012 triagens GmbH, Cologne, Germany +/// Copyright 2012 triagens GmbH, Cologne, Germany /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. @@ -25,6 +25,17 @@ /// @author Copyright 2012, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +/// @page InstallManual AvocadoDB Installation Manual +/// +///
    +///
  1. @ref Installing +///
  2. +///
  3. @ref Compiling +///
  4. +///
+//////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// /// @page InstallingTOC /// @@ -290,6 +301,7 @@ //////////////////////////////////////////////////////////////////////////////// // Local Variables: +// mode: c++ // mode: outline-minor -// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)" +// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)" // End: From 2f0aeda80018ff813d5ec56d737b2e0533305ebe Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sun, 11 Mar 2012 21:17:15 +0100 Subject: [PATCH 4/8] doc --- Doxygen/Examples.AvocadoDB/avocsh1 | 26 ++ Doxygen/Examples.AvocadoDB/avocsh2 | 11 + Doxygen/Examples.Durham/graph11 | 18 +- Doxygen/Examples.Durham/graph12 | 13 +- Doxygen/Examples.Durham/graph13 | 11 +- Doxygen/Examples.Durham/graph14 | 13 +- Doxygen/Examples.Durham/graph2 | 4 +- Doxygen/Examples.Durham/graph20 | 14 +- Doxygen/Examples.Durham/graph21 | 16 +- Doxygen/Examples.Durham/graph22 | 14 +- Doxygen/Examples.Durham/graph23 | 9 +- Doxygen/Examples.Durham/graph24 | 12 +- Doxygen/Examples.Durham/graph29 | 8 +- Doxygen/Examples.Durham/graph3 | 8 +- Doxygen/Examples.Durham/graph32 | 13 +- Doxygen/Examples.Durham/graph33 | 19 +- Doxygen/Examples.Durham/graph35 | 2 +- Doxygen/Scripts/md2html.sh | 2 + Doxygen/js/modules/graph.c | 372 +++++++------------- Makefile.files | 1 + Makefile.in | 1 + RestServer/graphs.dox | 224 ++++++++++++ RestServer/simple-queries.dox | 188 ++++++++++ RestServer/user-manual-avocsh.dox | 151 ++------ V8/v8-line-editor.cpp | 26 +- V8Client/shell.cpp | 46 ++- js/modules/graph.js | 533 ++++++++++++----------------- js/modules/simple-query.js | 156 --------- 28 files changed, 949 insertions(+), 962 deletions(-) create mode 100644 Doxygen/Examples.AvocadoDB/avocsh1 create mode 100644 Doxygen/Examples.AvocadoDB/avocsh2 create mode 100644 RestServer/graphs.dox create mode 100644 RestServer/simple-queries.dox diff --git a/Doxygen/Examples.AvocadoDB/avocsh1 b/Doxygen/Examples.AvocadoDB/avocsh1 new file mode 100644 index 0000000000..10a40bd0c0 --- /dev/null +++ b/Doxygen/Examples.AvocadoDB/avocsh1 @@ -0,0 +1,26 @@ +> ./avocsh + _ + __ ___ _____ ___ ___| |__ + / _` \ \ / / _ \ / __/ __| '_ \ + | (_| |\ V / (_) | (__\__ \ | | | + \__,_| \_/ \___/ \___|___/_| |_| + +Welcome to avocsh x.y.z. Copyright (c) 2012 triAGENS GmbH. +Using Google V8 3.8.5 JavaScript engine. +Using READLINE 6.1. + +Connected to Avocado DB 127.0.0.1:8529 Version 0.x.y + +------------------------------------- Help ------------------------------------- +Predefined objects: + avocado: AvocadoConnection + db: AvocadoDatabase +Example: + > db._collections(); list all collections + > db..all(); list all documents + > id = db..save({ ... }); save a document + > db..delete(<_id>); delete a document + > db..document(<_id>); get a document + > help show help pages + > helpQueries query help + > exit diff --git a/Doxygen/Examples.AvocadoDB/avocsh2 b/Doxygen/Examples.AvocadoDB/avocsh2 new file mode 100644 index 0000000000..7cc4574ffa --- /dev/null +++ b/Doxygen/Examples.AvocadoDB/avocsh2 @@ -0,0 +1,11 @@ +> ./avocsh --help +STANDARD options: + --help help message + --log.level log level (default: "info") + --no-auto-complete disable auto completion + --no-colors deactivate color support + --pager output pager (default: 'more') (default: "more") + --pretty-print pretty print values + --server server address and port (default: "127.0.0.1:8529") + --startup startup path containing the JavaScript files + --use-pager use pager diff --git a/Doxygen/Examples.Durham/graph11 b/Doxygen/Examples.Durham/graph11 index fc3f747aac..d84c0f398b 100644 --- a/Doxygen/Examples.Durham/graph11 +++ b/Doxygen/Examples.Durham/graph11 @@ -1,16 +1,8 @@ -avocado> var Graph = require("graph").Graph; +avocado> v = g.addVertex(1); +Vertex(1) -avocado> g = new Graph("vertices", "edges"); -Graph("vertices", "edges") +avocado> e = g.addEdge(2, v, v, "knows"); +Edge(2) -avocado> v1 = g.addVertex(); -Vertex(, "153246:2310672") - -avocado> v2 = g.addVertex(); -Vertex(, "153246:2310673") - -avocado> e = g.addEdge(v1, v2, "knows", { "weight" : 10 }); -Edge(, "3999653:5570857") - -avocado> e.properties(e); +avocado> e.properties(); { "weight" : 10 } diff --git a/Doxygen/Examples.Durham/graph12 b/Doxygen/Examples.Durham/graph12 index ff3fb7b13d..ac265e5eaf 100644 --- a/Doxygen/Examples.Durham/graph12 +++ b/Doxygen/Examples.Durham/graph12 @@ -1,13 +1,8 @@ -avocado> var Graph = require("graph").Graph; +avocado> v = g.addVertex(1); +Vertex(1) -avocado> g = new Graph("vertices", "edges"); -Graph("vertices", "edges") - -avocado> v = g.addVertex(); -Vertex(, "153246:2310672") - -avocado> e = g.addEdge(v, v, "self", { "weight" : 10 }); -Edge(, "3999653:5570857") +avocado> e = g.addEdge(2, v, v, "self", { "weight" : 10 }); +Edge(2) avocado> e.getProperty("weight"); 10 diff --git a/Doxygen/Examples.Durham/graph13 b/Doxygen/Examples.Durham/graph13 index d99e570ebd..d6a3a65251 100644 --- a/Doxygen/Examples.Durham/graph13 +++ b/Doxygen/Examples.Durham/graph13 @@ -1,13 +1,8 @@ -avocado> var Graph = require("graph").Graph; - -avocado> g = new Graph("vertices", "edges"); -Graph("vertices", "edges") - avocado> v = g.addVertex(); Vertex(, "153246:2310672") -avocado> e = g.addEdge(v, v, "self"); -Edge(, "3999653:5570857") +avocado> e = g.addEdge(1, v, v, "self"); +Edge(1) avocado> e.getId(); -"3999653:5570857" +1 diff --git a/Doxygen/Examples.Durham/graph14 b/Doxygen/Examples.Durham/graph14 index 542c40f604..d1b4a58c8f 100644 --- a/Doxygen/Examples.Durham/graph14 +++ b/Doxygen/Examples.Durham/graph14 @@ -1,13 +1,8 @@ -avocado> var Graph = require("graph").Graph; +avocado> v = g.addVertex(1); +Vertex(1) -avocado> g = new Graph("vertices", "edges"); -Graph("vertices", "edges") - -avocado> v = g.addVertex(); -Vertex(, "153246:2310672") - -avocado> e = g.addEdge(v, v, "self", { weight: 10 }) -Edge(, "2141724:6339989") +avocado> e = g.addEdge(2, v, v, "self", { weight: 10 }) +Edge(2) avocado> e.getPropert("weight") 10 diff --git a/Doxygen/Examples.Durham/graph2 b/Doxygen/Examples.Durham/graph2 index 4b585a1535..8c747e5810 100644 --- a/Doxygen/Examples.Durham/graph2 +++ b/Doxygen/Examples.Durham/graph2 @@ -3,5 +3,5 @@ avocado> var Graph = require("graph").Graph; avocado> g = new Graph("vertices", "edges"); Graph("vertices", "edges") -avocado> v = g.addVertex(); -Vertex(, "153246:1824463") +avocado> v = g.addVertex("hugo"); +Vertex("hugo") diff --git a/Doxygen/Examples.Durham/graph20 b/Doxygen/Examples.Durham/graph20 index 3dd96f6b7d..ff8a2494a7 100644 --- a/Doxygen/Examples.Durham/graph20 +++ b/Doxygen/Examples.Durham/graph20 @@ -1,12 +1,8 @@ -avocado> var Graph = require("graph").Graph; +avocado> v = g.addVertex(1); +Vertex(1) -avocado> g = new Graph("vertices", "edges"); +avocado> e = g.addEdge(2, v, v, "knows"); +Edge(2) -avocado> v1 = g.addVertex(); -Vertex(, "153246:2310672") - -avocado> e1 = g.addEdge(v, v, "self"); -Edge(, "3999653:7360858") - -avocado> e1.getLabel(); +avocado> e.getLabel(); knows diff --git a/Doxygen/Examples.Durham/graph21 b/Doxygen/Examples.Durham/graph21 index 80dbedee6d..61897d2730 100644 --- a/Doxygen/Examples.Durham/graph21 +++ b/Doxygen/Examples.Durham/graph21 @@ -1,12 +1,8 @@ -avocado> var Graph = require("graph").Graph; +avocado> v1 = g.addVertex(1); +Vertex(1) -avocado> g = new Graph("vertices", "edges"); +avocado> e = g.addEdge(2, v, v, "self"); +Edge(2) -avocado> v1 = g.addVertex(); -Vertex(, "153246:2310672") - -avocado> e1 = g.addEdge(v, v, "self"); -Edge(, "3999653:7360858") - -avocado> e1.getInVertex(); -Vertex(, "153246:2310673") +avocado> e.getInVertex(); +Vertex(1) diff --git a/Doxygen/Examples.Durham/graph22 b/Doxygen/Examples.Durham/graph22 index 508e48e7c2..b62a063842 100644 --- a/Doxygen/Examples.Durham/graph22 +++ b/Doxygen/Examples.Durham/graph22 @@ -1,12 +1,8 @@ -avocado> var Graph = require("graph").Graph; +avocado> v = g.addVertex(1); +Vertex(1) -avocado> g = new Graph("vertices", "edges"); - -avocado> v = g.addVertex(); -Vertex(, "153246:2310672") - -avocado> e = g.addEdge(v, v, "self"); -Edge(, "3999653:7360858") +avocado> e = g.addEdge(2, v, v, "self"); +Edge(2) avocado> e.getOutVertex(); -Vertex(, "153246:2310672") +Vertex(1) diff --git a/Doxygen/Examples.Durham/graph23 b/Doxygen/Examples.Durham/graph23 index 499e2a5235..c47a963f2b 100644 --- a/Doxygen/Examples.Durham/graph23 +++ b/Doxygen/Examples.Durham/graph23 @@ -1,8 +1,5 @@ -avocado> v1 = g.addVertex(); -Vertex(, "153246:8712055") - -avocado> v1.addInEdge(v2, "knows"); -Edge(, "3999653:8908663") +avocado> v1.addInEdge("K", v2, "knows"); +Edge("K") avocado> v1.getInEdges(); -[ Edge(, "3999653:8908663") ] +[ Edge("K"), Edge("2 -> 1") ] diff --git a/Doxygen/Examples.Durham/graph24 b/Doxygen/Examples.Durham/graph24 index 6bef4e8dd7..3103dd918f 100644 --- a/Doxygen/Examples.Durham/graph24 +++ b/Doxygen/Examples.Durham/graph24 @@ -1,11 +1,5 @@ -avocado> v1 = g.addVertex(); -Vertex(, "153246:8712055") - -avocado> v2 = g.addVertex(); -Vertex(, "153246:8777591") - -avocado> v1.addInEdge(v2, "knows", { data : 1 }); -Edge(, "3999653:8908663") +avocado> v1.addInEdge("D", v2, "knows", { data : 1 }); +Edge("D") avocado> v1.getInEdges(); -[ Edge(, "3999653:8908663") ] +[ Edge("K"), Edge("2 -> 1"), Edges("D") ] diff --git a/Doxygen/Examples.Durham/graph29 b/Doxygen/Examples.Durham/graph29 index ea2f9c4cf3..7365273d60 100644 --- a/Doxygen/Examples.Durham/graph29 +++ b/Doxygen/Examples.Durham/graph29 @@ -3,8 +3,8 @@ avocado> var Graph = require("graph").Graph; avocado> g = new Graph("vertices", "edges"); Graph("vertices", "edges") -avocado> v = g.addVertex(); -Vertex(, "153246:1824463") +avocado> g.addVertex(1); +Vertex(1) -avocado> g.getVertex("153246:1824463") -Vertex(, "153246:1824463") +avocado> g.getVertex(1) +Vertex(1) diff --git a/Doxygen/Examples.Durham/graph3 b/Doxygen/Examples.Durham/graph3 index e2485eeebc..be8447451d 100644 --- a/Doxygen/Examples.Durham/graph3 +++ b/Doxygen/Examples.Durham/graph3 @@ -1,5 +1,5 @@ -avocado> v = g.addVertex({ name : "Hugo" }); -Vertex(, "153246:2034680") +avocado> v = g.addVertex("Emil", { age : 123 }); +Vertex("Emil") -avocado> v.getProperty("name"); -Hugo +avocado> v.getProperty("age"); +123 diff --git a/Doxygen/Examples.Durham/graph32 b/Doxygen/Examples.Durham/graph32 index b3a392ea71..96942a955c 100644 --- a/Doxygen/Examples.Durham/graph32 +++ b/Doxygen/Examples.Durham/graph32 @@ -1,13 +1,8 @@ -avocado> var Graph = require("graph").Graph; +avocado> v = g.addVertex(1); +Vertex(1) -avocado> g = new Graph("vertices", "edges"); -Graph("vertices", "edges") - -avocado> v = g.addVertex(); -Vertex(, "153246:2310672") - -avocado> e = g.addEdge(v, v, "self", { weight: 10 }) -Edge(, "2141724:6339989") +avocado> e = g.addEdge(2, v, v, "self", { weight: 10 }) +Edge(2) avocado> e.getPropertyKeys() [ "weight" ] diff --git a/Doxygen/Examples.Durham/graph33 b/Doxygen/Examples.Durham/graph33 index c8faa2de6c..740562e7bc 100644 --- a/Doxygen/Examples.Durham/graph33 +++ b/Doxygen/Examples.Durham/graph33 @@ -1,16 +1,11 @@ -avocado> var Graph = require("graph").Graph; +avocado> v1 = g.addVertex(1); +Vertex(1) -avocado> g = new Graph("vertices", "edges"); -Graph("vertices", "edges") +avocado> v2 = g.addVertex(2); +Vertex(2) -avocado> v1 = g.addVertex(); -Vertex(, "153246:8712055") - -avocado> v2 = g.addVertex(); -Vertex(, "153246:8777591") - -avocado> v1.addInEdge(v2); -Edge(, "3999653:8908663") +avocado> v1.addInEdge("2 -> 1", v2); +Edge("2 -> 1") avocado> v1.getInEdges(); -[ Edge(, "3999653:8908663") ] +[ Edge("2 -> 1") ] diff --git a/Doxygen/Examples.Durham/graph35 b/Doxygen/Examples.Durham/graph35 index f78e64c762..ea69ac7b6a 100644 --- a/Doxygen/Examples.Durham/graph35 +++ b/Doxygen/Examples.Durham/graph35 @@ -10,4 +10,4 @@ avocado> f.hasNext(); true avocado> v = f.next(); -Vertex(, "179962:1945116") +Vertex(18364) diff --git a/Doxygen/Scripts/md2html.sh b/Doxygen/Scripts/md2html.sh index 592a56857c..452d457ff5 100755 --- a/Doxygen/Scripts/md2html.sh +++ b/Doxygen/Scripts/md2html.sh @@ -13,4 +13,6 @@ OUTPUT="`dirname $INPUT`/`basename $INPUT .md`.html" perl "$MARKDOWN" "$INPUT" \ | sed -r -e "s/href=\"([^\"#]+)([\"#])/href=\"\1\.html\2/g" \ | sed -e "s/href=\"wiki\//href=\"/g" \ + | sed -e "s///g" \ + | sed -e "s/<\/var>/<\/it>/g" \ | sed -e "s/#wiki-/#/g" > $OUTPUT diff --git a/Doxygen/js/modules/graph.c b/Doxygen/js/modules/graph.c index 19b78741a9..84d76515a1 100644 --- a/Doxygen/js/modules/graph.c +++ b/Doxygen/js/modules/graph.c @@ -28,220 +28,24 @@ void dummy_34 (); -//////////////////////////////////////////////////////////////////////////////// -/// @page Graphs First Steps with Graphs -/// -/// A Graph consists of vertices and edges. The vertex collection contains the -/// documents forming the vertices. The edge collection contains the documents -/// forming the edges. Together both collections form a graph. Assume that -/// the vertex collection is called @LIT{vertices} and the edges collection -/// @LIT{edges}, then you can build a graph using the @FN{Graph} constructor. -/// -/// @verbinclude graph25 -/// -/// It is possible to use different edges with the same vertices. For -/// instance, to build a new graph with a different edge collection use -/// -/// @verbinclude graph26 -/// -/// It is, however, impossible to use different vertices with the same -/// edges. Edges are tied to the vertices. -/// -/// Next steps: learn more about -/// -/// - @ref JSModuleGraph -//////////////////////////////////////////////////////////////////////////////// - -void dummy_58 (); - -//////////////////////////////////////////////////////////////////////////////// -/// @page JSModuleGraphTOC -/// -///
    -///
  1. @ref JSModuleGraphGraph -///
      -///
    1. @ref JSModuleGraphGraphAddEdge "Graph.addEdge"
    2. -///
    3. @ref JSModuleGraphGraphAddVertex "Graph.addVertex"
    4. -///
    5. @ref JSModuleGraphGraphConstructor "Graph constructor"
    6. -///
    7. @ref JSModuleGraphGraphGetVertex "Graph.getEdges"
    8. -///
    9. @ref JSModuleGraphGraphGetVertex "Graph.getVertex"
    10. -///
    11. @ref JSModuleGraphGraphGetVertices "Graph.getVertices"
    12. -///
    13. @ref JSModuleGraphGraphRemoveEdge "Graph.removeEdge"
    14. -///
    15. @ref JSModuleGraphGraphRemoveVertex "Graph.removeVertex"
    16. -///
    -///
  2. -///
  3. @ref JSModuleGraphVertex -///
      -///
    1. @ref JSModuleGraphVertexAddInEdge "Vertex.addInEdge"
    2. -///
    3. @ref JSModuleGraphVertexAddOutEdge "Vertex.addOutEdge"
    4. -///
    5. @ref JSModuleGraphVertexEdges "Vertex.edges"
    6. -///
    7. @ref JSModuleGraphVertexGetId "Vertex.getId"
    8. -///
    9. @ref JSModuleGraphVertexGetInEdges "Vertex.getInEdges"
    10. -///
    11. @ref JSModuleGraphVertexGetOutEdges "Vertex.getOutEdges"
    12. -///
    13. @ref JSModuleGraphVertexGetProperty "Vertex.getProperty"
    14. -///
    15. @ref JSModuleGraphVertexGetPropertyKeys "Vertex.getPropertyKeys"
    16. -///
    17. @ref JSModuleGraphVertexProperties "Vertex.properties"
    18. -///
    19. @ref JSModuleGraphVertexSetProperty "Vertex.setProperty"
    20. -///
    -///
  4. -///
  5. @ref JSModuleGraphEdge -///
      -///
    1. @ref JSModuleGraphEdgeGetId "Edge.getId"
    2. -///
    3. @ref JSModuleGraphEdgeGetInVertex "Edge.getInVertex"
    4. -///
    5. @ref JSModuleGraphEdgeGetLabel "Edge.getLabel"
    6. -///
    7. @ref JSModuleGraphEdgeGetOutVertex "Edge.getOutVertex"
    8. -///
    9. @ref JSModuleGraphEdgeGetProperty "Edge.getProperty"
    10. -///
    11. @ref JSModuleGraphEdgeGetPropertyKeys "Edge.getPropertyKeys"
    12. -///
    13. @ref JSModuleGraphEdgeProperties "Edge.properties"
    14. -///
    15. @ref JSModuleGraphEdgeSetProperty "Edge.setProperty"
    16. -///
    -///
  6. -///
-//////////////////////////////////////////////////////////////////////////////// - -void dummy_103 (); - -//////////////////////////////////////////////////////////////////////////////// -/// @page JSModuleGraph Module "graph" -/// -/// The graph module provides basic functions dealing with graph structures. -/// It exports the constructors for Graph, Vertex, and Edge. -/// -///
-/// @copydoc JSModuleGraphTOC -///
-/// -/// @section JSModuleGraphGraph Graph Constructors and Methods -////////////////////////////////////////////////////////////// -/// -/// @anchor JSModuleGraphGraphConstructor -/// @copydetails JSF_Graph -///
-/// -/// @anchor JSModuleGraphGraphAddEdge -/// @copydetails JSF_Graph_prototype_addEdge -///
-/// -/// @anchor JSModuleGraphGraphAddVertex -/// @copydetails JSF_Graph_prototype_addVertex -///
-/// -/// @anchor JSModuleGraphGraphGetEdges -/// @copydetails JSF_Graph_prototype_getEdges -///
-/// -/// @anchor JSModuleGraphGraphGetVertex -/// @copydetails JSF_Graph_prototype_getVertex -///
-/// -/// @anchor JSModuleGraphGraphGetVertices -/// @copydetails JSF_Graph_prototype_getVertices -///
-/// -/// @anchor JSModuleGraphGraphRemoveVertex -/// @copydetails JSF_Graph_prototype_removeVertex -///
-/// -/// @anchor JSModuleGraphGraphRemoveEdge -/// @copydetails JSF_Graph_prototype_removeEdge -/// -/// @section JSModuleGraphVertex Vertex Methods -/////////////////////////////////////////////// -/// -/// @anchor JSModuleGraphVertexAddInEdge -/// @copydetails JSF_Vertex_prototype_addInEdge -///
-/// -/// @anchor JSModuleGraphVertexAddOutEdge -/// @copydetails JSF_Vertex_prototype_addOutEdge -///
-/// -/// @anchor JSModuleGraphVertexEdges -/// @copydetails JSF_Vertex_prototype_edges -///
-/// -/// @anchor JSModuleGraphVertexGetId -/// @copydetails JSF_Vertex_prototype_getId -///
-/// -/// @anchor JSModuleGraphVertexGetInEdges -/// @copydetails JSF_Vertex_prototype_getInEdges -///
-/// -/// @anchor JSModuleGraphVertexGetOutEdges -/// @copydetails JSF_Vertex_prototype_getOutEdges -///
-/// -/// @anchor JSModuleGraphVertexGetProperty -/// @copydetails JSF_Vertex_prototype_getProperty -///
-/// -/// @anchor JSModuleGraphVertexGetPropertyKeys -/// @copydetails JSF_Vertex_prototype_getPropertyKeys -///
-/// -/// @anchor JSModuleGraphVertexProperties -/// @copydetails JSF_Vertex_prototype_properties -///
-/// -/// @anchor JSModuleGraphVertexSetProperty -/// @copydetails JSF_Vertex_prototype_setProperty -/// -/// @section JSModuleGraphEdge Edge Methods -/////////////////////////////////////////// -/// -/// @anchor JSModuleGraphEdgeGetId -/// @copydetails JSF_Edge_prototype_getId -///
-/// -/// @anchor JSModuleGraphEdgeGetInVertex -/// @copydetails JSF_Edge_prototype_getInVertex -///
-/// -/// @anchor JSModuleGraphEdgeGetLabel -/// @copydetails JSF_Edge_prototype_getLabel -///
-/// -/// @anchor JSModuleGraphEdgeGetOutVertex -/// @copydetails JSF_Edge_prototype_getOutVertex -///
-/// -/// @anchor JSModuleGraphEdgeGetProperty -/// @copydetails JSF_Edge_prototype_getProperty -///
-/// -/// @anchor JSModuleGraphEdgeGetPropertyKeys -/// @copydetails JSF_Edge_prototype_getPropertyKeys -///
-/// -/// @anchor JSModuleGraphEdgeProperties -/// @copydetails JSF_Edge_prototype_properties -///
-/// -/// @anchor JSModuleGraphEdgeSetProperty -/// @copydetails JSF_Edge_prototype_setProperty -//////////////////////////////////////////////////////////////////////////////// - -void dummy_224 (); - // ----------------------------------------------------------------------------- // --SECTION-- EDGE // ----------------------------------------------------------------------------- -void dummy_228 (); +void dummy_38 (); // ----------------------------------------------------------------------------- // --SECTION-- constructors and destructors // ----------------------------------------------------------------------------- -void dummy_232 (); +void dummy_42 (); //////////////////////////////////////////////////////////////////////////////// /// @addtogroup AvocadoGraph /// @{ //////////////////////////////////////////////////////////////////////////////// -void dummy_237 (); +void dummy_47 (); //////////////////////////////////////////////////////////////////////////////// /// @brief constructs a new edge object @@ -256,20 +60,20 @@ void JSF_Edge (int graph, int id) {} /// @} //////////////////////////////////////////////////////////////////////////////// -void dummy_263 (); +void dummy_73 (); // ----------------------------------------------------------------------------- // --SECTION-- public functions // ----------------------------------------------------------------------------- -void dummy_267 (); +void dummy_77 (); //////////////////////////////////////////////////////////////////////////////// /// @addtogroup AvocadoGraph /// @{ //////////////////////////////////////////////////////////////////////////////// -void dummy_272 (); +void dummy_82 (); //////////////////////////////////////////////////////////////////////////////// /// @brief returns the identifier of an edge @@ -278,6 +82,8 @@ void dummy_272 (); /// /// Returns the identifier of the @FA{edge}. /// +/// @EXAMPLES +/// /// @verbinclude graph13 //////////////////////////////////////////////////////////////////////////////// @@ -290,6 +96,8 @@ void JSF_Edge_prototype_getId (int name) {} /// /// Returns the vertex at the head of the @FA{edge}. /// +/// @EXAMPLES +/// /// @verbinclude graph21 //////////////////////////////////////////////////////////////////////////////// @@ -303,6 +111,8 @@ void JSF_Edge_prototype_getInVertex (int ) {} /// /// Returns the label of the @FA{edge}. /// +/// @EXAMPLES +/// /// @verbinclude graph20 //////////////////////////////////////////////////////////////////////////////// @@ -316,6 +126,8 @@ void JSF_Edge_prototype_getLabel (int ) {} /// /// Returns the vertex at the tail of the @FA{edge}. /// +/// @EXAMPLES +/// /// @verbinclude graph22 //////////////////////////////////////////////////////////////////////////////// @@ -329,6 +141,8 @@ void JSF_Edge_prototype_getOutVertex (int ) {} /// /// Returns the property @FA{name} an @FA{edge}. /// +/// @EXAMPLES +/// /// @verbinclude graph12 //////////////////////////////////////////////////////////////////////////////// @@ -342,6 +156,8 @@ void JSF_Edge_prototype_getProperty (int name) {} /// /// Returns all propety names an @FA{edge}. /// +/// @EXAMPLES +/// /// @verbinclude graph32 //////////////////////////////////////////////////////////////////////////////// @@ -358,6 +174,8 @@ void JSF_Edge_prototype_getPropertyKeys (int ) {} /// /// Changes or sets the property @FA{name} an @FA{edges} to @FA{value}. /// +/// @EXAMPLES +/// /// @verbinclude graph14 //////////////////////////////////////////////////////////////////////////////// @@ -375,6 +193,8 @@ void JSF_Edge_prototype_setProperty (int name, int value) {} /// /// Returns all properties and their values of an @FA{edge} /// +/// @EXAMPLES +/// /// @verbinclude graph11 //////////////////////////////////////////////////////////////////////////////// @@ -389,52 +209,52 @@ void JSF_Edge_prototype_properties (int ) {} /// @} //////////////////////////////////////////////////////////////////////////////// -void dummy_456 (); +void dummy_282 (); // ----------------------------------------------------------------------------- // --SECTION-- private methods // ----------------------------------------------------------------------------- -void dummy_460 (); +void dummy_286 (); //////////////////////////////////////////////////////////////////////////////// /// @addtogroup AvocadoGraph /// @{ //////////////////////////////////////////////////////////////////////////////// -void dummy_465 (); +void dummy_291 (); //////////////////////////////////////////////////////////////////////////////// /// @brief edge printing //////////////////////////////////////////////////////////////////////////////// -void dummy_478 (); +void dummy_304 (); //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// -void dummy_482 (); +void dummy_308 (); // ----------------------------------------------------------------------------- // --SECTION-- VERTEX // ----------------------------------------------------------------------------- -void dummy_486 (); +void dummy_312 (); // ----------------------------------------------------------------------------- // --SECTION-- constructors and destructors // ----------------------------------------------------------------------------- -void dummy_490 (); +void dummy_316 (); //////////////////////////////////////////////////////////////////////////////// /// @addtogroup AvocadoGraph /// @{ //////////////////////////////////////////////////////////////////////////////// -void dummy_495 (); +void dummy_321 (); //////////////////////////////////////////////////////////////////////////////// /// @brief constructs a new vertex object @@ -445,24 +265,25 @@ void JSF_Vertex (int graph, int id) {} + //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// -void dummy_516 (); +void dummy_349 (); // ----------------------------------------------------------------------------- // --SECTION-- public functions // ----------------------------------------------------------------------------- -void dummy_520 (); +void dummy_353 (); //////////////////////////////////////////////////////////////////////////////// /// @addtogroup AvocadoGraph /// @{ //////////////////////////////////////////////////////////////////////////////// -void dummy_525 (); +void dummy_358 (); //////////////////////////////////////////////////////////////////////////////// /// @brief adds an inbound edge @@ -472,20 +293,22 @@ void dummy_525 (); /// Creates a new edge from @FA{peer} to @FA{vertex} and returns the edge /// object. /// -/// @verbinclude graph33 -/// /// @FUN{@FA{vertex}.addInEdge(@FA{peer}, @FA{label})} /// /// Creates a new edge from @FA{peer} to @FA{vertex} with given label and /// returns the edge object. /// -/// @verbinclude graph23 -/// /// @FUN{@FA{vertex}.addInEdge(@FA{peer}, @FA{label}, @FA{data})} /// /// Creates a new edge from @FA{peer} to @FA{vertex} with given label and /// properties defined in @FA{data}. Returns the edge object. /// +/// @EXAMPLES +/// +/// @verbinclude graph33 +/// +/// @verbinclude graph23 +/// /// @verbinclude graph24 //////////////////////////////////////////////////////////////////////////////// @@ -500,20 +323,22 @@ void JSF_Vertex_prototype_addInEdge (int out, int label, int data) {} /// Creates a new edge from @FA{vertex} to @FA{peer} and returns the edge /// object. /// -/// @verbinclude graph34 -/// /// @FUN{@FA{vertex}.addOutEdge(@FA{peer}, @FA{label})} /// /// Creates a new edge from @FA{vertex} to @FA{peer} with given @FA{label} and /// returns the edge object. /// -/// @verbinclude graph27 -/// /// @FUN{@FA{vertex}.addOutEdge(@FA{peer}, @FA{label}, @FA{data})} /// /// Creates a new edge from @FA{vertex} to @FA{peer} with given @FA{label} and /// properties defined in @FA{data}. Returns the edge object. /// +/// @EXAMPLES +/// +/// @verbinclude graph34 +/// +/// @verbinclude graph27 +/// /// @verbinclude graph28 //////////////////////////////////////////////////////////////////////////////// @@ -527,6 +352,8 @@ void JSF_Vertex_prototype_addOutEdge (int ine, int label, int data) {} /// /// Returns a list of in- or outbound edges of the @FA{vertex}. /// +/// @EXAMPLES +/// /// @verbinclude graph15 //////////////////////////////////////////////////////////////////////////////// @@ -544,6 +371,8 @@ void JSF_Vertex_prototype_edges (int ) {} /// Returns the identifier of the @FA{vertex}. If the vertex was deleted, then /// @CODE{undefined} is returned. /// +/// @EXAMPLES +/// /// @verbinclude graph8 //////////////////////////////////////////////////////////////////////////////// @@ -556,6 +385,8 @@ void JSF_Vertex_prototype_getId (int name) {} /// /// Returns a list of inbound edges of the @FA{vertex} with given label(s). /// +/// @EXAMPLES +/// /// @verbinclude graph18 //////////////////////////////////////////////////////////////////////////////// @@ -574,6 +405,8 @@ void JSF_Vertex_prototype_getInEdges (int ) {} /// /// Returns a list of outbound edges of the @FA{vertex} with given label(s). /// +/// @EXAMPLES +/// /// @verbinclude graph19 //////////////////////////////////////////////////////////////////////////////// @@ -592,6 +425,8 @@ void JSF_Vertex_prototype_getOutEdges (int ) {} /// /// Returns the property @FA{name} a @FA{vertex}. /// +/// @EXAMPLES +/// /// @verbinclude graph5 //////////////////////////////////////////////////////////////////////////////// @@ -605,6 +440,8 @@ void JSF_Vertex_prototype_getProperty (int name) {} /// /// Returns all propety names a @FA{vertex}. /// +/// @EXAMPLES +/// /// @verbinclude graph7 //////////////////////////////////////////////////////////////////////////////// @@ -621,6 +458,8 @@ void JSF_Vertex_prototype_getPropertyKeys (int ) {} /// /// Returns a list of inbound edges of the @FA{vertex}. /// +/// @EXAMPLES +/// /// @verbinclude graph16 //////////////////////////////////////////////////////////////////////////////// @@ -637,6 +476,8 @@ void JSF_Vertex_prototype_inbound (int ) {} /// /// Returns a list of outbound edges of the @FA{vertex}. /// +/// @EXAMPLES +/// /// @verbinclude graph17 //////////////////////////////////////////////////////////////////////////////// @@ -653,6 +494,8 @@ void JSF_Vertex_prototype_outbound (int ) {} /// /// Returns all properties and their values of a @FA{vertex} /// +/// @EXAMPLES +/// /// @verbinclude graph4 //////////////////////////////////////////////////////////////////////////////// @@ -670,6 +513,8 @@ void JSF_Vertex_prototype_properties (int ) {} /// /// Changes or sets the property @FA{name} a @FA{vertex} to @FA{value}. /// +/// @EXAMPLES +/// /// @verbinclude graph6 //////////////////////////////////////////////////////////////////////////////// @@ -685,52 +530,52 @@ void JSF_Vertex_prototype_setProperty (int name, int value) {} /// @} //////////////////////////////////////////////////////////////////////////////// -void dummy_897 (); +void dummy_754 (); // ----------------------------------------------------------------------------- // --SECTION-- private methods // ----------------------------------------------------------------------------- -void dummy_901 (); +void dummy_758 (); //////////////////////////////////////////////////////////////////////////////// /// @addtogroup AvocadoGraph /// @{ //////////////////////////////////////////////////////////////////////////////// -void dummy_906 (); +void dummy_763 (); //////////////////////////////////////////////////////////////////////////////// /// @brief vertex representation //////////////////////////////////////////////////////////////////////////////// -void dummy_919 (); +void dummy_784 (); //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// -void dummy_923 (); +void dummy_788 (); // ----------------------------------------------------------------------------- // --SECTION-- GRAPH // ----------------------------------------------------------------------------- -void dummy_927 (); +void dummy_792 (); // ----------------------------------------------------------------------------- // --SECTION-- constructors and destructors // ----------------------------------------------------------------------------- -void dummy_931 (); +void dummy_796 (); //////////////////////////////////////////////////////////////////////////////// /// @addtogroup AvocadoGraph /// @{ //////////////////////////////////////////////////////////////////////////////// -void dummy_936 (); +void dummy_801 (); //////////////////////////////////////////////////////////////////////////////// /// @brief constructs a new graph object @@ -742,6 +587,8 @@ void dummy_936 (); /// possible to construct two graphs with the same vertex set, but different /// edge sets. /// +/// @EXAMPLES +/// /// @verbinclude graph1 //////////////////////////////////////////////////////////////////////////////// @@ -755,20 +602,20 @@ void JSF_Graph (int vertices, int edg) {} /// @} //////////////////////////////////////////////////////////////////////////////// -void dummy_974 (); +void dummy_843 (); // ----------------------------------------------------------------------------- // --SECTION-- public functions // ----------------------------------------------------------------------------- -void dummy_978 (); +void dummy_847 (); //////////////////////////////////////////////////////////////////////////////// /// @addtogroup AvocadoGraph /// @{ //////////////////////////////////////////////////////////////////////////////// -void dummy_983 (); +void dummy_852 (); //////////////////////////////////////////////////////////////////////////////// /// @brief adds an edge to the graph @@ -778,27 +625,29 @@ void dummy_983 (); /// Creates a new edge from @FA{out} to @FA{in} and returns the edge /// object. /// -/// @verbinclude graph30 -/// /// @FUN{@FA{graph}.addEdge(@FA{out}, @FA{in}, @FA{label})} /// /// Creates a new edge from @FA{out} to @FA{in} with @FA{label} and returns the /// edge object. /// -/// @verbinclude graph9 -/// /// @FUN{@FA{graph}.addEdge(@FA{out}, @FA{in}, @FA{data})} /// /// Creates a new edge and returns the edge object. The edge contains the /// properties defined in @FA{data}. /// -/// @verbinclude graph31 -/// /// @FUN{@FA{graph}.addEdge(@FA{out}, @FA{in}, @FA{label}, @FA{data})} /// /// Creates a new edge and returns the edge object. The edge has the /// label @FA{label} and contains the properties defined in @FA{data}. /// +/// @EXAMPLES +/// +/// @verbinclude graph30 +/// +/// @verbinclude graph9 +/// +/// @verbinclude graph31 +/// /// @verbinclude graph10 //////////////////////////////////////////////////////////////////////////////// @@ -814,21 +663,30 @@ void JSF_Graph_prototype_addEdge (int out, int ine, int label, int data) {} //////////////////////////////////////////////////////////////////////////////// /// @brief adds a vertex to the graph /// -/// @FUN{@FA{graph}.addVertex()} +/// @FUN{@FA{graph}.addVertex(@FA{id})} /// -/// Creates a new vertex and returns the vertex object. +/// Creates a new vertex and returns the vertex object. The @FA{id} must be +/// a unique identifier or null. /// -/// @verbinclude graph2 -/// -/// @FUN{@FA{graph}.addVertex(@FA{data})} +/// @FUN{@FA{graph}.addVertex(@FA{id}, @FA{data})} /// /// Creates a new vertex and returns the vertex object. The vertex contains /// the properties defined in @FA{data}. /// +/// @EXAMPLES +/// +/// Without any properties: +/// +/// @verbinclude graph2 +/// +/// With given properties: +/// /// @verbinclude graph3 //////////////////////////////////////////////////////////////////////////////// -void JSF_Graph_prototype_addVertex (int data) {} +void JSF_Graph_prototype_addVertex (int id, int data) {} + + @@ -839,6 +697,8 @@ void JSF_Graph_prototype_addVertex (int data) {} /// /// Returns the vertex identified by @FA{id} or undefined. /// +/// @EXAMPLES +/// /// @verbinclude graph29 //////////////////////////////////////////////////////////////////////////////// @@ -854,6 +714,8 @@ void JSF_Graph_prototype_getVertex (int id) {} /// Returns an iterator for all vertices of the graph. The iterator supports the /// methods @FN{hasNext} and @FN{next}. /// +/// @EXAMPLES +/// /// @verbinclude graph35 //////////////////////////////////////////////////////////////////////////////// @@ -876,6 +738,8 @@ void JSF_iterator (int ) {} /// Returns an iterator for all edges of the graph. The iterator supports the /// methods @FN{hasNext} and @FN{next}. /// +/// @EXAMPLES +/// /// @verbinclude graph36 //////////////////////////////////////////////////////////////////////////////// @@ -897,6 +761,8 @@ void JSF_iterator (int ) {} /// /// Deletes the @FA{vertex} and all its edges. /// +/// @EXAMPLES +/// /// @verbinclude graph37 //////////////////////////////////////////////////////////////////////////////// @@ -914,6 +780,8 @@ void JSF_Graph_prototype_removeVertex (int vertex) {} /// /// Deletes the @FA{edge}. Note that the in and out vertices are left untouched. /// +/// @EXAMPLES +/// /// @verbinclude graph38 //////////////////////////////////////////////////////////////////////////////// @@ -927,20 +795,20 @@ void JSF_Graph_prototype_removeEdge (int edge) {} /// @} //////////////////////////////////////////////////////////////////////////////// -void dummy_1250 (); +void dummy_1139 (); // ----------------------------------------------------------------------------- // --SECTION-- private functions // ----------------------------------------------------------------------------- -void dummy_1254 (); +void dummy_1143 (); //////////////////////////////////////////////////////////////////////////////// /// @addtogroup AvocadoGraph /// @{ //////////////////////////////////////////////////////////////////////////////// -void dummy_1259 (); +void dummy_1148 (); //////////////////////////////////////////////////////////////////////////////// /// @brief private function to construct a vertex @@ -959,19 +827,19 @@ void JSF_Graph_prototype_constructEdge (int id) {} //////////////////////////////////////////////////////////////////////////////// -void dummy_1283 (); +void dummy_1172 (); //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// -void dummy_1287 (); +void dummy_1176 (); // ----------------------------------------------------------------------------- // --SECTION-- MODULE EXPORTS // ----------------------------------------------------------------------------- -void dummy_1291 (); +void dummy_1180 (); //////////////////////////////////////////////////////////////////////////////// /// @addtogroup AvocadoGraph @@ -979,13 +847,13 @@ void dummy_1291 (); //////////////////////////////////////////////////////////////////////////////// -void dummy_1302 (); +void dummy_1191 (); //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// -void dummy_1306 (); +void dummy_1195 (); // Local Variables: // mode: outline-minor diff --git a/Makefile.files b/Makefile.files index 7fecbf4e2b..f2407d1ff9 100644 --- a/Makefile.files +++ b/Makefile.files @@ -316,4 +316,5 @@ WIKI = \ Doxygen/xml/StartStop.md \ Doxygen/xml/UserManualServer.md \ Doxygen/xml/UserManualShell.md \ + Doxygen/xml/UserManualShellStartStop.md \ Doxygen/xml/jsUnity.md diff --git a/Makefile.in b/Makefile.in index 9120837ccc..fd103a2364 100644 --- a/Makefile.in +++ b/Makefile.in @@ -822,6 +822,7 @@ WIKI = \ Doxygen/xml/StartStop.md \ Doxygen/xml/UserManualServer.md \ Doxygen/xml/UserManualShell.md \ + Doxygen/xml/UserManualShellStartStop.md \ Doxygen/xml/jsUnity.md @ENABLE_32BIT_TRUE@@ENABLE_ALL_IN_ONE_TRUE@LIBEV_BUILD_VERSION = ARCH.ia32 diff --git a/RestServer/graphs.dox b/RestServer/graphs.dox new file mode 100644 index 0000000000..7869d0bb86 --- /dev/null +++ b/RestServer/graphs.dox @@ -0,0 +1,224 @@ +//////////////////////////////////////////////////////////////////////////////// +/// @brief installation guide +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2012 triAGENS GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Dr. Frank Celler +/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page Graphs First Steps with Graphs +/// +/// A Graph consists of vertices and edges. The vertex collection contains the +/// documents forming the vertices. The edge collection contains the documents +/// forming the edges. Together both collections form a graph. Assume that +/// the vertex collection is called @LIT{vertices} and the edges collection +/// @LIT{edges}, then you can build a graph using the @FN{Graph} constructor. +/// +/// @verbinclude graph25 +/// +/// It is possible to use different edges with the same vertices. For +/// instance, to build a new graph with a different edge collection use +/// +/// @verbinclude graph26 +/// +/// It is, however, impossible to use different vertices with the same +/// edges. Edges are tied to the vertices. +/// +/// Next steps: learn more about +/// +/// - @ref JSModuleGraph +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page JSModuleGraphTOC +/// +///
    +///
  1. @ref JSModuleGraphGraph +///
      +///
    1. @ref JSModuleGraphGraphAddEdge "Graph.addEdge"
    2. +///
    3. @ref JSModuleGraphGraphAddVertex "Graph.addVertex"
    4. +///
    5. @ref JSModuleGraphGraphConstructor "Graph constructor"
    6. +///
    7. @ref JSModuleGraphGraphGetVertex "Graph.getEdges"
    8. +///
    9. @ref JSModuleGraphGraphGetVertex "Graph.getVertex"
    10. +///
    11. @ref JSModuleGraphGraphGetVertices "Graph.getVertices"
    12. +///
    13. @ref JSModuleGraphGraphRemoveEdge "Graph.removeEdge"
    14. +///
    15. @ref JSModuleGraphGraphRemoveVertex "Graph.removeVertex"
    16. +///
    +///
  2. +///
  3. @ref JSModuleGraphVertex +///
      +///
    1. @ref JSModuleGraphVertexAddInEdge "Vertex.addInEdge"
    2. +///
    3. @ref JSModuleGraphVertexAddOutEdge "Vertex.addOutEdge"
    4. +///
    5. @ref JSModuleGraphVertexEdges "Vertex.edges"
    6. +///
    7. @ref JSModuleGraphVertexGetId "Vertex.getId"
    8. +///
    9. @ref JSModuleGraphVertexGetInEdges "Vertex.getInEdges"
    10. +///
    11. @ref JSModuleGraphVertexGetOutEdges "Vertex.getOutEdges"
    12. +///
    13. @ref JSModuleGraphVertexGetProperty "Vertex.getProperty"
    14. +///
    15. @ref JSModuleGraphVertexGetPropertyKeys "Vertex.getPropertyKeys"
    16. +///
    17. @ref JSModuleGraphVertexProperties "Vertex.properties"
    18. +///
    19. @ref JSModuleGraphVertexSetProperty "Vertex.setProperty"
    20. +///
    +///
  4. +///
  5. @ref JSModuleGraphEdge +///
      +///
    1. @ref JSModuleGraphEdgeGetId "Edge.getId"
    2. +///
    3. @ref JSModuleGraphEdgeGetInVertex "Edge.getInVertex"
    4. +///
    5. @ref JSModuleGraphEdgeGetLabel "Edge.getLabel"
    6. +///
    7. @ref JSModuleGraphEdgeGetOutVertex "Edge.getOutVertex"
    8. +///
    9. @ref JSModuleGraphEdgeGetProperty "Edge.getProperty"
    10. +///
    11. @ref JSModuleGraphEdgeGetPropertyKeys "Edge.getPropertyKeys"
    12. +///
    13. @ref JSModuleGraphEdgeProperties "Edge.properties"
    14. +///
    15. @ref JSModuleGraphEdgeSetProperty "Edge.setProperty"
    16. +///
    +///
  6. +///
+//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page JSModuleGraph Module "graph" +/// +/// The graph module provides basic functions dealing with graph structures. +/// It exports the constructors for Graph, Vertex, and Edge. In the +/// following examples, we assume the following +/// +/// @verbinclude graph39 +/// +///
+/// @copydoc JSModuleGraphTOC +///
+/// +/// @section JSModuleGraphGraph Graph Constructors and Methods +////////////////////////////////////////////////////////////// +/// +/// @anchor JSModuleGraphGraphConstructor +/// @copydetails JSF_Graph +///
+/// +/// @anchor JSModuleGraphGraphAddEdge +/// @copydetails JSF_Graph_prototype_addEdge +///
+/// +/// @anchor JSModuleGraphGraphAddVertex +/// @copydetails JSF_Graph_prototype_addVertex +///
+/// +/// @anchor JSModuleGraphGraphGetEdges +/// @copydetails JSF_Graph_prototype_getEdges +///
+/// +/// @anchor JSModuleGraphGraphGetVertex +/// @copydetails JSF_Graph_prototype_getVertex +///
+/// +/// @anchor JSModuleGraphGraphGetVertices +/// @copydetails JSF_Graph_prototype_getVertices +///
+/// +/// @anchor JSModuleGraphGraphRemoveVertex +/// @copydetails JSF_Graph_prototype_removeVertex +///
+/// +/// @anchor JSModuleGraphGraphRemoveEdge +/// @copydetails JSF_Graph_prototype_removeEdge +/// +/// @section JSModuleGraphVertex Vertex Methods +/////////////////////////////////////////////// +/// +/// @anchor JSModuleGraphVertexAddInEdge +/// @copydetails JSF_Vertex_prototype_addInEdge +///
+/// +/// @anchor JSModuleGraphVertexAddOutEdge +/// @copydetails JSF_Vertex_prototype_addOutEdge +///
+/// +/// @anchor JSModuleGraphVertexEdges +/// @copydetails JSF_Vertex_prototype_edges +///
+/// +/// @anchor JSModuleGraphVertexGetId +/// @copydetails JSF_Vertex_prototype_getId +///
+/// +/// @anchor JSModuleGraphVertexGetInEdges +/// @copydetails JSF_Vertex_prototype_getInEdges +///
+/// +/// @anchor JSModuleGraphVertexGetOutEdges +/// @copydetails JSF_Vertex_prototype_getOutEdges +///
+/// +/// @anchor JSModuleGraphVertexGetProperty +/// @copydetails JSF_Vertex_prototype_getProperty +///
+/// +/// @anchor JSModuleGraphVertexGetPropertyKeys +/// @copydetails JSF_Vertex_prototype_getPropertyKeys +///
+/// +/// @anchor JSModuleGraphVertexProperties +/// @copydetails JSF_Vertex_prototype_properties +///
+/// +/// @anchor JSModuleGraphVertexSetProperty +/// @copydetails JSF_Vertex_prototype_setProperty +/// +/// @section JSModuleGraphEdge Edge Methods +/////////////////////////////////////////// +/// +/// @anchor JSModuleGraphEdgeGetId +/// @copydetails JSF_Edge_prototype_getId +///
+/// +/// @anchor JSModuleGraphEdgeGetInVertex +/// @copydetails JSF_Edge_prototype_getInVertex +///
+/// +/// @anchor JSModuleGraphEdgeGetLabel +/// @copydetails JSF_Edge_prototype_getLabel +///
+/// +/// @anchor JSModuleGraphEdgeGetOutVertex +/// @copydetails JSF_Edge_prototype_getOutVertex +///
+/// +/// @anchor JSModuleGraphEdgeGetProperty +/// @copydetails JSF_Edge_prototype_getProperty +///
+/// +/// @anchor JSModuleGraphEdgeGetPropertyKeys +/// @copydetails JSF_Edge_prototype_getPropertyKeys +///
+/// +/// @anchor JSModuleGraphEdgeProperties +/// @copydetails JSF_Edge_prototype_properties +///
+/// +/// @anchor JSModuleGraphEdgeSetProperty +/// @copydetails JSF_Edge_prototype_setProperty +//////////////////////////////////////////////////////////////////////////////// + +// Local Variables: +// mode: outline-minor +// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)" +// End: diff --git a/RestServer/simple-queries.dox b/RestServer/simple-queries.dox new file mode 100644 index 0000000000..974a36db9b --- /dev/null +++ b/RestServer/simple-queries.dox @@ -0,0 +1,188 @@ +//////////////////////////////////////////////////////////////////////////////// +/// @brief installation guide +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2012 triAGENS GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Dr. Frank Celler +/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page SimpleQueriesTOC +/// +///
    +///
  1. @ref SimpleQueriesQueries +///
      +///
    1. @ref SimpleQueryDocument "db.@FA{collection}.document(@FA{document-reference})"
    2. +///
    3. @ref SimpleQueryAll "db.@FA{collection}.all()"
    4. +///
    5. @ref SimpleQuerySelect "db.@FA{collection}.select()"
    6. +///
    7. @ref SimpleQueryCount "@FA{query}.count()"
    8. +///
    +///
  2. +///
  3. @ref SimpleQueriesGeoQueries +///
      +///
    1. @ref SimpleQueryNear "db.@FA{collection}.near()"
    2. +///
    3. @ref SimpleQueryWithin "db.@FA{collection}.within()"
    4. +///
    5. @ref SimpleQueryGeo "db.@FA{collection}.geo()"
    6. +///
    +///
  4. +///
  5. @ref SimpleQueriesEdgesQueries +///
      +///
    1. @ref SimpleQueryEdges "edges.@FA{collection}.edges()"
    2. +///
    3. @ref SimpleQueryInEdges "edges.@FA{collection}.inEdges()"
    4. +///
    5. @ref SimpleQueryOutEdges "edges.@FA{collection}.outEdges()"
    6. +///
    +///
  6. +///
  7. @ref SimpleQueriesPagination +///
      +///
    1. @ref SimpleQueryLimit "@FA{query}.limit(@FA{limit})"
    2. +///
    3. @ref SimpleQuerySkip "@FA{query}.skip(@FA{skip})"
    4. +///
    +///
  8. +///
  9. @ref SimpleQueriesSequentialAccess +///
      +///
    1. @ref SimpleQueryHasNext "@FA{query}.hasNext()"
    2. +///
    3. @ref SimpleQueryNext "@FA{query}.next()"
    4. +///
    5. @ref SimpleQueryNextRef "@FA{query}.nextRef()"
    6. +///
    +///
  10. +///
+//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page SimpleQueries Simple Queries +/// +/// Simple queries can be used if the query condition is straight forward +/// simple, i. e., a document reference, all documents, a query-by-example, or a +/// simple geo query. In a simple query you can specify exactly one collection +/// and one condition. The result can then be sorted and result can be split +/// into pages. +/// +///
+/// @copydoc SimpleQueriesTOC +///
+/// +/// @section SimpleQueriesQueries Queries +///////////////////////////////////////// +/// +/// @anchor SimpleQueryDocument +/// @copydetails JS_DocumentQuery +///
+/// +/// @anchor SimpleQueryAll +/// @copydetails JSF_AvocadoCollection_prototype_all +///
+/// +/// @anchor SimpleQuerySelect +/// @copydetails JSF_AvocadoCollection_prototype_select +///
+/// +/// @anchor SimpleQueryCount +/// @copydetails JSF_SimpleQuery_prototype_count +/// +/// @section SimpleQueriesGeoQueries Geo Queries +//////////////////////////////////////////////// +/// +/// The AvocadoDB allows to selects documents based on geographic +/// coordinates. In order for this to work, a geo-spatial index must be defined. +/// This index will use a very elaborate algorithm to lookup neighbours that is +/// a magnitude faster than a simple R* index. +/// +/// In general a geo coordinate is a pair of latitude and longitude. This can +/// either be an list with two elements like @CODE{[ -10\, +30 ]} (latitude +/// first, followed by longitude) or an object like @CODE{{ lon: -10\, lat: +30 +/// }}. In order to find all documents within a given radius around a +/// coordinate use the @FN{within} operator. In order to find all +/// documents near a given document use the @FN{near} operator. +/// +/// It is possible to define more than one geo-spatial index per collection. In +/// this case you must give a hint using the @FN{geo} operator which of indexes +/// should be used in a query. +/// +///
+/// +/// @anchor SimpleQueryNear +/// @copydetails JSF_AvocadoCollection_prototype_near +///
+/// +/// @anchor SimpleQueryWithin +/// @copydetails JSF_AvocadoCollection_prototype_within +///
+/// +/// @anchor SimpleQueryGeo +/// @copydetails JSF_AvocadoCollection_prototype_geo +/// +/// @section SimpleQueriesEdgesQueries Edges Queries +//////////////////////////////////////////////////// +/// +/// @anchor SimpleQueryEdges +/// @copydetails JS_EdgesQuery +///
+/// +/// @anchor SimpleQueryInEdges +/// @copydetails JS_InEdgesQuery +///
+/// +/// @anchor SimpleQueryOutEdges +/// @copydetails JS_OutEdgesQuery +/// +/// @section SimpleQueriesPagination Pagination +/////////////////////////////////////////////// +/// +/// If, for example, you display the result of a user search, then you are in +/// general not interested in the completed result set, but only the first 10 or +/// so documents. Or maybe the next 10 documents for the second page. In this +/// case, you can the @FN{skip} and @FN{limit} operators. These operators works +/// like LIMIT in MySQL. +/// +/// @FN{skip} used together with @FN{limit} can be used to implement pagination. +/// The @FN{skip} operator skips over the first n documents. So, in order to +/// create result pages with 10 result documents per page, you can use +/// @CODE{skip(n * 10).limit(10)} to access the 10 documents on the n.th page. +/// This result should be sorted, so that the pagination works in a predicable +/// way. +/// +/// @anchor SimpleQueryLimit +/// @copydetails JSF_SimpleQuery_prototype_limit +///
+/// +/// @anchor SimpleQuerySkip +/// @copydetails JSF_SimpleQuery_prototype_skip +/// +/// @section SimpleQueriesSequentialAccess Sequential Access +//////////////////////////////////////////////////////////// +/// +/// @anchor SimpleQueryHasNext +/// @copydetails JSF_SimpleQuery_prototype_hasNext +///
+/// +/// @anchor SimpleQueryNext +/// @copydetails JSF_SimpleQuery_prototype_next +///
+/// +/// @anchor SimpleQueryNextRef +/// @copydetails JSF_SimpleQuery_prototype_nextRef +//////////////////////////////////////////////////////////////////////////////// + +// Local Variables: +// mode: outline-minor +// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)" +// End: diff --git a/RestServer/user-manual-avocsh.dox b/RestServer/user-manual-avocsh.dox index 077e7087c8..e4d62017b4 100644 --- a/RestServer/user-manual-avocsh.dox +++ b/RestServer/user-manual-avocsh.dox @@ -5,7 +5,7 @@ /// /// DISCLAIMER /// -/// Copyright 2012 triagens GmbH, Cologne, Germany +/// Copyright 2012 triAGENS GmbH, Cologne, Germany /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except in compliance with the License. @@ -26,18 +26,14 @@ //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -/// @page UserManualShell User Manual for the AvocadoDB Shell +/// @page UserManualShell AvocadoDB Shell User Manual /// ///
    ///
  1. @ref UserManualShellBasics ///
      -///
    1. @ref StartStop +///
    2. @ref UserManualShellStartStop ///
    3. -///
    4. AvocadoScript -///
        -///
      1. @ref SimpleQueries -///
      2. -///
      +///
    5. @ref SimpleQueries ///
    6. ///
    7. Vertices, Edges, and Graphs ///
        @@ -55,145 +51,54 @@ //////////////////////////////////////////////////////////////////////////////// /// @page UserManualShellBasics Basics /// -/// The AvocadoDB groups documents into collections. Each collection can be -/// accessed using queries. For simple queries involving just one collection, -/// you can use a fluent interface from within JavaScript code, see @ref -/// AvocadoScript. This interface allows you to select documents from one -/// collection based on simple search criteria. The @ref HttpInterface -/// lets you create, modify, or delete a single document via HTTP. For -/// more complex queries, you can use the Avocado Query Language, which is -/// an extension of SQL resp. UNQL. +/// The AvocadoDB consists of a server, which can be accessed by clients +/// using the appropriate client API. A simple JavaScript shell can be used +/// to administrate the server, when no HTTP access is possible or when +/// more complex administration tasks are required. This shell can also +/// be used to query documents for debugging. //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -/// @page StartStopTOC +/// @page UserManualShellStartStopTOC /// ///
          -///
        1. @ref StartStopHttp "Starting the HTTP Server"
        2. -///
        3. @ref StartStopDebug "Starting the Debug Shell"
        4. -///
        5. @ref StartStopOptions "Frequently Used Options"
        6. -///
        -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page StartStop Starting the AvocadoDB -/// -/// The AvocadoDB has two mode of operation: as server, where it will answer to -/// HTTP requests, see @ref HttpInterface, and a debug shell, where you can -/// access the database directly. Using the debug shell allows you to issue all -/// commands normally available in actions and transactions, see @ref -/// AvocadoScript. -/// -/// You should never start more than one server for the same database, -/// independent from the mode of operation. -/// -///
        -/// @copydoc StartStopTOC -///
        -/// -/// @section StartStopHttp Starting the HTTP Server -/// -/// The following command starts the AvocadoDB in server mode. You will be able -/// to access the server using HTTP request on port 8529. See below for a list -/// of frequently used options, see @ref CommandLine "here" for a complete list. -/// -/// @verbinclude start2 -/// -/// @section StartStopDebug Starting the Debug Shell -/// -/// The following command starts a debug shell. See below for a list of -/// frequently used options, see @ref CommandLine "here" for a complete list. -/// -/// @verbinclude start1 -/// -/// @section StartStopOptions Frequently Used Options -/// -/// The following command-line options are frequently used. For a full -/// list of options see @ref CommandLine "here". -/// -/// @CMDOPT{@CA{database-directory}} -/// -/// Uses the @CA{database-directory} as base directory. There is an alternative -/// version available for use in configuration files, see @ref -/// CommandLineAvocado "here". -/// -/// @copydetails triagens::rest::ApplicationServerImpl::options -/// -/// @CMDOPT{--log @CA{level}} -/// -/// Allows the user to choose the level of information which is logged by the -/// server. The @CA{level} is specified as a string and can be one of the -/// following values: fatal, error, warning, info, debug, trace. For more -/// information see @ref CommandLineLogging "here". -/// -/// @copydetails triagens::avocado::AvocadoServer::_httpPort -/// -/// @CMDOPT{--shell} -/// -/// Opens a debug shell instead of starting the HTTP server. -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page DBAdminTOC -/// -///
          -///
        1. @ref DBAdminDurability +///
        2. @ref UserManualShellStartStopShell ///
        3. -///
        4. @ref DBAdminIndex -///
            -///
          1. @ref DBAdminIndexGeo -///
          +///
        5. @ref UserManualShellStartStopOptions ///
        6. ///
        //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -/// @page DBAdmin Database Administration +/// @page UserManualShellStartStop Starting the AvocadoDB Shell +/// +/// After starting the AvocadoDB server, you can access the server +/// using the avocsh JavaScript shell. /// ///
        -/// @copydetails DBAdminTOC +/// @copydoc UserManualShellStartStopTOC ///
        /// -/// @section DBAdminDurability Durability +/// @section UserManualShellStartStopShell avocsh /// -/// @subsection DBAdminDurability1 Mostly Memory/Durability +/// After the server has been @ref UserManualServerStartStop "started", +/// you can use the AvocadoDB shell to administrate the server. Without +/// any arguments, the AvocadoDB shell will try to contact the server +/// on port 8529 on the localhost. /// -/// Database documents are stored in the memory-memory-mapped files are used to -/// store them. The operating system has the advantageous option to decide -/// swapping sparsely used areas out of the main memory. Per default, these -/// memory-mapped files are synced frequently - advantageously storing all -/// documents securely at once (durability). +/// @verbinclude avocsh1 /// -/// @subsection DBAdminDurability2 AppendOnly/MVCC -/// -/// Instead of overwriting existing documents, a completely new version of the -/// document is generated. The two benefits are: +/// The shell will print its own version number and, if successfully connected +/// to a server, the version number of the AvocadoDB server. /// -/// - Objects can be stored coherently and compactly in the main memory. -/// - Objects are preserved-isolated writing and reading transactions allow -/// accessing these objects for parallel operations. +/// @section UserManualShellStartStopOptions Command-Line Options /// -/// The system collects obsolete versions as garbage, recognizing them as -/// forsaken. Garbage collection is asynchronous and runs parallel to other -/// processes. +/// Use @LIT{--help} to get a list of command-line options: /// -/// @subsection DBAdminDurability3 Configuration -/// -/// @copydetails JS_ParameterVocbaseCol -/// -/// @section DBAdminIndex Index Management -/// -/// @subsection DBAdminIndexHash Hash Indexes -/// -/// @copydetails JS_EnsureHashIndexVocbaseCol -/// -/// @subsection DBAdminIndexGeo Geo Indexes -/// -/// @copydetails JS_EnsureGeoIndexVocbaseCol +/// @verbinclude avocsh2 //////////////////////////////////////////////////////////////////////////////// // Local Variables: -// mode: c++ // mode: outline-minor // outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)" // End: diff --git a/V8/v8-line-editor.cpp b/V8/v8-line-editor.cpp index 06e68f0f7d..b8dbd95773 100644 --- a/V8/v8-line-editor.cpp +++ b/V8/v8-line-editor.cpp @@ -160,14 +160,11 @@ static char* CompletionGenerator (char const* text, int state) { char const* s = *str; if (s != 0) { - - string x = (current->Get(v)->IsFunction()) ? "()" : ""; + string suffix = (current->Get(v)->IsFunction()) ? "()" : ""; + string name = path + s + suffix; - if (*prefix == '\0') { - result.push_back(path + s + x); - } - else if (TRI_IsPrefixString(s, prefix)) { - result.push_back(path + s + x); + if (*prefix == '\0' || TRI_IsPrefixString(s, prefix)) { + result.push_back(name); } } } @@ -192,8 +189,20 @@ static char* CompletionGenerator (char const* text, int state) { //////////////////////////////////////////////////////////////////////////////// static char** AttemptedCompletion (char const* text, int start, int end) { - char** result = completion_matches(text, CompletionGenerator); + char** result; + + result = completion_matches(text, CompletionGenerator); rl_attempted_completion_over = true; + + if (result != 0 && result[0] != 0 && result[1] == 0) { + size_t n = strlen(result[0]); + + if (result[0][n-1] == ')') { + result[0][n-1] = '\0'; + rl_completion_suppress_append = 1; + } + } + return result; } @@ -382,6 +391,7 @@ V8LineEditor::V8LineEditor (v8::Handle context, string const& histo bool V8LineEditor::open (const bool autoComplete) { rl_initialize(); + if (autoComplete) { rl_attempted_completion_function = AttemptedCompletion; rl_completer_word_break_characters = WordBreakCharacters; diff --git a/V8Client/shell.cpp b/V8Client/shell.cpp index a7eeabfb29..b61842a507 100644 --- a/V8Client/shell.cpp +++ b/V8Client/shell.cpp @@ -261,16 +261,25 @@ static void ParseProgramOptions (int argc, char* argv[]) { ProgramOptionsDescription description("STANDARD options"); + ProgramOptionsDescription hidden("HIDDEN options"); + + hidden + ("colors", "activate color support") + ("no-pretty-print", "disable pretty printting") + ("auto-complete", "enable auto completion, use no-auto-complete to disable") + ; + description ("help,h", "help message") ("log.level,l", &level, "log level") ("server", &ServerAddress, "server address and port") ("startup", &StartupPath, "startup path containing the JavaScript files") - ("use_pager", &usePager, "use pager") ("pager", &OutputPager, "output pager (default: 'more')") - ("no_colors", &noColors, "deactivate color support") - ("no_autocomplete", &noAutoComplete, "disable auto completion") - ("pretty_print", &prettyPrint, "pretty print values") + ("use-pager", "use pager") + ("pretty-print", "pretty print values") + ("no-colors", "deactivate color support") + ("no-auto-complete", "disable auto completion") + (hidden, true) ; ProgramOptions options; @@ -292,6 +301,35 @@ static void ParseProgramOptions (int argc, char* argv[]) { TRI_SetLogLevelLogging(level.c_str()); TRI_CreateLogAppenderFile("-"); + // set colors + if (options.has("colors")) { + noColors = false; + } + + if (options.has("no-colors")) { + noColors = true; + } + + if (options.has("auto-complete")) { + noAutoComplete = false; + } + + if (options.has("no-auto-complete")) { + noAutoComplete = true; + } + + if (options.has("pretty-print")) { + prettyPrint = true; + } + + if (options.has("no-pretty-print")) { + prettyPrint = false; + } + + if (options.has("use-pager")) { + usePager = true; + } + // set V8 options v8::V8::SetFlagsFromCommandLine(&argc, argv, true); } diff --git a/js/modules/graph.js b/js/modules/graph.js index 65802d47e0..ee70867c31 100644 --- a/js/modules/graph.js +++ b/js/modules/graph.js @@ -31,196 +31,6 @@ var edges = internal.edges; var AvocadoCollection = internal.AvocadoCollection; var AvocadoEdgesCollection = internal.AvocadoEdgesCollection; -//////////////////////////////////////////////////////////////////////////////// -/// @page Graphs First Steps with Graphs -/// -/// A Graph consists of vertices and edges. The vertex collection contains the -/// documents forming the vertices. The edge collection contains the documents -/// forming the edges. Together both collections form a graph. Assume that -/// the vertex collection is called @LIT{vertices} and the edges collection -/// @LIT{edges}, then you can build a graph using the @FN{Graph} constructor. -/// -/// @verbinclude graph25 -/// -/// It is possible to use different edges with the same vertices. For -/// instance, to build a new graph with a different edge collection use -/// -/// @verbinclude graph26 -/// -/// It is, however, impossible to use different vertices with the same -/// edges. Edges are tied to the vertices. -/// -/// Next steps: learn more about -/// -/// - @ref JSModuleGraph -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page JSModuleGraphTOC -/// -///
          -///
        1. @ref JSModuleGraphGraph -///
            -///
          1. @ref JSModuleGraphGraphAddEdge "Graph.addEdge"
          2. -///
          3. @ref JSModuleGraphGraphAddVertex "Graph.addVertex"
          4. -///
          5. @ref JSModuleGraphGraphConstructor "Graph constructor"
          6. -///
          7. @ref JSModuleGraphGraphGetVertex "Graph.getEdges"
          8. -///
          9. @ref JSModuleGraphGraphGetVertex "Graph.getVertex"
          10. -///
          11. @ref JSModuleGraphGraphGetVertices "Graph.getVertices"
          12. -///
          13. @ref JSModuleGraphGraphRemoveEdge "Graph.removeEdge"
          14. -///
          15. @ref JSModuleGraphGraphRemoveVertex "Graph.removeVertex"
          16. -///
          -///
        2. -///
        3. @ref JSModuleGraphVertex -///
            -///
          1. @ref JSModuleGraphVertexAddInEdge "Vertex.addInEdge"
          2. -///
          3. @ref JSModuleGraphVertexAddOutEdge "Vertex.addOutEdge"
          4. -///
          5. @ref JSModuleGraphVertexEdges "Vertex.edges"
          6. -///
          7. @ref JSModuleGraphVertexGetId "Vertex.getId"
          8. -///
          9. @ref JSModuleGraphVertexGetInEdges "Vertex.getInEdges"
          10. -///
          11. @ref JSModuleGraphVertexGetOutEdges "Vertex.getOutEdges"
          12. -///
          13. @ref JSModuleGraphVertexGetProperty "Vertex.getProperty"
          14. -///
          15. @ref JSModuleGraphVertexGetPropertyKeys "Vertex.getPropertyKeys"
          16. -///
          17. @ref JSModuleGraphVertexProperties "Vertex.properties"
          18. -///
          19. @ref JSModuleGraphVertexSetProperty "Vertex.setProperty"
          20. -///
          -///
        4. -///
        5. @ref JSModuleGraphEdge -///
            -///
          1. @ref JSModuleGraphEdgeGetId "Edge.getId"
          2. -///
          3. @ref JSModuleGraphEdgeGetInVertex "Edge.getInVertex"
          4. -///
          5. @ref JSModuleGraphEdgeGetLabel "Edge.getLabel"
          6. -///
          7. @ref JSModuleGraphEdgeGetOutVertex "Edge.getOutVertex"
          8. -///
          9. @ref JSModuleGraphEdgeGetProperty "Edge.getProperty"
          10. -///
          11. @ref JSModuleGraphEdgeGetPropertyKeys "Edge.getPropertyKeys"
          12. -///
          13. @ref JSModuleGraphEdgeProperties "Edge.properties"
          14. -///
          15. @ref JSModuleGraphEdgeSetProperty "Edge.setProperty"
          16. -///
          -///
        6. -///
        -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page JSModuleGraph Module "graph" -/// -/// The graph module provides basic functions dealing with graph structures. -/// It exports the constructors for Graph, Vertex, and Edge. -/// -///
        -/// @copydoc JSModuleGraphTOC -///
        -/// -/// @section JSModuleGraphGraph Graph Constructors and Methods -////////////////////////////////////////////////////////////// -/// -/// @anchor JSModuleGraphGraphConstructor -/// @copydetails JSF_Graph -///
        -/// -/// @anchor JSModuleGraphGraphAddEdge -/// @copydetails JSF_Graph_prototype_addEdge -///
        -/// -/// @anchor JSModuleGraphGraphAddVertex -/// @copydetails JSF_Graph_prototype_addVertex -///
        -/// -/// @anchor JSModuleGraphGraphGetEdges -/// @copydetails JSF_Graph_prototype_getEdges -///
        -/// -/// @anchor JSModuleGraphGraphGetVertex -/// @copydetails JSF_Graph_prototype_getVertex -///
        -/// -/// @anchor JSModuleGraphGraphGetVertices -/// @copydetails JSF_Graph_prototype_getVertices -///
        -/// -/// @anchor JSModuleGraphGraphRemoveVertex -/// @copydetails JSF_Graph_prototype_removeVertex -///
        -/// -/// @anchor JSModuleGraphGraphRemoveEdge -/// @copydetails JSF_Graph_prototype_removeEdge -/// -/// @section JSModuleGraphVertex Vertex Methods -/////////////////////////////////////////////// -/// -/// @anchor JSModuleGraphVertexAddInEdge -/// @copydetails JSF_Vertex_prototype_addInEdge -///
        -/// -/// @anchor JSModuleGraphVertexAddOutEdge -/// @copydetails JSF_Vertex_prototype_addOutEdge -///
        -/// -/// @anchor JSModuleGraphVertexEdges -/// @copydetails JSF_Vertex_prototype_edges -///
        -/// -/// @anchor JSModuleGraphVertexGetId -/// @copydetails JSF_Vertex_prototype_getId -///
        -/// -/// @anchor JSModuleGraphVertexGetInEdges -/// @copydetails JSF_Vertex_prototype_getInEdges -///
        -/// -/// @anchor JSModuleGraphVertexGetOutEdges -/// @copydetails JSF_Vertex_prototype_getOutEdges -///
        -/// -/// @anchor JSModuleGraphVertexGetProperty -/// @copydetails JSF_Vertex_prototype_getProperty -///
        -/// -/// @anchor JSModuleGraphVertexGetPropertyKeys -/// @copydetails JSF_Vertex_prototype_getPropertyKeys -///
        -/// -/// @anchor JSModuleGraphVertexProperties -/// @copydetails JSF_Vertex_prototype_properties -///
        -/// -/// @anchor JSModuleGraphVertexSetProperty -/// @copydetails JSF_Vertex_prototype_setProperty -/// -/// @section JSModuleGraphEdge Edge Methods -/////////////////////////////////////////// -/// -/// @anchor JSModuleGraphEdgeGetId -/// @copydetails JSF_Edge_prototype_getId -///
        -/// -/// @anchor JSModuleGraphEdgeGetInVertex -/// @copydetails JSF_Edge_prototype_getInVertex -///
        -/// -/// @anchor JSModuleGraphEdgeGetLabel -/// @copydetails JSF_Edge_prototype_getLabel -///
        -/// -/// @anchor JSModuleGraphEdgeGetOutVertex -/// @copydetails JSF_Edge_prototype_getOutVertex -///
        -/// -/// @anchor JSModuleGraphEdgeGetProperty -/// @copydetails JSF_Edge_prototype_getProperty -///
        -/// -/// @anchor JSModuleGraphEdgeGetPropertyKeys -/// @copydetails JSF_Edge_prototype_getPropertyKeys -///
        -/// -/// @anchor JSModuleGraphEdgeProperties -/// @copydetails JSF_Edge_prototype_properties -///
        -/// -/// @anchor JSModuleGraphEdgeSetProperty -/// @copydetails JSF_Edge_prototype_setProperty -//////////////////////////////////////////////////////////////////////////////// - // ----------------------------------------------------------------------------- // --SECTION-- EDGE // ----------------------------------------------------------------------------- @@ -246,11 +56,15 @@ function Edge (graph, id) { props = this._graph._edges.document(this._id); + // extract the custom identifier, label, edges if (props) { - this._label = props._label; + this._eid = props.$eid; + this._label = props.$label; this._from = props._from; this._to = props._to; } + + // deleted else { this._id = undefined; } @@ -276,11 +90,13 @@ function Edge (graph, id) { /// /// Returns the identifier of the @FA{edge}. /// +/// @EXAMPLES +/// /// @verbinclude graph13 //////////////////////////////////////////////////////////////////////////////// Edge.prototype.getId = function (name) { - return this._id; + return this._eid; } //////////////////////////////////////////////////////////////////////////////// @@ -290,6 +106,8 @@ Edge.prototype.getId = function (name) { /// /// Returns the vertex at the head of the @FA{edge}. /// +/// @EXAMPLES +/// /// @verbinclude graph21 //////////////////////////////////////////////////////////////////////////////// @@ -298,7 +116,7 @@ Edge.prototype.getInVertex = function () { throw "accessing a deleted edge"; } - return this.graph.constructVertex(this._to); + return this._graph.constructVertex(this._to); } //////////////////////////////////////////////////////////////////////////////// @@ -308,6 +126,8 @@ Edge.prototype.getInVertex = function () { /// /// Returns the label of the @FA{edge}. /// +/// @EXAMPLES +/// /// @verbinclude graph20 //////////////////////////////////////////////////////////////////////////////// @@ -326,6 +146,8 @@ Edge.prototype.getLabel = function () { /// /// Returns the vertex at the tail of the @FA{edge}. /// +/// @EXAMPLES +/// /// @verbinclude graph22 //////////////////////////////////////////////////////////////////////////////// @@ -344,6 +166,8 @@ Edge.prototype.getOutVertex = function () { /// /// Returns the property @FA{name} an @FA{edge}. /// +/// @EXAMPLES +/// /// @verbinclude graph12 //////////////////////////////////////////////////////////////////////////////// @@ -362,28 +186,17 @@ Edge.prototype.getProperty = function (name) { /// /// Returns all propety names an @FA{edge}. /// +/// @EXAMPLES +/// /// @verbinclude graph32 //////////////////////////////////////////////////////////////////////////////// Edge.prototype.getPropertyKeys = function () { - var keys; - var key; - var props; - if (! this._id) { throw "accessing a deleted edge"; } - props = this.properties(); - keys = []; - - for (key in props) { - if (props.hasOwnProperty(key)) { - keys.push(key); - } - } - - return keys; + return propertyKeys(this.properties()); } //////////////////////////////////////////////////////////////////////////////// @@ -393,22 +206,27 @@ Edge.prototype.getPropertyKeys = function () { /// /// Changes or sets the property @FA{name} an @FA{edges} to @FA{value}. /// +/// @EXAMPLES +/// /// @verbinclude graph14 //////////////////////////////////////////////////////////////////////////////// Edge.prototype.setProperty = function (name, value) { - var document; + var props; + var shallow; if (! this._id) { throw "accessing a deleted edge"; } - document = this._graph._edges.document(this._id); // TODO use "update" + props = this._graph._edges.document(this._id); // TODO use "update" - if (query !== undefined) { - document[name] = value; + if (props !== undefined) { + shallow = shallowCopy(props); - this._graph._edges.replace(this._id, document); + shallow[name] = value; + + this._graph._edges.replace(this._id, shallow); return value; } @@ -424,11 +242,13 @@ Edge.prototype.setProperty = function (name, value) { /// /// Returns all properties and their values of an @FA{edge} /// +/// @EXAMPLES +/// /// @verbinclude graph11 //////////////////////////////////////////////////////////////////////////////// Edge.prototype.properties = function () { - var props; + var result; if (! this._id) { throw "accessing a deleted edge"; @@ -441,12 +261,7 @@ Edge.prototype.properties = function () { throw "accessing a deleted edge"; } - delete props._id; - delete props._label; - delete props._from; - delete props._to; - - return props; + return shallowCopy(props); } //////////////////////////////////////////////////////////////////////////////// @@ -470,8 +285,16 @@ Edge.prototype._PRINT = function (seen, path, names) { if (! this._id) { internal.output("[deleted Edge]"); } + else if (this._eid !== undefined) { + if (typeof this._eid === "string") { + internal.output("Edge(\"", this._eid, "\")"); + } + else { + internal.output("Edge(", this._eid, ")"); + } + } else { - internal.output("Edge(, \"", this._id, "\")"); + internal.output("Edge(\"", this._id, "\")"); } } @@ -504,7 +327,13 @@ function Vertex (graph, id) { props = this._graph._vertices.document(this._id); - if (props === undefined) { + // extract the custom identifier + if (props) { + this._vid = props.$vid; + } + + // deleted + else { this._id = undefined; } } @@ -525,34 +354,36 @@ function Vertex (graph, id) { //////////////////////////////////////////////////////////////////////////////// /// @brief adds an inbound edge /// -/// @FUN{@FA{vertex}.addInEdge(@FA{peer})} +/// @FUN{@FA{vertex}.addInEdge(@FA{id}, @FA{peer})} /// /// Creates a new edge from @FA{peer} to @FA{vertex} and returns the edge -/// object. +/// object. The identifier @FA{id} must be a unique identifier or null. /// -/// @verbinclude graph33 -/// -/// @FUN{@FA{vertex}.addInEdge(@FA{peer}, @FA{label})} +/// @FUN{@FA{vertex}.addInEdge(@FA{id}, @FA{peer}, @FA{label})} /// /// Creates a new edge from @FA{peer} to @FA{vertex} with given label and /// returns the edge object. /// -/// @verbinclude graph23 -/// -/// @FUN{@FA{vertex}.addInEdge(@FA{peer}, @FA{label}, @FA{data})} +/// @FUN{@FA{vertex}.addInEdge(@FA{id}, @FA{peer}, @FA{label}, @FA{data})} /// /// Creates a new edge from @FA{peer} to @FA{vertex} with given label and /// properties defined in @FA{data}. Returns the edge object. /// +/// @EXAMPLES +/// +/// @verbinclude graph33 +/// +/// @verbinclude graph23 +/// /// @verbinclude graph24 //////////////////////////////////////////////////////////////////////////////// -Vertex.prototype.addInEdge = function (out, label, data) { +Vertex.prototype.addInEdge = function (id, out, label, data) { if (! this._id) { throw "accessing a deleted vertex"; } - return this._graph.addEdge(out, this, label, data); + return this._graph.addEdge(id, out, this, label, data); } //////////////////////////////////////////////////////////////////////////////// @@ -563,29 +394,31 @@ Vertex.prototype.addInEdge = function (out, label, data) { /// Creates a new edge from @FA{vertex} to @FA{peer} and returns the edge /// object. /// -/// @verbinclude graph34 -/// /// @FUN{@FA{vertex}.addOutEdge(@FA{peer}, @FA{label})} /// /// Creates a new edge from @FA{vertex} to @FA{peer} with given @FA{label} and /// returns the edge object. /// -/// @verbinclude graph27 -/// /// @FUN{@FA{vertex}.addOutEdge(@FA{peer}, @FA{label}, @FA{data})} /// /// Creates a new edge from @FA{vertex} to @FA{peer} with given @FA{label} and /// properties defined in @FA{data}. Returns the edge object. /// +/// @EXAMPLES +/// +/// @verbinclude graph34 +/// +/// @verbinclude graph27 +/// /// @verbinclude graph28 //////////////////////////////////////////////////////////////////////////////// -Vertex.prototype.addOutEdge = function (ine, label, data) { +Vertex.prototype.addOutEdge = function (id, ine, label, data) { if (! this._id) { throw "accessing a deleted vertex"; } - return this._graph.addEdge(this, ine, label, data); + return this._graph.addEdge(id, this, ine, label, data); } //////////////////////////////////////////////////////////////////////////////// @@ -595,6 +428,8 @@ Vertex.prototype.addOutEdge = function (ine, label, data) { /// /// Returns a list of in- or outbound edges of the @FA{vertex}. /// +/// @EXAMPLES +/// /// @verbinclude graph15 //////////////////////////////////////////////////////////////////////////////// @@ -608,11 +443,12 @@ Vertex.prototype.edges = function () { } graph = this._graph; - query = graph._vertices.document(this._id).edges(graph._edges); + query = graph._edges.edges(this._id); + result = []; - while (query.hasNext()) { - result.push(graph.constructEdge(query.nextRef())); + for (var i = 0; i < query.length; ++i) { + result.push(graph.constructEdge(query[i]._id)); } return result; @@ -626,11 +462,13 @@ Vertex.prototype.edges = function () { /// Returns the identifier of the @FA{vertex}. If the vertex was deleted, then /// @CODE{undefined} is returned. /// +/// @EXAMPLES +/// /// @verbinclude graph8 //////////////////////////////////////////////////////////////////////////////// Vertex.prototype.getId = function (name) { - return this._id; + return this._vid; } //////////////////////////////////////////////////////////////////////////////// @@ -640,6 +478,8 @@ Vertex.prototype.getId = function (name) { /// /// Returns a list of inbound edges of the @FA{vertex} with given label(s). /// +/// @EXAMPLES +/// /// @verbinclude graph18 //////////////////////////////////////////////////////////////////////////////// @@ -683,6 +523,8 @@ Vertex.prototype.getInEdges = function () { /// /// Returns a list of outbound edges of the @FA{vertex} with given label(s). /// +/// @EXAMPLES +/// /// @verbinclude graph19 //////////////////////////////////////////////////////////////////////////////// @@ -726,6 +568,8 @@ Vertex.prototype.getOutEdges = function () { /// /// Returns the property @FA{name} a @FA{vertex}. /// +/// @EXAMPLES +/// /// @verbinclude graph5 //////////////////////////////////////////////////////////////////////////////// @@ -744,28 +588,17 @@ Vertex.prototype.getProperty = function (name) { /// /// Returns all propety names a @FA{vertex}. /// +/// @EXAMPLES +/// /// @verbinclude graph7 //////////////////////////////////////////////////////////////////////////////// Vertex.prototype.getPropertyKeys = function () { - var keys; - var key; - var props; - if (! this._id) { throw "accessing a deleted vertex"; } - props = this.properties(); - keys = []; - - for (key in props) { - if (props.hasOwnProperty(key)) { - keys.push(key); - } - } - - return keys; + return propertyKeys(this.properties()); } //////////////////////////////////////////////////////////////////////////////// @@ -775,6 +608,8 @@ Vertex.prototype.getPropertyKeys = function () { /// /// Returns a list of inbound edges of the @FA{vertex}. /// +/// @EXAMPLES +/// /// @verbinclude graph16 //////////////////////////////////////////////////////////////////////////////// @@ -788,11 +623,12 @@ Vertex.prototype.inbound = function () { } graph = this._graph; - query = graph._vertices.document(this._id).inEdges(graph._edges); + query = graph._edges.inEdges(this._id); + result = []; - while (query.hasNext()) { - result.push(graph.constructEdge(query.nextRef())); + for (var i = 0; i < query.length; ++i) { + result.push(graph.constructEdge(query[i]._id)); } return result; @@ -805,6 +641,8 @@ Vertex.prototype.inbound = function () { /// /// Returns a list of outbound edges of the @FA{vertex}. /// +/// @EXAMPLES +/// /// @verbinclude graph17 //////////////////////////////////////////////////////////////////////////////// @@ -818,11 +656,12 @@ Vertex.prototype.outbound = function () { } graph = this._graph; - query = graph._vertices.document(this._id).outEdges(graph._edges); + query = graph._edges.outEdges(this._id); + result = []; - while (query.hasNext()) { - result.push(graph.constructEdge(query.nextRef())); + for (var i = 0; i < query.length; ++i) { + result.push(graph.constructEdge(query[i]._id)); } return result; @@ -835,11 +674,14 @@ Vertex.prototype.outbound = function () { /// /// Returns all properties and their values of a @FA{vertex} /// +/// @EXAMPLES +/// /// @verbinclude graph4 //////////////////////////////////////////////////////////////////////////////// Vertex.prototype.properties = function () { var props; + var result; if (! this._id) { throw "accessing a deleted vertex"; @@ -852,9 +694,7 @@ Vertex.prototype.properties = function () { throw "accessing a deleted vertex"; } - delete props._id; - - return props; + return shallowCopy(props); } //////////////////////////////////////////////////////////////////////////////// @@ -864,11 +704,14 @@ Vertex.prototype.properties = function () { /// /// Changes or sets the property @FA{name} a @FA{vertex} to @FA{value}. /// +/// @EXAMPLES +/// /// @verbinclude graph6 //////////////////////////////////////////////////////////////////////////////// Vertex.prototype.setProperty = function (name, value) { var props; + var shallow; if (! this._id) { throw "accessing a deleted vertex"; @@ -879,9 +722,11 @@ Vertex.prototype.setProperty = function (name, value) { props = this._graph._vertices.document(this._id); // TODO use "update" if (props !== undefined) { - props[name] = value; + shallow = shallowCopy(props); - this._graph._vertices.replace(this._id, props); + shallow[name] = value; + + this._graph._vertices.replace(this._id, shallow); return value; } @@ -911,8 +756,16 @@ Vertex.prototype._PRINT = function (seen, path, names) { if (! this._id) { internal.output("[deleted Vertex]"); } + else if (this._vid !== undefined) { + if (typeof this._vid === "string") { + internal.output("Vertex(\"", this._vid, "\")"); + } + else { + internal.output("Vertex(", this._vid, ")"); + } + } else { - internal.output("Vertex(, \"", this._id, "\")"); + internal.output("Vertex(\"", this._id, "\")"); } } @@ -943,12 +796,15 @@ Vertex.prototype._PRINT = function (seen, path, names) { /// possible to construct two graphs with the same vertex set, but different /// edge sets. /// +/// @EXAMPLES +/// /// @verbinclude graph1 //////////////////////////////////////////////////////////////////////////////// function Graph (vertices, edg) { if (typeof vertices === "string") { vertices = db[vertices]; + vertices.ensureUniqueConstraint("$vid"); } if (! vertices instanceof AvocadoCollection) { @@ -957,6 +813,7 @@ function Graph (vertices, edg) { if (typeof edg === "string") { edg = edges[edg]; + edg.ensureUniqueConstraint("$eid"); } if (! edg instanceof AvocadoEdgesCollection) { @@ -983,36 +840,38 @@ function Graph (vertices, edg) { //////////////////////////////////////////////////////////////////////////////// /// @brief adds an edge to the graph /// -/// @FUN{@FA{graph}.addEdge(@FA{out}, @FA{in})} +/// @FUN{@FA{graph}.addEdge(@FA{id}, @FA{out}, @FA{in})} /// -/// Creates a new edge from @FA{out} to @FA{in} and returns the edge -/// object. +/// Creates a new edge from @FA{out} to @FA{in} and returns the edge object. The +/// identifier @FA{id} must be a unique identifier or null. /// -/// @verbinclude graph30 -/// -/// @FUN{@FA{graph}.addEdge(@FA{out}, @FA{in}, @FA{label})} +/// @FUN{@FA{graph}.addEdge(@FA{id}, @FA{out}, @FA{in}, @FA{label})} /// /// Creates a new edge from @FA{out} to @FA{in} with @FA{label} and returns the /// edge object. /// -/// @verbinclude graph9 -/// -/// @FUN{@FA{graph}.addEdge(@FA{out}, @FA{in}, @FA{data})} +/// @FUN{@FA{graph}.addEdge(@FA{id}, @FA{out}, @FA{in}, @FA{data})} /// /// Creates a new edge and returns the edge object. The edge contains the /// properties defined in @FA{data}. /// -/// @verbinclude graph31 -/// -/// @FUN{@FA{graph}.addEdge(@FA{out}, @FA{in}, @FA{label}, @FA{data})} +/// @FUN{@FA{graph}.addEdge(@FA{id}, @FA{out}, @FA{in}, @FA{label}, @FA{data})} /// /// Creates a new edge and returns the edge object. The edge has the /// label @FA{label} and contains the properties defined in @FA{data}. /// +/// @EXAMPLES +/// +/// @verbinclude graph30 +/// +/// @verbinclude graph9 +/// +/// @verbinclude graph31 +/// /// @verbinclude graph10 //////////////////////////////////////////////////////////////////////////////// -Graph.prototype.addEdge = function (out, ine, label, data) { +Graph.prototype.addEdge = function (id, out, ine, label, data) { var ref; var shallow; var key; @@ -1027,22 +886,16 @@ Graph.prototype.addEdge = function (out, ine, label, data) { label = null; } - if (data === undefined) { - ref = this._edges.save(out._id, ine._id, {"_label" : label}); + if (data == null || typeof data !== "object") { + data = {}; } - else { - shallow = {}; - for (key in data) { - if (data.hasOwnProperty(key)) { - shallow[key] = data[key]; - } - } + shallow = shallowCopy(data); - shallow["_label"] = label; + shallow.$eid = id || null; + shallow.$label = label || null; - ref = this._edges.save(out._id, ine._id, shallow); - } + ref = this._edges.save(out._id, ine._id, shallow); return this.constructEdge(ref); } @@ -1050,30 +903,41 @@ Graph.prototype.addEdge = function (out, ine, label, data) { //////////////////////////////////////////////////////////////////////////////// /// @brief adds a vertex to the graph /// -/// @FUN{@FA{graph}.addVertex()} +/// @FUN{@FA{graph}.addVertex(@FA{id})} /// -/// Creates a new vertex and returns the vertex object. +/// Creates a new vertex and returns the vertex object. The identifier +/// @FA{id} must be a unique identifier or null. /// -/// @verbinclude graph2 -/// -/// @FUN{@FA{graph}.addVertex(@FA{data})} +/// @FUN{@FA{graph}.addVertex(@FA{id}, @FA{data})} /// /// Creates a new vertex and returns the vertex object. The vertex contains /// the properties defined in @FA{data}. /// +/// @EXAMPLES +/// +/// Without any properties: +/// +/// @verbinclude graph2 +/// +/// With given properties: +/// /// @verbinclude graph3 //////////////////////////////////////////////////////////////////////////////// -Graph.prototype.addVertex = function (data) { +Graph.prototype.addVertex = function (id, data) { var ref; + var shallow; - if (data === undefined) { - ref = this._vertices.save({}); - } - else { - ref = this._vertices.save(data); + if (data == null || typeof data !== "object") { + data = {}; } + shallow = shallowCopy(data); + + shallow.$vid = id || null; + + ref = this._vertices.save(shallow); + return this.constructVertex(ref); } @@ -1084,16 +948,18 @@ Graph.prototype.addVertex = function (data) { /// /// Returns the vertex identified by @FA{id} or undefined. /// +/// @EXAMPLES +/// /// @verbinclude graph29 //////////////////////////////////////////////////////////////////////////////// Graph.prototype.getVertex = function (id) { var ref; - ref = this._vertices.document(id); + ref = this._vertices.select({ $vid : id }); if (ref.count() == 1) { - return this.constructVertex(id); + return this.constructVertex(ref.next()._id); } else { return undefined; @@ -1108,6 +974,8 @@ Graph.prototype.getVertex = function (id) { /// Returns an iterator for all vertices of the graph. The iterator supports the /// methods @FN{hasNext} and @FN{next}. /// +/// @EXAMPLES +/// /// @verbinclude graph35 //////////////////////////////////////////////////////////////////////////////// @@ -1151,6 +1019,8 @@ Graph.prototype.getVertices = function () { /// Returns an iterator for all edges of the graph. The iterator supports the /// methods @FN{hasNext} and @FN{next}. /// +/// @EXAMPLES +/// /// @verbinclude graph36 //////////////////////////////////////////////////////////////////////////////// @@ -1193,6 +1063,8 @@ Graph.prototype.getEdges = function () { /// /// Deletes the @FA{vertex} and all its edges. /// +/// @EXAMPLES +/// /// @verbinclude graph37 //////////////////////////////////////////////////////////////////////////////// @@ -1224,6 +1096,8 @@ Graph.prototype.removeVertex = function (vertex) { /// /// Deletes the @FA{edge}. Note that the in and out vertices are left untouched. /// +/// @EXAMPLES +/// /// @verbinclude graph38 //////////////////////////////////////////////////////////////////////////////// @@ -1284,6 +1158,55 @@ Graph.prototype._PRINT = function (seen, path, names) { /// @} //////////////////////////////////////////////////////////////////////////////// +// ----------------------------------------------------------------------------- +// --SECTION-- private methods +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup AvocadoGraph +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief shallow copy properties +//////////////////////////////////////////////////////////////////////////////// + +function shallowCopy (props) { + var shallow; + + shallow = {}; + + for (var key in props) { + if (props.hasOwnProperty(key) && key[0] != '_' && key[0] != '$') { + shallow[key] = props[key]; + } + } + + return shallow; +} + +//////////////////////////////////////////////////////////////////////////////// +/// @brief property keys +//////////////////////////////////////////////////////////////////////////////// + +function propertyKeys (props) { + var keys; + + keys = []; + + for (var key in props) { + if (props.hasOwnProperty(key) && key[0] != '_' && key[0] != '$') { + keys.push(key); + } + } + + return keys; +} + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + // ----------------------------------------------------------------------------- // --SECTION-- MODULE EXPORTS // ----------------------------------------------------------------------------- diff --git a/js/modules/simple-query.js b/js/modules/simple-query.js index c411a8630b..d4d84ee965 100644 --- a/js/modules/simple-query.js +++ b/js/modules/simple-query.js @@ -29,162 +29,6 @@ var internal = require("internal"); var AvocadoCollection = internal.AvocadoCollection; var AvocadoEdgesCollection = internal.AvocadoEdgesCollection; -//////////////////////////////////////////////////////////////////////////////// -/// @page SimpleQueriesTOC -/// -///
          -///
        1. @ref SimpleQueriesQueries -///
            -///
          1. @ref SimpleQueryDocument "db.@FA{collection}.document(@FA{document-reference})"
          2. -///
          3. @ref SimpleQueryAll "db.@FA{collection}.all()"
          4. -///
          5. @ref SimpleQuerySelect "db.@FA{collection}.select()"
          6. -///
          7. @ref SimpleQueryCount "@FA{query}.count()"
          8. -///
          -///
        2. -///
        3. @ref SimpleQueriesGeoQueries -///
            -///
          1. @ref SimpleQueryNear "db.@FA{collection}.near()"
          2. -///
          3. @ref SimpleQueryWithin "db.@FA{collection}.within()"
          4. -///
          5. @ref SimpleQueryGeo "db.@FA{collection}.geo()"
          6. -///
          -///
        4. -///
        5. @ref SimpleQueriesEdgesQueries -///
            -///
          1. @ref SimpleQueryEdges "edges.@FA{collection}.edges()"
          2. -///
          3. @ref SimpleQueryInEdges "edges.@FA{collection}.inEdges()"
          4. -///
          5. @ref SimpleQueryOutEdges "edges.@FA{collection}.outEdges()"
          6. -///
          -///
        6. -///
        7. @ref SimpleQueriesPagination -///
            -///
          1. @ref SimpleQueryLimit "@FA{query}.limit(@FA{limit})"
          2. -///
          3. @ref SimpleQuerySkip "@FA{query}.skip(@FA{skip})"
          4. -///
          -///
        8. -///
        9. @ref SimpleQueriesSequentialAccess -///
            -///
          1. @ref SimpleQueryHasNext "@FA{query}.hasNext()"
          2. -///
          3. @ref SimpleQueryNext "@FA{query}.next()"
          4. -///
          5. @ref SimpleQueryNextRef "@FA{query}.nextRef()"
          6. -///
          -///
        10. -///
        -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page SimpleQueries Simple Queries -/// -/// Simple queries can be used if the query condition is very simple, i. e., a -/// document reference, all documents, a query-by-example, or a simple geo -/// query. In a simple query you can specify exactly one collection and one -/// condition. The result can then be sorted and result can be split into pages. -/// -///
        -/// @copydoc SimpleQueriesTOC -///
        -/// -/// @section SimpleQueriesQueries Queries -///////////////////////////////////////// -/// -/// @anchor SimpleQueryDocument -/// @copydetails JS_DocumentQuery -///
        -/// -/// @anchor SimpleQueryAll -/// @copydetails JSF_AvocadoCollection_prototype_all -///
        -/// -/// @anchor SimpleQuerySelect -/// @copydetails JSF_AvocadoCollection_prototype_select -///
        -/// -/// @anchor SimpleQueryCount -/// @copydetails JSF_SimpleQuery_prototype_count -/// -/// @section SimpleQueriesGeoQueries Geo Queries -//////////////////////////////////////////////// -/// -/// The AvocadoDB allows to selects documents based on geographic -/// coordinates. In order for this to work, a geo-spatial index must be defined. -/// This index will use a very elaborate algorithm to lookup neighbours that is -/// a magnitude faster than a simple R* index. -/// -/// In general a geo coordinate is a pair of latitude and longitude. This can -/// either be an list with two elements like @CODE{[ -10\, +30 ]} (latitude -/// first, followed by longitude) or an object like @CODE{{ lon: -10\, lat: +30 -/// }}. In order to find all documents within a given radius around a -/// coordinate use the @FN{within} operator. In order to find all -/// documents near a given document use the @FN{near} operator. -/// -/// It is possible to define more than one geo-spatial index per collection. In -/// this case you must give a hint using the @FN{geo} operator which of indexes -/// should be used in a query. -/// -///
        -/// -/// @anchor SimpleQueryNear -/// @copydetails JSF_AvocadoCollection_prototype_near -///
        -/// -/// @anchor SimpleQueryWithin -/// @copydetails JSF_AvocadoCollection_prototype_within -///
        -/// -/// @anchor SimpleQueryGeo -/// @copydetails JSF_AvocadoCollection_prototype_geo -/// -/// @section SimpleQueriesEdgesQueries Edges Queries -//////////////////////////////////////////////////// -/// -/// @anchor SimpleQueryEdges -/// @copydetails JS_EdgesQuery -///
        -/// -/// @anchor SimpleQueryInEdges -/// @copydetails JS_InEdgesQuery -///
        -/// -/// @anchor SimpleQueryOutEdges -/// @copydetails JS_OutEdgesQuery -/// -/// @section SimpleQueriesPagination Pagination -/////////////////////////////////////////////// -/// -/// If, for example, you display the result of a user search, then you are in -/// general not interested in the completed result set, but only the first 10 or -/// so documents. Or maybe the next 10 documents for the second page. In this -/// case, you can the @FN{skip} and @FN{limit} operators. These operators works -/// like LIMIT in MySQL. -/// -/// @FN{skip} used together with @FN{limit} can be used to implement pagination. -/// The @FN{skip} operator skips over the first n documents. So, in order to -/// create result pages with 10 result documents per page, you can use -/// @CODE{skip(n * 10).limit(10)} to access the 10 documents on the n.th page. -/// This result should be sorted, so that the pagination works in a predicable -/// way. -/// -/// @anchor SimpleQueryLimit -/// @copydetails JSF_SimpleQuery_prototype_limit -///
        -/// -/// @anchor SimpleQuerySkip -/// @copydetails JSF_SimpleQuery_prototype_skip -/// -/// @section SimpleQueriesSequentialAccess Sequential Access -//////////////////////////////////////////////////////////// -/// -/// @anchor SimpleQueryHasNext -/// @copydetails JSF_SimpleQuery_prototype_hasNext -///
        -/// -/// @anchor SimpleQueryNext -/// @copydetails JSF_SimpleQuery_prototype_next -///
        -/// -/// @anchor SimpleQueryNextRef -/// @copydetails JSF_SimpleQuery_prototype_nextRef -//////////////////////////////////////////////////////////////////////////////// - // ----------------------------------------------------------------------------- // --SECTION-- AVOCADO COLLECTION // ----------------------------------------------------------------------------- From 3e909e7faae2d3832f4900e6eeb53789285d491f Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sun, 11 Mar 2012 21:23:44 +0100 Subject: [PATCH 5/8] example --- Doxygen/Examples.Durham/graph39 | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Doxygen/Examples.Durham/graph39 diff --git a/Doxygen/Examples.Durham/graph39 b/Doxygen/Examples.Durham/graph39 new file mode 100644 index 0000000000..beb203dc22 --- /dev/null +++ b/Doxygen/Examples.Durham/graph39 @@ -0,0 +1,4 @@ +avocado> var Graph = require("graph").Graph; + +avocado> g = new Graph("vertices", "edges"); +Graph("vertices", "edges") From a3a24ddb87a58073fe12996a6579b43809993256 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Mon, 12 Mar 2012 13:40:45 +0100 Subject: [PATCH 6/8] cleanup by jan --- BasicsC/strings.c | 129 ++++++++------- BasicsC/threads-posix.c | 12 +- Doxygen/Examples.AvocadoDB/start2 | 2 +- QL/optimize.h | 1 - RestServer/ActionDispatcherThread.cpp | 12 +- RestServer/ActionDispatcherThread.h | 6 + RestServer/AvocadoServer.cpp | 3 + RestServer/AvocadoServer.h | 37 ++++- RestServer/{graphs.dox => module-graph.js} | 0 RestServer/user-manual-server.dox | 6 +- V8/v8-vocbase.cpp | 25 ++- V8/v8-vocbase.h | 7 +- VocBase/collection.c | 12 ++ VocBase/query-base.c | 29 +++- VocBase/query-base.h | 15 +- VocBase/query-cursor.c | 4 +- VocBase/query-cursor.h | 2 +- VocBase/query-error.c | 4 +- VocBase/query-error.h | 174 ++++++++++++++++++++- VocBase/query-execute.h | 2 +- VocBase/query-join.h | 6 + VocBase/query-parse.c | 25 +-- VocBase/query-parse.h | 2 +- VocBase/vocbase.c | 67 +++++--- VocBase/vocbase.h | 10 +- js/system/aql-cursor.js | 6 +- 26 files changed, 462 insertions(+), 136 deletions(-) rename RestServer/{graphs.dox => module-graph.js} (100%) diff --git a/BasicsC/strings.c b/BasicsC/strings.c index a80834e2c9..c1e5db1661 100644 --- a/BasicsC/strings.c +++ b/BasicsC/strings.c @@ -360,8 +360,7 @@ char* TRI_DuplicateString (char const* value) { n = strlen(value) + 1; result = TRI_Allocate(n); - - if (result == 0) { + if (!result) { return 0; } @@ -381,7 +380,7 @@ char* TRI_DuplicateString2 (char const* value, size_t length) { n = length + 1; result = TRI_Allocate(n); - if (result == 0) { + if (!result) { return 0; } @@ -426,11 +425,12 @@ char* TRI_Concatenate2String (char const* a, char const* b) { nb = strlen(b); result = TRI_Allocate(na + nb + 1); + if (result) { + memcpy(result, a, na); + memcpy(result + na, b, nb); - memcpy(result, a, na); - memcpy(result + na, b, nb); - - result[na + nb] = '\0'; + result[na + nb] = '\0'; + } return result; } @@ -445,18 +445,18 @@ char* TRI_Concatenate3String (char const* a, char const* b, char const* c) { size_t nb; size_t nc; - na = strlen(a); nb = strlen(b); nc = strlen(c); result = TRI_Allocate(na + nb + nc + 1); + if (result) { + memcpy(result, a, na); + memcpy(result + na, b, nb); + memcpy(result + na + nb, c, nc); - memcpy(result, a, na); - memcpy(result + na, b, nb); - memcpy(result + na + nb, c, nc); - - result[na + nb + nc] = '\0'; + result[na + nb + nc] = '\0'; + } return result; } @@ -478,13 +478,14 @@ char* TRI_Concatenate4String (char const* a, char const* b, char const* c, char nd = strlen(d); result = TRI_Allocate(na + nb + nc + nd + 1); + if (result) { + memcpy(result, a, na); + memcpy(result + na, b, nb); + memcpy(result + na + nb, c, nc); + memcpy(result + na + nb + nc, d, nd); - memcpy(result, a, na); - memcpy(result + na, b, nb); - memcpy(result + na + nb, c, nc); - memcpy(result + na + nb + nc, d, nd); - - result[na + nb + nc + nd] = '\0'; + result[na + nb + nc + nd] = '\0'; + } return result; } @@ -508,14 +509,15 @@ char* TRI_Concatenate5String (char const* a, char const* b, char const* c, char ne = strlen(e); result = TRI_Allocate(na + nb + nc + nd + ne + 1); + if (result) { + memcpy(result, a, na); + memcpy(result + na, b, nb); + memcpy(result + na + nb, c, nc); + memcpy(result + na + nb + nc, d, nd); + memcpy(result + na + nb + nc + nd, e, ne); - memcpy(result, a, na); - memcpy(result + na, b, nb); - memcpy(result + na + nb, c, nc); - memcpy(result + na + nb + nc, d, nd); - memcpy(result + na + nb + nc + nd, e, ne); - - result[na + nb + nc + nd + ne] = '\0'; + result[na + nb + nc + nd + ne] = '\0'; + } return result; } @@ -541,16 +543,16 @@ char* TRI_Concatenate6String (char const* a, char const* b, char const* c, char nf = strlen(f); result = TRI_Allocate(na + nb + nc + nd + ne + nf + 1); + if (result) { + memcpy(result, a, na); + memcpy(result + na, b, nb); + memcpy(result + na + nb, c, nc); + memcpy(result + na + nb + nc, d, nd); + memcpy(result + na + nb + nc + nd, e, ne); + memcpy(result + na + nb + nc + nd + ne, f, nf); - memcpy(result, a, na); - memcpy(result + na, b, nb); - memcpy(result + na + nb, c, nc); - memcpy(result + na + nb + nc, d, nd); - memcpy(result + na + nb + nc + nd, e, ne); - memcpy(result + na + nb + nc + nd + ne, f, nf); - - result[na + nb + nc + nd + ne + nf] = '\0'; - + result[na + nb + nc + nd + ne + nf] = '\0'; + } return result; } @@ -574,30 +576,32 @@ TRI_vector_string_t TRI_SplitString (char const* source, char delim) { size = strlen(source); buffer = TRI_Allocate(size + 1); - p = buffer; + if (buffer) { + p = buffer; - q = source; - e = source + size; + q = source; + e = source + size; - for (; q < e; ++q) { - if (*q == delim) { - *p = '\0'; + for (; q < e; ++q) { + if (*q == delim) { + *p = '\0'; - TRI_PushBackVectorString(&result, TRI_DuplicateString2(buffer, p - buffer)); + TRI_PushBackVectorString(&result, TRI_DuplicateString2(buffer, p - buffer)); - p = buffer; - } - else { - *p++ = *q; + p = buffer; + } + else { + *p++ = *q; + } } + + *p = '\0'; + + TRI_PushBackVectorString(&result, TRI_DuplicateString2(buffer, p - buffer)); + + TRI_FreeString(buffer); } - *p = '\0'; - - TRI_PushBackVectorString(&result, TRI_DuplicateString2(buffer, p - buffer)); - - TRI_FreeString(buffer); - return result; } @@ -651,6 +655,10 @@ char* TRI_EscapeCString (char const* in, size_t inLength, size_t* outLength) { char const * end; buffer = TRI_Allocate(4 * inLength + 1); + if (!buffer) { + return NULL; + } + qtr = buffer; for (ptr = in, end = ptr + inLength; ptr < end; ptr++, qtr++) { @@ -720,6 +728,10 @@ char* TRI_EscapeUtf8String (char const* in, size_t inLength, bool escapeSlash, s char const * end; buffer = (char*) TRI_Allocate(6 * inLength + 1); + if (!buffer) { + return NULL; + } + qtr = buffer; for (ptr = in, end = ptr + inLength; ptr < end; ++ptr, ++qtr) { @@ -849,7 +861,9 @@ char* TRI_EscapeUtf8String (char const* in, size_t inLength, bool escapeSlash, s *outLength = qtr - buffer; qtr = TRI_Allocate(*outLength + 1); - memcpy(qtr, buffer, *outLength + 1); + if (qtr) { + memcpy(qtr, buffer, *outLength + 1); + } TRI_Free(buffer); @@ -871,6 +885,10 @@ char* TRI_UnescapeUtf8String (char const* in, size_t inLength, size_t* outLength char c4; buffer = TRI_Allocate(inLength + 1); + if (!buffer) { + return NULL; + } + qtr = buffer; for (ptr = in, end = ptr + inLength; ptr < end; ++ptr, ++qtr) { @@ -966,8 +984,9 @@ char* TRI_UnescapeUtf8String (char const* in, size_t inLength, size_t* outLength *outLength = qtr - buffer; qtr = TRI_Allocate(*outLength + 1); - memcpy(qtr, buffer, *outLength + 1); - + if (qtr) { + memcpy(qtr, buffer, *outLength + 1); + } TRI_Free(buffer); return qtr; diff --git a/BasicsC/threads-posix.c b/BasicsC/threads-posix.c index 05e17ecb99..fffb4ca4a7 100644 --- a/BasicsC/threads-posix.c +++ b/BasicsC/threads-posix.c @@ -76,14 +76,15 @@ static void* ThreadStarter (void* data) { sigset_t all; sigfillset(&all); - pthread_sigmask(SIG_SETMASK, &all, 0); d = data; d->starter(d->_data); - TRI_Free(data); - + if (d) { + TRI_Free(d); + d = NULL; + } return 0; } @@ -168,11 +169,12 @@ bool TRI_StartThread (TRI_thread_t* thread, void (*starter)(void*), void* data) d->_data = data; rc = pthread_create(thread, 0, &ThreadStarter, d); - if (rc != 0) { - TRI_Free(d); TRI_set_errno(TRI_ERROR_SYS_ERROR); LOG_ERROR("could not start thread: %s ", strerror(errno)); + if (d) { + TRI_Free(d); + } return false; } diff --git a/Doxygen/Examples.AvocadoDB/start2 b/Doxygen/Examples.AvocadoDB/start2 index ea230e2b03..f4cf422e4e 100644 --- a/Doxygen/Examples.AvocadoDB/start2 +++ b/Doxygen/Examples.AvocadoDB/start2 @@ -1,4 +1,4 @@ -> ./avocado /tmp/vocbase --port 8528 /tmp/vocbase +> ./avocado --port 8529 /tmp/vocbase 2011-12-05T09:58:31Z [2690] INFO AvocadoDB (version 1 (9711)) is ready for business 2011-12-05T09:58:31Z [2690] INFO HTTP client port: 8529 2011-12-05T09:58:31Z [2690] INFO HTTP admin port: localhost:8530 diff --git a/QL/optimize.h b/QL/optimize.h index 9bc723b719..e4feaf274d 100644 --- a/QL/optimize.h +++ b/QL/optimize.h @@ -58,7 +58,6 @@ extern "C" { /// less work when executing the query and produce the results faster. /// /// @section OptimizerTransformations Optimizer transformations -/// /// /// Currently, the AQL query optimizer applies the following transformations: /// - constant folding: numeric literals, boolean values and null are folded diff --git a/RestServer/ActionDispatcherThread.cpp b/RestServer/ActionDispatcherThread.cpp index d8269209b2..3aaaa3d940 100644 --- a/RestServer/ActionDispatcherThread.cpp +++ b/RestServer/ActionDispatcherThread.cpp @@ -74,6 +74,12 @@ TRI_vocbase_t* ActionDispatcherThread::_vocbase = 0; string ActionDispatcherThread::_startupModules; +//////////////////////////////////////////////////////////////////////////////// +/// @brief Javascript garbage collection interval (each x requests) +//////////////////////////////////////////////////////////////////////////////// + +uint64_t ActionDispatcherThread::_gcInterval = 1000; + //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// @@ -134,12 +140,10 @@ void ActionDispatcherThread::reportStatus () { //////////////////////////////////////////////////////////////////////////////// void ActionDispatcherThread::tick (bool idle) { - static uint64_t const INTERVALL = 1000; - _gc += (idle ? 10 : 1); - if (_gc > INTERVALL) { - while(!v8::V8::IdleNotification()) { + if (_gc > _gcInterval) { + while (!v8::V8::IdleNotification()) { } _gc = 0; diff --git a/RestServer/ActionDispatcherThread.h b/RestServer/ActionDispatcherThread.h index 07fce93dcb..d00cbf6294 100644 --- a/RestServer/ActionDispatcherThread.h +++ b/RestServer/ActionDispatcherThread.h @@ -90,6 +90,12 @@ namespace triagens { static string _startupModules; +//////////////////////////////////////////////////////////////////////////////// +/// @brief Javascript garbage collection interval (each x requests) +//////////////////////////////////////////////////////////////////////////////// + + static uint64_t _gcInterval; + //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// diff --git a/RestServer/AvocadoServer.cpp b/RestServer/AvocadoServer.cpp index 4ca2be9375..141421d324 100644 --- a/RestServer/AvocadoServer.cpp +++ b/RestServer/AvocadoServer.cpp @@ -165,6 +165,7 @@ AvocadoServer::AvocadoServer (int argc, char** argv) _actionPath(), _systemActionPath(), _actionThreads(1), + _gcInterval(1000), _databasePath("/var/lib/avocado"), _vocbase(0) { char* p; @@ -330,6 +331,7 @@ void AvocadoServer::buildApplicationServer () { ("startup.directory", &_startupPath, "path to the directory containing alternate startup scripts") ("startup.modules-path", &_startupModules, "one or more directories separated by semicolon") ("action.directory", &_actionPath, "path to the action directory, defaults to /_ACTIONS") + ("gc.interval", &_gcInterval, "garbage collection interval (each x requests)") ; additional["JAVASCRIPT Options:help-admin"] @@ -489,6 +491,7 @@ int AvocadoServer::startupServer () { ActionDispatcherThread::_startupLoader = &StartupLoader; ActionDispatcherThread::_vocbase = _vocbase; ActionDispatcherThread::_startupModules = _startupModules; + ActionDispatcherThread::_gcInterval = _gcInterval; // ............................................................................. // create the various parts of the Avocado server diff --git a/RestServer/AvocadoServer.h b/RestServer/AvocadoServer.h index d00ca3e148..a68629eea7 100644 --- a/RestServer/AvocadoServer.h +++ b/RestServer/AvocadoServer.h @@ -210,7 +210,7 @@ namespace triagens { /// /// @CMDOPT{--port @CA{port}} /// -/// This variant can be used as command line options. +/// This variant can be used as command line option. //////////////////////////////////////////////////////////////////////////////// string _httpPort; @@ -240,34 +240,69 @@ namespace triagens { //////////////////////////////////////////////////////////////////////////////// /// @brief path to the directory containing the startup scripts +/// +/// @CMDOPT{--startup.directory @CA{directory}} +/// +/// Specifies the @CA{directory} path to alternate startup Javascript files. //////////////////////////////////////////////////////////////////////////////// string _startupPath; //////////////////////////////////////////////////////////////////////////////// /// @brief semicolon separated list of module directories +/// +/// @CMDOPT{--startup.modules-path @CA{directory}} +/// +/// Specifies the @CA{directory} path with user defined Javascript modules. +/// Multiple paths can be specified separated with commas. //////////////////////////////////////////////////////////////////////////////// string _startupModules; //////////////////////////////////////////////////////////////////////////////// /// @brief path to the action directory +/// +/// @CMDOPT{--action.directory @CA{directory}} +/// +/// Specifies the @CA{directory} path to user defined Javascript files that +/// can be invoked as actions. //////////////////////////////////////////////////////////////////////////////// string _actionPath; //////////////////////////////////////////////////////////////////////////////// /// @brief path to the system action directory +/// +/// @CMDOPT{--action.system-directory @CA{directory}} +/// +/// Specifies the @CA{system-directory} path to system defined Javascript files +/// that can be invoked as actions. //////////////////////////////////////////////////////////////////////////////// string _systemActionPath; //////////////////////////////////////////////////////////////////////////////// /// @brief number of action threads +/// +/// @CMDOPT{--action.threads @CA{number}} +/// +/// Specifies the @CA{number} of threads that are spawned to handle action +/// requests. //////////////////////////////////////////////////////////////////////////////// int _actionThreads; +//////////////////////////////////////////////////////////////////////////////// +/// @brief Javascript garbage collection interval (each x requests) +/// +/// @CMDOPT{--gc.interval @CA{interval}} +/// +/// Specifies the interval (approximately in number of requests) that the +/// garbage collection for Javascript objects will be run in each thread. +//////////////////////////////////////////////////////////////////////////////// + + uint64_t _gcInterval; + //////////////////////////////////////////////////////////////////////////////// /// @brief path to the database /// diff --git a/RestServer/graphs.dox b/RestServer/module-graph.js similarity index 100% rename from RestServer/graphs.dox rename to RestServer/module-graph.js diff --git a/RestServer/user-manual-server.dox b/RestServer/user-manual-server.dox index 8b09cbc3ce..290bb0bed0 100644 --- a/RestServer/user-manual-server.dox +++ b/RestServer/user-manual-server.dox @@ -39,8 +39,10 @@ /// ///
      ///
    8. -///
    9. @ref AQL +///
    10. Avocado Query Language ///
        +///
      1. @ref AQLBasics +///
      2. ///
      3. @ref Optimizer ///
      4. ///
      5. @ref IndexUsage @@ -61,6 +63,8 @@ ///
      6. ///
      ///
    11. +///
    12. @ref AvocadoErrors +///
    13. ///
    ///
  2. ///
  3. Client Communication diff --git a/V8/v8-vocbase.cpp b/V8/v8-vocbase.cpp index 197b5b069d..fb4b2dbede 100644 --- a/V8/v8-vocbase.cpp +++ b/V8/v8-vocbase.cpp @@ -630,6 +630,7 @@ static void WeakQueryInstanceCallback (v8::Persistent object, void* p static v8::Handle WrapQueryInstance (TRI_query_instance_t* instance) { TRI_v8_global_t* v8g; + v8::HandleScope scope; v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData(); @@ -644,6 +645,7 @@ static v8::Handle WrapQueryInstance (TRI_query_instance_t* instance) v8g->JSQueryInstances[instance] = persistent; + LOG_TRACE("creating new query instance"); persistent.MakeWeak(instance, WeakQueryInstanceCallback); } else { @@ -651,7 +653,7 @@ static v8::Handle WrapQueryInstance (TRI_query_instance_t* instance) queryInstance->SetInternalField(SLOT_CLASS, i->second); } - return queryInstance; + return scope.Close(queryInstance); } //////////////////////////////////////////////////////////////////////////////// @@ -660,6 +662,7 @@ static v8::Handle WrapQueryInstance (TRI_query_instance_t* instance) static v8::Handle CreateQueryErrorObject (TRI_query_error_t* error) { TRI_v8_global_t* v8g; + v8::HandleScope scope; v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData(); @@ -677,7 +680,7 @@ static v8::Handle CreateQueryErrorObject (TRI_query_error_t* error) TRI_Free(errorMessage); } - return errorObject; + return scope.Close(errorObject); } //////////////////////////////////////////////////////////////////////////////// @@ -800,6 +803,7 @@ static void WeakQueryCursorCallback (v8::Persistent object, void* par static v8::Handle WrapQueryCursor (TRI_query_cursor_t* cursor) { TRI_v8_global_t* v8g; + v8::HandleScope scope; v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData(); @@ -820,8 +824,8 @@ static v8::Handle WrapQueryCursor (TRI_query_cursor_t* cursor) { cursorObject->SetInternalField(SLOT_CLASS_TYPE, v8::Integer::New(WRP_RC_QUERY_CURSOR_TYPE)); cursorObject->SetInternalField(SLOT_CLASS, i->second); } - - return cursorObject; + + return scope.Close(cursorObject); } //////////////////////////////////////////////////////////////////////////////// @@ -1519,7 +1523,7 @@ static v8::Handle JS_PrepareAql (v8::Arguments const& argv) { v8::Handle dbArg = argv[0]->ToObject(); TRI_vocbase_t* vocbase = UnwrapClass(dbArg, WRP_VOCBASE_TYPE); - if (vocbase == 0) { + if (!vocbase) { return scope.Close(v8::ThrowException(v8::String::New("corrupted vocbase"))); } @@ -1536,7 +1540,7 @@ static v8::Handle JS_PrepareAql (v8::Arguments const& argv) { parameters = ConvertHelper(argv[2]); } - // create a parser object + // create a template object TRI_query_template_t* template_ = TRI_CreateQueryTemplate(queryString.c_str(), vocbase); if (template_) { bool ok = TRI_ParseQueryTemplate(template_); @@ -4319,6 +4323,9 @@ static v8::Handle MapGetShapedJson (v8::Local name, TRI_shape_access_t* acc = TRI_ShapeAccessor(shaper, sid, pid); if (acc == NULL || acc->_shape == NULL) { + if (acc) { + TRI_FreeShapeAccessor(acc); + } return scope.Close(v8::Handle()); } @@ -4327,8 +4334,10 @@ static v8::Handle MapGetShapedJson (v8::Local name, TRI_shaped_json_t json; if (TRI_ExecuteShapeAccessor(acc, document, &json)) { + TRI_FreeShapeAccessor(acc); return scope.Close(TRI_JsonShapeData(shaper, shape, json._data.data, json._data.length)); } + TRI_FreeShapeAccessor(acc); return scope.Close(v8::ThrowException(v8::String::New("cannot extract attribute"))); } @@ -4450,8 +4459,12 @@ static v8::Handle PropertyQueryShapedJson (v8::Local na // key not found if (acc == NULL || acc->_shape == NULL) { + if (acc) { + TRI_FreeShapeAccessor(acc); + } return scope.Close(v8::Handle()); } + TRI_FreeShapeAccessor(acc); return scope.Close(v8::Handle(v8::Integer::New(v8::ReadOnly))); } diff --git a/V8/v8-vocbase.h b/V8/v8-vocbase.h index c1f26503ca..8dda9e3537 100644 --- a/V8/v8-vocbase.h +++ b/V8/v8-vocbase.h @@ -204,12 +204,11 @@ /// /// @subsection JSFQueryBuilding Query Building Functions /// +/// A complete list of the available query building functions can be found @ref +/// SimpleQueries "here". +/// /// @copydetails JS_DocumentQuery /// -/// @copydetails JS_NearQuery -/// -/// @copydetails JS_SelectQuery -/// /// @subsection JSFQueryExecuting Query Execution Functions /// /// @section JSFGlobal Global Functions diff --git a/VocBase/collection.c b/VocBase/collection.c index 493de727bf..5a2adbaaae 100644 --- a/VocBase/collection.c +++ b/VocBase/collection.c @@ -51,6 +51,8 @@ static void InitCollection (TRI_collection_t* collection, char* directory, TRI_col_info_t* info) { + assert(collection); + memset(collection, 0, sizeof(TRI_collection_t)); collection->_version = info->_version; @@ -312,6 +314,7 @@ static bool CheckCollection (TRI_collection_t* collection) { void TRI_InitParameterCollection (TRI_col_parameter_t* parameter, char const* name, TRI_voc_size_t maximalSize) { + assert(parameter); memset(parameter, 0, sizeof(TRI_col_parameter_t)); parameter->_type = TRI_COL_TYPE_SIMPLE_DOCUMENT; @@ -413,6 +416,7 @@ TRI_collection_t* TRI_CreateCollection (TRI_collection_t* collection, //////////////////////////////////////////////////////////////////////////////// void TRI_DestroyCollection (TRI_collection_t* collection) { + assert(collection); TRI_DestroyVectorPointer(&collection->_datafiles); TRI_DestroyVectorPointer(&collection->_journals); TRI_DestroyVectorPointer(&collection->_compactors); @@ -425,6 +429,7 @@ void TRI_DestroyCollection (TRI_collection_t* collection) { //////////////////////////////////////////////////////////////////////////////// void TRI_FreeCollection (TRI_collection_t* collection) { + assert(collection); TRI_DestroyCollection(collection); TRI_Free(collection); } @@ -455,6 +460,9 @@ bool TRI_LoadParameterInfo (char const* path, size_t n; filename = TRI_Concatenate2File(path, TRI_COL_PARAMETER_FILE); + if (!filename) { + return false; + } if (! TRI_ExistsFile(filename)) { TRI_set_errno(TRI_VOC_ERROR_FILE_NOT_FOUND); @@ -535,6 +543,9 @@ bool TRI_SaveParameterInfo (char const* path, // create a json info object json = TRI_CreateArrayJson(); + if (!json) { + return false; + } TRI_Insert2ArrayJson(json, "version", TRI_CreateNumberJson(info->_version)); TRI_Insert2ArrayJson(json, "type", TRI_CreateNumberJson(info->_type)); @@ -547,6 +558,7 @@ bool TRI_SaveParameterInfo (char const* path, filename = TRI_Concatenate2File(path, TRI_COL_PARAMETER_FILE); ok = TRI_SaveJson(filename, json); TRI_DestroyJson(json); + // TODO: who is going to free json itself? if (! ok) { LOG_ERROR("cannot save info block '%s': '%s'", filename, TRI_last_error()); diff --git a/VocBase/query-base.c b/VocBase/query-base.c index fbb9931570..a8f108b8e2 100644 --- a/VocBase/query-base.c +++ b/VocBase/query-base.c @@ -266,6 +266,11 @@ static bool InitFromQueryTemplate (TRI_query_template_t* const template_) { node = node->_next; } + if (template_->_query->_from._collections._nrUsed > QUERY_MAX_JOINS) { + TRI_SetQueryError(&template_->_error, TRI_ERROR_QUERY_TOO_MANY_JOINS, NULL); + return false; + } + QLOptimizeFrom(template_->_query); return true; @@ -333,6 +338,28 @@ TRI_bind_parameter_t* TRI_CreateBindParameter (const char* name, // --SECTION-- query template // ----------------------------------------------------------------------------- +//////////////////////////////////////////////////////////////////////////////// +/// @brief Free a template based on its shadow +//////////////////////////////////////////////////////////////////////////////// + +void TRI_FreeShadowQueryTemplate (TRI_shadow_store_t* store, TRI_shadow_t* shadow) { + TRI_query_template_t* template_ = (TRI_query_template_t*) shadow->_data; + + if (!template_) { + return; + } + + TRI_FreeQueryTemplate(template_); +} + +//////////////////////////////////////////////////////////////////////////////// +/// @brief create shadow data store for templates +//////////////////////////////////////////////////////////////////////////////// + +TRI_shadow_store_t* TRI_CreateShadowsQueryTemplate (void) { + return TRI_CreateShadowStore(&TRI_FreeShadowQueryTemplate); +} + //////////////////////////////////////////////////////////////////////////////// /// @brief Initialize the structs contained in a query template and perform /// some basic optimizations and type detections @@ -434,7 +461,7 @@ TRI_query_template_t* TRI_CreateQueryTemplate (const char* queryString, /// @brief Free a query template //////////////////////////////////////////////////////////////////////////////// -void TRI_FreeQueryTemplate (TRI_query_template_t* const template_) { +void TRI_FreeQueryTemplate (TRI_query_template_t* template_) { assert(template_); assert(template_->_queryString); assert(template_->_query); diff --git a/VocBase/query-base.h b/VocBase/query-base.h index 504e854a8d..b1b2fd9819 100644 --- a/VocBase/query-base.h +++ b/VocBase/query-base.h @@ -36,6 +36,7 @@ #include #include "VocBase/vocbase.h" +#include "VocBase/shadow-data.h" #include "VocBase/query-node.h" #include "VocBase/query-error.h" @@ -163,6 +164,18 @@ typedef struct TRI_query_template_s { } TRI_query_template_t; +//////////////////////////////////////////////////////////////////////////////// +/// @brief Free a template based on its shadow +//////////////////////////////////////////////////////////////////////////////// + +void TRI_FreeShadowQueryTemplate (TRI_shadow_store_t*, TRI_shadow_t*); + +//////////////////////////////////////////////////////////////////////////////// +/// @brief create shadow data store for templates +//////////////////////////////////////////////////////////////////////////////// + +TRI_shadow_store_t* TRI_CreateShadowsQueryTemplate (void); + //////////////////////////////////////////////////////////////////////////////// /// @brief Initialize the structs contained in a query template and perform /// some basic optimizations and type detections @@ -188,7 +201,7 @@ TRI_query_template_t* TRI_CreateQueryTemplate (const char*, /// @brief Free a query template //////////////////////////////////////////////////////////////////////////////// -void TRI_FreeQueryTemplate (TRI_query_template_t* const); +void TRI_FreeQueryTemplate (TRI_query_template_t*); // ----------------------------------------------------------------------------- // --SECTION-- query instance diff --git a/VocBase/query-cursor.c b/VocBase/query-cursor.c index a5a01c3886..c904af1085 100644 --- a/VocBase/query-cursor.c +++ b/VocBase/query-cursor.c @@ -167,7 +167,7 @@ TRI_query_cursor_t* TRI_CreateQueryCursor (TRI_query_instance_t* const instance, /// @brief Free a cursor based on its shadow //////////////////////////////////////////////////////////////////////////////// -void TRI_FreeQueryCursor (TRI_shadow_store_t* store, TRI_shadow_t* shadow) { +void TRI_FreeShadowQueryCursor (TRI_shadow_store_t* store, TRI_shadow_t* shadow) { TRI_query_cursor_t* cursor = (TRI_query_cursor_t*) shadow->_data; if (!cursor) { @@ -202,7 +202,7 @@ void TRI_UnlockQueryCursor (TRI_query_cursor_t* const cursor) { //////////////////////////////////////////////////////////////////////////////// TRI_shadow_store_t* TRI_CreateShadowsQueryCursor (void) { - return TRI_CreateShadowStore(&TRI_FreeQueryCursor); + return TRI_CreateShadowStore(&TRI_FreeShadowQueryCursor); } //////////////////////////////////////////////////////////////////////////////// diff --git a/VocBase/query-cursor.h b/VocBase/query-cursor.h index bb4546e7cb..b186245dc6 100644 --- a/VocBase/query-cursor.h +++ b/VocBase/query-cursor.h @@ -82,7 +82,7 @@ TRI_query_cursor_t* TRI_CreateQueryCursor (TRI_query_instance_t* const, /// @brief Free a cursor based on its shadow //////////////////////////////////////////////////////////////////////////////// -void TRI_FreeQueryCursor (TRI_shadow_store_t*, TRI_shadow_t*); +void TRI_FreeShadowQueryCursor (TRI_shadow_store_t*, TRI_shadow_t*); //////////////////////////////////////////////////////////////////////////////// /// @brief exclusively lock a query cursor diff --git a/VocBase/query-error.c b/VocBase/query-error.c index 57e5c79652..3ef9e8f1b1 100644 --- a/VocBase/query-error.c +++ b/VocBase/query-error.c @@ -28,7 +28,7 @@ #include "VocBase/query-error.h" //////////////////////////////////////////////////////////////////////////////// -/// @addtogroup VocBase +/// @addtogroup AvocadoErrors /// @{ //////////////////////////////////////////////////////////////////////////////// @@ -50,6 +50,8 @@ void TRI_InitialiseQueryErrors (void) { REG_ERROR(NUMBER_OUT_OF_RANGE, "number '%s' is out of range"); REG_ERROR(LIMIT_VALUE_OUT_OF_RANGE, "limit value '%s' is out of range"); + REG_ERROR(TOO_MANY_JOINS, "too many joins"); + REG_ERROR(COLLECTION_NAME_INVALID, "collection name '%s' is invalid"); REG_ERROR(COLLECTION_ALIAS_INVALID, "collection alias '%s' is invalid"); REG_ERROR(COLLECTION_ALIAS_REDECLARED, "collection alias '%s' is declared multiple times in the same query"); diff --git a/VocBase/query-error.h b/VocBase/query-error.h index d58a932263..9c52942229 100644 --- a/VocBase/query-error.h +++ b/VocBase/query-error.h @@ -35,7 +35,35 @@ extern "C" { #endif //////////////////////////////////////////////////////////////////////////////// -/// @addtogroup VocBase +/// @page AvocadoErrors Errors +/// +/// @section AvocadoQueryErrors Query errors +/// +/// The following errors might be raised during query execution: +/// +/// - @copydoc TRI_ERROR_QUERY_OOM +/// - @copydoc TRI_ERROR_QUERY_KILLED +/// - @copydoc TRI_ERROR_QUERY_PARSE +/// - @copydoc TRI_ERROR_QUERY_EMPTY +/// - @copydoc TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE +/// - @copydoc TRI_ERROR_QUERY_LIMIT_VALUE_OUT_OF_RANGE +/// - @copydoc TRI_ERROR_QUERY_TOO_MANY_JOINS +/// - @copydoc TRI_ERROR_QUERY_COLLECTION_NAME_INVALID +/// - @copydoc TRI_ERROR_QUERY_COLLECTION_ALIAS_INVALID +/// - @copydoc TRI_ERROR_QUERY_COLLECTION_ALIAS_REDECLARED +/// - @copydoc TRI_ERROR_QUERY_COLLECTION_ALIAS_UNDECLARED +/// - @copydoc TRI_ERROR_QUERY_COLLECTION_NOT_FOUND +/// - @copydoc TRI_ERROR_QUERY_GEO_RESTRICTION_INVALID +/// - @copydoc TRI_ERROR_QUERY_GEO_INDEX_MISSING +/// - @copydoc TRI_ERROR_QUERY_BIND_PARAMETER_MISSING +/// - @copydoc TRI_ERROR_QUERY_BIND_PARAMETER_REDECLARED +/// - @copydoc TRI_ERROR_QUERY_BIND_PARAMETER_UNDECLARED +/// - @copydoc TRI_ERROR_QUERY_BIND_PARAMETER_VALUE_INVALID +/// - @copydoc TRI_ERROR_QUERY_BIND_PARAMETER_NUMBER_OUT_OF_RANGE +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup AvocadoErrors /// @{ //////////////////////////////////////////////////////////////////////////////// @@ -46,33 +74,175 @@ extern "C" { //////////////////////////////////////////////////////////////////////////////// /// @brief error numbers for specific errors during query parsing and execution /// -/// note that the error numbers defined here must not conflict with error +/// Note that the error numbers defined here must not conflict with error /// numbers defined for other parts of the program (e.g. in VocBase/vocbase.h) //////////////////////////////////////////////////////////////////////////////// +#define TRI_ERROR_QUERY_BASE (8000) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8000: Out of memory +/// +/// Will be raised during query execution when a memory allocation request can +/// not be satisfied. +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_OOM (8000) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8001: Query was killed by administrator +/// +/// Will be raised when a running query is killed by an explicit admin command. +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_KILLED (8001) +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8010: Parse error +/// +/// Will be raised when query is parsed and is found to be syntactially invalid. +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_PARSE (8010) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8011: Query is emtpy / no command specified +/// +/// Will be raised when an empty query is specified. +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_EMPTY (8011) +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8020: Specified numeric value is out of range +/// +/// Will be raised when a numeric value inside a query is out of the allowed +/// value range. +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE (8020) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8021: Specified limit value is out of range +/// +/// Will be raised when a limit value in the query is outside the allowed range +/// (e. g. when passing a negative skip value) +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_LIMIT_VALUE_OUT_OF_RANGE (8021) +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8040: Too many joins +/// +/// Will be raised when the number of joins in a query is beyond the allowed +/// value. +//////////////////////////////////////////////////////////////////////////////// + +#define TRI_ERROR_QUERY_TOO_MANY_JOINS (8040) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8050: Invalid name for collection +/// +/// Will be raised when an invalid collection name is used in the from clause +/// of a query. +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_COLLECTION_NAME_INVALID (8050) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8051: Invalid alias for collection +/// +/// Will be raised when an invalid alias name is used for a collection. +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_COLLECTION_ALIAS_INVALID (8051) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8052: Redeclaration of alias within query +/// +/// Will be raised when the same alias name is declared multiple times in the +/// same query's from clause. +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_COLLECTION_ALIAS_REDECLARED (8052) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8053: Usage of undeclared alias in query +/// +/// Will be raised when an alias not declared in the from clause is used in the +/// query. +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_COLLECTION_ALIAS_UNDECLARED (8053) +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8060: Collection not found +/// +/// Will be raised when one of the collections referenced in the query was not +/// found. +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_COLLECTION_NOT_FOUND (8060) +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8070: Invalid geo restriction specification +/// +/// Will be raised when a specified geo restriction is invalid. +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_GEO_RESTRICTION_INVALID (8070) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8071: No suitable geo index found to resolve query +/// +/// Will be raised when a geo restriction was specified but no suitable geo +/// index is found to resolve it. +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_GEO_INDEX_MISSING (8071) +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8100: No value specified for declared bind parameter +/// +/// Will be raised when a bind parameter was declared in the query but the +/// query is being executed with no value for that parameter. +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_BIND_PARAMETER_MISSING (8100) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8101: Redeclaration of same bind parameter value +/// +/// Will be raised when a value gets specified multiple times for the same bind +/// parameter. +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_BIND_PARAMETER_REDECLARED (8101) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8102: Value specified for undeclared bind parameter +/// +/// Will be raised when a value gets specified for an undeclared bind parameter. +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_BIND_PARAMETER_UNDECLARED (8102) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8103: Invalid value for bind parameter +/// +/// Will be raised when an invalid value is specified for one of the bind +/// parameters. +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_BIND_PARAMETER_VALUE_INVALID (8103) + +//////////////////////////////////////////////////////////////////////////////// +/// @brief 8104: Bind parameter number is out of range +/// +/// Will be specified when the numeric index for a bind parameter of type +/// @LIT{\@n} is out of the allowed range. +//////////////////////////////////////////////////////////////////////////////// + #define TRI_ERROR_QUERY_BIND_PARAMETER_NUMBER_OUT_OF_RANGE (8104) //////////////////////////////////////////////////////////////////////////////// diff --git a/VocBase/query-execute.h b/VocBase/query-execute.h index b427fba8f9..f344183823 100644 --- a/VocBase/query-execute.h +++ b/VocBase/query-execute.h @@ -40,7 +40,7 @@ extern "C" { #endif //////////////////////////////////////////////////////////////////////////////// -/// @page AQL Avocado Query Language (AQL) +/// @page AQLBasics Query language basics /// /// Queries can be used to extract arbitrary data from one or multiple /// collections. A query needs to be composed in the Avocado Query Language diff --git a/VocBase/query-join.h b/VocBase/query-join.h index ccd1645fa0..f246e52885 100644 --- a/VocBase/query-join.h +++ b/VocBase/query-join.h @@ -46,6 +46,12 @@ extern "C" { /// @{ //////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +/// @brief Maximum number of joins in one query +//////////////////////////////////////////////////////////////////////////////// + +#define QUERY_MAX_JOINS (16) + //////////////////////////////////////////////////////////////////////////////// /// @brief possible join types //////////////////////////////////////////////////////////////////////////////// diff --git a/VocBase/query-parse.c b/VocBase/query-parse.c index 198538694a..e1f202c364 100644 --- a/VocBase/query-parse.c +++ b/VocBase/query-parse.c @@ -295,26 +295,11 @@ void TRI_ParseQueryPopIntoRhs (TRI_query_node_t* node, //////////////////////////////////////////////////////////////////////////////// bool TRI_ParseQueryValidateCollectionName (const char* name) { - const char* p = name; - char c; - size_t length = 0; - - while ('\0' != (c = *p++)) { - if (length == 0) { - if (!(c >= 'A' && c <= 'Z') && - !(c >= 'a' && c <= 'z')) { - return false; - } - } - if (!(c >= 'A' && c <= 'Z') && - !(c >= 'a' && c <= 'z') && - !(c >= '0' && c <= '9')) { - return false; - } - length++; + if (TRI_IsAllowedCollectionName(name) != 0) { + return false; } - - return ((length > 0) && (length <= TRI_QUERY_NAME_MAX_LENGTH)); + + return true; } //////////////////////////////////////////////////////////////////////////////// @@ -355,7 +340,7 @@ bool TRI_ParseQueryValidateCollectionAlias (const char* name) { return false; } - return ((totalLength > 0) && (totalLength <= TRI_QUERY_NAME_MAX_LENGTH)); + return ((totalLength > 0) && (totalLength <= TRI_QUERY_ALIAS_MAX_LENGTH)); } //////////////////////////////////////////////////////////////////////////////// diff --git a/VocBase/query-parse.h b/VocBase/query-parse.h index 02bc1eddf8..8d8e63ccbd 100644 --- a/VocBase/query-parse.h +++ b/VocBase/query-parse.h @@ -46,7 +46,7 @@ extern "C" { /// @brief Maximum length of an identifier in a query //////////////////////////////////////////////////////////////////////////////// -#define TRI_QUERY_NAME_MAX_LENGTH 64 +#define TRI_QUERY_ALIAS_MAX_LENGTH 64 // ----------------------------------------------------------------------------- // --SECTION-- forwards diff --git a/VocBase/vocbase.c b/VocBase/vocbase.c index 4404cde40d..20e5e4ba5f 100644 --- a/VocBase/vocbase.c +++ b/VocBase/vocbase.c @@ -167,30 +167,6 @@ static bool EqualKeyCollectionName (TRI_associative_pointer_t* array, void const /// @{ //////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -/// @brief checks if a collection is allowed -//////////////////////////////////////////////////////////////////////////////// - -static char IsAllowedCollectionName (char const* name) { - bool ok; - char const* ptr; - - for (ptr = name; *ptr; ++ptr) { - if (name < ptr) { - ok = (*ptr == '_') || ('0' <= *ptr && *ptr <= '9') || ('a' <= *ptr && *ptr <= 'z') || ('A' <= *ptr && *ptr <= 'Z'); - } - else { - ok = ('0' <= *ptr && *ptr <= '9') || ('a' <= *ptr && *ptr <= 'z') || ('A' <= *ptr && *ptr <= 'Z'); - } - - if (! ok) { - return *ptr; - } - } - - return 0; -} - //////////////////////////////////////////////////////////////////////////////// /// @brief adds a new collection //////////////////////////////////////////////////////////////////////////////// @@ -330,6 +306,30 @@ size_t PageSize; /// @{ //////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +/// @brief checks if a collection is allowed +//////////////////////////////////////////////////////////////////////////////// + +char TRI_IsAllowedCollectionName (char const* name) { + bool ok; + char const* ptr; + + for (ptr = name; *ptr; ++ptr) { + if (name < ptr) { + ok = (*ptr == '_') || ('0' <= *ptr && *ptr <= '9') || ('a' <= *ptr && *ptr <= 'z') || ('A' <= *ptr && *ptr <= 'Z'); + } + else { + ok = ('0' <= *ptr && *ptr <= '9') || ('a' <= *ptr && *ptr <= 'z') || ('A' <= *ptr && *ptr <= 'Z'); + } + + if (! ok) { + return *ptr; + } + } + + return 0; +} + //////////////////////////////////////////////////////////////////////////////// /// @brief create a new tick //////////////////////////////////////////////////////////////////////////////// @@ -449,9 +449,18 @@ TRI_vocbase_t* TRI_OpenVocBase (char const* path) { LOG_ERROR("out of memory when opening vocbase"); return NULL; } + + // set up shadow data stores for queries + vocbase->_templates = TRI_CreateShadowsQueryTemplate(); + if (!vocbase->_templates) { + TRI_Free(vocbase); + LOG_ERROR("out of memory when opening vocbase"); + return NULL; + } vocbase->_cursors = TRI_CreateShadowsQueryCursor(); if (!vocbase->_cursors) { + TRI_FreeShadowStore(vocbase->_cursors); TRI_Free(vocbase); LOG_ERROR("out of memory when opening vocbase"); return NULL; @@ -461,6 +470,8 @@ TRI_vocbase_t* TRI_OpenVocBase (char const* path) { vocbase->_path = TRI_DuplicateString(path); if (!vocbase->_path) { + TRI_FreeShadowStore(vocbase->_templates); + TRI_FreeShadowStore(vocbase->_cursors); TRI_Free(vocbase); LOG_ERROR("out of memory when opening vocbase"); return NULL; @@ -512,9 +523,13 @@ void TRI_CloseVocBase (TRI_vocbase_t* vocbase) { TRI_JoinThread(&vocbase->_synchroniser); TRI_JoinThread(&vocbase->_compactor); + // Free shadows if (vocbase->_cursors) { TRI_FreeShadowStore(vocbase->_cursors); } + if (vocbase->_templates) { + TRI_FreeShadowStore(vocbase->_templates); + } TRI_DestroyLockFile(vocbase->_lockFile); TRI_FreeString(vocbase->_lockFile); @@ -609,7 +624,7 @@ TRI_vocbase_col_t const* TRI_CreateCollectionVocBase (TRI_vocbase_t* vocbase, TR } // check that the name does not contain any strange characters - wrong = IsAllowedCollectionName(name); + wrong = TRI_IsAllowedCollectionName(name); if (wrong != 0) { LOG_ERROR("found illegal character in name: %c", wrong); @@ -735,7 +750,7 @@ TRI_vocbase_col_t const* TRI_BearCollectionVocBase (TRI_vocbase_t* vocbase, char } // check that the name does not contain any strange characters - wrong = IsAllowedCollectionName(name); + wrong = TRI_IsAllowedCollectionName(name); if (wrong != 0) { LOG_ERROR("found illegal character in name: %c", wrong); diff --git a/VocBase/vocbase.h b/VocBase/vocbase.h index e99868862c..c5d24a1f1a 100644 --- a/VocBase/vocbase.h +++ b/VocBase/vocbase.h @@ -90,7 +90,8 @@ extern size_t PageSize; /// @ref TRI_InitialiseVocBase. /// /// Please note that the error numbers defined here must not conflict with error -/// numbers defined for other parts of the program (e.g. in VocBase/vocbase.h) +/// numbers defined for other parts of the program (e.g. in +/// VocBase/query-error.h) //////////////////////////////////////////////////////////////////////////////// enum { @@ -230,6 +231,7 @@ typedef struct TRI_vocbase_s { TRI_thread_t _synchroniser; TRI_thread_t _compactor; + struct TRI_shadow_store_s* _templates; struct TRI_shadow_store_s* _cursors; } TRI_vocbase_t; @@ -267,6 +269,12 @@ TRI_vocbase_col_t; /// @{ //////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +/// @brief checks if a collection is allowed +//////////////////////////////////////////////////////////////////////////////// + +char TRI_IsAllowedCollectionName (char const*); + //////////////////////////////////////////////////////////////////////////////// /// @brief create a new tick //////////////////////////////////////////////////////////////////////////////// diff --git a/js/system/aql-cursor.js b/js/system/aql-cursor.js index e3b4c30697..0243504851 100644 --- a/js/system/aql-cursor.js +++ b/js/system/aql-cursor.js @@ -108,7 +108,9 @@ function postCursor(req, res) { return; } - actions.actionResultOK(req, res, 201, getCursorResult(cursor)); + actions.actionResultOK(req, res, 201, getCursorResult(cursor)); + cursor = null; + result = null; } catch (e) { actions.actionResultError (req, res, 404, actions.cursorNotModified, "Cursor not created"); @@ -133,6 +135,7 @@ function putCursor(req, res) { } actions.actionResultOK(req, res, 200, getCursorResult(cursor)); + cursor = null; } catch (e) { actions.actionResultError (req, res, 404, actions.cursorNotFound, "Cursor not found"); @@ -158,6 +161,7 @@ function deleteCursor(req, res) { cursor.dispose(); actions.actionResultOK(req, res, 202, { "_id" : cursorId }); + cursor = null; } catch (e) { actions.actionResultError (req, res, 404, actions.cursorNotFound, "Cursor not found"); From 2d13901c2f4d2751d3f45cc8fc9cdebd8e4653d6 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Mon, 12 Mar 2012 18:02:46 +0100 Subject: [PATCH 7/8] fix (not yet) --- BasicsC/string-buffer.c | 54 +++- BasicsC/string-buffer.h | 1 - js/server/aql.js | 666 --------------------------------------- js/server/js-aql.h | 668 ---------------------------------------- js/server/js-json.h | 247 --------------- js/server/js-modules.h | 130 -------- js/server/js-shell.h | 89 ------ js/server/json.js | 245 --------------- js/server/modules.js | 128 -------- js/server/shell.js | 87 ------ 10 files changed, 39 insertions(+), 2276 deletions(-) delete mode 100644 js/server/aql.js delete mode 100644 js/server/js-aql.h delete mode 100644 js/server/js-json.h delete mode 100644 js/server/js-modules.h delete mode 100644 js/server/js-shell.h delete mode 100644 js/server/json.js delete mode 100644 js/server/modules.js delete mode 100644 js/server/shell.js diff --git a/BasicsC/string-buffer.c b/BasicsC/string-buffer.c index 37bebeeae7..2f30f2059a 100644 --- a/BasicsC/string-buffer.c +++ b/BasicsC/string-buffer.c @@ -59,15 +59,18 @@ static void Reserve (TRI_string_buffer_t * self, size_t size) { if (size < 1) { return; } + if (size > Remaining(self)) { self->_len = (size_t)(1.2 * (self->_len + size)); self->_buffer = TRI_Reallocate(self->_buffer, self->_len+1); memset(self->_buffer+self->_off, 0, Remaining(self)+1); + #if I_CARE_ABOUT_MALLOC_FAILURES if (NULL == self->_buffer) { abort(); } #endif + } } @@ -91,7 +94,7 @@ static void Reserve (TRI_string_buffer_t * self, size_t size) { //////////////////////////////////////////////////////////////////////////////// void TRI_InitStringBuffer (TRI_string_buffer_t * self) { - memset (self, 0, sizeof(TRI_string_buffer_t)); + memset(self, 0, sizeof(TRI_string_buffer_t)); Reserve(self, 1); } @@ -105,7 +108,7 @@ void TRI_FreeStringBuffer (TRI_string_buffer_t * self) { if (self->_buffer != NULL) { TRI_Free(self->_buffer); - memset (self, 0, sizeof(TRI_string_buffer_t)); + memset(self, 0, sizeof(TRI_string_buffer_t)); } } @@ -117,11 +120,12 @@ void TRI_FreeStringBuffer (TRI_string_buffer_t * self) { void TRI_DestroyStringBuffer (TRI_string_buffer_t * self) { if (self->_buffer != NULL) { + // somewhat paranoid? - memset(self->_buffer, 0, self->_bufferEnd - self->_buffer); + memset(self->_buffer, 0, self->_len); TRI_Free(self->_buffer); - memset (self, 0, sizeof(TRI_string_buffer_t)); + memset(self, 0, sizeof(TRI_string_buffer_t)); } } @@ -143,17 +147,17 @@ void TRI_DestroyStringBuffer (TRI_string_buffer_t * self) { //////////////////////////////////////////////////////////////////////////////// void TRI_SwapStringBuffer (TRI_string_buffer_t * self, TRI_string_buffer_t * other) { - char * otherBuffer= other->_buffer; - ptrdiff_t otherOff= other->_off; - size_t otherLen = other->_len; + char * otherBuffer = other->_buffer; + ptrdiff_t otherOff = other->_off; + size_t otherLen = other->_len; - other->_buffer = self->_buffer; - other->_off = self->_off; - other->_len = self->_len; + other->_buffer = self->_buffer; + other->_off = self->_off; + other->_len = self->_len; - self->_buffer = otherBuffer; - self->_off = otherOff; - self->_len = otherLen; + self->_buffer = otherBuffer; + self->_off = otherOff; + self->_len = otherLen; } //////////////////////////////////////////////////////////////////////////////// @@ -200,6 +204,7 @@ void TRI_ClearStringBuffer (TRI_string_buffer_t * self) { //////////////////////////////////////////////////////////////////////////////// /// @brief copies the string buffer //////////////////////////////////////////////////////////////////////////////// + void TRI_CopyStringBuffer (TRI_string_buffer_t * self, TRI_string_buffer_t const * source) { TRI_ReplaceStringStringBuffer(self, source->_buffer, source->_off); } @@ -207,6 +212,7 @@ void TRI_CopyStringBuffer (TRI_string_buffer_t * self, TRI_string_buffer_t const //////////////////////////////////////////////////////////////////////////////// /// @brief removes the first characters //////////////////////////////////////////////////////////////////////////////// + void TRI_EraseFrontStringBuffer (TRI_string_buffer_t * self, size_t len) { if (self->_off <= len) { TRI_ClearStringBuffer(self); @@ -214,13 +220,14 @@ void TRI_EraseFrontStringBuffer (TRI_string_buffer_t * self, size_t len) { else if (0 < len) { memmove(self->_buffer, self->_buffer+len, self->_off - len); self->_off -= len; - memset (self->_buffer + self->_off, 0, self->_len); + memset(self->_buffer + self->_off, 0, self->_len); } } //////////////////////////////////////////////////////////////////////////////// /// @brief replaces characters //////////////////////////////////////////////////////////////////////////////// + void TRI_ReplaceStringStringBuffer (TRI_string_buffer_t * self, char const * str, size_t len) { self->_off = 0; TRI_AppendString2StringBuffer(self, str, len); @@ -229,6 +236,7 @@ void TRI_ReplaceStringStringBuffer (TRI_string_buffer_t * self, char const * str //////////////////////////////////////////////////////////////////////////////// /// @brief replaces characters //////////////////////////////////////////////////////////////////////////////// + void TRI_ReplaceStringBufferStringBuffer (TRI_string_buffer_t * self, TRI_string_buffer_t const * text) { self->_off = 0; @@ -262,7 +270,7 @@ void TRI_AppendCharStringBuffer (TRI_string_buffer_t * self, char chr) { *(self->_buffer + self->_off) = chr; ++(self->_off); // bzero at init? - *(self->_buffer + self->_off) = '\0'; + *(self->_buffer + self->_off) = '\0'; } //////////////////////////////////////////////////////////////////////////////// @@ -282,6 +290,7 @@ void TRI_AppendStringStringBuffer (TRI_string_buffer_t * self, char const * str) //////////////////////////////////////////////////////////////////////////////// /// @brief appends characters //////////////////////////////////////////////////////////////////////////////// + void TRI_AppendString2StringBuffer (TRI_string_buffer_t * self, char const * str, size_t len) { if (len == 0) { return; @@ -296,6 +305,7 @@ void TRI_AppendString2StringBuffer (TRI_string_buffer_t * self, char const * str //////////////////////////////////////////////////////////////////////////////// /// @brief appends a string buffer //////////////////////////////////////////////////////////////////////////////// + void TRI_AppendStringBufferStringBuffer (TRI_string_buffer_t * self, TRI_string_buffer_t const * text) { TRI_AppendString2StringBuffer(self, text->_buffer, text->_off); } @@ -303,6 +313,7 @@ void TRI_AppendStringBufferStringBuffer (TRI_string_buffer_t * self, TRI_string_ //////////////////////////////////////////////////////////////////////////////// /// @brief appends a blob //////////////////////////////////////////////////////////////////////////////// + void TRI_AppendBlobStringBuffer (TRI_string_buffer_t * self, TRI_blob_t const * text) { TRI_AppendString2StringBuffer(self, text->data, text->length); } @@ -310,6 +321,7 @@ void TRI_AppendBlobStringBuffer (TRI_string_buffer_t * self, TRI_blob_t const * //////////////////////////////////////////////////////////////////////////////// /// @brief appends eol character //////////////////////////////////////////////////////////////////////////////// + void TRI_AppendEolStringBuffer (TRI_string_buffer_t * self) { TRI_AppendCharStringBuffer(self, '\n'); } @@ -334,6 +346,7 @@ void TRI_AppendEolStringBuffer (TRI_string_buffer_t * self) { //////////////////////////////////////////////////////////////////////////////// /// @brief appends integer with two digits //////////////////////////////////////////////////////////////////////////////// + void TRI_AppendInteger2StringBuffer (TRI_string_buffer_t * self, uint32_t attr) { Reserve(self, 2); @@ -345,6 +358,7 @@ void TRI_AppendInteger2StringBuffer (TRI_string_buffer_t * self, uint32_t attr) //////////////////////////////////////////////////////////////////////////////// /// @brief appends integer with three digits //////////////////////////////////////////////////////////////////////////////// + void TRI_AppendInteger3StringBuffer (TRI_string_buffer_t * self, uint32_t attr) { Reserve(self, 3); @@ -356,6 +370,7 @@ void TRI_AppendInteger3StringBuffer (TRI_string_buffer_t * self, uint32_t attr) //////////////////////////////////////////////////////////////////////////////// /// @brief appends integer with four digits //////////////////////////////////////////////////////////////////////////////// + void TRI_AppendInteger4StringBuffer (TRI_string_buffer_t * self, uint32_t attr) { Reserve(self, 4); @@ -369,6 +384,7 @@ void TRI_AppendInteger4StringBuffer (TRI_string_buffer_t * self, uint32_t attr) //////////////////////////////////////////////////////////////////////////////// /// @brief appends integer with 8 bits //////////////////////////////////////////////////////////////////////////////// + void TRI_AppendInt8StringBuffer (TRI_string_buffer_t * self, int8_t attr) { if (attr == INT8_MIN) { TRI_AppendString2StringBuffer(self, "-128", 4); @@ -393,6 +409,7 @@ void TRI_AppendInt8StringBuffer (TRI_string_buffer_t * self, int8_t attr) { //////////////////////////////////////////////////////////////////////////////// /// @brief appends unsigned integer with 8 bits //////////////////////////////////////////////////////////////////////////////// + void TRI_AppendUInt8StringBuffer (TRI_string_buffer_t * self, uint8_t attr) { Reserve(self, 3); @@ -406,6 +423,7 @@ void TRI_AppendUInt8StringBuffer (TRI_string_buffer_t * self, uint8_t attr) { //////////////////////////////////////////////////////////////////////////////// /// @brief appends integer with 16 bits //////////////////////////////////////////////////////////////////////////////// + void TRI_AppendInt16StringBuffer (TRI_string_buffer_t * self, int16_t attr) { if (attr == INT16_MIN) { TRI_AppendString2StringBuffer(self, "-32768", 6); @@ -431,6 +449,7 @@ void TRI_AppendInt16StringBuffer (TRI_string_buffer_t * self, int16_t attr) { //////////////////////////////////////////////////////////////////////////////// /// @brief appends unsigned integer with 32 bits //////////////////////////////////////////////////////////////////////////////// + void TRI_AppendUInt16StringBuffer (TRI_string_buffer_t * self, uint16_t attr) { Reserve(self, 5); @@ -445,6 +464,7 @@ void TRI_AppendUInt16StringBuffer (TRI_string_buffer_t * self, uint16_t attr) { //////////////////////////////////////////////////////////////////////////////// /// @brief appends integer with 32 bits //////////////////////////////////////////////////////////////////////////////// + void TRI_AppendInt32StringBuffer (TRI_string_buffer_t * self, int32_t attr) { if (attr == INT32_MIN) { TRI_AppendString2StringBuffer(self, "-2147483648", 11); @@ -475,6 +495,7 @@ void TRI_AppendInt32StringBuffer (TRI_string_buffer_t * self, int32_t attr) { //////////////////////////////////////////////////////////////////////////////// /// @brief appends unsigned integer with 32 bits //////////////////////////////////////////////////////////////////////////////// + void TRI_AppendUInt32StringBuffer (TRI_string_buffer_t * self, uint32_t attr) { Reserve(self, 10); @@ -495,6 +516,7 @@ void TRI_AppendUInt32StringBuffer (TRI_string_buffer_t * self, uint32_t attr) { //////////////////////////////////////////////////////////////////////////////// /// @brief appends integer with 64 bits //////////////////////////////////////////////////////////////////////////////// + void TRI_AppendInt64StringBuffer (TRI_string_buffer_t * self, int64_t attr) { if (attr == INT64_MIN) { TRI_AppendString2StringBuffer(self, "-9223372036854775808", 20); @@ -540,6 +562,7 @@ void TRI_AppendInt64StringBuffer (TRI_string_buffer_t * self, int64_t attr) { //////////////////////////////////////////////////////////////////////////////// /// @brief appends unsigned integer with 64 bits //////////////////////////////////////////////////////////////////////////////// + void TRI_AppendUInt64StringBuffer (TRI_string_buffer_t * self, uint64_t attr) { if ((attr >> 32) == 0) { TRI_AppendUInt32StringBuffer(self, (uint32_t) attr); @@ -576,6 +599,7 @@ void TRI_AppendUInt64StringBuffer (TRI_string_buffer_t * self, uint64_t attr) { //////////////////////////////////////////////////////////////////////////////// /// @brief appends size_t //////////////////////////////////////////////////////////////////////////////// + void TRI_AppendSizeStringBuffer (TRI_string_buffer_t * self, size_t attr) { #if TRI_SIZEOF_SIZE_T == 8 TRI_AppendUInt64StringBuffer(self, (uint64_t) attr); diff --git a/BasicsC/string-buffer.h b/BasicsC/string-buffer.h index 97f17c4280..148f518f9a 100644 --- a/BasicsC/string-buffer.h +++ b/BasicsC/string-buffer.h @@ -50,7 +50,6 @@ extern "C" { typedef struct TRI_string_buffer_s { char * _buffer; char * _bufferPtr; - char * _bufferEnd; ptrdiff_t _off; size_t _len; } diff --git a/js/server/aql.js b/js/server/aql.js deleted file mode 100644 index d701d7e414..0000000000 --- a/js/server/aql.js +++ /dev/null @@ -1,666 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// @brief Avocado Query Language -/// -/// @file -/// -/// DISCLAIMER -/// -/// Copyright 2010-2012 triagens GmbH, Cologne, Germany -/// -/// Licensed under the Apache License, Version 2.0 (the "License"); -/// you may not use this file except in compliance with the License. -/// You may obtain a copy of the License at -/// -/// http://www.apache.org/licenses/LICENSE-2.0 -/// -/// Unless required by applicable law or agreed to in writing, software -/// distributed under the License is distributed on an "AS IS" BASIS, -/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -/// See the License for the specific language governing permissions and -/// limitations under the License. -/// -/// Copyright holder is triAGENS GmbH, Cologne, Germany -/// -/// @author Dr. Frank Celler -/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page FluentInterface Fluent Interface -/// -/// The fluent interface for queries allows you to build simple queries -/// involving just one collection in a very natural way. -//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- FLUENT QUERY -// ----------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------- -// --SECTION-- constructors and destructors -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup AQL -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief abstract fluent query constructor -//////////////////////////////////////////////////////////////////////////////// - -function AvocadoFluentQuery2 () { - this._execution = null; - - this._skip = 0; - this._limit = null; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief fluent query constructor for abstract representation -//////////////////////////////////////////////////////////////////////////////// - -function AvocadoFluentQueryAbstract (collection, query) { - this._collection = collection; - - this._query = query; - this._current = 0; -} - -AvocadoFluentQueryAbstract.prototype = new AvocadoFluentQuery2(); -AvocadoFluentQueryAbstract.prototype.constructor = AvocadoFluentQueryAbstract; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief fluent query constructor for array representation -//////////////////////////////////////////////////////////////////////////////// - -function AvocadoFluentQueryArray (collection, documents) { - this._collection = collection; - - this._documents = documents; - this._current = 0; -} - -AvocadoFluentQueryArray.prototype = new AvocadoFluentQuery2(); -AvocadoFluentQueryArray.prototype.constructor = AvocadoFluentQueryArray; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief fluent query constructor for internal representation -//////////////////////////////////////////////////////////////////////////////// - -function AvocadoFluentQueryInternal (collection) { - this._collection = collection; - - this._query = null; - - this._select = null; - this._joins = null; - this._where = null; -} - -AvocadoFluentQueryInternal.prototype = new AvocadoFluentQuery2(); -AvocadoFluentQueryInternal.prototype.constructor = AvocadoFluentQueryInternal; - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- FLUENT QUERY -// ----------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------- -// --SECTION-- public functions -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup AQL -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief limits an existing query -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQuery2.prototype.limit = function (limit) { - var copy; - - if (this._execution != null) { - throw "query is already executing"; - } - - if (limit == 0) { - return new AvocadoFluentQueryArray(this._collection, []); - } - - copy = this.copyQuery(); - - if (limit == null || copy._limit == 0) { - return copy; - } - - if (copy._limit == null) { - copy._limit = limit; - } - else if (0 < limit) { - if (0 < copy._limit && limit < copy._limit) { - copy._limit = limit; - } - else if (copy._limit < 0) { - copy = new AvocadoFluentQueryArray(copy._collection, copy.toArray()); - - copy._limit = limit; - } - } - else { - if (copy._limit < 0 && copy._limit < limit) { - copy._limit = limit; - } - else if (0 < copy._limit) { - copy = new AvocadoFluentQueryArray(copy._collection, copy.toArray()); - - copy._limit = limit; - } - } - - return copy; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief skips an existing query -/// -/// @FUN{skip(@FA{number})} -/// -/// Skips the first @FA{number} documents. -/// -/// @verbinclude fluent31 -/// -/// The corresponding AQL queries would be: -/// -/// @verbinclude fluent31-aql -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQuery2.prototype.skip = function (skip) { - return "DELETE"; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief converts into an array -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQuery2.prototype.toArray = function () { - var cursor; - var result; - - if (this._execution != null) { - throw "query is already executing"; - } - - result = []; - - while (this.hasNext()) { - result.push(this.next()); - } - - return result; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief returns all elements -/// -/// @FUN{all()} -/// -/// Selects all documents of a collection. -/// -/// @verbinclude fluent23 -/// -/// The corresponding AQL query would be: -/// -/// @verbinclude fluent23-aql -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQuery2.prototype.all = function () { - if (this._execution != null) { - throw "query is already executing"; - } - - return this.copyQuery(); -} - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- ABSTRACT REPRESENTATION -// ----------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------- -// --SECTION-- private functions -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup AQL -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief copies an abstract fluent query -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryAbstract.prototype.copyQuery = function () { - var copy; - - copy = new AvocadoFluentQueryAbstract(this._collection, this._query.copyQuery()); - - copy._skip = this._skip; - copy._limit = this._limit; - - return copy; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief executes an abstract fluent query -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryAbstract.prototype.execute = function () { - if (this._execution == null) { - if (this._limit < 0) { - throw "limit must be non-negative"; - } - - this._execution = true; - - if (0 < this._skip) { - for (var i = 0; i < this._skip && this._query.hasNext(); ++i) { - this._query.useNext(); - } - } - - this._current = 0; - } -} - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- public functions -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup AQL -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief checks if the cursor is exhausted -/// -/// @FUN{hasNext()} -/// -/// The @FN{hasNext} operator returns @LIT{true}, if the cursor still has -/// documents. In this case the next document can be accessed using the -/// @FN{next} operator, which will advance the cursor. -/// -/// @verbinclude fluent3 -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryAbstract.prototype.hasNext = function () { - this.execute(); - - if (this._limit != null && this._limit <= this._current) { - return false; - } - - if (! this._query.hasNext()) { - this._limit = 0; - return false; - } - - return true; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief returns the next result document -/// -/// @FUN{next()} -/// -/// If the @FN{hasNext} operator returns @LIT{true}, if the cursor still has -/// documents. In this case the next document can be accessed using the @FN{next} -/// operator, which will advance the cursor. -/// -/// @verbinclude fluent28 -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryAbstract.prototype.next = function() { - this.execute(); - - if (this._limit != null) { - if (this._limit <= this._current) { - return false; - } - - ++this._limit; - } - - return this._query.next(); -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief returns the next result document -/// -/// @FUN{nextRef()} -/// -/// If the @FN{hasNext} operator returns @LIT{true}, if the cursor still has -/// documents. In this case the next document reference can be -/// accessed using the @FN{nextRef} operator, which will advance the -/// cursor. -/// -/// @verbinclude fluent51 -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryAbstract.prototype.nextRef = function() { - this.execute(); - - if (this._limit != null) { - if (this._limit <= this._current) { - return false; - } - - ++this._limit; - } - - return this._query.nextRef(); -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief uses the next document -/// -/// @FUN{useNext()} -/// -/// If the @FN{hasNext} operator returns @LIT{true}, then the cursor still has -/// documents. In this case the next document can be skipped using the -/// @FN{useNext} operator, which will advance the cursor and return @LIT{true}. -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryAbstract.prototype.useNext = function() { - this.execute(); - - if (this._limit != null) { - if (this._limit <= this._current) { - return; - } - - ++this._limit; - } - - this._query.useNext(); -} - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- ARRAY REPRESENTATION -// ----------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------- -// --SECTION-- private functions -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup AQL -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief copies an array fluent query -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryArray.prototype.copyQuery = function() { - var copy; - - copy = new AvocadoFluentQueryArray(this._collection, this._documents); - - copy._skip = this._skip; - copy._limit = this._limit; - - return copy; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief executes an array fluent query -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryArray.prototype.execute = function () { - return "DELETE"; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- public functions -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup AQL -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief checks if the cursor is exhausted -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryArray.prototype.hasNext = function () { - return "DELETE"; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief returns the next result document -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryArray.prototype.next = function() { - return "DELETE"; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief returns the next result document -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryArray.prototype.nextRef = function() { - return "DELETE"; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief uses the next document -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryArray.prototype.useNext = function() { - return "DELETE"; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- INTERNAL REPRESENTATION -// ----------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------- -// --SECTION-- private functions -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup AQL -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief copies an internal fluent query -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryInternal.prototype.copyQuery = function() { - var copy; - - copy = new AvocadoFluentQueryInternal(this._collection); - - copy._select = this._select; - copy._joins = this._joins; - copy._where = this._where; - copy._skip = this._skip; - copy._limit = this._limit; - - return copy; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief executes an internal fluent query -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryInternal.prototype.execute = function () { - if (this._execution == null) { - this._query = AQL_SELECT(this._select, - "$", - this._collection, - this._joins, - this._where, - this._skip, - this._limit); - - this._execution = this._query.execute(); - } -} - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- public functions -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup AQL -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief checks if the cursor is exhausted -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryInternal.prototype.hasNext = function () { - this.execute(); - - return this._execution.hasNext(); -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief returns the next result document -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryInternal.prototype.next = function () { - this.execute(); - - return this._execution.next(); -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief returns the next result document -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryInternal.prototype.nextRef = function () { - this.execute(); - - return this._execution.nextRef(); -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief uses the next document -//////////////////////////////////////////////////////////////////////////////// - -AvocadoFluentQueryInternal.prototype.useNext = function () { - this.execute(); - - return this._execution.useNext(); -} - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- COLLECTION -// ----------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------- -// --SECTION-- public functions -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup AQL -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief returns all elements -//////////////////////////////////////////////////////////////////////////////// - -AvocadoCollection.prototype.T_all = function () { - return "DELETE"; -} - -AvocadoEdgesCollection.prototype.T_all = AvocadoCollection.prototype.T_all; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief looks up a document -//////////////////////////////////////////////////////////////////////////////// - -AvocadoCollection.prototype.T_document = function (id) { - return "DOCUMENT"; -} - -AvocadoEdgesCollection.prototype.T_document = AvocadoCollection.prototype.T_document; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief limits an existing query -//////////////////////////////////////////////////////////////////////////////// - -AvocadoCollection.prototype.T_limit = function (limit) { - return "DELETE"; -} - -AvocadoEdgesCollection.prototype.T_limit = AvocadoCollection.prototype.T_limit; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief skips an existing query -//////////////////////////////////////////////////////////////////////////////// - -AvocadoCollection.prototype.T_skip = function (skip) { - return "DELETE"; -} - -AvocadoEdgesCollection.prototype.T_skip = AvocadoCollection.prototype.T_skip; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief converts into an array -//////////////////////////////////////////////////////////////////////////////// - -AvocadoCollection.prototype.toArray = function () { - return "DELETE"; -} - -AvocadoEdgesCollection.prototype.toArray = AvocadoCollection.prototype.toArray; - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// Local Variables: -// mode: outline-minor -// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)" -// End: diff --git a/js/server/js-aql.h b/js/server/js-aql.h deleted file mode 100644 index d65ce4c188..0000000000 --- a/js/server/js-aql.h +++ /dev/null @@ -1,668 +0,0 @@ -static string JS_server_aql = - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief Avocado Query Language\n" - "///\n" - "/// @file\n" - "///\n" - "/// DISCLAIMER\n" - "///\n" - "/// Copyright 2010-2012 triagens GmbH, Cologne, Germany\n" - "///\n" - "/// Licensed under the Apache License, Version 2.0 (the \"License\");\n" - "/// you may not use this file except in compliance with the License.\n" - "/// You may obtain a copy of the License at\n" - "///\n" - "/// http://www.apache.org/licenses/LICENSE-2.0\n" - "///\n" - "/// Unless required by applicable law or agreed to in writing, software\n" - "/// distributed under the License is distributed on an \"AS IS\" BASIS,\n" - "/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" - "/// See the License for the specific language governing permissions and\n" - "/// limitations under the License.\n" - "///\n" - "/// Copyright holder is triAGENS GmbH, Cologne, Germany\n" - "///\n" - "/// @author Dr. Frank Celler\n" - "/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @page FluentInterface Fluent Interface\n" - "///\n" - "/// The fluent interface for queries allows you to build simple queries\n" - "/// involving just one collection in a very natural way.\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- FLUENT QUERY\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- constructors and destructors\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @addtogroup AQL\n" - "/// @{\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief abstract fluent query constructor\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "function AvocadoFluentQuery2 () {\n" - " this._execution = null;\n" - "\n" - " this._skip = 0;\n" - " this._limit = null;\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief fluent query constructor for abstract representation\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "function AvocadoFluentQueryAbstract (collection, query) {\n" - " this._collection = collection;\n" - "\n" - " this._query = query;\n" - " this._current = 0;\n" - "}\n" - "\n" - "AvocadoFluentQueryAbstract.prototype = new AvocadoFluentQuery2();\n" - "AvocadoFluentQueryAbstract.prototype.constructor = AvocadoFluentQueryAbstract;\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief fluent query constructor for array representation\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "function AvocadoFluentQueryArray (collection, documents) {\n" - " this._collection = collection;\n" - "\n" - " this._documents = documents;\n" - " this._current = 0;\n" - "}\n" - "\n" - "AvocadoFluentQueryArray.prototype = new AvocadoFluentQuery2();\n" - "AvocadoFluentQueryArray.prototype.constructor = AvocadoFluentQueryArray;\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief fluent query constructor for internal representation\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "function AvocadoFluentQueryInternal (collection) {\n" - " this._collection = collection;\n" - "\n" - " this._query = null;\n" - "\n" - " this._select = null;\n" - " this._joins = null;\n" - " this._where = null;\n" - "}\n" - "\n" - "AvocadoFluentQueryInternal.prototype = new AvocadoFluentQuery2();\n" - "AvocadoFluentQueryInternal.prototype.constructor = AvocadoFluentQueryInternal;\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @}\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- FLUENT QUERY\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- public functions\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @addtogroup AQL\n" - "/// @{\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief limits an existing query\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQuery2.prototype.limit = function (limit) {\n" - " var copy;\n" - "\n" - " if (this._execution != null) {\n" - " throw \"query is already executing\";\n" - " }\n" - "\n" - " if (limit == 0) {\n" - " return new AvocadoFluentQueryArray(this._collection, []);\n" - " }\n" - "\n" - " copy = this.copyQuery();\n" - "\n" - " if (limit == null || copy._limit == 0) {\n" - " return copy;\n" - " }\n" - "\n" - " if (copy._limit == null) {\n" - " copy._limit = limit;\n" - " }\n" - " else if (0 < limit) {\n" - " if (0 < copy._limit && limit < copy._limit) {\n" - " copy._limit = limit;\n" - " }\n" - " else if (copy._limit < 0) {\n" - " copy = new AvocadoFluentQueryArray(copy._collection, copy.toArray());\n" - "\n" - " copy._limit = limit;\n" - " }\n" - " }\n" - " else {\n" - " if (copy._limit < 0 && copy._limit < limit) {\n" - " copy._limit = limit;\n" - " }\n" - " else if (0 < copy._limit) {\n" - " copy = new AvocadoFluentQueryArray(copy._collection, copy.toArray());\n" - "\n" - " copy._limit = limit;\n" - " }\n" - " }\n" - "\n" - " return copy;\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief skips an existing query\n" - "///\n" - "/// @FUN{skip(@FA{number})}\n" - "///\n" - "/// Skips the first @FA{number} documents.\n" - "///\n" - "/// @verbinclude fluent31\n" - "///\n" - "/// The corresponding AQL queries would be:\n" - "///\n" - "/// @verbinclude fluent31-aql\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQuery2.prototype.skip = function (skip) {\n" - " return \"DELETE\";\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief converts into an array\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQuery2.prototype.toArray = function () {\n" - " var cursor;\n" - " var result;\n" - "\n" - " if (this._execution != null) {\n" - " throw \"query is already executing\";\n" - " }\n" - "\n" - " result = [];\n" - "\n" - " while (this.hasNext()) {\n" - " result.push(this.next());\n" - " }\n" - "\n" - " return result;\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief returns all elements\n" - "///\n" - "/// @FUN{all()}\n" - "///\n" - "/// Selects all documents of a collection.\n" - "///\n" - "/// @verbinclude fluent23\n" - "///\n" - "/// The corresponding AQL query would be:\n" - "///\n" - "/// @verbinclude fluent23-aql\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQuery2.prototype.all = function () {\n" - " if (this._execution != null) {\n" - " throw \"query is already executing\";\n" - " }\n" - "\n" - " return this.copyQuery();\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @}\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- ABSTRACT REPRESENTATION\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- private functions\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @addtogroup AQL\n" - "/// @{\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief copies an abstract fluent query\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryAbstract.prototype.copyQuery = function () {\n" - " var copy;\n" - "\n" - " copy = new AvocadoFluentQueryAbstract(this._collection, this._query.copyQuery());\n" - "\n" - " copy._skip = this._skip;\n" - " copy._limit = this._limit;\n" - "\n" - " return copy;\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief executes an abstract fluent query\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryAbstract.prototype.execute = function () {\n" - " if (this._execution == null) {\n" - " if (this._limit < 0) {\n" - " throw \"limit must be non-negative\";\n" - " }\n" - "\n" - " this._execution = true;\n" - "\n" - " if (0 < this._skip) {\n" - " for (var i = 0; i < this._skip && this._query.hasNext(); ++i) {\n" - " this._query.useNext();\n" - " }\n" - " }\n" - "\n" - " this._current = 0;\n" - " }\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @}\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- public functions\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @addtogroup AQL\n" - "/// @{\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief checks if the cursor is exhausted\n" - "///\n" - "/// @FUN{hasNext()}\n" - "///\n" - "/// The @FN{hasNext} operator returns @LIT{true}, if the cursor still has\n" - "/// documents. In this case the next document can be accessed using the\n" - "/// @FN{next} operator, which will advance the cursor.\n" - "///\n" - "/// @verbinclude fluent3\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryAbstract.prototype.hasNext = function () {\n" - " this.execute();\n" - "\n" - " if (this._limit != null && this._limit <= this._current) {\n" - " return false;\n" - " }\n" - "\n" - " if (! this._query.hasNext()) {\n" - " this._limit = 0;\n" - " return false;\n" - " }\n" - "\n" - " return true;\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief returns the next result document\n" - "///\n" - "/// @FUN{next()}\n" - "///\n" - "/// If the @FN{hasNext} operator returns @LIT{true}, if the cursor still has\n" - "/// documents. In this case the next document can be accessed using the @FN{next}\n" - "/// operator, which will advance the cursor.\n" - "///\n" - "/// @verbinclude fluent28\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryAbstract.prototype.next = function() {\n" - " this.execute();\n" - "\n" - " if (this._limit != null) {\n" - " if (this._limit <= this._current) {\n" - " return false;\n" - " }\n" - "\n" - " ++this._limit;\n" - " }\n" - "\n" - " return this._query.next();\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief returns the next result document\n" - "///\n" - "/// @FUN{nextRef()}\n" - "///\n" - "/// If the @FN{hasNext} operator returns @LIT{true}, if the cursor still has\n" - "/// documents. In this case the next document reference can be\n" - "/// accessed using the @FN{nextRef} operator, which will advance the\n" - "/// cursor.\n" - "///\n" - "/// @verbinclude fluent51\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryAbstract.prototype.nextRef = function() {\n" - " this.execute();\n" - "\n" - " if (this._limit != null) {\n" - " if (this._limit <= this._current) {\n" - " return false;\n" - " }\n" - "\n" - " ++this._limit;\n" - " }\n" - "\n" - " return this._query.nextRef();\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief uses the next document\n" - "///\n" - "/// @FUN{useNext()}\n" - "///\n" - "/// If the @FN{hasNext} operator returns @LIT{true}, then the cursor still has\n" - "/// documents. In this case the next document can be skipped using the\n" - "/// @FN{useNext} operator, which will advance the cursor and return @LIT{true}.\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryAbstract.prototype.useNext = function() {\n" - " this.execute();\n" - "\n" - " if (this._limit != null) {\n" - " if (this._limit <= this._current) {\n" - " return;\n" - " }\n" - "\n" - " ++this._limit;\n" - " }\n" - "\n" - " this._query.useNext();\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @}\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- ARRAY REPRESENTATION\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- private functions\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @addtogroup AQL\n" - "/// @{\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief copies an array fluent query\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryArray.prototype.copyQuery = function() {\n" - " var copy;\n" - "\n" - " copy = new AvocadoFluentQueryArray(this._collection, this._documents);\n" - "\n" - " copy._skip = this._skip;\n" - " copy._limit = this._limit;\n" - "\n" - " return copy;\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief executes an array fluent query\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryArray.prototype.execute = function () {\n" - " return \"DELETE\";\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @}\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- public functions\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @addtogroup AQL\n" - "/// @{\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief checks if the cursor is exhausted\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryArray.prototype.hasNext = function () {\n" - " return \"DELETE\";\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief returns the next result document\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryArray.prototype.next = function() {\n" - " return \"DELETE\";\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief returns the next result document\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryArray.prototype.nextRef = function() {\n" - " return \"DELETE\";\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief uses the next document\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryArray.prototype.useNext = function() {\n" - " return \"DELETE\";\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @}\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- INTERNAL REPRESENTATION\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- private functions\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @addtogroup AQL\n" - "/// @{\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief copies an internal fluent query\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryInternal.prototype.copyQuery = function() {\n" - " var copy;\n" - "\n" - " copy = new AvocadoFluentQueryInternal(this._collection);\n" - "\n" - " copy._select = this._select;\n" - " copy._joins = this._joins;\n" - " copy._where = this._where;\n" - " copy._skip = this._skip;\n" - " copy._limit = this._limit;\n" - "\n" - " return copy;\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief executes an internal fluent query\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryInternal.prototype.execute = function () {\n" - " if (this._execution == null) {\n" - " this._query = AQL_SELECT(this._select,\n" - " \"$\",\n" - " this._collection,\n" - " this._joins,\n" - " this._where,\n" - " this._skip,\n" - " this._limit);\n" - "\n" - " this._execution = this._query.execute();\n" - " }\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @}\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- public functions\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @addtogroup AQL\n" - "/// @{\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief checks if the cursor is exhausted\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryInternal.prototype.hasNext = function () {\n" - " this.execute();\n" - "\n" - " return this._execution.hasNext();\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief returns the next result document\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryInternal.prototype.next = function () {\n" - " this.execute();\n" - "\n" - " return this._execution.next();\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief returns the next result document\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryInternal.prototype.nextRef = function () {\n" - " this.execute();\n" - "\n" - " return this._execution.nextRef();\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief uses the next document\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoFluentQueryInternal.prototype.useNext = function () {\n" - " this.execute();\n" - "\n" - " return this._execution.useNext();\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @}\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- COLLECTION\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- public functions\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @addtogroup AQL\n" - "/// @{\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief returns all elements\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoCollection.prototype.T_all = function () {\n" - " return \"DELETE\";\n" - "}\n" - "\n" - "AvocadoEdgesCollection.prototype.T_all = AvocadoCollection.prototype.T_all;\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief looks up a document\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoCollection.prototype.T_document = function (id) {\n" - " return \"DOCUMENT\";\n" - "}\n" - "\n" - "AvocadoEdgesCollection.prototype.T_document = AvocadoCollection.prototype.T_document;\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief limits an existing query\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoCollection.prototype.T_limit = function (limit) {\n" - " return \"DELETE\";\n" - "}\n" - "\n" - "AvocadoEdgesCollection.prototype.T_limit = AvocadoCollection.prototype.T_limit;\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief skips an existing query\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoCollection.prototype.T_skip = function (skip) {\n" - " return \"DELETE\";\n" - "}\n" - "\n" - "AvocadoEdgesCollection.prototype.T_skip = AvocadoCollection.prototype.T_skip;\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief converts into an array\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoCollection.prototype.toArray = function () {\n" - " return \"DELETE\";\n" - "}\n" - "\n" - "AvocadoEdgesCollection.prototype.toArray = AvocadoCollection.prototype.toArray;\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @}\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// Local Variables:\n" - "// mode: outline-minor\n" - "// outline-regexp: \"^\\\\(/// @brief\\\\|/// @addtogroup\\\\|// --SECTION--\\\\|/// @page\\\\|/// @}\\\\)\"\n" - "// End:\n" -; diff --git a/js/server/js-json.h b/js/server/js-json.h deleted file mode 100644 index ef28bd115c..0000000000 --- a/js/server/js-json.h +++ /dev/null @@ -1,247 +0,0 @@ -static string JS_server_json = - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief JavaScript JSON utility functions\n" - "///\n" - "/// @file\n" - "///\n" - "/// DISCLAIMER\n" - "///\n" - "/// Copyright 2010-2011 triagens GmbH, Cologne, Germany\n" - "///\n" - "/// Licensed under the Apache License, Version 2.0 (the \"License\");\n" - "/// you may not use this file except in compliance with the License.\n" - "/// You may obtain a copy of the License at\n" - "///\n" - "/// http://www.apache.org/licenses/LICENSE-2.0\n" - "///\n" - "/// Unless required by applicable law or agreed to in writing, software\n" - "/// distributed under the License is distributed on an \"AS IS\" BASIS,\n" - "/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" - "/// See the License for the specific language governing permissions and\n" - "/// limitations under the License.\n" - "///\n" - "/// Copyright holder is triAGENS GmbH, Cologne, Germany\n" - "///\n" - "/// @author Dr. Frank Celler\n" - "/// @author Copyright 2011, triAGENS GmbH, Cologne, Germany\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- AvocadoCollection\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @addtogroup V8Json\n" - "/// @{\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief string representation of a collection\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoCollection.prototype.toString = function() {\n" - " var status;\n" - "\n" - " if (this instanceof AvocadoCollection) {\n" - " status = this.status();\n" - "\n" - " if (status == 1) {\n" - " return \"[new born collection \" + JSON.stringify(this._name) + \"]\";\n" - " }\n" - " else if (status == 2) {\n" - " return \"[unloaded collection \" + JSON.stringify(this._name) + \"]\";\n" - " }\n" - " else if (status == 3) {\n" - " return \"[collection \" + JSON.stringify(this._name) + \"]\";\n" - " }\n" - " else {\n" - " return \"[corrupted collection \" + JSON.stringify(this._name) + \"]\";\n" - " }\n" - " }\n" - " else {\n" - " return \"[object]\";\n" - " }\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief JSON representation of a collection\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoCollection.prototype.toJSON = function() {\n" - " if (this instanceof AvocadoCollection) {\n" - " status = this.status();\n" - "\n" - " if (status == 1) {\n" - " return \"[new born collection \" + JSON.stringify(this._name) + \"]\";\n" - " }\n" - " else if (status == 2) {\n" - " return \"[unloaded collection \" + JSON.stringify(this._name) + \"]\";\n" - " }\n" - " else if (status == 3) {\n" - " return \"[collection \" + JSON.stringify(this._name) + \"]\";\n" - " }\n" - " else {\n" - " return \"[corrupted collection \" + JSON.stringify(this._name) + \"]\";\n" - " }\n" - " }\n" - " else {\n" - " return \"[object]\";\n" - " }\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @}\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- AvocadoDatabase\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @addtogroup V8Json\n" - "/// @{\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief string representation of a vocbase\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoDatabase.prototype.toString = function() {\n" - " if (this instanceof AvocadoDatabase) {\n" - " return \"[vocbase at \" + JSON.stringify(this._path) + \"]\";\n" - " }\n" - " else {\n" - " return \"[object]\";\n" - " }\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief JSON representation of a vocbase\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoDatabase.prototype.toJSON = function() {\n" - " if (this instanceof AvocadoDatabase) {\n" - " return \"[vocbase at \" + JSON.stringify(this._path) + \"]\";\n" - " }\n" - " else {\n" - " return \"[object]\";\n" - " }\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @}\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- AvocadoEdges\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @addtogroup V8Json\n" - "/// @{\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief string representation of a vocbase\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoEdges.prototype.toString = function() {\n" - " if (this instanceof AvocadoEdges) {\n" - " return \"[edges at \" + JSON.stringify(this._path) + \"]\";\n" - " }\n" - " else {\n" - " return \"[object]\";\n" - " }\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief JSON representation of a vocbase\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoEdges.prototype.toJSON = function() {\n" - " if (this instanceof AvocadoEdges) {\n" - " return \"[edges at \" + JSON.stringify(this._path) + \"]\";\n" - " }\n" - " else {\n" - " return \"[object]\";\n" - " }\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @}\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- AvocadoEdgesCollection\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @addtogroup V8Json\n" - "/// @{\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief string representation of an edges collection\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoEdgesCollection.prototype.toString = function() {\n" - " var status;\n" - "\n" - " if (this instanceof AvocadoEdgesCollection) {\n" - " status = this.status();\n" - "\n" - " if (status == 1) {\n" - " return \"[new born collection \" + JSON.stringify(this._name) + \"]\";\n" - " }\n" - " else if (status == 2) {\n" - " return \"[unloaded collection \" + JSON.stringify(this._name) + \"]\";\n" - " }\n" - " else if (status == 3) {\n" - " return \"[collection \" + JSON.stringify(this._name) + \"]\";\n" - " }\n" - " else {\n" - " return \"[corrupted collection \" + JSON.stringify(this._name) + \"]\";\n" - " }\n" - " }\n" - " else {\n" - " return \"[object]\";\n" - " }\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief JSON representation of an edges collection\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoEdgesCollection.prototype.toJSON = function() {\n" - " var status;\n" - "\n" - " if (this instanceof AvocadoEdgesCollection) {\n" - " status = this.status();\n" - "\n" - " if (status == 1) {\n" - " return \"[new born collection \" + JSON.stringify(this._name) + \"]\";\n" - " }\n" - " else if (status == 2) {\n" - " return \"[unloaded collection \" + JSON.stringify(this._name) + \"]\";\n" - " }\n" - " else if (status == 3) {\n" - " return \"[collection \" + JSON.stringify(this._name) + \"]\";\n" - " }\n" - " else {\n" - " return \"[corrupted collection \" + JSON.stringify(this._name) + \"]\";\n" - " }\n" - " }\n" - " else {\n" - " return \"[object]\";\n" - " }\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @}\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// Local Variables:\n" - "// mode: outline-minor\n" - "// outline-regexp: \"^\\\\(/// @brief\\\\|/// @addtogroup\\\\|// --SECTION--\\\\|/// @page\\\\|/// @}\\\\)\"\n" - "// End:\n" -; diff --git a/js/server/js-modules.h b/js/server/js-modules.h deleted file mode 100644 index 2dd70a61fa..0000000000 --- a/js/server/js-modules.h +++ /dev/null @@ -1,130 +0,0 @@ -static string JS_server_modules = - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief JavaScript server functions\n" - "///\n" - "/// @file\n" - "///\n" - "/// DISCLAIMER\n" - "///\n" - "/// Copyright 2011-2012 triagens GmbH, Cologne, Germany\n" - "///\n" - "/// Licensed under the Apache License, Version 2.0 (the \"License\");\n" - "/// you may not use this file except in compliance with the License.\n" - "/// You may obtain a copy of the License at\n" - "///\n" - "/// http://www.apache.org/licenses/LICENSE-2.0\n" - "///\n" - "/// Unless required by applicable law or agreed to in writing, software\n" - "/// distributed under the License is distributed on an \"AS IS\" BASIS,\n" - "/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" - "/// See the License for the specific language governing permissions and\n" - "/// limitations under the License.\n" - "///\n" - "/// Copyright holder is triAGENS GmbH, Cologne, Germany\n" - "///\n" - "/// @author Dr. Frank Celler\n" - "/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @page JSModuleAvocadoTOC\n" - "///\n" - "///
      \n" - "///
    1. @ref JSModuleAvocadoDefineHttpSystemAction \"avocado.defineHttpSystemAction\"
    2. \n" - "///
    \n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @page JSModuleAvocado Module \"avocado\"\n" - "///\n" - "/// The following functions are used avocadoly.\n" - "///\n" - "///
    \n" - "/// @copydoc JSModuleAvocadoTOC\n" - "///
    \n" - "///\n" - "/// @anchor JSModuleAvocadoDefineHttpSystemAction\n" - "/// @copydetails JS_DefineSystemAction\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- Module \"internal\"\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @addtogroup V8ModuleInternal\n" - "/// @{\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief internal module\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "ModuleCache[\"/internal\"].exports.db = db;\n" - "ModuleCache[\"/internal\"].exports.edges = edges;\n" - "ModuleCache[\"/internal\"].exports.AvocadoCollection = AvocadoCollection;\n" - "ModuleCache[\"/internal\"].exports.AvocadoEdgesCollection = AvocadoEdgesCollection;\n" - "\n" - "if (typeof SYS_DEFINE_ACTION === \"undefined\") {\n" - " ModuleCache[\"/internal\"].exports.defineAction = function() {\n" - " console.error(\"SYS_DEFINE_ACTION not available\");\n" - " }\n" - "}\n" - "else {\n" - " ModuleCache[\"/internal\"].exports.defineAction = SYS_DEFINE_ACTION;\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @}\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- Module \"avocado\"\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @addtogroup V8ModuleAvocado\n" - "/// @{\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief avocado module\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "ModuleCache[\"/avocado\"] = new Module(\"/avocado\");\n" - "\n" - "if (typeof defineSystemAction == \"function\") {\n" - " ModuleCache[\"/avocado\"].exports.defineHttpSystemAction = defineSystemAction;\n" - "}\n" - "\n" - "avocado = ModuleCache[\"/avocado\"].exports;\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @}\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- Module \"simple-query\"\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @addtogroup V8ModuleSimpleQuery\n" - "/// @{\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "try {\n" - " require(\"simple-query\");\n" - "}\n" - "catch (err) {\n" - " console.error(\"while loading 'simple-query' module: %s\", err);\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @}\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// Local Variables:\n" - "// mode: outline-minor\n" - "// outline-regexp: \"^\\\\(/// @brief\\\\|/// @addtogroup\\\\|// --SECTION--\\\\|/// @page\\\\|/// @}\\\\)\"\n" - "// End:\n" -; diff --git a/js/server/js-shell.h b/js/server/js-shell.h deleted file mode 100644 index d86eee8e9b..0000000000 --- a/js/server/js-shell.h +++ /dev/null @@ -1,89 +0,0 @@ -static string JS_server_shell = - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief JavaScript server functions\n" - "///\n" - "/// @file\n" - "///\n" - "/// DISCLAIMER\n" - "///\n" - "/// Copyright 2010-2011 triagens GmbH, Cologne, Germany\n" - "///\n" - "/// Licensed under the Apache License, Version 2.0 (the \"License\");\n" - "/// you may not use this file except in compliance with the License.\n" - "/// You may obtain a copy of the License at\n" - "///\n" - "/// http://www.apache.org/licenses/LICENSE-2.0\n" - "///\n" - "/// Unless required by applicable law or agreed to in writing, software\n" - "/// distributed under the License is distributed on an \"AS IS\" BASIS,\n" - "/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" - "/// See the License for the specific language governing permissions and\n" - "/// limitations under the License.\n" - "///\n" - "/// Copyright holder is triAGENS GmbH, Cologne, Germany\n" - "///\n" - "/// @author Dr. Frank Celler\n" - "/// @author Copyright 2011, triAGENS GmbH, Cologne, Germany\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "var internal = require(\"internal\");\n" - "\n" - "// -----------------------------------------------------------------------------\n" - "// --SECTION-- PRINT\n" - "// -----------------------------------------------------------------------------\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @addtogroup V8Shell\n" - "/// @{\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief prints a query\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "AvocadoCursor.prototype._PRINT = function() {\n" - " if (this instanceof AvocadoCursor) {\n" - " var count = 0;\n" - "\n" - " try {\n" - " while (this.hasNext() && count++ < queryLimit) {\n" - " internal.output(JSON.stringify(this.next()), \"\\n\");\n" - " }\n" - "\n" - " if (this.hasNext()) {\n" - " internal.output(\"...more results...\");\n" - " }\n" - "\n" - " it = this;\n" - " }\n" - " catch (e) {\n" - " internal.output(\"encountered error while printing: \" + e);\n" - " }\n" - " }\n" - " else {\n" - " internal.output(this.toString());\n" - " }\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @brief prints a shaped json\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "ShapedJson.prototype._PRINT = function(seen, path, names) {\n" - " if (this instanceof ShapedJson) {\n" - " PRINT_OBJECT(this, seen, path, names);\n" - " }\n" - " else {\n" - " internal.output(this.toString());\n" - " }\n" - "}\n" - "\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "/// @}\n" - "////////////////////////////////////////////////////////////////////////////////\n" - "\n" - "// Local Variables:\n" - "// mode: outline-minor\n" - "// outline-regexp: \"^\\\\(/// @brief\\\\|/// @addtogroup\\\\|// --SECTION--\\\\|/// @page\\\\|/// @}\\\\)\"\n" - "// End:\n" -; diff --git a/js/server/json.js b/js/server/json.js deleted file mode 100644 index 76127b3521..0000000000 --- a/js/server/json.js +++ /dev/null @@ -1,245 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// @brief JavaScript JSON utility functions -/// -/// @file -/// -/// DISCLAIMER -/// -/// Copyright 2010-2011 triagens GmbH, Cologne, Germany -/// -/// Licensed under the Apache License, Version 2.0 (the "License"); -/// you may not use this file except in compliance with the License. -/// You may obtain a copy of the License at -/// -/// http://www.apache.org/licenses/LICENSE-2.0 -/// -/// Unless required by applicable law or agreed to in writing, software -/// distributed under the License is distributed on an "AS IS" BASIS, -/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -/// See the License for the specific language governing permissions and -/// limitations under the License. -/// -/// Copyright holder is triAGENS GmbH, Cologne, Germany -/// -/// @author Dr. Frank Celler -/// @author Copyright 2011, triAGENS GmbH, Cologne, Germany -//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- AvocadoCollection -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup V8Json -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief string representation of a collection -//////////////////////////////////////////////////////////////////////////////// - -AvocadoCollection.prototype.toString = function() { - var status; - - if (this instanceof AvocadoCollection) { - status = this.status(); - - if (status == 1) { - return "[new born collection " + JSON.stringify(this._name) + "]"; - } - else if (status == 2) { - return "[unloaded collection " + JSON.stringify(this._name) + "]"; - } - else if (status == 3) { - return "[collection " + JSON.stringify(this._name) + "]"; - } - else { - return "[corrupted collection " + JSON.stringify(this._name) + "]"; - } - } - else { - return "[object]"; - } -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief JSON representation of a collection -//////////////////////////////////////////////////////////////////////////////// - -AvocadoCollection.prototype.toJSON = function() { - if (this instanceof AvocadoCollection) { - status = this.status(); - - if (status == 1) { - return "[new born collection " + JSON.stringify(this._name) + "]"; - } - else if (status == 2) { - return "[unloaded collection " + JSON.stringify(this._name) + "]"; - } - else if (status == 3) { - return "[collection " + JSON.stringify(this._name) + "]"; - } - else { - return "[corrupted collection " + JSON.stringify(this._name) + "]"; - } - } - else { - return "[object]"; - } -} - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- AvocadoDatabase -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup V8Json -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief string representation of a vocbase -//////////////////////////////////////////////////////////////////////////////// - -AvocadoDatabase.prototype.toString = function() { - if (this instanceof AvocadoDatabase) { - return "[vocbase at " + JSON.stringify(this._path) + "]"; - } - else { - return "[object]"; - } -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief JSON representation of a vocbase -//////////////////////////////////////////////////////////////////////////////// - -AvocadoDatabase.prototype.toJSON = function() { - if (this instanceof AvocadoDatabase) { - return "[vocbase at " + JSON.stringify(this._path) + "]"; - } - else { - return "[object]"; - } -} - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- AvocadoEdges -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup V8Json -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief string representation of a vocbase -//////////////////////////////////////////////////////////////////////////////// - -AvocadoEdges.prototype.toString = function() { - if (this instanceof AvocadoEdges) { - return "[edges at " + JSON.stringify(this._path) + "]"; - } - else { - return "[object]"; - } -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief JSON representation of a vocbase -//////////////////////////////////////////////////////////////////////////////// - -AvocadoEdges.prototype.toJSON = function() { - if (this instanceof AvocadoEdges) { - return "[edges at " + JSON.stringify(this._path) + "]"; - } - else { - return "[object]"; - } -} - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- AvocadoEdgesCollection -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup V8Json -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief string representation of an edges collection -//////////////////////////////////////////////////////////////////////////////// - -AvocadoEdgesCollection.prototype.toString = function() { - var status; - - if (this instanceof AvocadoEdgesCollection) { - status = this.status(); - - if (status == 1) { - return "[new born collection " + JSON.stringify(this._name) + "]"; - } - else if (status == 2) { - return "[unloaded collection " + JSON.stringify(this._name) + "]"; - } - else if (status == 3) { - return "[collection " + JSON.stringify(this._name) + "]"; - } - else { - return "[corrupted collection " + JSON.stringify(this._name) + "]"; - } - } - else { - return "[object]"; - } -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief JSON representation of an edges collection -//////////////////////////////////////////////////////////////////////////////// - -AvocadoEdgesCollection.prototype.toJSON = function() { - var status; - - if (this instanceof AvocadoEdgesCollection) { - status = this.status(); - - if (status == 1) { - return "[new born collection " + JSON.stringify(this._name) + "]"; - } - else if (status == 2) { - return "[unloaded collection " + JSON.stringify(this._name) + "]"; - } - else if (status == 3) { - return "[collection " + JSON.stringify(this._name) + "]"; - } - else { - return "[corrupted collection " + JSON.stringify(this._name) + "]"; - } - } - else { - return "[object]"; - } -} - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// Local Variables: -// mode: outline-minor -// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)" -// End: diff --git a/js/server/modules.js b/js/server/modules.js deleted file mode 100644 index 9063b0ddae..0000000000 --- a/js/server/modules.js +++ /dev/null @@ -1,128 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// @brief JavaScript server functions -/// -/// @file -/// -/// DISCLAIMER -/// -/// Copyright 2011-2012 triagens GmbH, Cologne, Germany -/// -/// Licensed under the Apache License, Version 2.0 (the "License"); -/// you may not use this file except in compliance with the License. -/// You may obtain a copy of the License at -/// -/// http://www.apache.org/licenses/LICENSE-2.0 -/// -/// Unless required by applicable law or agreed to in writing, software -/// distributed under the License is distributed on an "AS IS" BASIS, -/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -/// See the License for the specific language governing permissions and -/// limitations under the License. -/// -/// Copyright holder is triAGENS GmbH, Cologne, Germany -/// -/// @author Dr. Frank Celler -/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page JSModuleAvocadoTOC -/// -///
      -///
    1. @ref JSModuleAvocadoDefineHttpSystemAction "avocado.defineHttpSystemAction"
    2. -///
    -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page JSModuleAvocado Module "avocado" -/// -/// The following functions are used avocadoly. -/// -///
    -/// @copydoc JSModuleAvocadoTOC -///
    -/// -/// @anchor JSModuleAvocadoDefineHttpSystemAction -/// @copydetails JS_DefineSystemAction -//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- Module "internal" -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup V8ModuleInternal -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief internal module -//////////////////////////////////////////////////////////////////////////////// - -ModuleCache["/internal"].exports.db = db; -ModuleCache["/internal"].exports.edges = edges; -ModuleCache["/internal"].exports.AvocadoCollection = AvocadoCollection; -ModuleCache["/internal"].exports.AvocadoEdgesCollection = AvocadoEdgesCollection; - -if (typeof SYS_DEFINE_ACTION === "undefined") { - ModuleCache["/internal"].exports.defineAction = function() { - console.error("SYS_DEFINE_ACTION not available"); - } -} -else { - ModuleCache["/internal"].exports.defineAction = SYS_DEFINE_ACTION; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- Module "avocado" -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup V8ModuleAvocado -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief avocado module -//////////////////////////////////////////////////////////////////////////////// - -ModuleCache["/avocado"] = new Module("/avocado"); - -if (typeof defineSystemAction == "function") { - ModuleCache["/avocado"].exports.defineHttpSystemAction = defineSystemAction; -} - -avocado = ModuleCache["/avocado"].exports; - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// ----------------------------------------------------------------------------- -// --SECTION-- Module "simple-query" -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup V8ModuleSimpleQuery -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -try { - require("simple-query"); -} -catch (err) { - console.error("while loading 'simple-query' module: %s", err); -} - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// Local Variables: -// mode: outline-minor -// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)" -// End: diff --git a/js/server/shell.js b/js/server/shell.js deleted file mode 100644 index 5a21ae56d8..0000000000 --- a/js/server/shell.js +++ /dev/null @@ -1,87 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// @brief JavaScript server functions -/// -/// @file -/// -/// DISCLAIMER -/// -/// Copyright 2010-2011 triagens GmbH, Cologne, Germany -/// -/// Licensed under the Apache License, Version 2.0 (the "License"); -/// you may not use this file except in compliance with the License. -/// You may obtain a copy of the License at -/// -/// http://www.apache.org/licenses/LICENSE-2.0 -/// -/// Unless required by applicable law or agreed to in writing, software -/// distributed under the License is distributed on an "AS IS" BASIS, -/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -/// See the License for the specific language governing permissions and -/// limitations under the License. -/// -/// Copyright holder is triAGENS GmbH, Cologne, Germany -/// -/// @author Dr. Frank Celler -/// @author Copyright 2011, triAGENS GmbH, Cologne, Germany -//////////////////////////////////////////////////////////////////////////////// - -var internal = require("internal"); - -// ----------------------------------------------------------------------------- -// --SECTION-- PRINT -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup V8Shell -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief prints a query -//////////////////////////////////////////////////////////////////////////////// - -AvocadoCursor.prototype._PRINT = function() { - if (this instanceof AvocadoCursor) { - var count = 0; - - try { - while (this.hasNext() && count++ < queryLimit) { - internal.output(JSON.stringify(this.next()), "\n"); - } - - if (this.hasNext()) { - internal.output("...more results..."); - } - - it = this; - } - catch (e) { - internal.output("encountered error while printing: " + e); - } - } - else { - internal.output(this.toString()); - } -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief prints a shaped json -//////////////////////////////////////////////////////////////////////////////// - -ShapedJson.prototype._PRINT = function(seen, path, names) { - if (this instanceof ShapedJson) { - PRINT_OBJECT(this, seen, path, names); - } - else { - internal.output(this.toString()); - } -} - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// Local Variables: -// mode: outline-minor -// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)" -// End: From decb5ede0f9e2e4079f2615574c59fd960b8c216 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Tue, 13 Mar 2012 01:25:43 +0100 Subject: [PATCH 8/8] fixed layout and memory bug --- Makefile.am | 6 +- Makefile.files | 17 +- Makefile.in | 25 ++- Makefile.javascript | 2 +- RestServer/AvocadoServer.cpp | 18 +- V8Client/shell.cpp | 8 +- js/actions/{ => demo}/geo.js | 0 js/actions/{ => demo}/hallo-world.js | 0 js/{ => actions}/system/api-help.js | 0 js/{ => actions}/system/aql-cursor.js | 0 js/{ => actions}/system/aql-query.js | 0 js/{ => actions}/system/collection.js | 0 js/{ => actions}/system/collections.js | 0 js/{ => actions}/system/document.js | 0 js/{ => actions}/system/documents.js | 0 js/{ => actions}/system/front-end.js | 0 js/{ => common}/bootstrap/js-modules.h | 2 +- js/{ => common}/bootstrap/js-print.h | 2 +- js/{ => common}/bootstrap/modules.js | 0 js/{ => common}/bootstrap/print.js | 0 js/{ => common}/modules/graph.js | 0 js/{ => common}/modules/jsunity.js | 0 js/{ => common}/modules/jsunity/jsunity.js | 0 .../tests/simple-queries-geo.js} | 0 .../tests/simple-queries.js} | 0 js/server/js-server.h | 156 ++++++++++++++++++ js/{ => server}/modules/actions.js | 0 js/{ => server}/modules/simple-query.js | 0 js/server/server.js | 154 +++++++++++++++++ js/{ => server}/tests/aql-joins.js | 0 js/{ => server}/tests/aql-keywords.js | 0 js/{ => server}/tests/aql-simple.js | 0 32 files changed, 346 insertions(+), 44 deletions(-) rename js/actions/{ => demo}/geo.js (100%) rename js/actions/{ => demo}/hallo-world.js (100%) rename js/{ => actions}/system/api-help.js (100%) rename js/{ => actions}/system/aql-cursor.js (100%) rename js/{ => actions}/system/aql-query.js (100%) rename js/{ => actions}/system/collection.js (100%) rename js/{ => actions}/system/collections.js (100%) rename js/{ => actions}/system/document.js (100%) rename js/{ => actions}/system/documents.js (100%) rename js/{ => actions}/system/front-end.js (100%) rename js/{ => common}/bootstrap/js-modules.h (99%) rename js/{ => common}/bootstrap/js-print.h (99%) rename js/{ => common}/bootstrap/modules.js (100%) rename js/{ => common}/bootstrap/print.js (100%) rename js/{ => common}/modules/graph.js (100%) rename js/{ => common}/modules/jsunity.js (100%) rename js/{ => common}/modules/jsunity/jsunity.js (100%) rename js/{tests/aql_geo_tests.js => common/tests/simple-queries-geo.js} (100%) rename js/{tests/aql_tests.js => common/tests/simple-queries.js} (100%) create mode 100644 js/server/js-server.h rename js/{ => server}/modules/actions.js (100%) rename js/{ => server}/modules/simple-query.js (100%) create mode 100644 js/server/server.js rename js/{ => server}/tests/aql-joins.js (100%) rename js/{ => server}/tests/aql-keywords.js (100%) rename js/{ => server}/tests/aql-simple.js (100%) diff --git a/Makefile.am b/Makefile.am index 47ffef0ca9..5c6c670ab2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,8 +38,10 @@ sbin_PROGRAMS = avocado bin_PROGRAMS = avocsh nobase_pkgdata_DATA = \ - $(shell find @srcdir@/js/system -name "*.js" -print) \ - $(shell find @srcdir@/js/modules -name "*.js" -print) \ + $(shell find @srcdir@/js/actions/system -name "*.js" -print) \ + $(shell find @srcdir@/js/common/modules -name "*.js" -print) \ + $(shell find @srcdir@/js/server/modules -name "*.js" -print) \ + $(shell find @srcdir@/js/client/modules -name "*.js" -print) \ $(shell find @srcdir@/html -name "*.css" -print) \ $(shell find @srcdir@/html -name "*.gif" -print) \ $(shell find @srcdir@/html -name "*.html" -print) \ diff --git a/Makefile.files b/Makefile.files index f2407d1ff9..32ea4d7392 100644 --- a/Makefile.files +++ b/Makefile.files @@ -215,13 +215,10 @@ avocsh_SOURCES = \ ################################################################################ JAVASCRIPT_HEADER = \ - js/bootstrap/js-modules.h \ - js/bootstrap/js-print.h \ + js/common/bootstrap/js-modules.h \ + js/common/bootstrap/js-print.h \ js/client/js-client.h \ - js/server/js-modules.h \ - js/server/js-aql.h \ - js/server/js-json.h \ - js/server/js-shell.h + js/server/js-server.h BUILT_SOURCES += $(JAVASCRIPT_HEADER) @@ -268,8 +265,8 @@ BUILT_SOURCES += $(BISONXX_FILES) ################################################################################ DOXYGEN = \ - Doxygen/js/bootstrap/modules.c \ - Doxygen/js/bootstrap/print.c \ + Doxygen/js/common/bootstrap/modules.c \ + Doxygen/js/common/bootstrap/print.c \ Doxygen/js/modules/actions.c \ Doxygen/js/modules/graph.c \ Doxygen/js/modules/jsunity.c \ @@ -277,8 +274,8 @@ DOXYGEN = \ Doxygen/js/server/modules.c \ Doxygen/js/server/json.c \ Doxygen/js/server/shell.c \ - Doxygen/js/system/collections.c \ - Doxygen/js/system/indexes.c + Doxygen/js/actions/system/collections.c \ + Doxygen/js/actions/system/indexes.c ################################################################################ ## wiki diff --git a/Makefile.in b/Makefile.in index fd103a2364..6d4963b5be 100644 --- a/Makefile.in +++ b/Makefile.in @@ -522,8 +522,10 @@ CLEANUP = $(DOXYGEN) $(WIKI) $(subst Doxygen/xml,Doxygen/wiki,$(WIKI)) \ $(JAVASCRIPT_HEADER) $(am__append_1) $(am__append_2) noinst_LIBRARIES = libavocado.a nobase_pkgdata_DATA = \ - $(shell find @srcdir@/js/system -name "*.js" -print) \ - $(shell find @srcdir@/js/modules -name "*.js" -print) \ + $(shell find @srcdir@/js/actions/system -name "*.js" -print) \ + $(shell find @srcdir@/js/common/modules -name "*.js" -print) \ + $(shell find @srcdir@/js/server/modules -name "*.js" -print) \ + $(shell find @srcdir@/js/client/modules -name "*.js" -print) \ $(shell find @srcdir@/html -name "*.css" -print) \ $(shell find @srcdir@/html -name "*.gif" -print) \ $(shell find @srcdir@/html -name "*.html" -print) \ @@ -737,13 +739,10 @@ avocsh_SOURCES = \ ################################################################################ ################################################################################ JAVASCRIPT_HEADER = \ - js/bootstrap/js-modules.h \ - js/bootstrap/js-print.h \ + js/common/bootstrap/js-modules.h \ + js/common/bootstrap/js-print.h \ js/client/js-client.h \ - js/server/js-modules.h \ - js/server/js-aql.h \ - js/server/js-json.h \ - js/server/js-shell.h + js/server/js-server.h ################################################################################ @@ -775,8 +774,8 @@ BISONXX_FILES = \ ################################################################################ ################################################################################ DOXYGEN = \ - Doxygen/js/bootstrap/modules.c \ - Doxygen/js/bootstrap/print.c \ + Doxygen/js/common/bootstrap/modules.c \ + Doxygen/js/common/bootstrap/print.c \ Doxygen/js/modules/actions.c \ Doxygen/js/modules/graph.c \ Doxygen/js/modules/jsunity.c \ @@ -784,8 +783,8 @@ DOXYGEN = \ Doxygen/js/server/modules.c \ Doxygen/js/server/json.c \ Doxygen/js/server/shell.c \ - Doxygen/js/system/collections.c \ - Doxygen/js/system/indexes.c + Doxygen/js/actions/system/collections.c \ + Doxygen/js/actions/system/indexes.c ################################################################################ @@ -2430,7 +2429,7 @@ wiki: $(WIKI) js/js-%.h: @srcdir@/js/%.js .setup-directories @top_srcdir@/config/js2c.sh $< > $@ -js/bootstrap/js-%.h: @srcdir@/js/bootstrap/%.js .setup-directories +js/common/bootstrap/js-%.h: @srcdir@/js/common/bootstrap/%.js .setup-directories @top_srcdir@/config/js2c.sh $< > $@ js/client/js-%.h: @srcdir@/js/client/%.js .setup-directories diff --git a/Makefile.javascript b/Makefile.javascript index c743c8953b..4f0e5f87af 100644 --- a/Makefile.javascript +++ b/Makefile.javascript @@ -16,7 +16,7 @@ BUILT_SOURCES += .setup-directories js/js-%.h: @srcdir@/js/%.js .setup-directories @top_srcdir@/config/js2c.sh $< > $@ -js/bootstrap/js-%.h: @srcdir@/js/bootstrap/%.js .setup-directories +js/common/bootstrap/js-%.h: @srcdir@/js/common/bootstrap/%.js .setup-directories @top_srcdir@/config/js2c.sh $< > $@ js/client/js-%.h: @srcdir@/js/client/%.js .setup-directories diff --git a/RestServer/AvocadoServer.cpp b/RestServer/AvocadoServer.cpp index 141421d324..a96c9145da 100644 --- a/RestServer/AvocadoServer.cpp +++ b/RestServer/AvocadoServer.cpp @@ -65,12 +65,9 @@ using namespace triagens::rest; using namespace triagens::admin; using namespace triagens::avocado; -#include "js/bootstrap/js-modules.h" -#include "js/bootstrap/js-print.h" -#include "js/server/js-aql.h" -#include "js/server/js-json.h" -#include "js/server/js-modules.h" -#include "js/server/js-shell.h" +#include "js/common/bootstrap/js-modules.h" +#include "js/common/bootstrap/js-print.h" +#include "js/server/js-server.h" // ----------------------------------------------------------------------------- // --SECTION-- private variables @@ -372,12 +369,9 @@ void AvocadoServer::buildApplicationServer () { if (_startupPath.empty()) { LOGGER_INFO << "using built-in JavaScript startup files"; - StartupLoader.defineScript("bootstrap/modules.js", JS_bootstrap_modules); - StartupLoader.defineScript("bootstrap/print.js", JS_bootstrap_print); - StartupLoader.defineScript("server/modules.js", JS_server_modules); - StartupLoader.defineScript("server/aql.js", JS_server_aql); - StartupLoader.defineScript("server/json.js", JS_server_json); - StartupLoader.defineScript("server/shell.js", JS_server_shell); + StartupLoader.defineScript("common/bootstrap/modules.js", JS_common_bootstrap_modules); + StartupLoader.defineScript("common/bootstrap/print.js", JS_common_bootstrap_print); + StartupLoader.defineScript("server/server.js", JS_server_server); } else { LOGGER_INFO << "using JavaScript startup files at '" << _startupPath << "'"; diff --git a/V8Client/shell.cpp b/V8Client/shell.cpp index b61842a507..bab7b21ce0 100644 --- a/V8Client/shell.cpp +++ b/V8Client/shell.cpp @@ -54,8 +54,8 @@ using namespace triagens::httpclient; using namespace triagens::v8client; using namespace triagens::avocado; -#include "js/bootstrap/js-print.h" -#include "js/bootstrap/js-modules.h" +#include "js/common/bootstrap/js-print.h" +#include "js/common/bootstrap/js-modules.h" #include "js/client/js-client.h" // ----------------------------------------------------------------------------- @@ -950,8 +950,8 @@ int main (int argc, char* argv[]) { // load java script from js/bootstrap/*.h files if (StartupPath.empty()) { - StartupLoader.defineScript("bootstrap/modules.js", JS_bootstrap_modules); - StartupLoader.defineScript("bootstrap/print.js", JS_bootstrap_print); + StartupLoader.defineScript("common/bootstrap/modules.js", JS_common_bootstrap_modules); + StartupLoader.defineScript("common/bootstrap/print.js", JS_common_bootstrap_print); StartupLoader.defineScript("client/client.js", JS_client_client); } else { diff --git a/js/actions/geo.js b/js/actions/demo/geo.js similarity index 100% rename from js/actions/geo.js rename to js/actions/demo/geo.js diff --git a/js/actions/hallo-world.js b/js/actions/demo/hallo-world.js similarity index 100% rename from js/actions/hallo-world.js rename to js/actions/demo/hallo-world.js diff --git a/js/system/api-help.js b/js/actions/system/api-help.js similarity index 100% rename from js/system/api-help.js rename to js/actions/system/api-help.js diff --git a/js/system/aql-cursor.js b/js/actions/system/aql-cursor.js similarity index 100% rename from js/system/aql-cursor.js rename to js/actions/system/aql-cursor.js diff --git a/js/system/aql-query.js b/js/actions/system/aql-query.js similarity index 100% rename from js/system/aql-query.js rename to js/actions/system/aql-query.js diff --git a/js/system/collection.js b/js/actions/system/collection.js similarity index 100% rename from js/system/collection.js rename to js/actions/system/collection.js diff --git a/js/system/collections.js b/js/actions/system/collections.js similarity index 100% rename from js/system/collections.js rename to js/actions/system/collections.js diff --git a/js/system/document.js b/js/actions/system/document.js similarity index 100% rename from js/system/document.js rename to js/actions/system/document.js diff --git a/js/system/documents.js b/js/actions/system/documents.js similarity index 100% rename from js/system/documents.js rename to js/actions/system/documents.js diff --git a/js/system/front-end.js b/js/actions/system/front-end.js similarity index 100% rename from js/system/front-end.js rename to js/actions/system/front-end.js diff --git a/js/bootstrap/js-modules.h b/js/common/bootstrap/js-modules.h similarity index 99% rename from js/bootstrap/js-modules.h rename to js/common/bootstrap/js-modules.h index 4ad7b0e752..87bee0edb4 100644 --- a/js/bootstrap/js-modules.h +++ b/js/common/bootstrap/js-modules.h @@ -1,4 +1,4 @@ -static string JS_bootstrap_modules = +static string JS_common_bootstrap_modules = "////////////////////////////////////////////////////////////////////////////////\n" "/// @brief JavaScript server functions\n" "///\n" diff --git a/js/bootstrap/js-print.h b/js/common/bootstrap/js-print.h similarity index 99% rename from js/bootstrap/js-print.h rename to js/common/bootstrap/js-print.h index c538344a55..1e62bbb465 100644 --- a/js/bootstrap/js-print.h +++ b/js/common/bootstrap/js-print.h @@ -1,4 +1,4 @@ -static string JS_bootstrap_print = +static string JS_common_bootstrap_print = "////////////////////////////////////////////////////////////////////////////////\n" "/// @brief printing\n" "///\n" diff --git a/js/bootstrap/modules.js b/js/common/bootstrap/modules.js similarity index 100% rename from js/bootstrap/modules.js rename to js/common/bootstrap/modules.js diff --git a/js/bootstrap/print.js b/js/common/bootstrap/print.js similarity index 100% rename from js/bootstrap/print.js rename to js/common/bootstrap/print.js diff --git a/js/modules/graph.js b/js/common/modules/graph.js similarity index 100% rename from js/modules/graph.js rename to js/common/modules/graph.js diff --git a/js/modules/jsunity.js b/js/common/modules/jsunity.js similarity index 100% rename from js/modules/jsunity.js rename to js/common/modules/jsunity.js diff --git a/js/modules/jsunity/jsunity.js b/js/common/modules/jsunity/jsunity.js similarity index 100% rename from js/modules/jsunity/jsunity.js rename to js/common/modules/jsunity/jsunity.js diff --git a/js/tests/aql_geo_tests.js b/js/common/tests/simple-queries-geo.js similarity index 100% rename from js/tests/aql_geo_tests.js rename to js/common/tests/simple-queries-geo.js diff --git a/js/tests/aql_tests.js b/js/common/tests/simple-queries.js similarity index 100% rename from js/tests/aql_tests.js rename to js/common/tests/simple-queries.js diff --git a/js/server/js-server.h b/js/server/js-server.h new file mode 100644 index 0000000000..222c2e676a --- /dev/null +++ b/js/server/js-server.h @@ -0,0 +1,156 @@ +static string JS_server_server = + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @brief JavaScript server functions\n" + "///\n" + "/// @file\n" + "///\n" + "/// DISCLAIMER\n" + "///\n" + "/// Copyright 2011-2012 triagens GmbH, Cologne, Germany\n" + "///\n" + "/// Licensed under the Apache License, Version 2.0 (the \"License\");\n" + "/// you may not use this file except in compliance with the License.\n" + "/// You may obtain a copy of the License at\n" + "///\n" + "/// http://www.apache.org/licenses/LICENSE-2.0\n" + "///\n" + "/// Unless required by applicable law or agreed to in writing, software\n" + "/// distributed under the License is distributed on an \"AS IS\" BASIS,\n" + "/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" + "/// See the License for the specific language governing permissions and\n" + "/// limitations under the License.\n" + "///\n" + "/// Copyright holder is triAGENS GmbH, Cologne, Germany\n" + "///\n" + "/// @author Dr. Frank Celler\n" + "/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @page JSModuleAvocadoTOC\n" + "///\n" + "///
      \n" + "///
    1. @ref JSModuleAvocadoDefineHttpSystemAction \"avocado.defineHttpSystemAction\"
    2. \n" + "///
    \n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @page JSModuleAvocado Module \"avocado\"\n" + "///\n" + "/// The following functions are used avocadoly.\n" + "///\n" + "///
    \n" + "/// @copydoc JSModuleAvocadoTOC\n" + "///
    \n" + "///\n" + "/// @anchor JSModuleAvocadoDefineHttpSystemAction\n" + "/// @copydetails JS_DefineSystemAction\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "// -----------------------------------------------------------------------------\n" + "// --SECTION-- Module \"internal\"\n" + "// -----------------------------------------------------------------------------\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @addtogroup V8ModuleInternal\n" + "/// @{\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @brief internal module\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "ModuleCache[\"/internal\"].exports.db = db;\n" + "ModuleCache[\"/internal\"].exports.edges = edges;\n" + "ModuleCache[\"/internal\"].exports.AvocadoCollection = AvocadoCollection;\n" + "ModuleCache[\"/internal\"].exports.AvocadoEdgesCollection = AvocadoEdgesCollection;\n" + "\n" + "if (typeof SYS_DEFINE_ACTION === \"undefined\") {\n" + " ModuleCache[\"/internal\"].exports.defineAction = function() {\n" + " console.error(\"SYS_DEFINE_ACTION not available\");\n" + " }\n" + "}\n" + "else {\n" + " ModuleCache[\"/internal\"].exports.defineAction = SYS_DEFINE_ACTION;\n" + "}\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @}\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "// -----------------------------------------------------------------------------\n" + "// --SECTION-- Module \"avocado\"\n" + "// -----------------------------------------------------------------------------\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @addtogroup V8ModuleAvocado\n" + "/// @{\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @brief avocado module\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "ModuleCache[\"/avocado\"] = new Module(\"/avocado\");\n" + "\n" + "if (typeof defineSystemAction == \"function\") {\n" + " ModuleCache[\"/avocado\"].exports.defineHttpSystemAction = defineSystemAction;\n" + "}\n" + "\n" + "avocado = ModuleCache[\"/avocado\"].exports;\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @}\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "// -----------------------------------------------------------------------------\n" + "// --SECTION-- Module \"simple-query\"\n" + "// -----------------------------------------------------------------------------\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @addtogroup V8ModuleSimpleQuery\n" + "/// @{\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "try {\n" + " require(\"simple-query\");\n" + "}\n" + "catch (err) {\n" + " console.error(\"while loading 'simple-query' module: %s\", err);\n" + "}\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @}\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "// -----------------------------------------------------------------------------\n" + "// --SECTION-- PRINT\n" + "// -----------------------------------------------------------------------------\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @addtogroup V8Shell\n" + "/// @{\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @brief prints a shaped json\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "ShapedJson.prototype._PRINT = function(seen, path, names) {\n" + " if (this instanceof ShapedJson) {\n" + " PRINT_OBJECT(this, seen, path, names);\n" + " }\n" + " else {\n" + " internal.output(this.toString());\n" + " }\n" + "}\n" + "\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "/// @}\n" + "////////////////////////////////////////////////////////////////////////////////\n" + "\n" + "// Local Variables:\n" + "// mode: outline-minor\n" + "// outline-regexp: \"^\\\\(/// @brief\\\\|/// @addtogroup\\\\|// --SECTION--\\\\|/// @page\\\\|/// @}\\\\)\"\n" + "// End:\n" +; diff --git a/js/modules/actions.js b/js/server/modules/actions.js similarity index 100% rename from js/modules/actions.js rename to js/server/modules/actions.js diff --git a/js/modules/simple-query.js b/js/server/modules/simple-query.js similarity index 100% rename from js/modules/simple-query.js rename to js/server/modules/simple-query.js diff --git a/js/server/server.js b/js/server/server.js new file mode 100644 index 0000000000..5aff8d45e4 --- /dev/null +++ b/js/server/server.js @@ -0,0 +1,154 @@ +//////////////////////////////////////////////////////////////////////////////// +/// @brief JavaScript server functions +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2011-2012 triagens GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Dr. Frank Celler +/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page JSModuleAvocadoTOC +/// +///
      +///
    1. @ref JSModuleAvocadoDefineHttpSystemAction "avocado.defineHttpSystemAction"
    2. +///
    +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @page JSModuleAvocado Module "avocado" +/// +/// The following functions are used avocadoly. +/// +///
    +/// @copydoc JSModuleAvocadoTOC +///
    +/// +/// @anchor JSModuleAvocadoDefineHttpSystemAction +/// @copydetails JS_DefineSystemAction +//////////////////////////////////////////////////////////////////////////////// + +// ----------------------------------------------------------------------------- +// --SECTION-- Module "internal" +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup V8ModuleInternal +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief internal module +//////////////////////////////////////////////////////////////////////////////// + +ModuleCache["/internal"].exports.db = db; +ModuleCache["/internal"].exports.edges = edges; +ModuleCache["/internal"].exports.AvocadoCollection = AvocadoCollection; +ModuleCache["/internal"].exports.AvocadoEdgesCollection = AvocadoEdgesCollection; + +if (typeof SYS_DEFINE_ACTION === "undefined") { + ModuleCache["/internal"].exports.defineAction = function() { + console.error("SYS_DEFINE_ACTION not available"); + } +} +else { + ModuleCache["/internal"].exports.defineAction = SYS_DEFINE_ACTION; +} + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +// ----------------------------------------------------------------------------- +// --SECTION-- Module "avocado" +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup V8ModuleAvocado +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief avocado module +//////////////////////////////////////////////////////////////////////////////// + +ModuleCache["/avocado"] = new Module("/avocado"); + +if (typeof defineSystemAction == "function") { + ModuleCache["/avocado"].exports.defineHttpSystemAction = defineSystemAction; +} + +avocado = ModuleCache["/avocado"].exports; + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +// ----------------------------------------------------------------------------- +// --SECTION-- Module "simple-query" +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup V8ModuleSimpleQuery +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +try { + require("simple-query"); +} +catch (err) { + console.error("while loading 'simple-query' module: %s", err); +} + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +// ----------------------------------------------------------------------------- +// --SECTION-- PRINT +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup V8Shell +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief prints a shaped json +//////////////////////////////////////////////////////////////////////////////// + +ShapedJson.prototype._PRINT = function(seen, path, names) { + if (this instanceof ShapedJson) { + PRINT_OBJECT(this, seen, path, names); + } + else { + internal.output(this.toString()); + } +} + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +// Local Variables: +// mode: outline-minor +// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)" +// End: diff --git a/js/tests/aql-joins.js b/js/server/tests/aql-joins.js similarity index 100% rename from js/tests/aql-joins.js rename to js/server/tests/aql-joins.js diff --git a/js/tests/aql-keywords.js b/js/server/tests/aql-keywords.js similarity index 100% rename from js/tests/aql-keywords.js rename to js/server/tests/aql-keywords.js diff --git a/js/tests/aql-simple.js b/js/server/tests/aql-simple.js similarity index 100% rename from js/tests/aql-simple.js rename to js/server/tests/aql-simple.js