1
0
Fork 0

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

This commit is contained in:
a-brandt 2012-10-17 10:28:43 +02:00
commit 33a463e4d1
29 changed files with 3250 additions and 339 deletions

View File

@ -8,10 +8,32 @@ v1.1.beta1 (2012-XX-XX)
- In 1.1, we have introduced types for collections: regular documents go into document
collections, and edges go into edge collections. The prefixing (db.xxx vs. edges.xxx)
is gone in 1.1. edges.xxx can still be used to access collections, however, it will
not determine the collection type anymore. To create an edge collection 1.1, you can
use db._createEdgeCollection(). And there's also db._createDocumentCollection().
db._create() is also still there and will create a document collection.
works slightly different in 1.1: edges.xxx can still be used to access collections,
however, it will not determine the type of existing collections anymore. To create an
edge collection 1.1, you can use db._createEdgeCollection() or edges._create().
And there's of course also db._createDocumentCollection().
db._create() is also still there and will create a document collection by default,
whereas edges._create() will create an edge collection.
* the server now handles requests with invalid Content-Length header values as follows:
- if Content-Length is negative, the server will respond instantly with HTTP 411
(length required)
- if Content-Length is positive but shorter than the supplied body, the server will
respond with HTTP 400 (bad request)
- if Content-Length is positive but longer than the supplied body, the server will
wait for the client to send the missing bytes. The server allows 90 seconds for this
and will close the connection if the client does not send the remaining data
- if Content-Length is bigger than the maximum allowed size (512 MB), the server will
fail with HTTP 413 (request entitiy too large).
- if the length of the HTTP headers is greated than the maximum allowed size (1 MB),
the server will fail with HTTP 431 (request header fields too large)
* reduced size of hash index elements by 50 %, allowing more index elements to fit in
memory
* issue #235: GUI Shell throws Error:ReferenceError: db is not defined

View File

@ -35,6 +35,7 @@ WIKI = \
ArangoErrors \
CommandLine \
Compiling \
Communication \
DbaManual \
DbaManualBasics \
DbaManualAuthentication \

View File

@ -219,7 +219,7 @@ ALIASES = \
"EXAMPLE{2}=@latexonly\renewcommand{\examplecap}{\2}\setboolean{hascap}{true}@endlatexonly@verbinclude \1@latexonly\setboolean{hascap}{false}@endlatexonly" \
"TINYEXAMPLE{2}=@latexonly\renewcommand{\examplecap}{\2}\setboolean{hascap}{true}\renewcommand{\examplesize}{\tiny}@endlatexonly@verbinclude \1@latexonly\setboolean{hascap}{false}\renewcommand{\examplesize}{\ttfamily}@endlatexonly" \
"VERSION=@PACKAGE_VERSION@" \
"EMBEDTOC{1}=@if LATEX@else<hr>@copydoc \1<hr>@endif" \
"EMBEDTOC{1}=@if LATEX@else<hr>@copydoc \1\n<hr>@endif" \
"RESTHEADER{2}=@if LATEX@latexonly \vskip 0.5em\colorbox{gray}{@endlatexonly\1 (\2)@latexonly}\vskip 1em@endlatexonly@else <hr><em>\1</em> (\2)<hr><br>@endif" \
"LATEXBREAK=@latexonly\vskip -0.5em\hskip 1.0em@endlatexonly" \
"EXTREF{2}=@if LATEX \2 (see @latexonly \url{\1}@endlatexonly)@else<a href= \1>\2</a>@endif" \

View File

@ -0,0 +1,92 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief explanation for ArangoDB's HTTP handling
///
/// @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 Jan Steemann
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @page Communication HTTP Handling in ArangoDB
///
/// ArangoDB will always respond to client requests with HTTP 1.1. Clients should
/// therefore support HTTP version 1.1.
///
/// ArangoDB supports HTTP keep-alive. If the client does not send a @LIT{Connection}
/// header in its request, ArangoDB will assume the client wants to keep alive the
/// connection. If clients do not wish to use the keep-alive feature, they should
/// explicitly indicate that by sending a @LIT{Connection: Close} HTTP header in
/// the request.
///
/// Client authentication is done by using the @LIT{Authorization} HTTP header.
/// ArangoDB supports Basic authentication.
///
/// Authentication is optional if the server has been started with the option
/// @LIT{--server.disable-authentication}.
///
/// The following should be noted about how ArangoDB handles client errors in its
/// HTTP layer:
///
/// - ArangoDB will reject client requests with a negative value in the @LIT{Content-Length}
/// request header with @LIT{HTTP 411} (Length Required).
///
/// - if the client sends a @LIT{Content-Length} header with a value bigger than 0
/// for an HTTP GET, HEAD, or DELETE request, ArangoDB will process the request,
/// but will write a warning to its log file.
///
/// - when the client sends a @LIT{Content-Length} header that has a value that
/// is lower than the actual size of the body sent, ArangoDB will respond with
/// @LIT{HTTP 400} (Bad Request).
///
/// - if clients send a @LIT{Content-Length} value bigger than the actual size of the
/// body of the request, ArangoDB will wait for about 90 seconds for the client to
/// complete its request. If the client does not send the remaining body data within
/// this time, ArangoDB will close the connection.
///
/// - when clients send a body or a @LIT{Content-Length} value bigger than the maximum
/// allowed value (512 MB), ArangoDB will respond with @LIT{HTTP 413} (Request Entity
/// Too Large).
///
/// - if the overall length of the HTTP headers a client sends for one request exceeds
/// the maximum allowed size (1 MB), the server will fail with @LIT{HTTP 431}
/// (Request Header Fields Too Large).
///
/// - if clients request a HTTP method that is not supported by the server, ArangoDB
/// will return with @LIT{HTTP 405} (Method Not Allowed). Generally supported methods
/// are:
/// - GET
/// - POST
/// - PUT
/// - DELETE
/// - HEAD
/// - PATCH
///
/// Please note that not all server actions allow using all of these HTTP methods.
/// You should look up up the supported methods for each method you intend to use
/// in the manual.
////////////////////////////////////////////////////////////////////////////////
// Local Variables:
// mode: c++
// mode: outline-minor
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)"
// End:

View File

@ -45,6 +45,7 @@
/// <li>@ref HttpBatch</li>
/// <li>@ref HttpImport</li>
/// <li>@ref ArangoErrors</li>
/// <li>@ref Communication</li>
/// <li>@ref Glossary</li>
/// </ul>
/// @else
@ -76,6 +77,7 @@
/// </li>
/// <li>Advanced Topics
/// <ul>
/// <li>@ref Communication</li>
/// <li>@ref ArangoErrors</li>
/// </ul>
/// </li>

View File

