1
0
Fork 0
arangodb/V8/v8-globals.h

270 lines
10 KiB
C++

////////////////////////////////////////////////////////////////////////////////
/// @brief V8-vocbase bridge
///
/// @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
////////////////////////////////////////////////////////////////////////////////
#ifndef TRIAGENS_DURHAM_V8_V8_GLOBALS_H
#define TRIAGENS_DURHAM_V8_V8_GLOBALS_H 1
#include <Basics/Common.h>
#include <regex.h>
#include <map>
#include <v8.h>
#include <Basics/ReadWriteLock.h>
#include <VocBase/query.h>
// -----------------------------------------------------------------------------
// --SECTION-- public types
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup V8Globals
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief globals stored in the isolate
////////////////////////////////////////////////////////////////////////////////
typedef struct TRI_v8_global_s {
////////////////////////////////////////////////////////////////////////////////
/// @brief constructor
////////////////////////////////////////////////////////////////////////////////
TRI_v8_global_s ()
: JSQueries(),
JSResultSets(),
Actions(),
ActionsLock(),
EdgesTempl(),
EdgesColTempl(),
QueryTempl(),
VocbaseColTempl(),
VocbaseTempl(),
OutputFuncName(),
PrintFuncName(),
ToStringFuncName(),
CollectionQueryType(),
ContentType(),
BodyKey(),
DidKey(),
FromKey(),
JournalSizeKey(),
ParametersKey(),
ResponseCodeKey(),
SyncAfterBytesKey(),
SyncAfterObjectsKey(),
SyncAfterTimeKey(),
ToKey(),
DocumentIdRegex() {
}
////////////////////////////////////////////////////////////////////////////////
/// @brief query mapping for weak pointers
////////////////////////////////////////////////////////////////////////////////
std::map< TRI_query_t*, v8::Persistent<v8::Value> > JSQueries;
////////////////////////////////////////////////////////////////////////////////
/// @brief result set mapping for weak pointers
////////////////////////////////////////////////////////////////////////////////
std::map< TRI_result_set_t*, v8::Persistent<v8::Value> > JSResultSets;
////////////////////////////////////////////////////////////////////////////////
/// @brief map of callbacks for an action
////////////////////////////////////////////////////////////////////////////////
std::map<std::string, void*> Actions;
////////////////////////////////////////////////////////////////////////////////
/// @brief lock for the actions
////////////////////////////////////////////////////////////////////////////////
triagens::basics::ReadWriteLock ActionsLock;
// -----------------------------------------------------------------------------
// --SECTION-- JAVASCRIPT OBJECT TEMPLATES
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief TRI_vocbase_t template for edges
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::ObjectTemplate> EdgesTempl;
////////////////////////////////////////////////////////////////////////////////
/// @brief TRI_vocbase_col_t template for edges
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::ObjectTemplate> EdgesColTempl;
////////////////////////////////////////////////////////////////////////////////
/// @brief query template
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::ObjectTemplate> QueryTempl;
////////////////////////////////////////////////////////////////////////////////
/// @brief TRI_vocbase_col_t template
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::ObjectTemplate> VocbaseColTempl;
////////////////////////////////////////////////////////////////////////////////
/// @brief TRI_vocbase_t template
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::ObjectTemplate> VocbaseTempl;
// -----------------------------------------------------------------------------
// --SECTION-- JAVASCRIPT FUNCTION NAMES
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief "output" function name
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::String> OutputFuncName;
////////////////////////////////////////////////////////////////////////////////
/// @brief "print" function name
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::String> PrintFuncName;
////////////////////////////////////////////////////////////////////////////////
/// @brief "toString" function name
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::String> ToStringFuncName;
// -----------------------------------------------------------------------------
// --SECTION-- JAVASCRIPT KEY NAMES
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief "collection" query type
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::String> CollectionQueryType;
////////////////////////////////////////////////////////////////////////////////
/// @brief "contentType" key name
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::String> ContentType;
////////////////////////////////////////////////////////////////////////////////
/// @brief "body" key name
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::String> BodyKey;
////////////////////////////////////////////////////////////////////////////////
/// @brief "_id" key name
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::String> DidKey;
////////////////////////////////////////////////////////////////////////////////
/// @brief "_from" key name
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::String> FromKey;
////////////////////////////////////////////////////////////////////////////////
/// @brief "journalSize" key name
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::String> JournalSizeKey;
////////////////////////////////////////////////////////////////////////////////
/// @brief "parameters" key name
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::String> ParametersKey;
////////////////////////////////////////////////////////////////////////////////
/// @brief "responseCode" key name
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::String> ResponseCodeKey;
////////////////////////////////////////////////////////////////////////////////
/// @brief "syncAfterBytes" key name
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::String> SyncAfterBytesKey;
////////////////////////////////////////////////////////////////////////////////
/// @brief "syncAfterObjects" key name
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::String> SyncAfterObjectsKey;
////////////////////////////////////////////////////////////////////////////////
/// @brief "syncAfterTime" key name
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::String> SyncAfterTimeKey;
////////////////////////////////////////////////////////////////////////////////
/// @brief "_to" key name
////////////////////////////////////////////////////////////////////////////////
v8::Persistent<v8::String> ToKey;
// -----------------------------------------------------------------------------
// --SECTION-- REGULAR EXPRESSIONS
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- private variables
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief document identifier as collection-id:document-id
////////////////////////////////////////////////////////////////////////////////
regex_t DocumentIdRegex;
}
TRI_v8_global_t;
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
#endif
// Local Variables:
// mode: outline-minor
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\)"
// End: