1
0
Fork 0

Merge branches 'devel' and 'devel' of ssh://github.com/triAGENS/ArangoDB into devel

This commit is contained in:
James 2014-10-17 10:22:33 +01:00
commit 15e2c87823
13 changed files with 202 additions and 152 deletions

View File

@ -1,221 +1,221 @@
article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary {
display: block
display: block
}
audio,canvas,video {
display: inline-block
display: inline-block
}
audio:not([controls]) {
display: none;
height: 0
display: none;
height: 0
}
[hidden] {
display: none
display: none
}
html {
font-family: sans-serif;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%
font-family: sans-serif;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%
}
body {
margin: 0
margin: 0
}
a:focus {
outline: thin dotted
outline: thin dotted
}
a:active,a:hover {
outline: 0
outline: 0
}
h1 {
font-size: 2em;
margin: .67em 0
font-size: 2em;
margin: .67em 0
}
abbr[title] {
border-bottom: 1px dotted
border-bottom: 1px dotted
}
b,strong {
font-weight: bold
font-weight: bold
}
dfn {
font-style: italic
font-style: italic
}
hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0
}
mark {
background: #ff0;
color: #000
background: #ff0;
color: #000
}
code,kbd,pre,samp {
font-family: monospace,serif;
font-size: 1em
font-family: monospace,serif;
font-size: 1em
}
pre {
white-space: pre-wrap
white-space: pre-wrap
}
q {
quotes: "\201C" "\201D" "\2018" "\2019"
quotes: "\201C" "\201D" "\2018" "\2019"
}
small {
font-size: 80%
font-size: 80%
}
sub,sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline
}
sup {
top: -0.5em
top: -0.5em
}
sub {
bottom: -0.25em
bottom: -0.25em
}
img {
border: 0
border: 0
}
svg:not(:root) {
overflow: hidden
overflow: hidden
}
figure {
margin: 0
margin: 0
}
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: .35em .625em .75em
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: .35em .625em .75em
}
legend {
border: 0;
padding: 0
border: 0;
padding: 0
}
button,input,select,textarea {
font-family: inherit;
font-size: 100%;
margin: 0
font-family: inherit;
font-size: 100%;
margin: 0
}
button,input {
line-height: normal
line-height: normal
}
button,select {
text-transform: none
text-transform: none
}
button,html input[type="button"],input[type="reset"],input[type="submit"] {
-webkit-appearance: button;
cursor: pointer
-webkit-appearance: button;
cursor: pointer
}
button[disabled],html input[disabled] {
cursor: default
cursor: default
}
input[type="checkbox"],input[type="radio"] {
box-sizing: border-box;
padding: 0
box-sizing: border-box;
padding: 0
}
input[type="search"] {
-webkit-appearance: textfield;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box
-webkit-appearance: textfield;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box
}
input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none
-webkit-appearance: none
}
button::-moz-focus-inner,input::-moz-focus-inner {
border: 0;
padding: 0
border: 0;
padding: 0
}
textarea {
overflow: auto;
vertical-align: top
overflow: auto;
vertical-align: top
}
table {
border-collapse: collapse;
border-spacing: 0
border-collapse: collapse;
border-spacing: 0
}
@font-face {
font-family: 'FontAwesome';
src: url('.//fonts/fontawesome/fontawesome-webfont.eot?v=4.1.0');
src: url('.//fonts/fontawesome/fontawesome-webfont.eot?#iefix&v=4.1.0') format('embedded-opentype'),url('.//fonts/fontawesome/fontawesome-webfont.woff?v=4.1.0') format('woff'),url('.//fonts/fontawesome/fontawesome-webfont.ttf?v=4.1.0') format('truetype'),url('.//fonts/fontawesome/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal
font-family: 'FontAwesome';
src: url('.//fonts/fontawesome/fontawesome-webfont.eot?v=4.1.0');
src: url('.//fonts/fontawesome/fontawesome-webfont.eot?#iefix&v=4.1.0') format('embedded-opentype'),url('.//fonts/fontawesome/fontawesome-webfont.woff?v=4.1.0') format('woff'),url('.//fonts/fontawesome/fontawesome-webfont.ttf?v=4.1.0') format('truetype'),url('.//fonts/fontawesome/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal
}
.fa {
display: inline-block;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale
display: inline-block;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale
}
.fa-lg {
font-size: 1.3333333333333333em;
line-height: .75em;
vertical-align: -15%
font-size: 1.3333333333333333em;
line-height: .75em;
vertical-align: -15%
}
.fa-2x {
font-size: 2em
font-size: 2em
}
.fa-3x {
font-size: 3em
font-size: 3em
}
.fa-4x {
font-size: 4em
font-size: 4em
}
.fa-5x {
font-size: 5em
font-size: 5em
}
.fa-fw {
width: 1.2857142857142858em;
text-align: center
width: 1.2857142857142858em;
text-align: center
}
.fa-ul {
padding-left: 0;
margin-left: 2.142857142857143em;
list-style-type: none
padding-left: 0;
margin-left: 2.142857142857143em;
list-style-type: none
}
.fa-ul>li {
position: relative
position: relative
}
.fa-li {
position: absolute;
left: -2.142857142857143em;
width: 2.142857142857143em;
top: .14285714285714285em;
text-align: center
position: absolute;
left: -2.142857142857143em;
width: 2.142857142857143em;
top: .14285714285714285em;
text-align: center
}
.fa-li.fa-lg {
left: -1.8571428571428572em
left: -1.8571428571428572em
}
.fa-border {
padding: .2em .25em .15em;
border: solid .08em #eee;
border-radius: .1em
padding: .2em .25em .15em;
border: solid .08em #eee;
border-radius: .1em
}
.pull-right {
float: right
float: right
}
.pull-left {
float: left
float: left
}
.fa.pull-left {
margin-right: .3em
margin-right: .3em
}
.fa.pull-right {
margin-left: .3em
margin-left: .3em
}
.fa-spin {
-webkit-animation: spin 2s infinite linear;
-moz-animation: spin 2s infinite linear;
-o-animation: spin 2s infinite linear;
animation: spin 2s infinite linear
-webkit-animation: spin 2s infinite linear;
-moz-animation: spin 2s infinite linear;
-o-animation: spin 2s infinite linear;
animation: spin 2s infinite linear
}
@-moz-keyframes spin {0% {
-moz-transform: rotate(0deg)
-moz-transform: rotate(0deg)
}
100% {
-moz-transform: rotate(359deg)
-moz-transform: rotate(359deg)
}
}
@ -1634,6 +1634,9 @@ color: inherit
.hidden {
display: none
}
.lets-see-who-copies-this: {
font-family: 'proven!';
}
@font-face {
font-family: 'Merriweather';
font-style: normal;
@ -2904,10 +2907,10 @@ font-family: "Open Sans","Clear Sans","Helvetica Neue",Helvetica,Arial,sans-seri
font-size: 14px
}
div.example_show_button {
border: medium solid lightgray;
text-align: center;
position: relative;
top: -10px;
border: medium solid lightgray;
text-align: center;
position: relative;
top: -10px;
}
.book .book-body .page-wrapper .page-inner section.normal .deprecated{
@ -2919,26 +2922,26 @@ background-color: rgba(240,240,0,0.4);
}
#clear-search {
display: inline;
position: absolute;
top: 12px;
right: 9px;
font-size: 18pt;
line-height: 18pt;
color: #364149; // needs to be updated on theme change
display: inline;
position: absolute;
top: 12px;
right: 9px;
font-size: 18pt;
line-height: 18pt;
color: #364149; // needs to be updated on theme change
}
#clear-search:hover {
color: #008cff; // needs to be updated on theme change
text-decoration: none;
color: #008cff; // needs to be updated on theme change
text-decoration: none;
}
.book .book-summary .book-search input{
padding-right: 20px !important;
padding-right: 20px !important;
}
.book .book-header {
background-color: #FFFFFF !important;
width: 84%;
position:fixed !important;
}
background-color: #FFFFFF !important;
width: 84%;
position:fixed !important;
}

