mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into readcache
This commit is contained in:
commit
56ba9342c8
|
@ -1,6 +1,7 @@
|
||||||
tags
|
tags
|
||||||
build
|
build
|
||||||
core.*
|
core.*
|
||||||
|
build.sh
|
||||||
|
|
||||||
.deps
|
.deps
|
||||||
.dirstamp
|
.dirstamp
|
||||||
|
|
|
@ -8444,6 +8444,10 @@ bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,
|
||||||
TraceInline(target, caller, "parse failure");
|
TraceInline(target, caller, "parse failure");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (target_shared->dont_crankshaft()) {
|
||||||
|
TraceInline(target, caller, "ParseAndAnalyze found incompatibility");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (target_info.scope()->num_heap_slots() > 0) {
|
if (target_info.scope()->num_heap_slots() > 0) {
|
||||||
TraceInline(target, caller, "target has context-allocated variables");
|
TraceInline(target, caller, "target has context-allocated variables");
|
||||||
|
|
12
CHANGELOG
12
CHANGELOG
|
@ -27,9 +27,19 @@ devel
|
||||||
`@arangodb/foxx/graphql` module and the bundled `graphql-sync` dependency
|
`@arangodb/foxx/graphql` module and the bundled `graphql-sync` dependency
|
||||||
|
|
||||||
|
|
||||||
v3.0.3 (XXXX-XX-XX)
|
v3.0.4 (XXXX-XX-XX)
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
* fixed segfault in V8, by backporting https://bugs.chromium.org/p/v8/issues/detail?id=5033
|
||||||
|
|
||||||
|
|
||||||
|
v3.0.3 (2016-07-17)
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
* fixed issue #1942
|
||||||
|
|
||||||
|
* fixed issue #1941
|
||||||
|
|
||||||
* fixed array index batch insertion issues for hash indexes that caused problems when
|
* fixed array index batch insertion issues for hash indexes that caused problems when
|
||||||
no elements remained for insertion
|
no elements remained for insertion
|
||||||
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
V8_VERSION=4.3.61
|
|
||||||
|
|
||||||
tar cvzf precompiled-libraries-${V8_VERSION}.tar.gz \
|
|
||||||
.v8-build-64 \
|
|
||||||
3rdParty/V8-${V8_VERSION}/include \
|
|
||||||
3rdParty/V8-${V8_VERSION}/out/x64.release/obj.target/tools/gyp \
|
|
||||||
3rdParty/V8-${V8_VERSION}/third_party/icu/source/common \
|
|
||||||
3rdParty/V8-${V8_VERSION}/third_party/icu/source/i18n \
|
|
||||||
3rdParty/V8-${V8_VERSION}/third_party/icu/source/io \
|
|
||||||
3rdParty/V8-${V8_VERSION}/out/x64.release/obj.target/third_party/icu
|
|
|
@ -221,7 +221,7 @@ OperationID ClusterComm::getOperationID() { return TRI_NewTickServer(); }
|
||||||
/// here in the form of "server:" followed by a serverID. Furthermore,
|
/// here in the form of "server:" followed by a serverID. Furthermore,
|
||||||
/// it is possible to specify the target endpoint directly using
|
/// it is possible to specify the target endpoint directly using
|
||||||
/// "tcp://..." or "ssl://..." endpoints, if `singleRequest` is true.
|
/// "tcp://..." or "ssl://..." endpoints, if `singleRequest` is true.
|
||||||
///
|
///
|
||||||
/// There are two timeout arguments. `timeout` is the globale timeout
|
/// There are two timeout arguments. `timeout` is the globale timeout
|
||||||
/// specifying after how many seconds the complete operation must be
|
/// specifying after how many seconds the complete operation must be
|
||||||
/// completed. `initTimeout` is a second timeout, which is used to
|
/// completed. `initTimeout` is a second timeout, which is used to
|
||||||
|
@ -229,7 +229,7 @@ OperationID ClusterComm::getOperationID() { return TRI_NewTickServer(); }
|
||||||
/// is negative (as for example in the default value), then `initTimeout`
|
/// is negative (as for example in the default value), then `initTimeout`
|
||||||
/// is taken to be the same as `timeout`. The idea behind the two timeouts
|
/// is taken to be the same as `timeout`. The idea behind the two timeouts
|
||||||
/// is to be able to specify correct behaviour for automatic failover.
|
/// is to be able to specify correct behaviour for automatic failover.
|
||||||
/// The idea is that if the initial request cannot be sent within
|
/// The idea is that if the initial request cannot be sent within
|
||||||
/// `initTimeout`, one can retry after a potential failover.
|
/// `initTimeout`, one can retry after a potential failover.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -800,14 +800,12 @@ void ClusterComm::drop(ClientTransactionID const& clientTransactionID,
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void ClusterComm::asyncAnswer(std::string& coordinatorHeader,
|
void ClusterComm::asyncAnswer(std::string& coordinatorHeader,
|
||||||
GeneralResponse* responseToSendGeneral) {
|
GeneralResponse* responseToSend) {
|
||||||
// TODO needs to generalized
|
|
||||||
auto responseToSend = dynamic_cast<HttpResponse*>(responseToSendGeneral);
|
|
||||||
|
|
||||||
if (responseToSend == nullptr) {
|
if (responseToSend == nullptr) {
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// First take apart the header to get the coordinatorID:
|
// First take apart the header to get the coordinatorID:
|
||||||
ServerID coordinatorID;
|
ServerID coordinatorID;
|
||||||
size_t start = 0;
|
size_t start = 0;
|
||||||
|
@ -891,14 +889,11 @@ void ClusterComm::asyncAnswer(std::string& coordinatorHeader,
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
std::string ClusterComm::processAnswer(std::string& coordinatorHeader,
|
std::string ClusterComm::processAnswer(std::string& coordinatorHeader,
|
||||||
GeneralRequest* answerGeneral) {
|
GeneralRequest* answer) {
|
||||||
// TODO needs to generalized
|
|
||||||
auto answer = dynamic_cast<HttpRequest*>(answerGeneral);
|
|
||||||
|
|
||||||
if (answer == nullptr) {
|
if (answer == nullptr) {
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRI_ASSERT(answer != nullptr);
|
TRI_ASSERT(answer != nullptr);
|
||||||
// First take apart the header to get the operaitonID:
|
// First take apart the header to get the operaitonID:
|
||||||
OperationID operationID;
|
OperationID operationID;
|
||||||
|
@ -991,7 +986,7 @@ bool ClusterComm::moveFromSendToReceived(OperationID operationID) {
|
||||||
CONDITION_LOCKER(locker, somethingReceived);
|
CONDITION_LOCKER(locker, somethingReceived);
|
||||||
CONDITION_LOCKER(sendLocker, somethingToSend);
|
CONDITION_LOCKER(sendLocker, somethingToSend);
|
||||||
|
|
||||||
IndexIterator i = toSendByOpID.find(operationID); // cannot fail
|
IndexIterator i = toSendByOpID.find(operationID); // cannot fail
|
||||||
// TRI_ASSERT(i != toSendByOpID.end());
|
// TRI_ASSERT(i != toSendByOpID.end());
|
||||||
//KV: Except the operation has been dropped in the meantime
|
//KV: Except the operation has been dropped in the meantime
|
||||||
|
|
||||||
|
@ -1099,7 +1094,7 @@ size_t ClusterComm::performRequests(std::vector<ClusterCommRequest>& requests,
|
||||||
for (size_t i = 0; i < requests.size(); ++i) {
|
for (size_t i = 0; i < requests.size(); ++i) {
|
||||||
dueTime.push_back(startTime);
|
dueTime.push_back(startTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
nrDone = 0;
|
nrDone = 0;
|
||||||
size_t nrGood = 0;
|
size_t nrGood = 0;
|
||||||
|
|
||||||
|
@ -1116,7 +1111,7 @@ size_t ClusterComm::performRequests(std::vector<ClusterCommRequest>& requests,
|
||||||
for (size_t i = 0; i < requests.size(); i++) {
|
for (size_t i = 0; i < requests.size(); i++) {
|
||||||
if (!requests[i].done && now >= dueTime[i]) {
|
if (!requests[i].done && now >= dueTime[i]) {
|
||||||
if (requests[i].headerFields.get() == nullptr) {
|
if (requests[i].headerFields.get() == nullptr) {
|
||||||
requests[i].headerFields
|
requests[i].headerFields
|
||||||
= std::make_unique<std::unordered_map<std::string, std::string>>();
|
= std::make_unique<std::unordered_map<std::string, std::string>>();
|
||||||
}
|
}
|
||||||
LOG_TOPIC(TRACE, logTopic)
|
LOG_TOPIC(TRACE, logTopic)
|
||||||
|
@ -1191,7 +1186,7 @@ size_t ClusterComm::performRequests(std::vector<ClusterCommRequest>& requests,
|
||||||
}
|
}
|
||||||
LOG_TOPIC(TRACE, logTopic) << "ClusterComm::performRequests: "
|
LOG_TOPIC(TRACE, logTopic) << "ClusterComm::performRequests: "
|
||||||
<< "got answer from " << requests[index].destination << ":"
|
<< "got answer from " << requests[index].destination << ":"
|
||||||
<< requests[index].path << " with return code "
|
<< requests[index].path << " with return code "
|
||||||
<< (int) res.answer_code;
|
<< (int) res.answer_code;
|
||||||
} else if (res.status == CL_COMM_BACKEND_UNAVAILABLE ||
|
} else if (res.status == CL_COMM_BACKEND_UNAVAILABLE ||
|
||||||
(res.status == CL_COMM_TIMEOUT && !res.sendWasComplete)) {
|
(res.status == CL_COMM_TIMEOUT && !res.sendWasComplete)) {
|
||||||
|
@ -1236,7 +1231,7 @@ size_t ClusterComm::performRequests(std::vector<ClusterCommRequest>& requests,
|
||||||
LOG_TOPIC(DEBUG, logTopic) << "ClusterComm::performRequests: "
|
LOG_TOPIC(DEBUG, logTopic) << "ClusterComm::performRequests: "
|
||||||
<< "got timeout, this will be reported...";
|
<< "got timeout, this will be reported...";
|
||||||
|
|
||||||
// Forget about
|
// Forget about
|
||||||
drop("", coordinatorTransactionID, 0, "");
|
drop("", coordinatorTransactionID, 0, "");
|
||||||
return nrGood;
|
return nrGood;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
#include "Basics/Thread.h"
|
#include "Basics/Thread.h"
|
||||||
#include "Cluster/AgencyComm.h"
|
#include "Cluster/AgencyComm.h"
|
||||||
#include "Cluster/ClusterInfo.h"
|
#include "Cluster/ClusterInfo.h"
|
||||||
|
#include "Rest/GeneralRequest.h"
|
||||||
|
#include "Rest/GeneralResponse.h"
|
||||||
#include "Rest/HttpRequest.h"
|
#include "Rest/HttpRequest.h"
|
||||||
#include "Rest/HttpResponse.h"
|
#include "Rest/HttpResponse.h"
|
||||||
#include "SimpleHttpClient/SimpleHttpResult.h"
|
#include "SimpleHttpClient/SimpleHttpResult.h"
|
||||||
|
@ -90,8 +92,8 @@ enum ClusterCommOpStatus {
|
||||||
///
|
///
|
||||||
/// First, the actual destination is determined. If the responsible server
|
/// First, the actual destination is determined. If the responsible server
|
||||||
/// for a shard is not found or the endpoint for a named server is not found,
|
/// for a shard is not found or the endpoint for a named server is not found,
|
||||||
/// or if the given endpoint is no known protocol (currently "tcp://" or
|
/// or if the given endpoint is no known protocol (currently "tcp://" or
|
||||||
/// "ssl://", then `status` is set to CL_COMM_BACKEND_UNAVAILABLE,
|
/// "ssl://", then `status` is set to CL_COMM_BACKEND_UNAVAILABLE,
|
||||||
/// `errorMessage` is set but `result` and `answer` are both set
|
/// `errorMessage` is set but `result` and `answer` are both set
|
||||||
/// to nullptr. The flag `sendWasComplete` remains false and the
|
/// to nullptr. The flag `sendWasComplete` remains false and the
|
||||||
/// `answer_code` remains GeneralResponse::ResponseCode::PROCESSING.
|
/// `answer_code` remains GeneralResponse::ResponseCode::PROCESSING.
|
||||||
|
@ -111,7 +113,7 @@ enum ClusterCommOpStatus {
|
||||||
/// error cases `result`, `answer` and `answer_code` are still unset.
|
/// error cases `result`, `answer` and `answer_code` are still unset.
|
||||||
///
|
///
|
||||||
/// If the connection was successfully created the request is sent.
|
/// If the connection was successfully created the request is sent.
|
||||||
/// If the request ended with a timeout, `status` is set to
|
/// If the request ended with a timeout, `status` is set to
|
||||||
/// CL_COMM_TIMEOUT as above. If another communication error (broken
|
/// CL_COMM_TIMEOUT as above. If another communication error (broken
|
||||||
/// connection) happens, `status` is set to CL_COMM_BACKEND_UNAVAILABLE.
|
/// connection) happens, `status` is set to CL_COMM_BACKEND_UNAVAILABLE.
|
||||||
/// In both cases, `result` can be set or can still be a nullptr.
|
/// In both cases, `result` can be set or can still be a nullptr.
|
||||||
|
@ -125,7 +127,7 @@ enum ClusterCommOpStatus {
|
||||||
/// stage. The callback is called, and the result either left in the
|
/// stage. The callback is called, and the result either left in the
|
||||||
/// receiving queue or dropped. A call to ClusterComm::enquire or
|
/// receiving queue or dropped. A call to ClusterComm::enquire or
|
||||||
/// ClusterComm::wait can return a result in this state. Note that
|
/// ClusterComm::wait can return a result in this state. Note that
|
||||||
/// `answer` and `answer_code` are still not set. The flag
|
/// `answer` and `answer_code` are still not set. The flag
|
||||||
/// `sendWasComplete` is correctly set, though.
|
/// `sendWasComplete` is correctly set, though.
|
||||||
///
|
///
|
||||||
/// In the `singleRequest==false` mode, an asynchronous operation happens
|
/// In the `singleRequest==false` mode, an asynchronous operation happens
|
||||||
|
@ -189,9 +191,9 @@ struct ClusterCommResult {
|
||||||
std::shared_ptr<httpclient::SimpleHttpResult> result;
|
std::shared_ptr<httpclient::SimpleHttpResult> result;
|
||||||
// the field answer is != nullptr if status is == CL_COMM_RECEIVED
|
// the field answer is != nullptr if status is == CL_COMM_RECEIVED
|
||||||
// answer_code is valid iff answer is != 0
|
// answer_code is valid iff answer is != 0
|
||||||
std::shared_ptr<HttpRequest> answer;
|
std::shared_ptr<GeneralRequest> answer;
|
||||||
GeneralResponse::ResponseCode answer_code;
|
GeneralResponse::ResponseCode answer_code;
|
||||||
|
|
||||||
// The following flag indicates whether or not the complete request was
|
// The following flag indicates whether or not the complete request was
|
||||||
// sent to the other side. This is often important to judge whether or
|
// sent to the other side. This is often important to judge whether or
|
||||||
// not the operation could have been completed on the server, for example
|
// not the operation could have been completed on the server, for example
|
||||||
|
|
|
@ -48,7 +48,7 @@ static double const CL_DEFAULT_TIMEOUT = 60.0;
|
||||||
namespace arangodb {
|
namespace arangodb {
|
||||||
|
|
||||||
static int handleGeneralCommErrors(ClusterCommResult const* res) {
|
static int handleGeneralCommErrors(ClusterCommResult const* res) {
|
||||||
// This function creates an error code from a ClusterCommResult,
|
// This function creates an error code from a ClusterCommResult,
|
||||||
// but only if it is a communication error. If the communication
|
// but only if it is a communication error. If the communication
|
||||||
// was successful and there was an HTTP error code, this function
|
// was successful and there was an HTTP error code, this function
|
||||||
// returns TRI_ERROR_NO_ERROR.
|
// returns TRI_ERROR_NO_ERROR.
|
||||||
|
@ -406,10 +406,8 @@ std::unordered_map<std::string, std::string> getForwardableRequestHeaders(
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto httpRequest = dynamic_cast<HttpRequest*>(request);
|
if (request != nullptr) {
|
||||||
|
result["content-length"] = StringUtils::itoa(request->contentLength());
|
||||||
if (httpRequest != nullptr) {
|
|
||||||
result["content-length"] = StringUtils::itoa(httpRequest->contentLength());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -672,7 +670,7 @@ int countOnCoordinator(std::string const& dbname, std::string const& collname,
|
||||||
for (auto const& p : *shards) {
|
for (auto const& p : *shards) {
|
||||||
requests.emplace_back("shard:" + p.first,
|
requests.emplace_back("shard:" + p.first,
|
||||||
arangodb::GeneralRequest::RequestType::GET,
|
arangodb::GeneralRequest::RequestType::GET,
|
||||||
"/_db/" + StringUtils::urlEncode(dbname) +
|
"/_db/" + StringUtils::urlEncode(dbname) +
|
||||||
"/_api/collection/" +
|
"/_api/collection/" +
|
||||||
StringUtils::urlEncode(p.first) + "/count", body);
|
StringUtils::urlEncode(p.first) + "/count", body);
|
||||||
}
|
}
|
||||||
|
@ -700,7 +698,7 @@ int countOnCoordinator(std::string const& dbname, std::string const& collname,
|
||||||
return TRI_ERROR_CLUSTER_BACKEND_UNAVAILABLE;
|
return TRI_ERROR_CLUSTER_BACKEND_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRI_ERROR_NO_ERROR;
|
return TRI_ERROR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -973,7 +971,7 @@ int deleteDocumentOnCoordinator(
|
||||||
TRI_ASSERT(requests.size() == 1);
|
TRI_ASSERT(requests.size() == 1);
|
||||||
auto const& req = requests[0];
|
auto const& req = requests[0];
|
||||||
auto& res = req.result;
|
auto& res = req.result;
|
||||||
|
|
||||||
int commError = handleGeneralCommErrors(&res);
|
int commError = handleGeneralCommErrors(&res);
|
||||||
if (commError != TRI_ERROR_NO_ERROR) {
|
if (commError != TRI_ERROR_NO_ERROR) {
|
||||||
return commError;
|
return commError;
|
||||||
|
@ -1219,7 +1217,7 @@ int getDocumentOnCoordinator(
|
||||||
headers->emplace("if-match",
|
headers->emplace("if-match",
|
||||||
slice.get(StaticStrings::RevString).copyString());
|
slice.get(StaticStrings::RevString).copyString());
|
||||||
}
|
}
|
||||||
|
|
||||||
VPackSlice keySlice = slice;
|
VPackSlice keySlice = slice;
|
||||||
if (slice.isObject()) {
|
if (slice.isObject()) {
|
||||||
keySlice = slice.get(StaticStrings::KeyString);
|
keySlice = slice.get(StaticStrings::KeyString);
|
||||||
|
@ -1965,7 +1963,7 @@ int flushWalOnAllDBServers(bool waitForSync, bool waitForCollector) {
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief compute a shard distribution for a new collection, the list
|
/// @brief compute a shard distribution for a new collection, the list
|
||||||
/// dbServers must be a list of DBserver ids to distribute across.
|
/// dbServers must be a list of DBserver ids to distribute across.
|
||||||
/// If this list is empty, the complete current list of DBservers is
|
/// If this list is empty, the complete current list of DBservers is
|
||||||
/// fetched from ClusterInfo and with random_shuffle to mix it up.
|
/// fetched from ClusterInfo and with random_shuffle to mix it up.
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -2009,7 +2007,7 @@ std::map<std::string, std::vector<std::string>> distributeShards(
|
||||||
found = false;
|
found = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (std::find(serverIds.begin(), serverIds.end(), candidate) !=
|
} while (std::find(serverIds.begin(), serverIds.end(), candidate) !=
|
||||||
serverIds.end());
|
serverIds.end());
|
||||||
if (found) {
|
if (found) {
|
||||||
serverIds.push_back(candidate);
|
serverIds.push_back(candidate);
|
||||||
|
|
|
@ -66,7 +66,7 @@ int HttpServer::sendChunk(uint64_t taskId, std::string const& data) {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
HttpServer::HttpServer(
|
HttpServer::HttpServer(
|
||||||
double keepAliveTimeout,
|
double keepAliveTimeout,
|
||||||
bool allowMethodOverride,
|
bool allowMethodOverride,
|
||||||
std::vector<std::string> const& accessControlAllowOrigins)
|
std::vector<std::string> const& accessControlAllowOrigins)
|
||||||
: _listenTasks(),
|
: _listenTasks(),
|
||||||
|
|
|
@ -46,17 +46,12 @@ RestBatchHandler::~RestBatchHandler() {}
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
RestHandler::status RestBatchHandler::execute() {
|
RestHandler::status RestBatchHandler::execute() {
|
||||||
// TODO needs to generalized
|
// TODO OBI - generalize function
|
||||||
auto response = dynamic_cast<HttpResponse*>(_response);
|
if (_response == nullptr) {
|
||||||
|
|
||||||
if (response == nullptr) {
|
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO needs to generalized
|
if (_request == nullptr) {
|
||||||
auto httpRequest = dynamic_cast<HttpRequest*>(_request);
|
|
||||||
|
|
||||||
if (httpRequest == nullptr) {
|
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,15 +81,15 @@ RestHandler::status RestBatchHandler::execute() {
|
||||||
|
|
||||||
// get authorization header. we will inject this into the subparts
|
// get authorization header. we will inject this into the subparts
|
||||||
std::string const& authorization =
|
std::string const& authorization =
|
||||||
httpRequest->header(StaticStrings::Authorization);
|
_request->header(StaticStrings::Authorization);
|
||||||
|
|
||||||
// create the response
|
// create the response
|
||||||
setResponseCode(GeneralResponse::ResponseCode::OK);
|
setResponseCode(GeneralResponse::ResponseCode::OK);
|
||||||
response->setContentType(
|
_response->setContentType(
|
||||||
httpRequest->header(StaticStrings::ContentTypeHeader));
|
_request->header(StaticStrings::ContentTypeHeader));
|
||||||
|
|
||||||
// setup some auxiliary structures to parse the multipart message
|
// setup some auxiliary structures to parse the multipart message
|
||||||
std::string const& bodyStr = httpRequest->body();
|
std::string const& bodyStr = _request->body();
|
||||||
MultipartMessage message(boundary.c_str(), boundary.size(), bodyStr.c_str(),
|
MultipartMessage message(boundary.c_str(), boundary.size(), bodyStr.c_str(),
|
||||||
bodyStr.c_str() + bodyStr.size());
|
bodyStr.c_str() + bodyStr.size());
|
||||||
|
|
||||||
|
@ -148,7 +143,7 @@ RestHandler::status RestBatchHandler::execute() {
|
||||||
|
|
||||||
// set up request object for the part
|
// set up request object for the part
|
||||||
LOG(TRACE) << "part header is: " << std::string(headerStart, headerLength);
|
LOG(TRACE) << "part header is: " << std::string(headerStart, headerLength);
|
||||||
HttpRequest* request = new HttpRequest(httpRequest->connectionInfo(),
|
HttpRequest* request = new HttpRequest(_request->connectionInfo(),
|
||||||
headerStart, headerLength, false);
|
headerStart, headerLength, false);
|
||||||
|
|
||||||
// we do not have a client task id here
|
// we do not have a client task id here
|
||||||
|
@ -204,8 +199,7 @@ RestHandler::status RestBatchHandler::execute() {
|
||||||
return status::FAILED;
|
return status::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpResponse* partResponse =
|
GeneralResponse* partResponse = handler->response();
|
||||||
dynamic_cast<HttpResponse*>(handler->response());
|
|
||||||
|
|
||||||
if (partResponse == nullptr) {
|
if (partResponse == nullptr) {
|
||||||
generateError(GeneralResponse::ResponseCode::BAD, TRI_ERROR_INTERNAL,
|
generateError(GeneralResponse::ResponseCode::BAD, TRI_ERROR_INTERNAL,
|
||||||
|
@ -222,28 +216,28 @@ RestHandler::status RestBatchHandler::execute() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// append the boundary for this subpart
|
// append the boundary for this subpart
|
||||||
response->body().appendText(boundary + "\r\nContent-Type: ");
|
_response->body().appendText(boundary + "\r\nContent-Type: ");
|
||||||
response->body().appendText(StaticStrings::BatchContentType);
|
_response->body().appendText(StaticStrings::BatchContentType);
|
||||||
|
|
||||||
// append content-id if it is present
|
// append content-id if it is present
|
||||||
if (helper.contentId != 0) {
|
if (helper.contentId != 0) {
|
||||||
response->body().appendText(
|
_response->body().appendText(
|
||||||
"\r\nContent-Id: " +
|
"\r\nContent-Id: " +
|
||||||
std::string(helper.contentId, helper.contentIdLength));
|
std::string(helper.contentId, helper.contentIdLength));
|
||||||
}
|
}
|
||||||
|
|
||||||
response->body().appendText(TRI_CHAR_LENGTH_PAIR("\r\n\r\n"));
|
_response->body().appendText(TRI_CHAR_LENGTH_PAIR("\r\n\r\n"));
|
||||||
|
|
||||||
// remove some headers we don't need
|
// remove some headers we don't need
|
||||||
partResponse->setConnectionType(HttpResponse::CONNECTION_NONE);
|
partResponse->setConnectionType(HttpResponse::CONNECTION_NONE);
|
||||||
partResponse->setHeaderNC(StaticStrings::Server, "");
|
partResponse->setHeaderNC(StaticStrings::Server, "");
|
||||||
|
|
||||||
// append the part response header
|
// append the part response header
|
||||||
partResponse->writeHeader(&response->body());
|
partResponse->writeHeader(&_response->body());
|
||||||
|
|
||||||
// append the part response body
|
// append the part response body
|
||||||
response->body().appendText(partResponse->body());
|
_response->body().appendText(partResponse->body());
|
||||||
response->body().appendText(TRI_CHAR_LENGTH_PAIR("\r\n"));
|
_response->body().appendText(TRI_CHAR_LENGTH_PAIR("\r\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// we've read the last part
|
// we've read the last part
|
||||||
|
@ -253,10 +247,10 @@ RestHandler::status RestBatchHandler::execute() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// append final boundary + "--"
|
// append final boundary + "--"
|
||||||
response->body().appendText(boundary + "--");
|
_response->body().appendText(boundary + "--");
|
||||||
|
|
||||||
if (errors > 0) {
|
if (errors > 0) {
|
||||||
response->setHeaderNC(StaticStrings::Errors, StringUtils::itoa(errors));
|
_response->setHeaderNC(StaticStrings::Errors, StringUtils::itoa(errors));
|
||||||
}
|
}
|
||||||
|
|
||||||
// success
|
// success
|
||||||
|
@ -268,14 +262,12 @@ RestHandler::status RestBatchHandler::execute() {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool RestBatchHandler::getBoundaryBody(std::string* result) {
|
bool RestBatchHandler::getBoundaryBody(std::string* result) {
|
||||||
// TODO needs to generalized
|
|
||||||
auto request = dynamic_cast<HttpRequest*>(_request);
|
|
||||||
|
|
||||||
if (request == nullptr) {
|
if (_request == nullptr) {
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const& bodyStr = request->body();
|
std::string const& bodyStr = _request->body();
|
||||||
char const* p = bodyStr.c_str();
|
char const* p = bodyStr.c_str();
|
||||||
char const* e = p + bodyStr.size();
|
char const* e = p + bodyStr.size();
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ std::string RestImportHandler::buildParseError(size_t i,
|
||||||
|
|
||||||
int RestImportHandler::handleSingleDocument(
|
int RestImportHandler::handleSingleDocument(
|
||||||
SingleCollectionTransaction& trx, RestImportResult& result,
|
SingleCollectionTransaction& trx, RestImportResult& result,
|
||||||
VPackBuilder& babies, char const* lineStart, VPackSlice slice,
|
VPackBuilder& babies, char const* lineStart, VPackSlice slice,
|
||||||
bool isEdgeCollection, size_t i) {
|
bool isEdgeCollection, size_t i) {
|
||||||
|
|
||||||
if (!slice.isObject()) {
|
if (!slice.isObject()) {
|
||||||
|
@ -188,7 +188,7 @@ int RestImportHandler::handleSingleDocument(
|
||||||
// add prefixes to _from and _to
|
// add prefixes to _from and _to
|
||||||
if (!_fromPrefix.empty() || !_toPrefix.empty()) {
|
if (!_fromPrefix.empty() || !_toPrefix.empty()) {
|
||||||
TransactionBuilderLeaser tempBuilder(&trx);
|
TransactionBuilderLeaser tempBuilder(&trx);
|
||||||
|
|
||||||
tempBuilder->openObject();
|
tempBuilder->openObject();
|
||||||
if (!_fromPrefix.empty()) {
|
if (!_fromPrefix.empty()) {
|
||||||
VPackSlice from = slice.get(StaticStrings::FromString);
|
VPackSlice from = slice.get(StaticStrings::FromString);
|
||||||
|
@ -253,10 +253,8 @@ int RestImportHandler::handleSingleDocument(
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool RestImportHandler::createFromJson(std::string const& type) {
|
bool RestImportHandler::createFromJson(std::string const& type) {
|
||||||
// TODO needs to generalized
|
|
||||||
auto request = dynamic_cast<HttpRequest*>(_request);
|
|
||||||
|
|
||||||
if (request == nullptr) {
|
if (_request == nullptr) {
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,15 +298,12 @@ bool RestImportHandler::createFromJson(std::string const& type) {
|
||||||
} else if (type == "auto") {
|
} else if (type == "auto") {
|
||||||
linewise = true;
|
linewise = true;
|
||||||
|
|
||||||
// TODO generalize
|
if (_response == nullptr) {
|
||||||
auto* httpResponse = dynamic_cast<HttpResponse*>(_response);
|
|
||||||
|
|
||||||
if (httpResponse == nullptr) {
|
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// auto detect import type by peeking at first non-whitespace character
|
// auto detect import type by peeking at first non-whitespace character
|
||||||
std::string const& body = request->body();
|
std::string const& body = _request->body();
|
||||||
char const* ptr = body.c_str();
|
char const* ptr = body.c_str();
|
||||||
char const* end = ptr + body.size();
|
char const* end = ptr + body.size();
|
||||||
|
|
||||||
|
@ -361,7 +356,7 @@ bool RestImportHandler::createFromJson(std::string const& type) {
|
||||||
|
|
||||||
if (linewise) {
|
if (linewise) {
|
||||||
// each line is a separate JSON document
|
// each line is a separate JSON document
|
||||||
std::string const& body = request->body();
|
std::string const& body = _request->body();
|
||||||
char const* ptr = body.c_str();
|
char const* ptr = body.c_str();
|
||||||
char const* end = ptr + body.size();
|
char const* end = ptr + body.size();
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
@ -395,8 +390,8 @@ bool RestImportHandler::createFromJson(std::string const& type) {
|
||||||
ptr = pos + 1;
|
ptr = pos + 1;
|
||||||
++result._numEmpty;
|
++result._numEmpty;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos != nullptr) {
|
if (pos != nullptr) {
|
||||||
// non-empty line
|
// non-empty line
|
||||||
*(const_cast<char*>(pos)) = '\0';
|
*(const_cast<char*>(pos)) = '\0';
|
||||||
|
@ -442,7 +437,7 @@ bool RestImportHandler::createFromJson(std::string const& type) {
|
||||||
// the entire request body is one JSON document
|
// the entire request body is one JSON document
|
||||||
std::shared_ptr<VPackBuilder> parsedDocuments;
|
std::shared_ptr<VPackBuilder> parsedDocuments;
|
||||||
try {
|
try {
|
||||||
parsedDocuments = VPackParser::fromJson(request->body());
|
parsedDocuments = VPackParser::fromJson(_request->body());
|
||||||
} catch (VPackException const&) {
|
} catch (VPackException const&) {
|
||||||
generateError(GeneralResponse::ResponseCode::BAD,
|
generateError(GeneralResponse::ResponseCode::BAD,
|
||||||
TRI_ERROR_HTTP_BAD_PARAMETER,
|
TRI_ERROR_HTTP_BAD_PARAMETER,
|
||||||
|
@ -477,14 +472,14 @@ bool RestImportHandler::createFromJson(std::string const& type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
babies.close();
|
babies.close();
|
||||||
|
|
||||||
if (res == TRI_ERROR_NO_ERROR) {
|
if (res == TRI_ERROR_NO_ERROR) {
|
||||||
// no error so far. go on and perform the actual insert
|
// no error so far. go on and perform the actual insert
|
||||||
res = performImport(trx, result, collectionName, babies, complete, opOptions);
|
res = performImport(trx, result, collectionName, babies, complete, opOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = trx.finish(res);
|
res = trx.finish(res);
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
|
@ -500,10 +495,7 @@ bool RestImportHandler::createFromJson(std::string const& type) {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool RestImportHandler::createFromKeyValueList() {
|
bool RestImportHandler::createFromKeyValueList() {
|
||||||
// TODO needs to generalized
|
if (_request == nullptr) {
|
||||||
auto* request = dynamic_cast<HttpRequest*>(_request);
|
|
||||||
|
|
||||||
if (request == nullptr) {
|
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,7 +536,7 @@ bool RestImportHandler::createFromKeyValueList() {
|
||||||
lineNumber = StringUtils::int64(lineNumValue);
|
lineNumber = StringUtils::int64(lineNumValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const& bodyStr = request->body();
|
std::string const& bodyStr = _request->body();
|
||||||
char const* current = bodyStr.c_str();
|
char const* current = bodyStr.c_str();
|
||||||
char const* bodyEnd = current + bodyStr.size();
|
char const* bodyEnd = current + bodyStr.size();
|
||||||
|
|
||||||
|
@ -702,12 +694,12 @@ bool RestImportHandler::createFromKeyValueList() {
|
||||||
}
|
}
|
||||||
|
|
||||||
babies.close();
|
babies.close();
|
||||||
|
|
||||||
if (res == TRI_ERROR_NO_ERROR) {
|
if (res == TRI_ERROR_NO_ERROR) {
|
||||||
// no error so far. go on and perform the actual insert
|
// no error so far. go on and perform the actual insert
|
||||||
res = performImport(trx, result, collectionName, babies, complete, opOptions);
|
res = performImport(trx, result, collectionName, babies, complete, opOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = trx.finish(res);
|
res = trx.finish(res);
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
|
@ -723,7 +715,7 @@ bool RestImportHandler::createFromKeyValueList() {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
int RestImportHandler::performImport(SingleCollectionTransaction& trx,
|
int RestImportHandler::performImport(SingleCollectionTransaction& trx,
|
||||||
RestImportResult& result,
|
RestImportResult& result,
|
||||||
std::string const& collectionName,
|
std::string const& collectionName,
|
||||||
VPackBuilder const& babies,
|
VPackBuilder const& babies,
|
||||||
bool complete,
|
bool complete,
|
||||||
|
@ -767,10 +759,10 @@ int RestImportHandler::performImport(SingleCollectionTransaction& trx,
|
||||||
// special behavior in case of unique constraint violation . . .
|
// special behavior in case of unique constraint violation . . .
|
||||||
if (errorCode == TRI_ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED && _onDuplicateAction != DUPLICATE_ERROR) {
|
if (errorCode == TRI_ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED && _onDuplicateAction != DUPLICATE_ERROR) {
|
||||||
VPackSlice const keySlice = which.get(StaticStrings::KeyString);
|
VPackSlice const keySlice = which.get(StaticStrings::KeyString);
|
||||||
|
|
||||||
if (keySlice.isString()) {
|
if (keySlice.isString()) {
|
||||||
// insert failed. now try an update/replace
|
// insert failed. now try an update/replace
|
||||||
if (_onDuplicateAction == DUPLICATE_UPDATE ||
|
if (_onDuplicateAction == DUPLICATE_UPDATE ||
|
||||||
_onDuplicateAction == DUPLICATE_REPLACE) {
|
_onDuplicateAction == DUPLICATE_REPLACE) {
|
||||||
// update/replace
|
// update/replace
|
||||||
updateReplace.add(which);
|
updateReplace.add(which);
|
||||||
|
@ -795,7 +787,7 @@ int RestImportHandler::performImport(SingleCollectionTransaction& trx,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
|
@ -803,14 +795,14 @@ int RestImportHandler::performImport(SingleCollectionTransaction& trx,
|
||||||
updateReplace.close();
|
updateReplace.close();
|
||||||
|
|
||||||
if (res == TRI_ERROR_NO_ERROR && updateReplace.slice().length() > 0) {
|
if (res == TRI_ERROR_NO_ERROR && updateReplace.slice().length() > 0) {
|
||||||
if (_onDuplicateAction == DUPLICATE_UPDATE) {
|
if (_onDuplicateAction == DUPLICATE_UPDATE) {
|
||||||
opResult = trx.update(collectionName, updateReplace.slice(), opOptions);
|
opResult = trx.update(collectionName, updateReplace.slice(), opOptions);
|
||||||
} else {
|
} else {
|
||||||
opResult = trx.replace(collectionName, updateReplace.slice(), opOptions);
|
opResult = trx.replace(collectionName, updateReplace.slice(), opOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
VPackSlice resultSlice = opResult.slice();
|
VPackSlice resultSlice = opResult.slice();
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
for (auto const& it : VPackArrayIterator(resultSlice)) {
|
for (auto const& it : VPackArrayIterator(resultSlice)) {
|
||||||
if (!it.hasKey("error") || !it.get("error").getBool()) {
|
if (!it.hasKey("error") || !it.get("error").getBool()) {
|
||||||
++result._numUpdated;
|
++result._numUpdated;
|
||||||
|
@ -827,7 +819,7 @@ int RestImportHandler::performImport(SingleCollectionTransaction& trx,
|
||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -778,10 +778,8 @@ void RestReplicationHandler::handleCommandBarrier() {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void RestReplicationHandler::handleTrampolineCoordinator() {
|
void RestReplicationHandler::handleTrampolineCoordinator() {
|
||||||
// TODO needs to generalized
|
|
||||||
auto request = dynamic_cast<HttpRequest*>(_request);
|
|
||||||
|
|
||||||
if (request == nullptr) {
|
if (_request == nullptr) {
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -821,7 +819,7 @@ void RestReplicationHandler::handleTrampolineCoordinator() {
|
||||||
_request->requestType(),
|
_request->requestType(),
|
||||||
"/_db/" + StringUtils::urlEncode(dbname) +
|
"/_db/" + StringUtils::urlEncode(dbname) +
|
||||||
_request->requestPath() + params,
|
_request->requestPath() + params,
|
||||||
request->body(), *headers, 300.0);
|
_request->body(), *headers, 300.0);
|
||||||
|
|
||||||
if (res->status == CL_COMM_TIMEOUT) {
|
if (res->status == CL_COMM_TIMEOUT) {
|
||||||
// No reply, we give up:
|
// No reply, we give up:
|
||||||
|
@ -848,16 +846,13 @@ void RestReplicationHandler::handleTrampolineCoordinator() {
|
||||||
setResponseCode(static_cast<GeneralResponse::ResponseCode>(
|
setResponseCode(static_cast<GeneralResponse::ResponseCode>(
|
||||||
res->result->getHttpReturnCode()));
|
res->result->getHttpReturnCode()));
|
||||||
|
|
||||||
// TODO needs to generalized
|
if (_response == nullptr) {
|
||||||
auto response = dynamic_cast<HttpResponse*>(_response);
|
|
||||||
|
|
||||||
if (response == nullptr) {
|
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
response->setContentType(
|
_response->setContentType(
|
||||||
res->result->getHeaderField(StaticStrings::ContentTypeHeader, dummy));
|
res->result->getHeaderField(StaticStrings::ContentTypeHeader, dummy));
|
||||||
response->body().swap(&(res->result->getBody()));
|
_response->body().swap(&(res->result->getBody()));
|
||||||
|
|
||||||
auto const& resultHeaders = res->result->getHeaderFields();
|
auto const& resultHeaders = res->result->getHeaderFields();
|
||||||
for (auto const& it : resultHeaders) {
|
for (auto const& it : resultHeaders) {
|
||||||
|
@ -1003,14 +998,11 @@ void RestReplicationHandler::handleCommandLoggerFollow() {
|
||||||
setResponseCode(GeneralResponse::ResponseCode::OK);
|
setResponseCode(GeneralResponse::ResponseCode::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO needs to generalized
|
if (_response == nullptr) {
|
||||||
auto response = dynamic_cast<HttpResponse*>(_response);
|
|
||||||
|
|
||||||
if (response == nullptr) {
|
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
response->setContentType(GeneralResponse::ContentType::DUMP);
|
_response->setContentType(GeneralResponse::ContentType::DUMP);
|
||||||
|
|
||||||
// set headers
|
// set headers
|
||||||
_response->setHeaderNC(TRI_REPLICATION_HEADER_CHECKMORE,
|
_response->setHeaderNC(TRI_REPLICATION_HEADER_CHECKMORE,
|
||||||
|
@ -1029,7 +1021,7 @@ void RestReplicationHandler::handleCommandLoggerFollow() {
|
||||||
|
|
||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
// transfer ownership of the buffer contents
|
// transfer ownership of the buffer contents
|
||||||
response->body().set(dump._buffer);
|
_response->body().set(dump._buffer);
|
||||||
|
|
||||||
// to avoid double freeing
|
// to avoid double freeing
|
||||||
TRI_StealStringBuffer(dump._buffer);
|
TRI_StealStringBuffer(dump._buffer);
|
||||||
|
@ -1106,14 +1098,11 @@ void RestReplicationHandler::handleCommandDetermineOpenTransactions() {
|
||||||
setResponseCode(GeneralResponse::ResponseCode::OK);
|
setResponseCode(GeneralResponse::ResponseCode::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO needs to generalized
|
if (_response == nullptr) {
|
||||||
auto response = dynamic_cast<HttpResponse*>(_response);
|
|
||||||
|
|
||||||
if (response == nullptr) {
|
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
response->setContentType(HttpResponse::ContentType::DUMP);
|
_response->setContentType(HttpResponse::ContentType::DUMP);
|
||||||
|
|
||||||
_response->setHeaderNC(TRI_REPLICATION_HEADER_FROMPRESENT,
|
_response->setHeaderNC(TRI_REPLICATION_HEADER_FROMPRESENT,
|
||||||
dump._fromTickIncluded ? "true" : "false");
|
dump._fromTickIncluded ? "true" : "false");
|
||||||
|
@ -1123,7 +1112,7 @@ void RestReplicationHandler::handleCommandDetermineOpenTransactions() {
|
||||||
|
|
||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
// transfer ownership of the buffer contents
|
// transfer ownership of the buffer contents
|
||||||
response->body().set(dump._buffer);
|
_response->body().set(dump._buffer);
|
||||||
|
|
||||||
// to avoid double freeing
|
// to avoid double freeing
|
||||||
TRI_StealStringBuffer(dump._buffer);
|
TRI_StealStringBuffer(dump._buffer);
|
||||||
|
@ -1215,10 +1204,10 @@ void RestReplicationHandler::handleCommandClusterInventory() {
|
||||||
|
|
||||||
AgencyComm _agency;
|
AgencyComm _agency;
|
||||||
AgencyCommResult result;
|
AgencyCommResult result;
|
||||||
|
|
||||||
std::string prefix("Plan/Collections/");
|
std::string prefix("Plan/Collections/");
|
||||||
prefix.append(dbName);
|
prefix.append(dbName);
|
||||||
|
|
||||||
result = _agency.getValues(prefix);
|
result = _agency.getValues(prefix);
|
||||||
if (!result.successful()) {
|
if (!result.successful()) {
|
||||||
generateError(GeneralResponse::ResponseCode::SERVER_ERROR,
|
generateError(GeneralResponse::ResponseCode::SERVER_ERROR,
|
||||||
|
@ -1258,7 +1247,7 @@ void RestReplicationHandler::handleCommandClusterInventory() {
|
||||||
resultBuilder.slice());
|
resultBuilder.slice());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -2186,14 +2175,12 @@ int RestReplicationHandler::processRestoreDataBatch(
|
||||||
|
|
||||||
VPackBuilder builder;
|
VPackBuilder builder;
|
||||||
|
|
||||||
// TODO needs to generalized
|
|
||||||
auto request = dynamic_cast<HttpRequest*>(_request);
|
|
||||||
|
|
||||||
if (request == nullptr) {
|
if (_request == nullptr) {
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const& bodyStr = request->body();
|
std::string const& bodyStr = _request->body();
|
||||||
char const* ptr = bodyStr.c_str();
|
char const* ptr = bodyStr.c_str();
|
||||||
char const* end = ptr + bodyStr.size();
|
char const* end = ptr + bodyStr.size();
|
||||||
|
|
||||||
|
@ -2528,14 +2515,11 @@ void RestReplicationHandler::handleCommandRestoreDataCoordinator() {
|
||||||
std::string("received invalid JSON data for collection ") + name;
|
std::string("received invalid JSON data for collection ") + name;
|
||||||
VPackBuilder builder;
|
VPackBuilder builder;
|
||||||
|
|
||||||
// TODO needs to generalized
|
if (_request == nullptr) {
|
||||||
auto request = dynamic_cast<HttpRequest*>(_request);
|
|
||||||
|
|
||||||
if (request == nullptr) {
|
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const& bodyStr = request->body();
|
std::string const& bodyStr = _request->body();
|
||||||
char const* ptr = bodyStr.c_str();
|
char const* ptr = bodyStr.c_str();
|
||||||
char const* end = ptr + bodyStr.size();
|
char const* end = ptr + bodyStr.size();
|
||||||
|
|
||||||
|
@ -3153,7 +3137,7 @@ void RestReplicationHandler::handleCommandDump() {
|
||||||
|
|
||||||
bool compat28 = false;
|
bool compat28 = false;
|
||||||
std::string const& value8 = _request->value("compat28", found);
|
std::string const& value8 = _request->value("compat28", found);
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
compat28 = StringUtils::boolean(value8);
|
compat28 = StringUtils::boolean(value8);
|
||||||
}
|
}
|
||||||
|
@ -3195,7 +3179,7 @@ void RestReplicationHandler::handleCommandDump() {
|
||||||
TRI_replication_dump_t dump(transactionContext,
|
TRI_replication_dump_t dump(transactionContext,
|
||||||
static_cast<size_t>(determineChunkSize()),
|
static_cast<size_t>(determineChunkSize()),
|
||||||
includeSystem, 0);
|
includeSystem, 0);
|
||||||
|
|
||||||
if (compat28) {
|
if (compat28) {
|
||||||
dump._compat28 = true;
|
dump._compat28 = true;
|
||||||
}
|
}
|
||||||
|
@ -3507,7 +3491,7 @@ void RestReplicationHandler::handleCommandSync() {
|
||||||
config._includeSystem = includeSystem;
|
config._includeSystem = includeSystem;
|
||||||
config._verbose = verbose;
|
config._verbose = verbose;
|
||||||
config._useCollectionId = useCollectionId;
|
config._useCollectionId = useCollectionId;
|
||||||
|
|
||||||
// wait until all data in current logfile got synced
|
// wait until all data in current logfile got synced
|
||||||
arangodb::wal::LogfileManager::instance()->waitForSync(5.0);
|
arangodb::wal::LogfileManager::instance()->waitForSync(5.0);
|
||||||
|
|
||||||
|
@ -4018,7 +4002,7 @@ void RestReplicationHandler::handleCommandHoldReadLockCollection() {
|
||||||
double now = TRI_microtime();
|
double now = TRI_microtime();
|
||||||
double startTime = now;
|
double startTime = now;
|
||||||
double endTime = startTime + ttl;
|
double endTime = startTime + ttl;
|
||||||
|
|
||||||
{
|
{
|
||||||
CONDITION_LOCKER(locker, _condVar);
|
CONDITION_LOCKER(locker, _condVar);
|
||||||
while (now < endTime) {
|
while (now < endTime) {
|
||||||
|
|
|
@ -42,10 +42,8 @@ RestUploadHandler::RestUploadHandler(GeneralRequest* request,
|
||||||
RestUploadHandler::~RestUploadHandler() {}
|
RestUploadHandler::~RestUploadHandler() {}
|
||||||
|
|
||||||
RestHandler::status RestUploadHandler::execute() {
|
RestHandler::status RestUploadHandler::execute() {
|
||||||
// TODO needs to generalized
|
|
||||||
auto request = dynamic_cast<HttpRequest*>(_request);
|
|
||||||
|
|
||||||
if (request == nullptr) {
|
if (_request == nullptr) {
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +71,7 @@ RestHandler::status RestUploadHandler::execute() {
|
||||||
|
|
||||||
char* relative = TRI_GetFilename(filename);
|
char* relative = TRI_GetFilename(filename);
|
||||||
|
|
||||||
std::string const& bodyStr = request->body();
|
std::string const& bodyStr = _request->body();
|
||||||
char const* body = bodyStr.c_str();
|
char const* body = bodyStr.c_str();
|
||||||
size_t bodySize = bodyStr.size();
|
size_t bodySize = bodyStr.size();
|
||||||
|
|
||||||
|
@ -135,14 +133,12 @@ RestHandler::status RestUploadHandler::execute() {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool RestUploadHandler::parseMultiPart(char const*& body, size_t& length) {
|
bool RestUploadHandler::parseMultiPart(char const*& body, size_t& length) {
|
||||||
// TODO needs to generalized
|
|
||||||
auto request = dynamic_cast<HttpRequest*>(_request);
|
|
||||||
|
|
||||||
if (request == nullptr) {
|
if (_request == nullptr) {
|
||||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
THROW_ARANGO_EXCEPTION(TRI_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const& bodyStr = request->body();
|
std::string const& bodyStr = _request->body();
|
||||||
char const* beg = bodyStr.c_str();
|
char const* beg = bodyStr.c_str();
|
||||||
char const* end = beg + bodyStr.size();
|
char const* end = beg + bodyStr.size();
|
||||||
|
|
||||||
|
|
|
@ -649,12 +649,8 @@ std::shared_ptr<VPackBuilder> RestVocbaseBaseHandler::parseVelocyPackBody(
|
||||||
contentType == StaticStrings::MimeTypeVPack) {
|
contentType == StaticStrings::MimeTypeVPack) {
|
||||||
|
|
||||||
VPackValidator validator;
|
VPackValidator validator;
|
||||||
//FIXME broken casts!!
|
validator.validate(_request->body().c_str() ,_request->body().length());
|
||||||
validator.validate(static_cast<HttpRequest*>(_request)->body().c_str()
|
VPackSlice slice{_request->body().c_str()};
|
||||||
,static_cast<HttpRequest*>(_request)->body().length()
|
|
||||||
);
|
|
||||||
|
|
||||||
VPackSlice slice{ static_cast<HttpRequest*>(_request)->body().c_str()};
|
|
||||||
auto builder = std::make_shared<VPackBuilder>(options);
|
auto builder = std::make_shared<VPackBuilder>(options);
|
||||||
builder->add(slice);
|
builder->add(slice);
|
||||||
return builder;
|
return builder;
|
||||||
|
|
|
@ -65,7 +65,7 @@ SingleCollectionTransaction::SingleCollectionTransaction(
|
||||||
// add the (sole) collection
|
// add the (sole) collection
|
||||||
if (setupState() == TRI_ERROR_NO_ERROR) {
|
if (setupState() == TRI_ERROR_NO_ERROR) {
|
||||||
_cid = resolver()->getCollectionId(name);
|
_cid = resolver()->getCollectionId(name);
|
||||||
addCollection(_cid, _accessType);
|
addCollection(_cid, name.c_str(), _accessType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3292,6 +3292,9 @@ int Transaction::addCollectionEmbedded(TRI_voc_cid_t cid, TRI_transaction_type_e
|
||||||
false, _allowImplicitCollections);
|
false, _allowImplicitCollections);
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
|
if (res == TRI_ERROR_TRANSACTION_UNREGISTERED_COLLECTION) {
|
||||||
|
THROW_ARANGO_EXCEPTION_MESSAGE(res, std::string(TRI_errno_string(res)) + ": " + resolver()->getCollectionNameCluster(cid));
|
||||||
|
}
|
||||||
return registerError(res);
|
return registerError(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3316,6 +3319,9 @@ int Transaction::addCollectionToplevel(TRI_voc_cid_t cid, TRI_transaction_type_e
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
|
if (res == TRI_ERROR_TRANSACTION_UNREGISTERED_COLLECTION) {
|
||||||
|
THROW_ARANGO_EXCEPTION_MESSAGE(res, std::string(TRI_errno_string(res)) + ": " + resolver()->getCollectionNameCluster(cid));
|
||||||
|
}
|
||||||
registerError(res);
|
registerError(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -385,6 +385,9 @@ class Transaction {
|
||||||
type,
|
type,
|
||||||
_nestingLevel, true, true);
|
_nestingLevel, true, true);
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
|
if (res == TRI_ERROR_TRANSACTION_UNREGISTERED_COLLECTION) {
|
||||||
|
THROW_ARANGO_EXCEPTION_MESSAGE(res, std::string(TRI_errno_string(res)) + ": " + collectionName);
|
||||||
|
}
|
||||||
THROW_ARANGO_EXCEPTION(res);
|
THROW_ARANGO_EXCEPTION(res);
|
||||||
}
|
}
|
||||||
TRI_EnsureCollectionsTransaction(_trx, _nestingLevel);
|
TRI_EnsureCollectionsTransaction(_trx, _nestingLevel);
|
||||||
|
|
|
@ -290,11 +290,11 @@ static void AddCookie(v8::Isolate* isolate, TRI_v8_global_t const* v8g,
|
||||||
|
|
||||||
static v8::Handle<v8::Object> RequestCppToV8(v8::Isolate* isolate,
|
static v8::Handle<v8::Object> RequestCppToV8(v8::Isolate* isolate,
|
||||||
TRI_v8_global_t const* v8g,
|
TRI_v8_global_t const* v8g,
|
||||||
GeneralRequest* generalRequest) {
|
GeneralRequest* request) {
|
||||||
// setup the request
|
// setup the request
|
||||||
v8::Handle<v8::Object> req = v8::Object::New(isolate);
|
v8::Handle<v8::Object> req = v8::Object::New(isolate);
|
||||||
|
|
||||||
auto request = dynamic_cast<HttpRequest*>(generalRequest);
|
//auto request = dynamic_cast<HttpRequest*>(generalRequest);
|
||||||
|
|
||||||
// TODO generalize
|
// TODO generalize
|
||||||
if (request == nullptr) {
|
if (request == nullptr) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -1018,13 +1018,14 @@ if (list.length > 0) {
|
||||||
<span class="icon_arangodb_edge5 icon_arangodb_edge5-2 tile-icon"></span>
|
<span class="icon_arangodb_edge5 icon_arangodb_edge5-2 tile-icon"></span>
|
||||||
<div class="tileBadge"></div>
|
<div class="tileBadge"></div>
|
||||||
<h5 class="collectionName"><%=graphName %></h5>
|
<h5 class="collectionName"><%=graphName %></h5>
|
||||||
|
<span id="gv2" title="please remove me when final" style="background-color: red; color: white; width: 100px; position: absolute; right: 9px; border-radius: 2px; ">DEV GV2</span>
|
||||||
</div>
|
</div>
|
||||||
</div> <%});%> </div>
|
</div> <%});%> </div>
|
||||||
</div></script><script id="graphSettingsView.ejs" type="text/template"> <% var genClass = 'pure-u-1-2'; %> <% var formatName = function(name) { %> <% var formattedName = %> <% return name.charAt(0).toUpperCase() + string.slice(1);%> <% }; %> <div id="graphSettingsView" class="innerContent">
|
</div></script><script id="graphSettingsView.ejs" type="text/template"> <% var genClass = 'pure-u-1-3'; %> <% var genClass2 = 'pure-u-2-3'; %> <% var formatName = function(name) { %> <% var formattedName = %> <% return name.charAt(0).toUpperCase() + string.slice(1);%> <% }; %> <div id="graphSettingsView" class="innerContent">
|
||||||
|
|
||||||
<div class="pure-g" style="margin-top: -15px">
|
<div class="pure-g" style="margin-top: -15px">
|
||||||
|
|
||||||
<div class="pure-u-1-1 pure-u-md-1-1 pure-u-lg-1-1 pure-u-xl-1-2">
|
<div class="pure-u-1-1 pure-u-md-1-1 pure-u-lg-1-1 pure-u-xl-1-1">
|
||||||
|
|
||||||
<div class="sectionHeader pure-g">
|
<div class="sectionHeader pure-g">
|
||||||
<div class="pure-u-1-1">
|
<div class="pure-u-1-1">
|
||||||
|
@ -1035,14 +1036,12 @@ if (list.length > 0) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pure-g pure-table pure-table-body"> <% _.each(specific, function(val, key) { %> <% if (val.type === 'divider') { %> <div class="heading <%= genClass %> left"><%=val.name%></div>
|
<div class="pure-g pure-table pure-table-body"> <% _.each(specific, function(val, key) { %> <% if (val.type === 'divider') { %> <div class="heading <%= genClass %> left"><%=val.name%></div>
|
||||||
<div class="<%= genClass %> left"></div> <% } else { %> <div class="<%= genClass %> left"><%=val.name%></div>
|
<div class="<%= genClass2 %> left"></div> <% } else { %> <div class="<%= genClass %> left"><%=val.name%></div>
|
||||||
<div class="<%= genClass %> left"> <% var VALUE; %> <% if (val.value) { %> <% VALUE = val.value %> <% } else { %> <% VALUE = val.default %> <% } %> <% if (val.type === 'string') { %> <input id="g_<%=key%>" type="text" placeholder="string"></input> <% } %> <% if (val.type === 'number') { %> <input id="g_<%=key%>" type="text" placeholder="number"></input> <% } %> <% if (val.type === 'color') { %> <input id="g_<%=key%>" type='color' name='color' value="<%=VALUE%>"/> <% } %> <% if (val.type === 'select') { %> <div class="<%= genClass %> left">
|
<div class="<%= genClass2 %> left"> <% var VALUE; %> <% if (val.value) { %> <% VALUE = val.value %> <% } else { %> <% VALUE = val.default %> <% } %> <% if (val.type === 'string') { %> <input id="g_<%=key%>" type="text" placeholder="string"></input> <% } %> <% if (val.type === 'number') { %> <input id="g_<%=key%>" type="text" placeholder="number"></input> <% } %> <% if (val.type === 'color') { %> <input id="g_<%=key%>" type='color' name='color' value="<%=VALUE%>"/> <% } %> <% if (val.type === 'select') { %> <select id="g_<%=key%>"> <% _.each(val, function(option, optKey) { %> <% if (option.name) { %> <option value="<%=option.val%>"> <%=option.name%> </option> <% } %> <% }); %> </select> <% } %> </div> <% } %> <% }); %> </div>
|
||||||
<select id="g_<%=key%>"> <% _.each(val, function(option, optKey) { %> <% if (option.name) { %> <option value="<%=option.val%>"> <%=option.name%> </option> <% } %> <% }); %> </select>
|
|
||||||
</div> <% } %> </div> <% } %> <% }); %> </div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pure-u-1-1 pure-u-md-1-1 pure-u-lg-1-1 pure-u-xl-1-2">
|
<div class="pure-u-1-1 pure-u-md-1-1 pure-u-lg-1-1 pure-u-xl-1-1">
|
||||||
|
|
||||||
<div class="sectionHeader pure-g">
|
<div class="sectionHeader pure-g">
|
||||||
<div class="pure-u-1-1">
|
<div class="pure-u-1-1">
|
||||||
|
@ -1053,9 +1052,7 @@ if (list.length > 0) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pure-g pure-table pure-table-body"> <% _.each(general, function(val, key) { %> <% if (val.type === 'divider') { %> <div class="heading <%= genClass %> left"><%=val.name%></div>
|
<div class="pure-g pure-table pure-table-body"> <% _.each(general, function(val, key) { %> <% if (val.type === 'divider') { %> <div class="heading <%= genClass %> left"><%=val.name%></div>
|
||||||
<div class="<%= genClass %> left"></div> <% } else { %> <div class="<%= genClass %> left"><%=val.name%></div> <% if (val.type === 'select') { %> <div class="<%= genClass %> left">
|
<div class="<%= genClass2 %> left"></div> <% } else { %> <div class="<%= genClass %> left"><%=val.name%></div> <% if (val.type === 'select') { %> <select id="g_<%=key%>"> <% _.each(val, function(option, optKey) { %> <% if (option.name) { %> <option value="<%=option.val%>"> <%=option.name%> </option> <% } %> <% }); %> </select> <% } %> <% if (val.type === 'string') { %> <input id="g_<%=key%>" type="text" placeholder="string"></input> <% } %> <% if (val.type === 'number') { %> <input id="g_<%=key%>" type="text" id="<%=val %>" value="<%=val.value %>" placeholder=""></input> <% } %> <% } %> <% }); %> </div>
|
||||||
<select id="g_<%=key%>"> <% _.each(val, function(option, optKey) { %> <% if (option.name) { %> <option value="<%=option.val%>"> <%=option.name%> </option> <% } %> <% }); %> </select>
|
|
||||||
</div> <% } %> <% if (val.type === 'string') { %> <input id="g_<%=key%>" type="text" placeholder="string"></input> <% } %> <% if (val.type === 'number') { %> <input id="g_<%=key%>" type="text" id="<%=val %>" value="<%=val.value %>" placeholder=""></input> <% } %> <% } %> <% }); %> </div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1066,6 +1063,13 @@ if (list.length > 0) {
|
||||||
<div class="headerBar">
|
<div class="headerBar">
|
||||||
<div class="headerButtonBar" style="margin: 0;">
|
<div class="headerButtonBar" style="margin: 0;">
|
||||||
<ul class="headerButtonList">
|
<ul class="headerButtonList">
|
||||||
|
<li class="enabled">
|
||||||
|
<a id="settingsMenu" class="headerButton">
|
||||||
|
<span title="Download visible graph as png image">
|
||||||
|
<i class="fa fa-bars fa-stack-1x"></i>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li class="enabled">
|
<li class="enabled">
|
||||||
<a id="graph-fullscreen-btn" class="headerButton">
|
<a id="graph-fullscreen-btn" class="headerButton">
|
||||||
<span title="Switch to fullscreen mode">
|
<span title="Switch to fullscreen mode">
|
||||||
|
@ -2711,4 +2715,4 @@ var cutByResolution = function (str) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="workMonitorContent" class="innerContent">
|
<div id="workMonitorContent" class="innerContent">
|
||||||
</div></script></head><body><nav class="navbar" style="display: none"><div class="primary"><div class="navlogo"><a class="logo big" href="#"><img class="arangodbLogo" src="img/arangodb_logo_big.png"></a><a class="logo small" href="#"><img class="arangodbLogo" src="img/arangodb_logo_small.png"></a><a class="version"><span>VERSION: </span><span id="currentVersion"></span></a></div><div class="statmenu" id="statisticBar"></div><div class="navmenu" id="navigationBar"></div></div></nav><div id="modalPlaceholder"></div><div class="bodyWrapper" style="display: none"><div class="centralRow"><div id="navbar2" class="navbarWrapper secondary"><div class="subnavmenu" id="subNavigationBar"></div></div><div class="resizecontainer contentWrapper"><div id="loadingScreen" class="loadingScreen" style="display: none"><i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw margin-bottom"></i> <span class="sr-only">Loading...</span></div><div id="content" class="centralContent"></div><footer class="footer"><div id="footerBar"></div></footer></div></div></div><div id="progressPlaceholder" style="display:none"></div><div id="spotlightPlaceholder" style="display:none"></div><div id="offlinePlaceholder" style="display:none"><div class="offline-div"><div class="pure-u"><div class="pure-u-1-4"></div><div class="pure-u-1-2 offline-window"><div class="offline-header"><h3>You have been disconnected from the server</h3></div><div class="offline-body"><p>The connection to the server has been lost. The server may be under heavy load.</p><p>Trying to reconnect in <span id="offlineSeconds">10</span> seconds.</p><p class="animation_state"><span><button class="button-success">Reconnect now</button></span></p></div></div><div class="pure-u-1-4"></div></div></div></div><div class="arangoFrame" style=""><div class="outerDiv"><div class="innerDiv"></div></div></div><script src="libs.js?version=1468517665207"></script><script src="app.js?version=1468517665207"></script></body></html>
|
</div></script></head><body><nav class="navbar" style="display: none"><div class="primary"><div class="navlogo"><a class="logo big" href="#"><img class="arangodbLogo" src="img/arangodb_logo_big.png"></a><a class="logo small" href="#"><img class="arangodbLogo" src="img/arangodb_logo_small.png"></a><a class="version"><span>VERSION: </span><span id="currentVersion"></span></a></div><div class="statmenu" id="statisticBar"></div><div class="navmenu" id="navigationBar"></div></div></nav><div id="modalPlaceholder"></div><div class="bodyWrapper" style="display: none"><div class="centralRow"><div id="navbar2" class="navbarWrapper secondary"><div class="subnavmenu" id="subNavigationBar"></div></div><div class="resizecontainer contentWrapper"><div id="loadingScreen" class="loadingScreen" style="display: none"><i class="fa fa-circle-o-notch fa-spin fa-3x fa-fw margin-bottom"></i> <span class="sr-only">Loading...</span></div><div id="content" class="centralContent"></div><footer class="footer"><div id="footerBar"></div></footer></div></div></div><div id="progressPlaceholder" style="display:none"></div><div id="spotlightPlaceholder" style="display:none"></div><div id="graphSettingsContent" style="display: none"></div><div id="offlinePlaceholder" style="display:none"><div class="offline-div"><div class="pure-u"><div class="pure-u-1-4"></div><div class="pure-u-1-2 offline-window"><div class="offline-header"><h3>You have been disconnected from the server</h3></div><div class="offline-body"><p>The connection to the server has been lost. The server may be under heavy load.</p><p>Trying to reconnect in <span id="offlineSeconds">10</span> seconds.</p><p class="animation_state"><span><button class="button-success">Reconnect now</button></span></p></div></div><div class="pure-u-1-4"></div></div></div></div><div class="arangoFrame" style=""><div class="outerDiv"><div class="innerDiv"></div></div></div><script src="libs.js?version=1468602932566"></script><script src="app.js?version=1468602932566"></script></body></html>
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
|
@ -51,6 +51,9 @@
|
||||||
<div id="spotlightPlaceholder" style="display:none">
|
<div id="spotlightPlaceholder" style="display:none">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="graphSettingsContent" style="display: none">
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="offlinePlaceholder" style="display:none">
|
<div id="offlinePlaceholder" style="display:none">
|
||||||
<div class="offline-div">
|
<div class="offline-div">
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<script id="graphSettingsView.ejs" type="text/template">
|
<script id="graphSettingsView.ejs" type="text/template">
|
||||||
|
|
||||||
<% var genClass = 'pure-u-1-2'; %>
|
<% var genClass = 'pure-u-1-3'; %>
|
||||||
|
<% var genClass2 = 'pure-u-2-3'; %>
|
||||||
|
|
||||||
<% var formatName = function(name) { %>
|
<% var formatName = function(name) { %>
|
||||||
<% var formattedName = %>
|
<% var formattedName = %>
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
|
|
||||||
<div class="pure-g" style="margin-top: -15px">
|
<div class="pure-g" style="margin-top: -15px">
|
||||||
|
|
||||||
<div class="pure-u-1-1 pure-u-md-1-1 pure-u-lg-1-1 pure-u-xl-1-2">
|
<div class="pure-u-1-1 pure-u-md-1-1 pure-u-lg-1-1 pure-u-xl-1-1">
|
||||||
|
|
||||||
<div class="sectionHeader pure-g">
|
<div class="sectionHeader pure-g">
|
||||||
<div class="pure-u-1-1">
|
<div class="pure-u-1-1">
|
||||||
|
@ -26,11 +27,11 @@
|
||||||
|
|
||||||
<% if (val.type === 'divider') { %>
|
<% if (val.type === 'divider') { %>
|
||||||
<div class="heading <%= genClass %> left"><%=val.name%></div>
|
<div class="heading <%= genClass %> left"><%=val.name%></div>
|
||||||
<div class="<%= genClass %> left"></div>
|
<div class="<%= genClass2 %> left"></div>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
|
|
||||||
<div class="<%= genClass %> left"><%=val.name%></div>
|
<div class="<%= genClass %> left"><%=val.name%></div>
|
||||||
<div class="<%= genClass %> left">
|
<div class="<%= genClass2 %> left">
|
||||||
|
|
||||||
|
|
||||||
<% var VALUE; %>
|
<% var VALUE; %>
|
||||||
|
@ -53,7 +54,6 @@
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<% if (val.type === 'select') { %>
|
<% if (val.type === 'select') { %>
|
||||||
<div class="<%= genClass %> left">
|
|
||||||
<select id="g_<%=key%>">
|
<select id="g_<%=key%>">
|
||||||
<% _.each(val, function(option, optKey) { %>
|
<% _.each(val, function(option, optKey) { %>
|
||||||
<% if (option.name) { %>
|
<% if (option.name) { %>
|
||||||
|
@ -61,7 +61,6 @@
|
||||||
<% } %>
|
<% } %>
|
||||||
<% }); %>
|
<% }); %>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -71,7 +70,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pure-u-1-1 pure-u-md-1-1 pure-u-lg-1-1 pure-u-xl-1-2">
|
<div class="pure-u-1-1 pure-u-md-1-1 pure-u-lg-1-1 pure-u-xl-1-1">
|
||||||
|
|
||||||
<div class="sectionHeader pure-g">
|
<div class="sectionHeader pure-g">
|
||||||
<div class="pure-u-1-1">
|
<div class="pure-u-1-1">
|
||||||
|
@ -86,12 +85,11 @@
|
||||||
<% _.each(general, function(val, key) { %>
|
<% _.each(general, function(val, key) { %>
|
||||||
<% if (val.type === 'divider') { %>
|
<% if (val.type === 'divider') { %>
|
||||||
<div class="heading <%= genClass %> left"><%=val.name%></div>
|
<div class="heading <%= genClass %> left"><%=val.name%></div>
|
||||||
<div class="<%= genClass %> left"></div>
|
<div class="<%= genClass2 %> left"></div>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<div class="<%= genClass %> left"><%=val.name%></div>
|
<div class="<%= genClass %> left"><%=val.name%></div>
|
||||||
|
|
||||||
<% if (val.type === 'select') { %>
|
<% if (val.type === 'select') { %>
|
||||||
<div class="<%= genClass %> left">
|
|
||||||
<select id="g_<%=key%>">
|
<select id="g_<%=key%>">
|
||||||
<% _.each(val, function(option, optKey) { %>
|
<% _.each(val, function(option, optKey) { %>
|
||||||
<% if (option.name) { %>
|
<% if (option.name) { %>
|
||||||
|
@ -99,7 +97,6 @@
|
||||||
<% } %>
|
<% } %>
|
||||||
<% }); %>
|
<% }); %>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<% if (val.type === 'string') { %>
|
<% if (val.type === 'string') { %>
|
||||||
|
|
|
@ -4,6 +4,13 @@
|
||||||
<div class="headerBar">
|
<div class="headerBar">
|
||||||
<div class="headerButtonBar" style="margin: 0;">
|
<div class="headerButtonBar" style="margin: 0;">
|
||||||
<ul class="headerButtonList">
|
<ul class="headerButtonList">
|
||||||
|
<li class="enabled">
|
||||||
|
<a id="settingsMenu" class="headerButton">
|
||||||
|
<span title="Download visible graph as png image">
|
||||||
|
<i class="fa fa-bars fa-stack-1x"></i>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li class="enabled">
|
<li class="enabled">
|
||||||
<a id="graph-fullscreen-btn" class="headerButton">
|
<a id="graph-fullscreen-btn" class="headerButton">
|
||||||
<span title="Switch to fullscreen mode">
|
<span title="Switch to fullscreen mode">
|
||||||
|
@ -32,4 +39,5 @@
|
||||||
<!--<div id="graph-fullscreen-btn"><i class="fa fa-desktop"></i></div>-->
|
<!--<div id="graph-fullscreen-btn"><i class="fa fa-desktop"></i></div>-->
|
||||||
<div id="graph-container" oncontextmenu="return false;"></div>
|
<div id="graph-container" oncontextmenu="return false;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
window.GraphSettingsView = Backbone.View.extend({
|
window.GraphSettingsView = Backbone.View.extend({
|
||||||
el: '#content',
|
el: '#graphSettingsContent',
|
||||||
|
|
||||||
remove: function () {
|
remove: function () {
|
||||||
this.$el.empty().off(); /* off to unbind the events */
|
this.$el.empty().off(); /* off to unbind the events */
|
||||||
|
@ -129,11 +129,28 @@
|
||||||
initialize: function (options) {
|
initialize: function (options) {
|
||||||
this.name = options.name;
|
this.name = options.name;
|
||||||
this.userConfig = options.userConfig;
|
this.userConfig = options.userConfig;
|
||||||
|
this.saveCallback = options.saveCallback;
|
||||||
},
|
},
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click #saveGraphSettings': 'saveGraphSettings',
|
'click #saveGraphSettings': 'saveGraphSettings',
|
||||||
'click #restoreGraphSettings': 'restoreGraphSettings'
|
'click #restoreGraphSettings': 'restoreGraphSettings',
|
||||||
|
'keyup #graphSettingsView input': 'checkEnterKey',
|
||||||
|
'keyup #graphSettingsView select': 'checkEnterKey',
|
||||||
|
'focus #graphSettingsView input': 'lastFocus',
|
||||||
|
'focus #graphSettingsView select': 'lastFocus'
|
||||||
|
},
|
||||||
|
|
||||||
|
lastFocus: function (e) {
|
||||||
|
console.log(e.currentTarget.id);
|
||||||
|
console.log(e.currentTarget);
|
||||||
|
this.lastFocussed = e.currentTarget.id;
|
||||||
|
},
|
||||||
|
|
||||||
|
checkEnterKey: function (e) {
|
||||||
|
if (e.keyCode === 13) {
|
||||||
|
this.saveGraphSettings();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getGraphSettings: function (render) {
|
getGraphSettings: function (render) {
|
||||||
|
@ -151,6 +168,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
saveGraphSettings: function () {
|
saveGraphSettings: function () {
|
||||||
|
var self = this;
|
||||||
var combinedName = window.App.currentDB.toJSON().name + '_' + this.name;
|
var combinedName = window.App.currentDB.toJSON().name + '_' + this.name;
|
||||||
|
|
||||||
var config = {};
|
var config = {};
|
||||||
|
@ -169,14 +187,34 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var callback = function () {
|
var callback = function () {
|
||||||
window.arangoHelper.arangoNotification('Graph ' + this.name, 'Configuration saved.');
|
if (window.App.graphViewer2) {
|
||||||
|
window.App.graphViewer2.render(self.lastFocussed);
|
||||||
|
} else {
|
||||||
|
arangoHelper.arangoNotification('Graph ' + this.name, 'Configuration saved.');
|
||||||
|
}
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
this.userConfig.setItem('graphs', config, callback);
|
this.userConfig.setItem('graphs', config, callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
setDefaults: function () {
|
setDefaults: function () {
|
||||||
|
console.log('implement me!');
|
||||||
|
},
|
||||||
|
|
||||||
|
toggle: function () {
|
||||||
|
if ($(this.el).is(':visible')) {
|
||||||
|
this.hide();
|
||||||
|
} else {
|
||||||
|
this.show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
show: function () {
|
||||||
|
$(this.el).show('slide', {direction: 'right'}, 250);
|
||||||
|
},
|
||||||
|
|
||||||
|
hide: function () {
|
||||||
|
$(this.el).hide('slide', {direction: 'right'}, 250);
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function () {
|
render: function () {
|
||||||
|
@ -197,7 +235,7 @@
|
||||||
this.setDefaults();
|
this.setDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
arangoHelper.buildGraphSubNav(this.name, 'Settings');
|
// arangoHelper.buildGraphSubNav(this.name, 'Settings');
|
||||||
|
|
||||||
// load graph settings from local storage
|
// load graph settings from local storage
|
||||||
// apply those values to view then
|
// apply those values to view then
|
||||||
|
|
|
@ -33,7 +33,8 @@
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click #downloadPNG': 'downloadSVG',
|
'click #downloadPNG': 'downloadSVG',
|
||||||
'click #reloadGraph': 'reloadGraph'
|
'click #reloadGraph': 'reloadGraph',
|
||||||
|
'click #settingsMenu': 'toggleSettings'
|
||||||
},
|
},
|
||||||
|
|
||||||
cursorX: 0,
|
cursorX: 0,
|
||||||
|
@ -80,16 +81,29 @@
|
||||||
$('#graph-container').height($('.centralRow').height() - 150);
|
$('#graph-container').height($('.centralRow').height() - 150);
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function () {
|
toggleSettings: function () {
|
||||||
|
this.graphSettingsView.toggle();
|
||||||
|
},
|
||||||
|
|
||||||
|
render: function (toFocus) {
|
||||||
this.$el.html(this.template.render({}));
|
this.$el.html(this.template.render({}));
|
||||||
|
|
||||||
|
// render navigation
|
||||||
|
$('#subNavigationBar .breadcrumb').html(
|
||||||
|
'Graph: ' + this.name
|
||||||
|
);
|
||||||
|
|
||||||
this.resize();
|
this.resize();
|
||||||
|
this.fetchGraph(toFocus);
|
||||||
|
},
|
||||||
|
|
||||||
|
rerender: function () {
|
||||||
this.fetchGraph();
|
this.fetchGraph();
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchGraph: function () {
|
fetchGraph: function (toFocus) {
|
||||||
var self = this;
|
var self = this;
|
||||||
arangoHelper.buildGraphSubNav(self.name, 'Content');
|
// arangoHelper.buildGraphSubNav(self.name, 'Content');
|
||||||
$('#content').append(
|
$('#content').append(
|
||||||
'<div id="calculatingGraph" style="position: absolute; left: 25px; top: 130px;">' +
|
'<div id="calculatingGraph" style="position: absolute; left: 25px; top: 130px;">' +
|
||||||
'<i class="fa fa-circle-o-notch fa-spin" style="margin-right: 10px;"></i>' +
|
'<i class="fa fa-circle-o-notch fa-spin" style="margin-right: 10px;"></i>' +
|
||||||
|
@ -119,8 +133,8 @@
|
||||||
data: ajaxData,
|
data: ajaxData,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
$('#calcText').html('Calculating layout. Please wait ... ');
|
$('#calcText').html('Calculating layout. Please wait ... ');
|
||||||
arangoHelper.buildGraphSubNav(self.name, 'Content');
|
// arangoHelper.buildGraphSubNav(self.name, 'Content');
|
||||||
self.renderGraph(data);
|
self.renderGraph(data, toFocus);
|
||||||
},
|
},
|
||||||
error: function (e) {
|
error: function (e) {
|
||||||
try {
|
try {
|
||||||
|
@ -216,7 +230,6 @@
|
||||||
if (error) {
|
if (error) {
|
||||||
arangoHelper.arangoError('Error', 'Could not create node');
|
arangoHelper.arangoError('Error', 'Could not create node');
|
||||||
} else {
|
} else {
|
||||||
console.log(id);
|
|
||||||
self.currentGraph.graph.addNode({
|
self.currentGraph.graph.addNode({
|
||||||
id: id,
|
id: id,
|
||||||
label: self.graphConfig.nodeLabel,
|
label: self.graphConfig.nodeLabel,
|
||||||
|
@ -318,7 +331,7 @@
|
||||||
// rerender graph
|
// rerender graph
|
||||||
self.currentGraph.refresh();
|
self.currentGraph.refresh();
|
||||||
} else {
|
} else {
|
||||||
console.log('could not create edge');
|
arangoHelper.arangoError('Graph', 'Could not create edge.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// then clear states
|
// then clear states
|
||||||
|
@ -568,6 +581,17 @@
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
self.graphConfig = data.toJSON().graphs[combinedName];
|
self.graphConfig = data.toJSON().graphs[combinedName];
|
||||||
|
|
||||||
|
// init settings view
|
||||||
|
if (self.graphSettingsView) {
|
||||||
|
self.graphSettingsView.remove();
|
||||||
|
}
|
||||||
|
self.graphSettingsView = new window.GraphSettingsView({
|
||||||
|
name: self.name,
|
||||||
|
userConfig: self.userConfig,
|
||||||
|
saveCallback: self.render
|
||||||
|
});
|
||||||
|
self.graphSettingsView.render();
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(self.graphConfig);
|
callback(self.graphConfig);
|
||||||
}
|
}
|
||||||
|
@ -603,7 +627,7 @@
|
||||||
return array;
|
return array;
|
||||||
},
|
},
|
||||||
|
|
||||||
renderGraph: function (graph) {
|
renderGraph: function (graph, toFocus) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.graphSettings = graph.settings;
|
this.graphSettings = graph.settings;
|
||||||
|
@ -821,6 +845,10 @@
|
||||||
var c = document.getElementsByClassName('sigma-mouse')[0];
|
var c = document.getElementsByClassName('sigma-mouse')[0];
|
||||||
c.addEventListener('mousemove', self.trackCursorPosition.bind(this), false);
|
c.addEventListener('mousemove', self.trackCursorPosition.bind(this), false);
|
||||||
|
|
||||||
|
// focus last input box if available
|
||||||
|
if (toFocus) {
|
||||||
|
$('#' + toFocus).focus();
|
||||||
|
}
|
||||||
// clear up info div
|
// clear up info div
|
||||||
$('#calculatingGraph').remove();
|
$('#calculatingGraph').remove();
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,3 +61,35 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#graphSettingsView {
|
||||||
|
background-color: rgba(64, 74, 83, .9);
|
||||||
|
border: 0;
|
||||||
|
border-radius: 0;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#graphSettingsContent {
|
||||||
|
height: 100%;
|
||||||
|
max-width: 50%;
|
||||||
|
min-width: 400px;
|
||||||
|
position: fixed;
|
||||||
|
right: -1px;
|
||||||
|
top: 103px;
|
||||||
|
width: 400px;
|
||||||
|
|
||||||
|
.pure-g {
|
||||||
|
.left {
|
||||||
|
color: $c-white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pure-u-2-3 {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pure-table {
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -98,6 +98,8 @@ global.DEFINE_MODULE('console', (function () {
|
||||||
if (typeof arg === 'object') {
|
if (typeof arg === 'object') {
|
||||||
if (arg === null) {
|
if (arg === null) {
|
||||||
arg = 'null';
|
arg = 'null';
|
||||||
|
} else if (arg instanceof Error) {
|
||||||
|
arg = String(arg);
|
||||||
} else if (arg instanceof Date || arg instanceof RegExp) {
|
} else if (arg instanceof Date || arg instanceof RegExp) {
|
||||||
arg = String(arg);
|
arg = String(arg);
|
||||||
} else if (Object.prototype.isPrototypeOf(arg) || Array.isArray(arg)) {
|
} else if (Object.prototype.isPrototypeOf(arg) || Array.isArray(arg)) {
|
||||||
|
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*jshint globalstrict:false, strict:false */
|
||||||
|
/*jshint -W034, -W098, -W016 */
|
||||||
|
/*eslint no-useless-computed-key: "off"*/
|
||||||
|
/*global assertTrue */
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief test v8
|
||||||
|
///
|
||||||
|
/// @file
|
||||||
|
///
|
||||||
|
/// DISCLAIMER
|
||||||
|
///
|
||||||
|
/// Copyright 2010-2012 triagens GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
/// you may not use this file except in compliance with the License.
|
||||||
|
/// You may obtain a copy of the License at
|
||||||
|
///
|
||||||
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
///
|
||||||
|
/// Unless required by applicable law or agreed to in writing, software
|
||||||
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
/// See the License for the specific language governing permissions and
|
||||||
|
/// limitations under the License.
|
||||||
|
///
|
||||||
|
/// Copyright holder is triAGENS GmbH, Cologne, Germany
|
||||||
|
///
|
||||||
|
/// @author Jan Steemann
|
||||||
|
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
var jsunity = require("jsunity");
|
||||||
|
var console = require("console");
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief test crash resilience
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
function V8CrashSuite () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
return {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief set up
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
setUp : function () {
|
||||||
|
},
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief tear down
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
tearDown : function () {
|
||||||
|
},
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief https://bugs.chromium.org/p/v8/issues/detail?id=5033
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
testTypeFeedbackOracle : function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// code below is useless, but it triggered a segfault in V8 code optimization
|
||||||
|
var test = function () {
|
||||||
|
var t = Date.now();
|
||||||
|
var o = {
|
||||||
|
['p'] : 1,
|
||||||
|
t
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
for (var n = 0; n < 100000; n++) {
|
||||||
|
test();
|
||||||
|
}
|
||||||
|
|
||||||
|
// simply need to survive the above code
|
||||||
|
assertTrue(true);
|
||||||
|
},
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief https://bugs.chromium.org/p/v8/issues/detail?id=5033
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
testTypeFeedbackOracle2 : function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// code below is useless, but it triggered a segfault in V8 code optimization
|
||||||
|
var test = function () {
|
||||||
|
var random = 0 | Math.random() * 1000;
|
||||||
|
var today = Date.now();
|
||||||
|
var o = {
|
||||||
|
['prop_' + random] : today,
|
||||||
|
random,
|
||||||
|
today
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
console.time('test');
|
||||||
|
for (var n = 0; n < 100000; n++) {
|
||||||
|
test();
|
||||||
|
}
|
||||||
|
console.timeEnd('test');
|
||||||
|
|
||||||
|
// simply need to survive the above code
|
||||||
|
assertTrue(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief executes the test suite
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
jsunity.run(V8CrashSuite);
|
||||||
|
|
||||||
|
return jsunity.done();
|
|
@ -173,6 +173,11 @@ class GeneralRequest {
|
||||||
virtual std::shared_ptr<arangodb::velocypack::Builder> toVelocyPack(
|
virtual std::shared_ptr<arangodb::velocypack::Builder> toVelocyPack(
|
||||||
arangodb::velocypack::Options const*) = 0;
|
arangodb::velocypack::Options const*) = 0;
|
||||||
|
|
||||||
|
virtual std::string const& body() const = 0;
|
||||||
|
virtual int64_t contentLength() const = 0;
|
||||||
|
|
||||||
|
virtual std::unordered_map<std::string, std::string> cookieValues() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setValue(char const* key, char const* value);
|
void setValue(char const* key, char const* value);
|
||||||
void setArrayValue(char* key, size_t length, char const* value);
|
void setArrayValue(char* key, size_t length, char const* value);
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include "Basics/StaticStrings.h"
|
#include "Basics/StaticStrings.h"
|
||||||
#include "Basics/StringUtils.h"
|
#include "Basics/StringUtils.h"
|
||||||
|
#include "Basics/StringBuffer.h"
|
||||||
|
|
||||||
namespace arangodb {
|
namespace arangodb {
|
||||||
namespace velocypack {
|
namespace velocypack {
|
||||||
|
@ -106,6 +107,13 @@ class GeneralResponse {
|
||||||
DUMP // application/x-arango-dump
|
DUMP // application/x-arango-dump
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ConnectionType {
|
||||||
|
CONNECTION_NONE,
|
||||||
|
CONNECTION_KEEP_ALIVE,
|
||||||
|
CONNECTION_CLOSE
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// converts the response code to a string for delivering to a http client.
|
// converts the response code to a string for delivering to a http client.
|
||||||
static std::string responseString(ResponseCode);
|
static std::string responseString(ResponseCode);
|
||||||
|
@ -116,6 +124,15 @@ class GeneralResponse {
|
||||||
// response code from integer error code
|
// response code from integer error code
|
||||||
static ResponseCode responseCode(int);
|
static ResponseCode responseCode(int);
|
||||||
|
|
||||||
|
// TODO OBI - check what can be implemented in this base class
|
||||||
|
virtual basics::StringBuffer& body() = 0;
|
||||||
|
virtual void setContentType(ContentType type) = 0;
|
||||||
|
virtual void setContentType(std::string const& contentType) = 0;
|
||||||
|
virtual void setContentType(std::string&& contentType) = 0;
|
||||||
|
virtual void setConnectionType(ConnectionType type) = 0;
|
||||||
|
virtual void writeHeader(basics::StringBuffer*) = 0;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit GeneralResponse(ResponseCode);
|
explicit GeneralResponse(ResponseCode);
|
||||||
|
|
||||||
|
|
|
@ -60,15 +60,15 @@ class HttpRequest : public GeneralRequest {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// the content length
|
// the content length
|
||||||
int64_t contentLength() const { return _contentLength; }
|
int64_t contentLength() const override { return _contentLength; }
|
||||||
|
|
||||||
std::string const& cookieValue(std::string const& key) const;
|
std::string const& cookieValue(std::string const& key) const;
|
||||||
std::string const& cookieValue(std::string const& key, bool& found) const;
|
std::string const& cookieValue(std::string const& key, bool& found) const;
|
||||||
std::unordered_map<std::string, std::string> cookieValues() const {
|
std::unordered_map<std::string, std::string> cookieValues() const override {
|
||||||
return _cookies;
|
return _cookies;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const& body() const;
|
std::string const& body() const override;
|
||||||
void setBody(char const* body, size_t length);
|
void setBody(char const* body, size_t length);
|
||||||
|
|
||||||
// the request body as VelocyPackBuilder
|
// the request body as VelocyPackBuilder
|
||||||
|
|
|
@ -49,12 +49,6 @@ class HttpResponse : public GeneralResponse {
|
||||||
public:
|
public:
|
||||||
bool isHeadResponse() const { return _isHeadResponse; }
|
bool isHeadResponse() const { return _isHeadResponse; }
|
||||||
|
|
||||||
enum ConnectionType {
|
|
||||||
CONNECTION_NONE,
|
|
||||||
CONNECTION_KEEP_ALIVE,
|
|
||||||
CONNECTION_CLOSE
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setCookie(std::string const& name, std::string const& value,
|
void setCookie(std::string const& name, std::string const& value,
|
||||||
int lifeTimeSeconds, std::string const& path,
|
int lifeTimeSeconds, std::string const& path,
|
||||||
|
@ -69,30 +63,30 @@ class HttpResponse : public GeneralResponse {
|
||||||
// information to the string buffer. Note that adding data to the body
|
// information to the string buffer. Note that adding data to the body
|
||||||
// invalidates any previously returned header. You must call header
|
// invalidates any previously returned header. You must call header
|
||||||
// again.
|
// again.
|
||||||
basics::StringBuffer& body() { return _body; }
|
basics::StringBuffer& body() override { return _body; }
|
||||||
size_t bodySize() const;
|
size_t bodySize() const;
|
||||||
|
|
||||||
/// @brief set type of connection
|
/// @brief set type of connection
|
||||||
void setConnectionType(ConnectionType type) { _connectionType = type; }
|
void setConnectionType(ConnectionType type) override { _connectionType = type; }
|
||||||
|
|
||||||
/// @brief set content-type
|
/// @brief set content-type
|
||||||
void setContentType(ContentType type) { _contentType = type; }
|
void setContentType(ContentType type) override { _contentType = type; }
|
||||||
|
|
||||||
/// @brief set content-type from a string. this should only be used in
|
/// @brief set content-type from a string. this should only be used in
|
||||||
/// cases when the content-type is user-defined
|
/// cases when the content-type is user-defined
|
||||||
void setContentType(std::string const& contentType) {
|
void setContentType(std::string const& contentType) override {
|
||||||
_headers[arangodb::StaticStrings::ContentTypeHeader] = contentType;
|
_headers[arangodb::StaticStrings::ContentTypeHeader] = contentType;
|
||||||
_contentType = ContentType::CUSTOM;
|
_contentType = ContentType::CUSTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setContentType(std::string&& contentType) {
|
void setContentType(std::string&& contentType) override {
|
||||||
_headers[arangodb::StaticStrings::ContentTypeHeader] =
|
_headers[arangodb::StaticStrings::ContentTypeHeader] =
|
||||||
std::move(contentType);
|
std::move(contentType);
|
||||||
_contentType = ContentType::CUSTOM;
|
_contentType = ContentType::CUSTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
// you should call writeHeader only after the body has been created
|
// you should call writeHeader only after the body has been created
|
||||||
void writeHeader(basics::StringBuffer*);
|
void writeHeader(basics::StringBuffer*) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void reset(ResponseCode code) override final;
|
void reset(ResponseCode code) override final;
|
||||||
|
|
Loading…
Reference in New Issue