@ -35,7 +35,37 @@
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- forward declared private functions
// --SECTION-- private defines
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief size of a cache line, in bytes
/// the memory acquired for the hash table is aligned to a multiple of this
/// value
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup HashArray
/// @{
////////////////////////////////////////////////////////////////////////////////
#define CACHE_LINE_SIZE 64
////////////////////////////////////////////////////////////////////////////////
/// @brief initial preallocation size of the hash table when the table is
/// first created
/// setting this to a high value will waste memory but reduce the number of
/// reallocations/repositionings necessary when the table grows
////////////////////////////////////////////////////////////////////////////////
#define INITIAL_SIZE 256
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- private functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
@ -43,11 +73,116 @@
/// @{
////////////////////////////////////////////////////////////////////////////////
static bool ResizeHashArray (TRI_hasharray_t*);
static bool ResizeHashArrayMulti (TRI_hasharray_t*);
////////////////////////////////////////////////////////////////////////////////
/// @brief adds a new element
////////////////////////////////////////////////////////////////////////////////
static void AddNewElement (TRI_hasharray_t* array, void* element) {
uint64_t hash;
uint64_t i;
// ...........................................................................
// compute the hash
// ...........................................................................
hash = IndexStaticHashElement(array, element);
// ...........................................................................
// search the table
// ...........................................................................
i = hash % array->_nrAlloc;
while (! IndexStaticIsEmptyElement(array, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesR++;
#endif
}
// ...........................................................................
// add a new element to the associative array
// memcpy ok here since are simply moving array items internally
// ...........................................................................
memcpy(array->_table + i * array->_elementSize, element, array->_elementSize);
array->_nrUsed++;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief allocate memory for the hash table
////////////////////////////////////////////////////////////////////////////////
static bool AllocateTable (TRI_hasharray_t* array, size_t numElements) {
char* data;
char* table;
size_t offset;
data = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, CACHE_LINE_SIZE + (array->_elementSize * numElements), true);
if (data == NULL) {
return false;
}
// position array directly on a cache line boundary
offset = ((uint64_t) data) % CACHE_LINE_SIZE;
if (offset == 0) {
// we're already on a cache line boundary
table = array->_data;
}
else {
// move to start of a cache line
table = data + (CACHE_LINE_SIZE - offset);
}
assert(((uint64_t) table) % CACHE_LINE_SIZE == 0);
array->_data = data;
array->_table = table;
array->_nrAlloc = numElements;
return true;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief resizes the array
////////////////////////////////////////////////////////////////////////////////
static bool ResizeHashArray (TRI_hasharray_t* array) {
char* oldData;
char* oldTable;
uint64_t oldAlloc;
uint64_t j;
oldData = array->_data;
oldTable = array->_table;
oldAlloc = array->_nrAlloc;
if (! AllocateTable(array, 2 * array->_nrAlloc + 1)) {
return false;
}
array->_nrUsed = 0;
#ifdef TRI_INTERNAL_STATS
array->_nrResizes++;
#endif
for (j = 0; j < oldAlloc; j++) {
if (! IndexStaticIsEmptyElement(array, oldTable + j * array->_elementSize)) {
AddNewElement(array, oldTable + j * array->_elementSize);
}
}
TRI_Free(TRI_UNKNOWN_MEM_ZONE, oldData);
return true;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief resizes the array
////////////////////////////////////////////////////////////////////////////////
static bool ResizeHashArrayMulti (TRI_hasharray_t* array) {
return ResizeHashArray(array);
}
////////////////////////////////////////////////////////////////////////////////
/// @}
@ -67,6 +202,7 @@ static bool ResizeHashArrayMulti (TRI_hasharray_t*);
////////////////////////////////////////////////////////////////////////////////
bool TRI_InitHashArray (TRI_hasharray_t* array,
size_t initialDocumentCount,
size_t numFields,
size_t elementSize,
uint64_t (*hashKey) (TRI_hasharray_t*, void*),
@ -76,6 +212,8 @@ bool TRI_InitHashArray (TRI_hasharray_t* array,
bool (*isEqualKeyElement) (TRI_hasharray_t*, void*, void*),
bool (*isEqualElementElement) (TRI_hasharray_t*, void*, void*)) {
size_t initialSize;
// ...........................................................................
// Assign the callback functions
// ...........................................................................
@ -91,27 +229,26 @@ bool TRI_InitHashArray (TRI_hasharray_t* array,
array->_elementSize = elementSize;
array->_table = NULL;
// set initial allocation size to 256 elements
array->_nrAlloc = 256;
if (initialDocumentCount > 0) {
// use initial document count provided as initial size
initialSize = (size_t) (2.5 * initialDocumentCount);
}
else {
initialSize = INITIAL_SIZE;
}
if (! AllocateTable(array, initialSize)) {
return false;
}
// ...........................................................................
// allocate storage for the hash array
// ...........................................................................
array->_table = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, array->_elementSize * array->_nrAlloc, true);
if (array->_table == NULL) {
array->_nrAlloc = 0;
return false;
}
// ...........................................................................
// Go through and 'zero' (clear) each item in the hash array
// ...........................................................................
array->_nrUsed = 0;
#ifdef TRI_INTERNAL_STATS
array->_nrFinds = 0;
array->_nrAdds = 0;
array->_nrRems = 0;
@ -120,12 +257,11 @@ bool TRI_InitHashArray (TRI_hasharray_t* array,
array->_nrProbesA = 0;
array->_nrProbesD = 0;
array->_nrProbesR = 0;
#endif
return true;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief destroys an array, but does not free the pointer
////////////////////////////////////////////////////////////////////////////////
@ -135,7 +271,6 @@ void TRI_DestroyHashArray (TRI_hasharray_t* array) {
return;
}
// ...........................................................................
// Go through each item in the array and remove any internal allocated memory
// ...........................................................................
@ -151,12 +286,10 @@ void TRI_DestroyHashArray (TRI_hasharray_t* array) {
IndexStaticDestroyElement(array, p);
}
TRI_Free(TRI_UNKNOWN_MEM_ZONE, array->_table);
TRI_Free(TRI_UNKNOWN_MEM_ZONE, array->_data);
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief destroys an array and frees the pointer
////////////////////////////////////////////////////////////////////////////////
@ -181,8 +314,6 @@ void TRI_FreeHashArray (TRI_hasharray_t* array) {
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief lookups an element given a key
////////////////////////////////////////////////////////////////////////////////
@ -198,13 +329,13 @@ void* TRI_LookupByKeyHashArray (TRI_hasharray_t* array, void* key) {
hash = IndexStaticHashKey(array, key);
i = hash % array->_nrAlloc;
// ...........................................................................
// update statistics
// ...........................................................................
#ifdef TRI_INTERNAL_STATS
array->_nrFinds++;
#endif
// ...........................................................................
// search the table
@ -213,7 +344,9 @@ void* TRI_LookupByKeyHashArray (TRI_hasharray_t* array, void* key) {
while (! IndexStaticIsEmptyElement(array, array->_table + i * array->_elementSize) &&
! IndexStaticIsEqualKeyElement(array, key, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesF++;
#endif
}
@ -224,8 +357,6 @@ void* TRI_LookupByKeyHashArray (TRI_hasharray_t* array, void* key) {
return array->_table + (i * array->_elementSize);
}
////////////////////////////////////////////////////////////////////////////////
/// @brief finds an element given a key, return NULL if not found
////////////////////////////////////////////////////////////////////////////////
@ -242,8 +373,6 @@ void* TRI_FindByKeyHashArray (TRI_hasharray_t* array, void* key) {
return NULL;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief lookups an element given an element
////////////////////////////////////////////////////////////////////////////////
@ -264,7 +393,9 @@ void* TRI_LookupByElementHashArray (TRI_hasharray_t* array, void* element) {
// update statistics
// ...........................................................................
#ifdef TRI_INTERNAL_STATS
array->_nrFinds++;
#endif
// ...........................................................................
@ -274,7 +405,9 @@ void* TRI_LookupByElementHashArray (TRI_hasharray_t* array, void* element) {
while (! IndexStaticIsEmptyElement(array, array->_table + i * array->_elementSize) &&
! IndexStaticIsEqualElementElement(array, element, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesF++;
#endif
}
// ...........................................................................
@ -284,8 +417,6 @@ void* TRI_LookupByElementHashArray (TRI_hasharray_t* array, void* element) {
return (array->_table) + (i * array->_elementSize);
}
////////////////////////////////////////////////////////////////////////////////
/// @brief finds an element given an element, returns NULL if not found
////////////////////////////////////////////////////////////////////////////////
@ -302,8 +433,6 @@ void* TRI_FindByElementHashArray (TRI_hasharray_t* array, void* element) {
return NULL;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief adds an element to the array
////////////////////////////////////////////////////////////////////////////////
@ -326,7 +455,9 @@ bool TRI_InsertElementHashArray (TRI_hasharray_t* array, void* element, bool ove
// update statistics
// ...........................................................................
#ifdef TRI_INTERNAL_STATS
array->_nrAdds++;
#endif
// ...........................................................................
@ -336,7 +467,9 @@ bool TRI_InsertElementHashArray (TRI_hasharray_t* array, void* element, bool ove
while (! IndexStaticIsEmptyElement(array, array->_table + i * array->_elementSize) &&
! IndexStaticIsEqualElementElement(array, element, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesA++;
#endif
}
arrayElement = array->_table + (i * array->_elementSize);
@ -356,8 +489,6 @@ bool TRI_InsertElementHashArray (TRI_hasharray_t* array, void* element, bool ove
return false;
}
// ...........................................................................
// add a new element to the hash array (existing item is empty so no need to
// destroy it)
@ -383,8 +514,6 @@ bool TRI_InsertElementHashArray (TRI_hasharray_t* array, void* element, bool ove
return true;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief adds an key/element to the array
////////////////////////////////////////////////////////////////////////////////
@ -407,7 +536,9 @@ bool TRI_InsertKeyHashArray (TRI_hasharray_t* array, void* key, void* element, b
// update statistics
// ...........................................................................
#ifdef TRI_INTERNAL_STATS
array->_nrAdds++;
#endif
// ...........................................................................
@ -417,7 +548,9 @@ bool TRI_InsertKeyHashArray (TRI_hasharray_t* array, void* key, void* element, b
while (! IndexStaticIsEmptyElement(array, array->_table + i * array->_elementSize) &&
! IndexStaticIsEqualKeyElement(array, key, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesA++;
#endif
}
arrayElement = array->_table + (i * array->_elementSize);
@ -460,8 +593,6 @@ bool TRI_InsertKeyHashArray (TRI_hasharray_t* array, void* key, void* element, b
return true;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief removes an element from the array
////////////////////////////////////////////////////////////////////////////////
@ -485,7 +616,9 @@ bool TRI_RemoveElementHashArray (TRI_hasharray_t* array, void* element) {
// update statistics
// ...........................................................................
#ifdef TRI_INTERNAL_STATS
array->_nrRems++;
#endif
// ...........................................................................
@ -495,7 +628,9 @@ bool TRI_RemoveElementHashArray (TRI_hasharray_t* array, void* element) {
while (! IndexStaticIsEmptyElement(array, array->_table + i * array->_elementSize) &&
! IndexStaticIsEqualElementElement(array, element, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesD++;
#endif
}
arrayElement = array->_table + (i * array->_elementSize);
@ -542,7 +677,6 @@ bool TRI_RemoveElementHashArray (TRI_hasharray_t* array, void* element) {
return true;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief removes an key/element to the array
////////////////////////////////////////////////////////////////////////////////
@ -562,13 +696,13 @@ bool TRI_RemoveKeyHashArray (TRI_hasharray_t* array, void* key) {
i = hash % array->_nrAlloc;
// ...........................................................................
// update statistics
// ...........................................................................
#ifdef TRI_INTERNAL_STATS
array->_nrRems++;
#endif
// ...........................................................................
@ -578,7 +712,9 @@ bool TRI_RemoveKeyHashArray (TRI_hasharray_t* array, void* key) {
while (! IndexStaticIsEmptyElement(array, array->_table + i * array->_elementSize) &&
! IndexStaticIsEqualKeyElement(array, key, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesD++;
#endif
}
arrayElement = array->_table + (i * array->_elementSize);
@ -634,36 +770,12 @@ bool TRI_RemoveKeyHashArray (TRI_hasharray_t* array, void* key) {
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- HASH ARRAY MULTI
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup Collections
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
@ -702,7 +814,9 @@ TRI_vector_pointer_t TRI_LookupByKeyHashArrayMulti (TRI_hasharray_t* array, void
// update statistics
// ...........................................................................
#ifdef TRI_INTERNAL_STATS
array->_nrFinds++;
#endif
// ...........................................................................
@ -714,9 +828,11 @@ TRI_vector_pointer_t TRI_LookupByKeyHashArrayMulti (TRI_hasharray_t* array, void
if (IndexStaticIsEqualKeyElementMulti(array, key, array->_table + i * array->_elementSize)) {
TRI_PushBackVectorPointer(&result, array->_table + i * array->_elementSize);
}
#ifdef TRI_INTERNAL_STATS
else {
array->_nrProbesF++;
}
#endif
i = (i + 1) % array->_nrAlloc;
}
@ -729,7 +845,6 @@ TRI_vector_pointer_t TRI_LookupByKeyHashArrayMulti (TRI_hasharray_t* array, void
return result;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief lookups an element given an element
////////////////////////////////////////////////////////////////////////////////
@ -759,7 +874,9 @@ TRI_vector_pointer_t TRI_LookupByElementHashArrayMulti (TRI_hasharray_t* array,
// update statistics
// ...........................................................................
#ifdef TRI_INTERNAL_STATS
array->_nrFinds++;
#endif
// ...........................................................................
@ -771,9 +888,11 @@ TRI_vector_pointer_t TRI_LookupByElementHashArrayMulti (TRI_hasharray_t* array,
if (IndexStaticIsEqualElementElementMulti(array, element, array->_table + i * array->_elementSize)) {
TRI_PushBackVectorPointer(&result, array->_table + i * array->_elementSize);
}
#ifdef TRI_INTERNAL_STATS
else {
array->_nrProbesF++;
}
#endif
i = (i + 1) % array->_nrAlloc;
}
@ -786,7 +905,6 @@ TRI_vector_pointer_t TRI_LookupByElementHashArrayMulti (TRI_hasharray_t* array,
return result;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief adds an element to the array
////////////////////////////////////////////////////////////////////////////////
@ -810,7 +928,9 @@ bool TRI_InsertElementHashArrayMulti (TRI_hasharray_t* array, void* element, boo
// update statistics
// ...........................................................................
#ifdef TRI_INTERNAL_STATS
array->_nrAdds++;
#endif
@ -821,7 +941,9 @@ bool TRI_InsertElementHashArrayMulti (TRI_hasharray_t* array, void* element, boo
while (! IndexStaticIsEmptyElement(array, array->_table + i * array->_elementSize) &&
! IndexStaticIsEqualElementElementMulti(array, element, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesA++;
#endif
}
arrayElement = array->_table + (i * array->_elementSize);
@ -889,7 +1011,9 @@ bool TRI_InsertKeyHashArrayMulti (TRI_hasharray_t* array, void* key, void* eleme
// update statistics
// ...........................................................................
#ifdef TRI_INTERNAL_STATS
array->_nrAdds++;
#endif
// ...........................................................................
@ -898,7 +1022,9 @@ bool TRI_InsertKeyHashArrayMulti (TRI_hasharray_t* array, void* key, void* eleme
while (! IndexStaticIsEmptyElement(array, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesA++;
#endif
}
arrayElement = array->_table + (i * array->_elementSize);
@ -951,7 +1077,10 @@ bool TRI_RemoveElementHashArrayMulti (TRI_hasharray_t* array, void* element) {
// ...........................................................................
// update statistics
// ...........................................................................
#ifdef TRI_INTERNAL_STATS
array->_nrRems++;
#endif
// ...........................................................................
@ -960,7 +1089,9 @@ bool TRI_RemoveElementHashArrayMulti (TRI_hasharray_t* array, void* element) {
while (! IndexStaticIsEmptyElement(array, array->_table + i * array->_elementSize) &&
! IndexStaticIsEqualElementElementMulti(array, element, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesD++;
#endif
}
arrayElement = array->_table + (i * array->_elementSize);
@ -1028,7 +1159,10 @@ bool TRI_RemoveKeyHashArrayMulti (TRI_hasharray_t* array, void* key) {
// ...........................................................................
// update statistics
// ...........................................................................
#ifdef TRI_INTERNAL_STATS
array->_nrRems++;
#endif
// ...........................................................................
@ -1038,7 +1172,9 @@ bool TRI_RemoveKeyHashArrayMulti (TRI_hasharray_t* array, void* key) {
while (! IndexStaticIsEmptyElement(array, array->_table + i * array->_elementSize) &&
! IndexStaticIsEqualKeyElementMulti(array, key, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesD++;
#endif
}
arrayElement = array->_table + (i * array->_elementSize);
@ -1087,126 +1223,6 @@ bool TRI_RemoveKeyHashArrayMulti (TRI_hasharray_t* array, void* key) {
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- forward declared private functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup HashArray
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief adds a new element
////////////////////////////////////////////////////////////////////////////////
static void AddNewElement (TRI_hasharray_t* array, void* element) {
uint64_t hash;
uint64_t i;
// ...........................................................................
// compute the hash
// ...........................................................................
hash = IndexStaticHashElement(array, element);
// ...........................................................................
// search the table
// ...........................................................................
i = hash % array->_nrAlloc;
while (! IndexStaticIsEmptyElement(array, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
array->_nrProbesR++;
}
// ...........................................................................
// add a new element to the associative array
// memcpy ok here since are simply moving array items internally
// ...........................................................................
memcpy(array->_table + i * array->_elementSize, element, array->_elementSize);
array->_nrUsed++;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief resizes the array
////////////////////////////////////////////////////////////////////////////////
static bool ResizeHashArray (TRI_hasharray_t* array) {
char * oldTable;
uint64_t oldAlloc;
uint64_t j;
oldTable = array->_table;
oldAlloc = array->_nrAlloc;
array->_nrAlloc = 2 * array->_nrAlloc + 1;
array->_table = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, array->_nrAlloc * array->_elementSize, true);
if (array->_table == NULL) {
// allocation has failed. must restore original values
array->_table = oldTable;
array->_nrAlloc = oldAlloc;
return false;
}
array->_nrUsed = 0;
array->_nrResizes++;
for (j = 0; j < oldAlloc; j++) {
if (! IndexStaticIsEmptyElement(array, oldTable + j * array->_elementSize)) {
AddNewElement(array, oldTable + j * array->_elementSize);
}
}
TRI_Free(TRI_UNKNOWN_MEM_ZONE, oldTable);
return true;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief resizes the array
////////////////////////////////////////////////////////////////////////////////
static bool ResizeHashArrayMulti (TRI_hasharray_t* array) {
char* oldTable;
uint64_t oldAlloc;
uint64_t j;
oldTable = array->_table;
oldAlloc = array->_nrAlloc;
array->_nrAlloc = 2 * array->_nrAlloc + 1;
array->_table = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, array->_nrAlloc * array->_elementSize, true);
if (array->_table == NULL) {
// allocation has failed, must restore original values
array->_table = oldTable;
array->_nrAlloc = oldAlloc;
return false;
}
array->_nrUsed = 0;
array->_nrResizes++;
for (j = 0; j < oldAlloc; j++) {
if (! IndexStaticIsEmptyElement(array, oldTable + j * array->_elementSize)) {
AddNewElement(array, oldTable + j * array->_elementSize);
}
}
TRI_Free(TRI_UNKNOWN_MEM_ZONE, oldTable);
return true;
}
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// Local Variables:
// mode: outline-minor
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)"

View File

@ -63,9 +63,15 @@ typedef struct TRI_hasharray_s {
uint64_t _elementSize;
uint64_t _nrAlloc; // the size of the table
uint64_t _nrUsed; // the number of used entries
// _table might or might not be the same pointer as _data
// if you want to handle the hash table memory, always use the _data pointer!
// if you want to work with the hash table elements, always use the _table pointer!
char* _table; // the table itself
char* _data; // pointer to memory acquired for the hash table
char* _table; // the table itself, aligned to a cache line boundary
#ifdef TRI_INTERNAL_STATS
uint64_t _nrFinds; // statistics: number of lookup calls
uint64_t _nrAdds; // statistics: number of insert calls
uint64_t _nrRems; // statistics: number of remove calls
@ -75,6 +81,7 @@ typedef struct TRI_hasharray_s {
uint64_t _nrProbesA; // statistics: number of misses while inserting
uint64_t _nrProbesD; // statistics: number of misses while removing
uint64_t _nrProbesR; // statistics: number of misses while adding
#endif
}
TRI_hasharray_t;
@ -101,6 +108,7 @@ TRI_hasharray_t;
////////////////////////////////////////////////////////////////////////////////
bool TRI_InitHashArray (TRI_hasharray_t*,
size_t initialDocumentCount,
size_t numFields,
size_t elementSize,
uint64_t (*hashKey) (TRI_hasharray_t*, void*),
@ -187,43 +195,10 @@ bool TRI_RemoveKeyHashArray (TRI_hasharray_t*, void* key);
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- public types
// --SECTION-- MULTI HASH ARRAY
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup HashArray
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- MULTI HASH ARRAY
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup HashArray
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
@ -273,15 +248,6 @@ bool TRI_RemoveKeyHashArrayMulti (TRI_hasharray_t*, void* key);
/// @}
////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
}
#endif

View File

@ -49,8 +49,42 @@ static int HashIndex_queryMethodCall (void*, TRI_index_operat
static TRI_index_iterator_t* HashIndex_resultMethodCall (void*, TRI_index_operator_t*, void*, bool (*filter) (TRI_index_iterator_t*));
static int HashIndex_freeMethodCall (void*, void*);
////////////////////////////////////////////////////////////////////////////////
/// @brief create an initialise a hash index
/// this function is used by unique and non-unique indexes to set up the
/// hash index base structure
////////////////////////////////////////////////////////////////////////////////
static HashIndex* CreateHashIndex (size_t numFields, size_t initialDocumentCount) {
HashIndex* hashIndex = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(HashIndex), false);
if (hashIndex == NULL) {
return NULL;
}
hashIndex->hashArray = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_hasharray_t), false);
if (hashIndex->hashArray == NULL) {
TRI_Free(TRI_UNKNOWN_MEM_ZONE, hashIndex);
return NULL;
}
if (! TRI_InitHashArray(hashIndex->hashArray,
initialDocumentCount,
numFields,
sizeof(HashIndexElement),
NULL,
NULL,
NULL,
NULL,
NULL,
NULL)) {
HashIndex_free(hashIndex);
return NULL;
}
return hashIndex;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief free a hash index results list
@ -74,7 +108,7 @@ static void FreeResults (TRI_hash_index_elements_t* list) {
/// @brief destroys the hash index by calling the hash array's own Free function
////////////////////////////////////////////////////////////////////////////////
void HashIndex_destroy(HashIndex* hashIndex) {
void HashIndex_destroy (HashIndex* hashIndex) {
if (hashIndex != NULL) {
TRI_FreeHashArray(hashIndex->hashArray);
}
@ -85,7 +119,7 @@ void HashIndex_destroy(HashIndex* hashIndex) {
/// @brief destroys the hash index and frees the memory associated with the index structure
////////////////////////////////////////////////////////////////////////////////
void HashIndex_free(HashIndex* hashIndex) {
void HashIndex_free (HashIndex* hashIndex) {
if (hashIndex != NULL) {
HashIndex_destroy(hashIndex);
TRI_Free(TRI_UNKNOWN_MEM_ZONE, hashIndex);
@ -96,7 +130,7 @@ void HashIndex_free(HashIndex* hashIndex) {
/// @brief free a result set allocated by HashIndex_find
////////////////////////////////////////////////////////////////////////////////
void HashIndex_freeResult(TRI_hash_index_elements_t* const list) {
void HashIndex_freeResult (TRI_hash_index_elements_t* const list) {
FreeResults(list);
}
@ -108,28 +142,14 @@ void HashIndex_freeResult(TRI_hash_index_elements_t* const list) {
/// @brief Creates a new hash array used for storage of elements in the hash index
////////////////////////////////////////////////////////////////////////////////
HashIndex* HashIndex_new(size_t numFields) {
HashIndex* HashIndex_new (size_t numFields, size_t initialDocumentCount) {
HashIndex* hashIndex;
hashIndex = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(HashIndex), false);
if (hashIndex == NULL) {
return NULL;
hashIndex = CreateHashIndex(numFields, initialDocumentCount);
if (hashIndex != NULL) {
hashIndex->unique = true;
}
hashIndex->unique = true;
hashIndex->hashArray = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_hasharray_t), false);
if (hashIndex->hashArray == NULL) {
TRI_Free(TRI_UNKNOWN_MEM_ZONE, hashIndex);
return NULL;
}
if (! TRI_InitHashArray(hashIndex->hashArray, numFields, sizeof(HashIndexElement), NULL, NULL, NULL, NULL, NULL, NULL) ) {
HashIndex_free(hashIndex);
return NULL;
}
return hashIndex;
}
@ -137,7 +157,7 @@ HashIndex* HashIndex_new(size_t numFields) {
/// @brief Assigns a static function call to a function pointer used by Query Engine
////////////////////////////////////////////////////////////////////////////////
int HashIndex_assignMethod(void* methodHandle, TRI_index_method_assignment_type_e methodType) {
int HashIndex_assignMethod (void* methodHandle, TRI_index_method_assignment_type_e methodType) {
switch (methodType) {
case TRI_INDEX_METHOD_ASSIGNMENT_FREE : {
@ -175,7 +195,7 @@ int HashIndex_assignMethod(void* methodHandle, TRI_index_method_assignment_type_
/// @brief Adds (inserts) a data element into the hash array part of the hash index
////////////////////////////////////////////////////////////////////////////////
int HashIndex_add(HashIndex* hashIndex, HashIndexElement* element) {
int HashIndex_add (HashIndex* hashIndex, HashIndexElement* element) {
bool result;
// .............................................................................
@ -192,7 +212,7 @@ int HashIndex_add(HashIndex* hashIndex, HashIndexElement* element) {
/// @brief Locates an entry within the hash array part of the hash index
////////////////////////////////////////////////////////////////////////////////
TRI_hash_index_elements_t* HashIndex_find(HashIndex* hashIndex, HashIndexElement* element) {
TRI_hash_index_elements_t* HashIndex_find (HashIndex* hashIndex, HashIndexElement* element) {
HashIndexElement* result;
TRI_hash_index_elements_t* results;
@ -237,7 +257,7 @@ TRI_hash_index_elements_t* HashIndex_find(HashIndex* hashIndex, HashIndexElement
/// @brief An alias for HashIndex_add
////////////////////////////////////////////////////////////////////////////////
int HashIndex_insert(HashIndex* hashIndex, HashIndexElement* element) {
int HashIndex_insert (HashIndex* hashIndex, HashIndexElement* element) {
return HashIndex_add(hashIndex,element);
}
@ -246,7 +266,7 @@ int HashIndex_insert(HashIndex* hashIndex, HashIndexElement* element) {
/// @brief Removes an entry from the hash array part of the hash index
////////////////////////////////////////////////////////////////////////////////
int HashIndex_remove(HashIndex* hashIndex, HashIndexElement* element) {
int HashIndex_remove (HashIndex* hashIndex, HashIndexElement* element) {
bool result;
result = TRI_RemoveElementHashArray(hashIndex->hashArray, element);
@ -259,8 +279,8 @@ int HashIndex_remove(HashIndex* hashIndex, HashIndexElement* element) {
/// @brief then adds the afterElement
////////////////////////////////////////////////////////////////////////////////
int HashIndex_update(HashIndex* hashIndex, const HashIndexElement* beforeElement,
const HashIndexElement* afterElement) {
int HashIndex_update (HashIndex* hashIndex, const HashIndexElement* beforeElement,
const HashIndexElement* afterElement) {
// ...........................................................................
// This function is not currently implemented and must not be called.
// It's purpose would be to remove the existing beforeElement and replace it
@ -289,7 +309,7 @@ int HashIndex_update(HashIndex* hashIndex, const HashIndexElement* beforeElement
/// @brief destroys the hash index by calling the hash array's own Free function
////////////////////////////////////////////////////////////////////////////////
void MultiHashIndex_destroy(HashIndex* hashIndex) {
void MultiHashIndex_destroy (HashIndex* hashIndex) {
HashIndex_destroy(hashIndex);
}
@ -298,7 +318,7 @@ void MultiHashIndex_destroy(HashIndex* hashIndex) {
/// @brief destroys the hash index and frees the memory associated with the index structure
////////////////////////////////////////////////////////////////////////////////
void MultiHashIndex_free(HashIndex* hashIndex) {
void MultiHashIndex_free (HashIndex* hashIndex) {
HashIndex_free(hashIndex);
}
@ -306,7 +326,7 @@ void MultiHashIndex_free(HashIndex* hashIndex) {
/// @brief free a result set allocated by MultiHashIndex_find
////////////////////////////////////////////////////////////////////////////////
void MultiHashIndex_freeResult(TRI_hash_index_elements_t* const list) {
void MultiHashIndex_freeResult (TRI_hash_index_elements_t* const list) {
FreeResults(list);
}
@ -319,32 +339,17 @@ void MultiHashIndex_freeResult(TRI_hash_index_elements_t* const list) {
/// @brief Creates a new multi (non-unique) hash index
////////////////////////////////////////////////////////////////////////////////
HashIndex* MultiHashIndex_new(size_t numFields) {
HashIndex* MultiHashIndex_new (size_t numFields, size_t initialDocumentCount) {
HashIndex* hashIndex;
hashIndex = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(HashIndex), false);
if (hashIndex == NULL) {
return NULL;
}
hashIndex->unique = false;
hashIndex->hashArray = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_hasharray_t), false);
if (hashIndex->hashArray == NULL) {
TRI_Free(TRI_UNKNOWN_MEM_ZONE, hashIndex);
return NULL;
}
if (! TRI_InitHashArray(hashIndex->hashArray, numFields, sizeof(HashIndexElement), NULL, NULL, NULL, NULL, NULL, NULL) ) {
HashIndex_free(hashIndex);
return NULL;
hashIndex = CreateHashIndex(numFields, initialDocumentCount);
if (hashIndex != NULL) {
hashIndex->unique = false;
}
return hashIndex;
}
// -----------------------------------------------------------------------------
// public functions : INSERT, REMOVE & LOOKUP
// -----------------------------------------------------------------------------
@ -354,7 +359,7 @@ HashIndex* MultiHashIndex_new(size_t numFields) {
/// @brief Adds (inserts) a data element into the hash array (hash index)
////////////////////////////////////////////////////////////////////////////////
int MultiHashIndex_add(HashIndex* hashIndex, HashIndexElement* element) {
int MultiHashIndex_add (HashIndex* hashIndex, HashIndexElement* element) {
bool result;
result = TRI_InsertElementHashArrayMulti(hashIndex->hashArray, element, false);
if (result) {
@ -367,7 +372,7 @@ int MultiHashIndex_add(HashIndex* hashIndex, HashIndexElement* element) {
// Locates an entry within the associative array
// ...............................................................................
TRI_hash_index_elements_t* MultiHashIndex_find(HashIndex* hashIndex, HashIndexElement* element) {
TRI_hash_index_elements_t* MultiHashIndex_find (HashIndex* hashIndex, HashIndexElement* element) {
TRI_vector_pointer_t result;
TRI_hash_index_elements_t* results;
size_t j;
@ -411,7 +416,7 @@ TRI_hash_index_elements_t* MultiHashIndex_find(HashIndex* hashIndex, HashIndexEl
// An alias for addIndex
// ...............................................................................
int MultiHashIndex_insert(HashIndex* hashIndex, HashIndexElement* element) {
int MultiHashIndex_insert (HashIndex* hashIndex, HashIndexElement* element) {
return MultiHashIndex_add(hashIndex,element);
}
@ -420,7 +425,7 @@ int MultiHashIndex_insert(HashIndex* hashIndex, HashIndexElement* element) {
// Removes an entry from the associative array
// ...............................................................................
int MultiHashIndex_remove(HashIndex* hashIndex, HashIndexElement* element) {
int MultiHashIndex_remove (HashIndex* hashIndex, HashIndexElement* element) {
bool result;
result = TRI_RemoveElementHashArrayMulti(hashIndex->hashArray, element);
return result ? TRI_ERROR_NO_ERROR : TRI_ERROR_INTERNAL;
@ -432,7 +437,7 @@ int MultiHashIndex_remove(HashIndex* hashIndex, HashIndexElement* element) {
// then adds the afterElement
// ...............................................................................
int MultiHashIndex_update(HashIndex* hashIndex, HashIndexElement* beforeElement,
int MultiHashIndex_update (HashIndex* hashIndex, HashIndexElement* beforeElement,
HashIndexElement* afterElement) {
assert(false);
return TRI_ERROR_INTERNAL;
@ -444,8 +449,8 @@ int MultiHashIndex_update(HashIndex* hashIndex, HashIndexElement* beforeElement,
// Implementation of forward declared query engine callback functions
////////////////////////////////////////////////////////////////////////////////////////
static int HashIndex_queryMethodCall(void* theIndex, TRI_index_operator_t* indexOperator,
TRI_index_challenge_t* challenge, void* data) {
static int HashIndex_queryMethodCall (void* theIndex, TRI_index_operator_t* indexOperator,
TRI_index_challenge_t* challenge, void* data) {
HashIndex* hIndex = (HashIndex*)(theIndex);
if (hIndex == NULL || indexOperator == NULL) {
return TRI_ERROR_INTERNAL;
@ -454,8 +459,8 @@ static int HashIndex_queryMethodCall(void* theIndex, TRI_index_operator_t* index
return TRI_ERROR_NO_ERROR;
}
static TRI_index_iterator_t* HashIndex_resultMethodCall(void* theIndex, TRI_index_operator_t* indexOperator,
void* data, bool (*filter) (TRI_index_iterator_t*)) {
static TRI_index_iterator_t* HashIndex_resultMethodCall (void* theIndex, TRI_index_operator_t* indexOperator,
void* data, bool (*filter) (TRI_index_iterator_t*)) {
HashIndex* hIndex = (HashIndex*)(theIndex);
if (hIndex == NULL || indexOperator == NULL) {
return NULL;

View File

@ -89,7 +89,7 @@ int HashIndex_assignMethod (void*, TRI_index_method_assignment_type_e);
void HashIndex_destroy (HashIndex*);
HashIndex* HashIndex_new (size_t);
HashIndex* HashIndex_new (size_t, size_t);
void HashIndex_free (HashIndex*);
@ -126,7 +126,7 @@ void MultiHashIndex_free (HashIndex*);
void MultiHashIndex_freeResult(TRI_hash_index_elements_t* const);
HashIndex* MultiHashIndex_new (size_t);
HashIndex* MultiHashIndex_new (size_t, size_t);
int MultiHashIndex_add (HashIndex*, HashIndexElement*);

View File

@ -3695,8 +3695,13 @@ static TRI_index_t* CreateHashIndexDocumentCollection (TRI_document_collection_t
return idx;
}
// create the hash index
idx = TRI_CreateHashIndex(&collection->base, &fields, &paths, unique);
// create the hash index. we'll provide it with the current number of documents
// in the collection so the index can do a sensible memory preallocation
idx = TRI_CreateHashIndex(&collection->base,
&fields,
&paths,
unique,
collection->base._primaryIndex._nrUsed);
// release memory allocated to vector
TRI_DestroyVector(&paths);

View File

@ -1759,7 +1759,8 @@ static int UpdateHashIndex (TRI_index_t* idx,
TRI_index_t* TRI_CreateHashIndex (struct TRI_primary_collection_s* collection,
TRI_vector_pointer_t* fields,
TRI_vector_t* paths,
bool unique) {
bool unique,
size_t initialDocumentCount) {
TRI_hash_index_t* hashIndex;
int result;
size_t j;
@ -1814,10 +1815,12 @@ TRI_index_t* TRI_CreateHashIndex (struct TRI_primary_collection_s* collection,
}
if (unique) {
hashIndex->_hashIndex = HashIndex_new(hashIndex->_paths._length);
// create a unique index preallocated for the current number of documents
hashIndex->_hashIndex = HashIndex_new(hashIndex->_paths._length, initialDocumentCount);
}
else {
hashIndex->_hashIndex = MultiHashIndex_new(hashIndex->_paths._length);
// create a non-unique index preallocated for the current number of documents
hashIndex->_hashIndex = MultiHashIndex_new(hashIndex->_paths._length, initialDocumentCount);
}
if (hashIndex->_hashIndex == NULL) { // oops out of memory?

View File

@ -476,7 +476,8 @@ GeoCoordinates* TRI_NearestGeoIndex (TRI_index_t*,
TRI_index_t* TRI_CreateHashIndex (struct TRI_primary_collection_s*,
TRI_vector_pointer_t* fields,
TRI_vector_t* paths,
bool unique);
bool unique,
size_t initialDocumentCount);
////////////////////////////////////////////////////////////////////////////////
/// @brief frees the memory allocated, but does not free the pointer

View File

@ -2619,13 +2619,20 @@ function ArangoDatabase (connection) {
'Print function: ' + "\n" +
' > print(x) std. print function ' + "\n" +
' > print_plain(x) print without pretty printing' + "\n" +
' and without colors ';
' and without colors ' + "\n" +
' > clear() clear screen ' ;
////////////////////////////////////////////////////////////////////////////////
/// @brief create the global db object and load the collections
////////////////////////////////////////////////////////////////////////////////
try {
clear = function () {
for (var i = 0; i < 100; ++i) {
print('\n');
}
};
if (typeof arango !== 'undefined') {
// default database object
db = internal.db = new ArangoDatabase(arango);

2682
js/client/js-client.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -106,7 +106,7 @@ string const ApplicationServer::OPTIONS_SERVER = "Server Options";
/// @brief constructor
////////////////////////////////////////////////////////////////////////////////
ApplicationServer::ApplicationServer (string const& name, string const& title, string const& version)
ApplicationServer::ApplicationServer (std::string const& name, std::string const& title, std::string const& version)
: _options(),
_description(),
_descriptionFile(),
@ -176,7 +176,7 @@ void ApplicationServer::addFeature (ApplicationFeature* feature) {
/// @brief sets the name of the system config file with a path
////////////////////////////////////////////////////////////////////////////////
void ApplicationServer::setSystemConfigFile (string const& name, string const& path) {
void ApplicationServer::setSystemConfigFile (std::string const& name, std::string const& path) {
_systemConfigFile = name;
_systemConfigPath = path;
}
@ -185,7 +185,7 @@ void ApplicationServer::setSystemConfigFile (string const& name, string const& p
/// @brief sets the name of the system config file without a path
////////////////////////////////////////////////////////////////////////////////
void ApplicationServer::setSystemConfigFile (string const& name) {
void ApplicationServer::setSystemConfigFile (std::string const& name) {
return setSystemConfigFile(name, "");
}
@ -193,7 +193,7 @@ void ApplicationServer::setSystemConfigFile (string const& name) {
/// @brief sets the name of the user config file
////////////////////////////////////////////////////////////////////////////////
void ApplicationServer::setUserConfigFile (string const& name) {
void ApplicationServer::setUserConfigFile (std::string const& name) {
_userConfigFile = name;
}
@ -286,7 +286,7 @@ bool ApplicationServer::parse (int argc, char* argv[]) {
bool ApplicationServer::parse (int argc,
char* argv[],
map<string, ProgramOptionsDescription> opts) {
std::map<std::string, ProgramOptionsDescription> opts) {
// .............................................................................
// setup the options

View File

@ -115,7 +115,8 @@ TRI_tid_t Thread::currentThreadId () {
/// @brief constructs a thread
////////////////////////////////////////////////////////////////////////////////
Thread::Thread(const std::string& name) : _name(name),
Thread::Thread (std::string const& name)
: _name(name),
_asynchronousCancelation(false),
_thread(),
_finishedCondition(0),
@ -124,7 +125,6 @@ Thread::Thread(const std::string& name) : _name(name),
TRI_InitThread(&_thread);
}
////////////////////////////////////////////////////////////////////////////////
/// @brief deletes the thread
////////////////////////////////////////////////////////////////////////////////

View File

@ -111,7 +111,7 @@ namespace triagens {
/// @brief constructs a thread
////////////////////////////////////////////////////////////////////////////////
explicit Thread (const string& name);
explicit Thread (std::string const& name);
////////////////////////////////////////////////////////////////////////////////
/// @brief deletes the thread

View File

@ -59,7 +59,9 @@ static void AddNewElement (TRI_associative_array_t* array, void* element) {
while (! array->isEmptyElement(array, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesR++;
#endif
}
// add a new element to the associative array
@ -80,7 +82,9 @@ static void ResizeAssociativeArray (TRI_associative_array_t* array) {
oldAlloc = array->_nrAlloc;
array->_nrAlloc = 2 * array->_nrAlloc + 1;
#ifdef TRI_INTERNAL_STATS
array->_nrResizes++;
#endif
array->_table = TRI_Allocate(array->_memoryZone, array->_nrAlloc * array->_elementSize, true);
@ -162,6 +166,8 @@ void TRI_InitAssociativeArray (TRI_associative_array_t* array,
}
array->_nrUsed = 0;
#ifdef TRI_INTERNAL_STATS
array->_nrFinds = 0;
array->_nrAdds = 0;
array->_nrRems = 0;
@ -170,6 +176,7 @@ void TRI_InitAssociativeArray (TRI_associative_array_t* array,
array->_nrProbesA = 0;
array->_nrProbesD = 0;
array->_nrProbesR = 0;
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -214,14 +221,18 @@ void* TRI_LookupByKeyAssociativeArray (TRI_associative_array_t* array, void* key
hash = array->hashKey(array, key);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrFinds++;
#endif
// search the table
while (! array->isEmptyElement(array, array->_table + i * array->_elementSize)
&& ! array->isEqualKeyElement(array, key, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesF++;
#endif
}
// return whatever we found
@ -256,14 +267,18 @@ void* TRI_LookupByElementAssociativeArray (TRI_associative_array_t* array, void*
hash = array->hashElement(array, element);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrFinds++;
#endif
// search the table
while (! array->isEmptyElement(array, array->_table + i * array->_elementSize)
&& ! array->isEqualElementElement(array, element, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesF++;
#endif
}
// return whatever we found
@ -304,14 +319,18 @@ bool TRI_InsertElementAssociativeArray (TRI_associative_array_t* array, void* el
hash = array->hashElement(array, element);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrAdds++;
#endif
// search the table
while (! array->isEmptyElement(array, array->_table + i * array->_elementSize)
&& ! array->isEqualElementElement(array, element, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesA++;
#endif
}
// if we found an element, return
@ -353,14 +372,18 @@ bool TRI_InsertKeyAssociativeArray (TRI_associative_array_t* array, void* key, v
hash = array->hashKey(array, key);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrAdds++;
#endif
// search the table
while (! array->isEmptyElement(array, array->_table + i * array->_elementSize)
&& ! array->isEqualKeyElement(array, key, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesA++;
#endif
}
// if we found an element, return
@ -396,14 +419,18 @@ bool TRI_RemoveElementAssociativeArray (TRI_associative_array_t* array, void* el
hash = array->hashElement(array, element);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrRems++;
#endif
// search the table
while (! array->isEmptyElement(array, array->_table + i * array->_elementSize)
&& ! array->isEqualElementElement(array, element, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesD++;
#endif
}
// if we did not find such an item return false
@ -454,14 +481,18 @@ bool TRI_RemoveKeyAssociativeArray (TRI_associative_array_t* array, void* key, v
hash = array->hashKey(array, key);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrRems++;
#endif
// search the table
while (! array->isEmptyElement(array, array->_table + i * array->_elementSize)
&& ! array->isEqualKeyElement(array, key, array->_table + i * array->_elementSize)) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesD++;
#endif
}
// if we did not find such an item return false
@ -541,7 +572,9 @@ static void AddNewElementPointer (TRI_associative_pointer_t* array, void* elemen
while (array->_table[i] != NULL) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesR++;
#endif
}
// add a new element to the associative array
@ -562,7 +595,9 @@ static void ResizeAssociativePointer (TRI_associative_pointer_t* array) {
oldAlloc = array->_nrAlloc;
array->_nrAlloc = 2 * array->_nrAlloc + 1;
#ifdef TRI_INTERNAL_STATS
array->_nrResizes++;
#endif
array->_table = TRI_Allocate(array->_memoryZone, array->_nrAlloc * sizeof(void*), true);
@ -623,6 +658,8 @@ void TRI_InitAssociativePointer (TRI_associative_pointer_t* array,
}
array->_nrUsed = 0;
#ifdef TRI_INTERNAL_STATS
array->_nrFinds = 0;
array->_nrAdds = 0;
array->_nrRems = 0;
@ -631,6 +668,7 @@ void TRI_InitAssociativePointer (TRI_associative_pointer_t* array,
array->_nrProbesA = 0;
array->_nrProbesD = 0;
array->_nrProbesR = 0;
#endif
}
////////////////////////////////////////////////////////////////////////////////
@ -695,13 +733,17 @@ void* TRI_LookupByKeyAssociativePointer (TRI_associative_pointer_t* array,
hash = array->hashKey(array, key);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrFinds++;
#endif
// search the table
while (array->_table[i] != NULL && ! array->isEqualKeyElement(array, key, array->_table[i])) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesF++;
#endif
}
// return whatever we found
@ -721,13 +763,17 @@ void* TRI_LookupByElementAssociativePointer (TRI_associative_pointer_t* array,
hash = array->hashElement(array, element);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrFinds++;
#endif
// search the table
while (array->_table[i] != NULL && ! array->isEqualElementElement(array, element, array->_table[i])) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesF++;
#endif
}
// return whatever we found
@ -755,13 +801,17 @@ void* TRI_InsertElementAssociativePointer (TRI_associative_pointer_t* array,
hash = array->hashElement(array, element);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrAdds++;
#endif
// search the table
while (array->_table[i] != NULL && ! array->isEqualElementElement(array, element, array->_table[i])) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesA++;
#endif
}
old = array->_table[i];
@ -809,13 +859,17 @@ void* TRI_InsertKeyAssociativePointer (TRI_associative_pointer_t* array,
hash = array->hashKey(array, key);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrAdds++;
#endif
// search the table
while (array->_table[i] != NULL && ! array->isEqualKeyElement(array, key, array->_table[i])) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesA++;
#endif
}
old = array->_table[i];
@ -855,13 +909,17 @@ void* TRI_RemoveElementAssociativePointer (TRI_associative_pointer_t* array,
hash = array->hashElement(array, element);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrRems++;
#endif
// search the table
while (array->_table[i] != NULL && ! array->isEqualElementElement(array, element, array->_table[i])) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesD++;
#endif
}
// if we did not find such an item return 0
@ -907,13 +965,17 @@ void* TRI_RemoveKeyAssociativePointer (TRI_associative_pointer_t* array,
hash = array->hashKey(array, key);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrRems++;
#endif
// search the table
while (array->_table[i] != NULL && ! array->isEqualKeyElement(array, key, array->_table[i])) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesD++;
#endif
}
// if we did not find such an item return false
@ -988,7 +1050,9 @@ static void AddNewElementSynced (TRI_associative_synced_t* array, void* element)
while (array->_table[i] != NULL) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesR++;
#endif
}
// add a new element to the associative array
@ -1011,7 +1075,9 @@ static void ResizeAssociativeSynced (TRI_associative_synced_t* array) {
oldAlloc = array->_nrAlloc;
array->_nrAlloc = 2 * array->_nrAlloc + 1;
#ifdef TRI_INTERNAL_STATS
array->_nrResizes++;
#endif
array->_table = TRI_Allocate(array->_memoryZone, array->_nrAlloc * sizeof(void*), true);
@ -1072,6 +1138,8 @@ void TRI_InitAssociativeSynced (TRI_associative_synced_t* array,
}
array->_nrUsed = 0;
#ifdef TRI_INTERNAL_STATS
array->_nrFinds = 0;
array->_nrAdds = 0;
array->_nrRems = 0;
@ -1080,6 +1148,7 @@ void TRI_InitAssociativeSynced (TRI_associative_synced_t* array,
array->_nrProbesA = 0;
array->_nrProbesD = 0;
array->_nrProbesR = 0;
#endif
TRI_InitReadWriteLock(&array->_lock);
}
@ -1129,15 +1198,19 @@ void const* TRI_LookupByKeyAssociativeSynced (TRI_associative_synced_t* array,
hash = array->hashKey(array, key);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrFinds++;
#endif
// search the table
TRI_ReadLockReadWriteLock(&array->_lock);
while (array->_table[i] != NULL && ! array->isEqualKeyElement(array, key, array->_table[i])) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesF++;
#endif
}
result = array->_table[i];
@ -1162,15 +1235,19 @@ void const* TRI_LookupByElementAssociativeSynced (TRI_associative_synced_t* arra
hash = array->hashElement(array, element);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrFinds++;
#endif
// search the table
TRI_ReadLockReadWriteLock(&array->_lock);
while (array->_table[i] != NULL && ! array->isEqualElementElement(array, element, array->_table[i])) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesF++;
#endif
}
result = array->_table[i];
@ -1201,15 +1278,19 @@ void* TRI_InsertElementAssociativeSynced (TRI_associative_synced_t* array,
hash = array->hashElement(array, element);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrAdds++;
#endif
// search the table, TODO optimise the locks
TRI_WriteLockReadWriteLock(&array->_lock);
while (array->_table[i] != NULL && ! array->isEqualElementElement(array, element, array->_table[i])) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesA++;
#endif
}
old = array->_table[i];
@ -1254,15 +1335,19 @@ void* TRI_InsertKeyAssociativeSynced (TRI_associative_synced_t* array,
hash = array->hashKey(array, key);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrAdds++;
#endif
// search the table
TRI_WriteLockReadWriteLock(&array->_lock);
while (array->_table[i] != NULL && ! array->isEqualKeyElement(array, key, array->_table[i])) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesA++;
#endif
}
old = array->_table[i];
@ -1300,15 +1385,19 @@ void* TRI_RemoveElementAssociativeSynced (TRI_associative_synced_t* array,
hash = array->hashElement(array, element);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrRems++;
#endif
// search the table
TRI_WriteLockReadWriteLock(&array->_lock);
while (array->_table[i] != NULL && ! array->isEqualElementElement(array, element, array->_table[i])) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesD++;
#endif
}
// if we did not find such an item return 0
@ -1356,15 +1445,19 @@ void* TRI_RemoveKeyAssociativeSynced (TRI_associative_synced_t* array,
hash = array->hashKey(array, key);
i = hash % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
// update statistics
array->_nrRems++;
#endif
// search the table
TRI_WriteLockReadWriteLock(&array->_lock);
while (array->_table[i] != NULL && ! array->isEqualKeyElement(array, key, array->_table[i])) {
i = (i + 1) % array->_nrAlloc;
#ifdef TRI_INTERNAL_STATS
array->_nrProbesD++;
#endif
}
// if we did not find such an item return false

View File

@ -72,6 +72,7 @@ typedef struct TRI_associative_array_s {
char* _table; // the table itself
#ifdef TRI_INTERNAL_STATS
uint64_t _nrFinds; // statistics: number of lookup calls
uint64_t _nrAdds; // statistics: number of insert calls
uint64_t _nrRems; // statistics: number of remove calls
@ -81,6 +82,7 @@ typedef struct TRI_associative_array_s {
uint64_t _nrProbesA; // statistics: number of misses while inserting
uint64_t _nrProbesD; // statistics: number of misses while removing
uint64_t _nrProbesR; // statistics: number of misses while adding
#endif
TRI_memory_zone_t* _memoryZone;
}
@ -225,6 +227,7 @@ typedef struct TRI_associative_pointer_s {
void** _table; // the table itself
#ifdef TRI_INTERNAL_STATS
uint64_t _nrFinds; // statistics: number of lookup calls
uint64_t _nrAdds; // statistics: number of insert calls
uint64_t _nrRems; // statistics: number of remove calls
@ -234,6 +237,7 @@ typedef struct TRI_associative_pointer_s {
uint64_t _nrProbesA; // statistics: number of misses while inserting
uint64_t _nrProbesD; // statistics: number of misses while removing
uint64_t _nrProbesR; // statistics: number of misses while adding
#endif
TRI_memory_zone_t* _memoryZone;
}
@ -379,6 +383,7 @@ typedef struct TRI_associative_synced_s {
TRI_read_write_lock_t _lock;
#ifdef TRI_INTERNAL_STATS
uint64_t _nrFinds; // statistics: number of lookup calls
uint64_t _nrAdds; // statistics: number of insert calls
uint64_t _nrRems; // statistics: number of remove calls
@ -388,6 +393,7 @@ typedef struct TRI_associative_synced_s {
uint64_t _nrProbesA; // statistics: number of misses while inserting
uint64_t _nrProbesD; // statistics: number of misses while removing
uint64_t _nrProbesR; // statistics: number of misses while adding
#endif
TRI_memory_zone_t* _memoryZone;
}

View File

@ -75,8 +75,15 @@ void TRI_InitVector (TRI_vector_t* vector, TRI_memory_zone_t* zone, size_t eleme
vector->_growthFactor = GROW_FACTOR;
}
int TRI_InitVector2 (TRI_vector_t* vector, TRI_memory_zone_t* zone, size_t elementSize,
size_t initialCapacity, double growthFactor) {
////////////////////////////////////////////////////////////////////////////////
/// @brief initialises a vector, with user-definable settings
////////////////////////////////////////////////////////////////////////////////
int TRI_InitVector2 (TRI_vector_t* vector,
TRI_memory_zone_t* zone,
size_t elementSize,
size_t initialCapacity,
double growthFactor) {
vector->_memoryZone = zone;
vector->_elementSize = elementSize;
vector->_buffer = NULL;

View File

@ -81,8 +81,11 @@ TRI_vector_t;
void TRI_InitVector (TRI_vector_t*, TRI_memory_zone_t*, size_t elementSize);
int TRI_InitVector2 (TRI_vector_t*, TRI_memory_zone_t*, size_t elementSize,
size_t initialCapacity, double growthFactor);
int TRI_InitVector2 (TRI_vector_t*,
TRI_memory_zone_t*,
size_t elementSize,
size_t initialCapacity,
double growthFactor);
////////////////////////////////////////////////////////////////////////////////
/// @brief destroys a vector, but does not free the pointer

View File

@ -119,7 +119,7 @@ bool Dispatcher::isRunning () {
/// @brief adds a new queue
////////////////////////////////////////////////////////////////////////////////
void Dispatcher::addQueue (const std::string& name, size_t nrThreads) {
void Dispatcher::addQueue (std::string const& name, size_t nrThreads) {
_queues[name] = new DispatcherQueue(this, name, defaultDispatcherThread, nrThreads);
}
@ -127,7 +127,7 @@ void Dispatcher::addQueue (const std::string& name, size_t nrThreads) {
/// @brief adds a queue which given dispatcher thread type
////////////////////////////////////////////////////////////////////////////////
void Dispatcher::addQueue (const std::string& name, newDispatcherThread_fptr func, size_t nrThreads) {
void Dispatcher::addQueue (std::string const& name, newDispatcherThread_fptr func, size_t nrThreads) {
_queues[name] = new DispatcherQueue(this, name, func, nrThreads);
}

View File

@ -155,13 +155,13 @@ namespace triagens {
/// @brief adds a new queue
////////////////////////////////////////////////////////////////////////////////
void addQueue (string const& name, size_t nrThreads);
void addQueue (std::string const& name, size_t nrThreads);
/////////////////////////////////////////////////////////////////////////
/// @brief adds a queue which given dispatcher thread type
/////////////////////////////////////////////////////////////////////////
void addQueue (string const& name, newDispatcherThread_fptr, size_t nrThreads);
void addQueue (std::string const& name, newDispatcherThread_fptr, size_t nrThreads);
////////////////////////////////////////////////////////////////////////////////
/// @brief adds a new job

View File

@ -147,7 +147,7 @@ namespace triagens {
/// @brief catches a special stream operator
////////////////////////////////////////////////////////////////////////////////
LoggerStream& operator<< (ostream& (*fptr)(ostream&));
LoggerStream& operator<< (std::ostream& (*fptr)(std::ostream&));
////////////////////////////////////////////////////////////////////////////////
/// @brief catches a log level

View File

@ -61,10 +61,10 @@ namespace triagens {
/// @brief creates an endpoint
////////////////////////////////////////////////////////////////////////////////
EndpointIp (const Type,
const DomainType,
const Protocol,
const Encryption,
EndpointIp (const Endpoint::Type,
const Endpoint::DomainType,
const Endpoint::Protocol,
const Endpoint::Encryption,
const std::string&,
const std::string&,
const uint16_t);

View File

@ -65,9 +65,9 @@ namespace triagens {
/// @brief creates an endpoint
////////////////////////////////////////////////////////////////////////////////
EndpointIpV4 (const Type,
const Protocol,
const Encryption,
EndpointIpV4 (const Endpoint::Type,
const Endpoint::Protocol,
const Endpoint::Encryption,
const std::string&,
const std::string&,
const uint16_t);

View File

@ -65,9 +65,9 @@ namespace triagens {
/// @brief creates an endpoint
////////////////////////////////////////////////////////////////////////////////
EndpointIpV6 (const Type,
const Protocol,
const Encryption,
EndpointIpV6 (const Endpoint::Type,
const Endpoint::Protocol,
const Endpoint::Encryption,
const std::string&,
const std::string&,
const uint16_t);

View File

@ -699,8 +699,8 @@ bool EndpointIp::initIncoming (socket_t incoming) {
EndpointIpV4::EndpointIpV4 (const Endpoint::Type type,
const Endpoint::Protocol protocol,
const Endpoint::Encryption encryption,
string const& specification,
string const& host,
const std::string& specification,
const std::string& host,
const uint16_t port) :
EndpointIp(type, ENDPOINT_IPV4, protocol, encryption, specification, host, port) {
}
@ -736,8 +736,8 @@ EndpointIpV4::~EndpointIpV4 () {
EndpointIpV6::EndpointIpV6 (const Endpoint::Type type,
const Endpoint::Protocol protocol,
const Endpoint::Encryption encryption,
string const& specification,
string const& host,
const std::string& specification,
const std::string& host,
const uint16_t port) :
EndpointIp(type, ENDPOINT_IPV6, protocol, encryption, specification, host, port) {
}

0
utils/arango-upgrade.in Executable file → Normal file
View File