View File

@ -40,6 +40,7 @@
#include "Utils/AqlTransaction.h"
#include "Utils/Exception.h"
#include "Utils/V8TransactionContext.h"
#include "V8Server/ApplicationV8.h"
#include "VocBase/vocbase.h"
using namespace triagens::aql;
@ -115,13 +116,15 @@ TRI_json_t* Profile::toJson (TRI_memory_zone_t*) {
/// @brief creates a query
////////////////////////////////////////////////////////////////////////////////
Query::Query (TRI_vocbase_t* vocbase,
Query::Query (triagens::arango::ApplicationV8* applicationV8,
TRI_vocbase_t* vocbase,
char const* queryString,
size_t queryLength,
TRI_json_t* bindParameters,
TRI_json_t* options,
QueryPart part)
: _vocbase(vocbase),
: _applicationV8(applicationV8),
_vocbase(vocbase),
_executor(nullptr),
_queryString(queryString),
_queryLength(queryLength),
@ -156,11 +159,13 @@ Query::Query (TRI_vocbase_t* vocbase,
/// @brief creates a query from Json
////////////////////////////////////////////////////////////////////////////////
Query::Query (TRI_vocbase_t* vocbase,
Query::Query (triagens::arango::ApplicationV8* applicationV8,
TRI_vocbase_t* vocbase,
triagens::basics::Json queryStruct,
TRI_json_t* options,
QueryPart part)
: _vocbase(vocbase),
: _applicationV8(applicationV8),
_vocbase(vocbase),
_executor(nullptr),
_queryString(nullptr),
_queryLength(0),
@ -242,7 +247,8 @@ Query* Query::clone (QueryPart part) {
std::unique_ptr<Query> clone;
try {
clone.reset(new Query(_vocbase,
clone.reset(new Query(_applicationV8,
_vocbase,
_queryString,
_queryLength,
nullptr,

View File

@ -43,6 +43,10 @@ struct TRI_json_t;
struct TRI_vocbase_s;
namespace triagens {
namespace arango {
class ApplicationV8;
}
namespace aql {
struct AstNode;
@ -127,14 +131,16 @@ namespace triagens {
public:
Query (struct TRI_vocbase_s*,
Query (triagens::arango::ApplicationV8*,
struct TRI_vocbase_s*,
char const*,
size_t,
struct TRI_json_t*,
struct TRI_json_t*,
QueryPart);
Query (struct TRI_vocbase_s*,
Query (triagens::arango::ApplicationV8*,
struct TRI_vocbase_s*,
triagens::basics::Json queryStruct,
struct TRI_json_t*,
QueryPart);
@ -416,6 +422,12 @@ namespace triagens {
private:
////////////////////////////////////////////////////////////////////////////////
/// @brief application v8 used in the query, we need this for V8 context access
////////////////////////////////////////////////////////////////////////////////
triagens::arango::ApplicationV8* _applicationV8;
////////////////////////////////////////////////////////////////////////////////
/// @brief all nodes created in the AST - will be used for freeing them later
////////////////////////////////////////////////////////////////////////////////

View File

@ -127,7 +127,7 @@ void RestAqlHandler::createQueryFromJson () {
std::string const part = JsonHelper::getStringValue(queryJson.json(), "part", "");
auto query = new Query(_vocbase, plan, options.steal(), (part == "main" ? PART_MAIN : PART_DEPENDENT));
auto query = new Query(_applicationV8, _vocbase, plan, options.steal(), (part == "main" ? PART_MAIN : PART_DEPENDENT));
QueryResult res = query->prepare(_queryRegistry);
if (res.code != TRI_ERROR_NO_ERROR) {
generateError(HttpResponse::BAD, TRI_ERROR_QUERY_BAD_JSON_PLAN,
@ -188,7 +188,7 @@ void RestAqlHandler::parseQuery () {
return;
}
auto query = new Query(_vocbase, queryString.c_str(), queryString.size(),
auto query = new Query(_applicationV8, _vocbase, queryString.c_str(), queryString.size(),
nullptr, nullptr, PART_MAIN);
QueryResult res = query->parse();
if (res.code != TRI_ERROR_NO_ERROR) {
@ -244,7 +244,7 @@ void RestAqlHandler::explainQuery () {
Json options;
options = queryJson.get("options").copy(); // cannot throw
auto query = new Query(_vocbase, queryString.c_str(), queryString.size(),
auto query = new Query(_applicationV8, _vocbase, queryString.c_str(), queryString.size(),
parameters.steal(), options.steal(), PART_MAIN);
QueryResult res = query->explain();
if (res.code != TRI_ERROR_NO_ERROR) {
@ -304,7 +304,7 @@ void RestAqlHandler::createQueryFromString () {
Json options;
options = queryJson.get("options").copy(); // cannot throw
auto query = new Query(_vocbase, queryString.c_str(), queryString.size(),
auto query = new Query(_applicationV8, _vocbase, queryString.c_str(), queryString.size(),
parameters.steal(), options.steal(), (part == "main" ? PART_MAIN : PART_DEPENDENT));
QueryResult res = query->prepare(_queryRegistry);
if (res.code != TRI_ERROR_NO_ERROR) {

View File

@ -1224,7 +1224,7 @@ bool ApplicationV8::prepareV8Instance (const string& name, size_t i, bool useAct
context->_context->Enter();
TRI_InitV8VocBridge(context->_context, _queryRegistry, _server, _vocbase, &_startupLoader, i);
TRI_InitV8VocBridge(this, context->_context, _queryRegistry, _server, _vocbase, &_startupLoader, i);
TRI_InitV8Queries(context->_context);
TRI_InitV8UserStructures(context->_context);

View File

@ -1343,8 +1343,7 @@ void TRI_InitV8Actions (v8::Handle<v8::Context> context,
GlobalV8Dealer = applicationV8;
// check the isolate
v8::Isolate* isolate = v8::Isolate::GetCurrent();
/* TRI_v8_global_t* v8g = */ TRI_CreateV8Globals(isolate);
v8::Isolate::GetCurrent();
// .............................................................................
// create the global functions

View File

@ -462,8 +462,7 @@ void TRI_InitV8Dispatcher (v8::Handle<v8::Context> context,
GlobalV8Dealer = applicationV8;
// check the isolate
v8::Isolate* isolate = v8::Isolate::GetCurrent();
/* TRI_v8_global_t* v8g = */ TRI_CreateV8Globals(isolate);
v8::Isolate::GetCurrent();
// .............................................................................
// create the global functions

View File

@ -819,9 +819,10 @@ static v8::Handle<v8::Value> JS_ParseAql (v8::Arguments const& argv) {
TRI_V8_TYPE_ERROR(scope, "expecting string for <querystring>");
}
TRI_v8_global_t* v8g = static_cast<TRI_v8_global_t*>(v8::Isolate::GetCurrent()->GetData());
string const&& queryString = TRI_ObjectToString(argv[0]);
triagens::aql::Query query(vocbase, queryString.c_str(), queryString.size(), nullptr, nullptr, triagens::aql::PART_MAIN);
triagens::aql::Query query(v8g->_applicationV8, vocbase, queryString.c_str(), queryString.size(), nullptr, nullptr, triagens::aql::PART_MAIN);
auto parseResult = query.parse();
@ -906,7 +907,8 @@ static v8::Handle<v8::Value> JS_ExplainAql (v8::Arguments const& argv) {
}
// bind parameters will be freed by the query later
triagens::aql::Query query(vocbase, queryString.c_str(), queryString.size(), parameters, options, triagens::aql::PART_MAIN);
TRI_v8_global_t* v8g = static_cast<TRI_v8_global_t*>(v8::Isolate::GetCurrent()->GetData());
triagens::aql::Query query(v8g->_applicationV8, vocbase, queryString.c_str(), queryString.size(), parameters, options, triagens::aql::PART_MAIN);
auto queryResult = query.explain();
@ -999,7 +1001,7 @@ static v8::Handle<v8::Value> JS_ExecuteAqlJson (v8::Arguments const& argv) {
TRI_v8_global_t* v8g = static_cast<TRI_v8_global_t*>(v8::Isolate::GetCurrent()->GetData());
triagens::aql::Query query(vocbase, Json(TRI_UNKNOWN_MEM_ZONE, queryjson), options, triagens::aql::PART_MAIN);
triagens::aql::Query query(v8g->_applicationV8, vocbase, Json(TRI_UNKNOWN_MEM_ZONE, queryjson), options, triagens::aql::PART_MAIN);
auto queryResult = query.execute(static_cast<triagens::aql::QueryRegistry*>(v8g->_queryRegistry));
if (queryResult.code != TRI_ERROR_NO_ERROR) {
@ -1136,7 +1138,7 @@ static v8::Handle<v8::Value> JS_ExecuteAql (v8::Arguments const& argv) {
TRI_v8_global_t* v8g = static_cast<TRI_v8_global_t*>(v8::Isolate::GetCurrent()->GetData());
// bind parameters will be freed by the query later
triagens::aql::Query query(vocbase, queryString.c_str(), queryString.size(), parameters, options, triagens::aql::PART_MAIN);
triagens::aql::Query query(v8g->_applicationV8, vocbase, queryString.c_str(), queryString.size(), parameters, options, triagens::aql::PART_MAIN);
auto queryResult = query.execute(static_cast<triagens::aql::QueryRegistry*>(v8g->_queryRegistry));
if (queryResult.code != TRI_ERROR_NO_ERROR) {
@ -2489,7 +2491,8 @@ void TRI_V8ReloadRouting (v8::Handle<v8::Context> context) {
/// @brief creates a TRI_vocbase_t global context
////////////////////////////////////////////////////////////////////////////////
void TRI_InitV8VocBridge (v8::Handle<v8::Context> context,
void TRI_InitV8VocBridge (triagens::arango::ApplicationV8* applicationV8,
v8::Handle<v8::Context> context,
triagens::aql::QueryRegistry* queryRegistry,
TRI_server_t* server,
TRI_vocbase_t* vocbase,
@ -2502,7 +2505,6 @@ void TRI_InitV8VocBridge (v8::Handle<v8::Context> context,
TRI_v8_global_t* v8g = TRI_CreateV8Globals(isolate);
TRI_ASSERT(v8g->_transactionContext == nullptr);
v8g->_transactionContext = new V8TransactionContext(true);
static_cast<V8TransactionContext*>(v8g->_transactionContext)->makeGlobal();
@ -2517,6 +2519,9 @@ void TRI_InitV8VocBridge (v8::Handle<v8::Context> context,
// register the startup loader
v8g->_loader = loader;
// register the context dealer
v8g->_applicationV8 = applicationV8;
v8::Handle<v8::ObjectTemplate> ArangoNS;
v8::Handle<v8::ObjectTemplate> rt;

View File

@ -45,6 +45,7 @@ namespace triagens {
}
namespace arango {
class ApplicationV8;
class CollectionNameResolver;
class JSLoader;
}
@ -95,7 +96,8 @@ void TRI_V8ReloadRouting (v8::Handle<v8::Context>);
/// @brief creates a TRI_vocbase_t global context
////////////////////////////////////////////////////////////////////////////////
void TRI_InitV8VocBridge (v8::Handle<v8::Context>,
void TRI_InitV8VocBridge (triagens::arango::ApplicationV8*,
v8::Handle<v8::Context>,
triagens::aql::QueryRegistry*,
struct TRI_server_s*,
struct TRI_vocbase_s*,

View File

@ -1625,7 +1625,7 @@ void TRI_InitV8Buffer (v8::Handle<v8::Context> context) {
// check the isolate
v8::Isolate* isolate = v8::Isolate::GetCurrent();
TRI_v8_global_t* v8g = TRI_CreateV8Globals(isolate);
TRI_v8_global_t* v8g = TRI_GetV8Globals(isolate);
// .............................................................................
// generate the general SlowBuffer template

View File

@ -134,6 +134,7 @@ TRI_v8_global_s::TRI_v8_global_s (v8::Isolate* isolate)
_vocbase(nullptr),
_allowUseDatabase(true),
_hasDeadObjects(false),
_applicationV8(nullptr),
_loader(nullptr),
_canceled(false) {
v8::HandleScope scope;
@ -228,14 +229,24 @@ TRI_v8_global_s::~TRI_v8_global_s () {
TRI_v8_global_t* TRI_CreateV8Globals (v8::Isolate* isolate) {
TRI_v8_global_t* v8g = static_cast<TRI_v8_global_t*>(isolate->GetData());
if (v8g == nullptr) {
v8g = new TRI_v8_global_t(isolate);
isolate->SetData(v8g);
}
TRI_ASSERT(v8g == nullptr);
v8g = new TRI_v8_global_t(isolate);
isolate->SetData(v8g);
return v8g;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief returns a global context
////////////////////////////////////////////////////////////////////////////////
TRI_v8_global_t* TRI_GetV8Globals (v8::Isolate* isolate) {
TRI_v8_global_t* v8g = static_cast<TRI_v8_global_t*>(isolate->GetData());
TRI_ASSERT(v8g != nullptr);
return v8g;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief adds a method to an object
////////////////////////////////////////////////////////////////////////////////

View File

@ -42,6 +42,7 @@ struct TRI_vocbase_s;
namespace triagens {
namespace arango {
class ApplicationV8;
class JSLoader;
}
}
@ -809,6 +810,12 @@ typedef struct TRI_v8_global_s {
// --SECTION-- GENERAL
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief pointer to the context dealer (ApplicationV8*)
////////////////////////////////////////////////////////////////////////////////
triagens::arango::ApplicationV8* _applicationV8;
////////////////////////////////////////////////////////////////////////////////
/// @brief pointer to the startup loader (JSLoader*)
////////////////////////////////////////////////////////////////////////////////
@ -833,6 +840,12 @@ TRI_v8_global_t;
TRI_v8_global_t* TRI_CreateV8Globals(v8::Isolate*);
////////////////////////////////////////////////////////////////////////////////
/// @brief gets the global context
////////////////////////////////////////////////////////////////////////////////
TRI_v8_global_t* TRI_GetV8Globals(v8::Isolate*);
////////////////////////////////////////////////////////////////////////////////
/// @brief adds a method to the prototype of an object
////////////////////////////////////////////////////////////////////////////////

View File

@ -3792,7 +3792,7 @@ void TRI_InitV8Utils (v8::Handle<v8::Context> context,
// check the isolate
v8::Isolate* isolate = v8::Isolate::GetCurrent();
TRI_v8_global_t* v8g = TRI_CreateV8Globals(isolate);
TRI_v8_global_t* v8g = TRI_GetV8Globals(isolate);
v8::Handle<v8::FunctionTemplate> ft;
v8::Handle<v8::ObjectTemplate> rt;